xml - Declare a type with attribute and text, limited by pattern -
i want declare next type:
<partcode negation="true|false">\*|[0-9]{1,9}</name>
with boolean attribute, , text-only content, limited pattern (*
or number).
i have next xsd far:
<xs:complextype name="partcode"> <xs:simplecontent> <xs:restriction base="xs:string"> <xs:pattern value="\*|[0-9]{1,9}" /> </xs:restriction> <xs:extension base="xs:string"> <-- error <xs:attribute name="negation" type="xs:boolean" use="optional" default="false" /> </xs:extension> </xs:simplecontent> </xs:complextype>
but contains error:
the 'extension' element exists in content model
how can achieve that?
<xs:complextype name="partcodevalue"> <xs:simplecontent> <xs:extension base="xs:string"> <xs:attribute name="negation" type="xs:boolean" use="optional" default="false" /> </xs:extension> </xs:simplecontent> </xs:complextype> <xs:complextype name="partcode"> <xs:simplecontent> <xs:restriction base="partcodevalue"> <xs:pattern value="\*|[0-9]{1,9}" /> </xs:restriction> </xs:simplecontent> </xs:complextype>
Comments
Post a Comment