xmlschema format

charms

New Member
What is the proper format to define a schema for an xml element which contains Attribute,Sub-elements and Subelements also contains SUB-ELEMENTS
For eg: My xml
\[code\]<element1 attribute1="hello"> <element-sub1> <element-sub-sub1 attribute-sub-1="hi"/> <elementsubsub1></element1>\[/code\]I tried with the following schema\[code\] <xs:element name="element1"> <xs:complexType> <xs:sequence> <xs:element name="element-sub1" type="xs:anyType" maxOccurs="unbounded"/> <xs:complexType> <xs:sequence> <xs:element name="element-sub-sub1" type="xs:anyType" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="attribute-sub-1" type="xs:string"/> </xs:complexType> </xs:sequence> <xs:attribute name="attribute1" type="xs:string"/> </xs:complexType> </xs:element>\[/code\]But I am getting the following error\[code\]The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: complexType.\[/code\]Why am I getting this error? What is the right format to write schema for my requirement?
NOTE
Element "element-sub-sub1" may have text also.
UPDATE 1\[code\]<element1 URI=""> <element-sub1> <element-sub-sub1 Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> <element-sub-sub1 Algorithm="http://www.w3.org/TR/1999/REC-xslt-19991116"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/><xsl:template match="/">Pan : <xsl:copy-of select="//Pp"/>MobileNo : <xsl:copy-of select="//Mm"/>TotalAmount : <xsl:copy-of select="//Total"/></xsl:template></xsl:stylesheet> element-sub-sub1 </element-sub1> </element1>\[/code\]
 
Back
Top