Reputation: 11
I got the following XML String:
<dyn_banner>
<pattern>header.jpg</pattern>
<param id='1'>attributes[123]</param>
<param id='2'>attributes[456]</param>
<param id='X'> etc.
<param id='X'> counting ...
.
.
.
</dyn_banner>
This is what I managed to produce in XSD so far:
<xs:element name="dyn_banner">
<xs:complexType>
<xs:sequence>
<xs:element name="pattern" type="xs:string"/>
<xs:element name="param" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:integer"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
My problem now is that it's not clear for me how to tell the XML Schema that the element "param" does include a string (here: attributes[123 etc.].
Upvotes: 0
Views: 334
Reputation: 11
I managed to solve the main problem. The string between the -tags is defined by simpleContent & extension-tags:
<xs:element name="dyn_banner">
<xs:complexType>
<xs:sequence>
<xs:element name="pattern" type="xs:string"/>
<xs:element name="param" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:int" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
The ID's can be of the same number still, that's something I need to figure out in the next step.
Upvotes: 1