How to use XSD Text Only in XML
In this article I am going to explain about in XML.
XSD Text Only in XML
An XSD Text-only such type of element that contain only text and attribute. XSD Text-only contain only simple content. So we have to add simple content element around with content. Within simple content we must defined extension or restriction.
Example with Extension
<xs:element name="Employee">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="EmpDetail">
Some text here
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
|
Example with Restriction
<xs:element name="Employee">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="EmpDetail">
Some Text here
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
</xs:element>
|
Defined Schema of "Employee" with complex type.
<xs:element name="Employee">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Name" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
|
Further Readings
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here