I want to create an XSD which can generate the following XML.
<note>
<email:to>abc@def.com</email:to>
<from>xyz@def.com</from>
</note>
How to write XSD element definition for the element.
<xsd:element name="note">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="email:to" type="xsd:string"/>
<xsd:element name="from" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Here the element name “email:to” fails validation.
How can I represent this in XSD?
Thank you.
The
:symbol in XML represents XML namespace syntax, which isn’t appropriate to what you’re trying to do. You can’t use that symbol in XML without the processors interpreting it as a namespace.You might want to consider using one of the two alternatives: