IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Wildcard element name? Options · View
brhunt
Posted: Monday, February 8, 2016 3:39:08 PM
Rank: Newbie

Joined: 2/7/2016
Posts: 1
Location: US
Hello,

I created an .xsd schema to deserialize an XML stream (see below).

The deserialzation works perfectly right now.

My issue is, I would like to use the template to deserialize other objects in addition to the CustomModule1 element. The schemas are exactly the same, only the element name would change.

Is there a way to use a wildcard for the name of CustomModule1 so that it would accept any name there (e.g. CustomModule2, CustomModule3...)?

I looked at using xs:any, but I could not figure out how to make that work in my schema.

Thanks.

Bryan Hunt

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="response">
<xs:complexType>
<xs:sequence>
<xs:element ref="result"/>
</xs:sequence>
<xs:attribute name="uri" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="result">
<xs:complexType>
<xs:sequence>
<xs:element ref="CustomModule1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CustomModule1">
<xs:complexType>
<xs:sequence>
<xs:element ref="row" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="row">
<xs:complexType>
<xs:sequence>
<xs:element ref="FL" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="no" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="FL">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="val"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
island
Posted: Tuesday, February 9, 2016 4:21:21 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Just to be clear:

i.e. are you generating program code (c#, java, or c++ code) from the xsd file in XML Spy and then using this code to read a stream of xml and "deserialize" it i.e. "DTD / Schema" menu "Generate Program Code" option?

OR do you simply want to validate different xml instance files against your xsd in XML Spy?

Please clarify.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.