Wednesday, 15 April 2015

xsd - XML Schema - how to add "type=xs:string" into a complex element? -



xsd - XML Schema - how to add "type=xs:string" into a complex element? -

i got next 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 managed produce in xsd 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 it's not clear me how tell xml schema element "param" include string (here: attributes[123 etc.].

i managed solve main problem. string between -tags defined 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 of same number still, that's need figure out in next step.

xml xsd schema

No comments:

Post a Comment