Unchangable fixed attribute value and the element date's format



i have to questions about the internet tv site i'm working on. first question is that the main element which is subscription has an attribute called (ServerIP) I want the server ip to be fixed and i want to give it a value that can never be changed. i tried this code but it didn't work, it prints nothing when i try to print it unless i give it a value in XML



<xs:attribute name="serverIP" type="xs:string" fixed="10.144.50.55"/>


The second question is, if i have an element called date,and i want to give it a specific pattern yyyy-mm-dd. i know i can do it for attributes using simple type. i tried this code but it didn't work



<xs:element name="dateOfBirth" type="xs:date">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="xs:date">
<xs:pattern value="d{4}[-]d{2}[-]d{2}"/>
</xs:restriction>
</xs:complexType>
</xs:simpleContent>
</xs:element>


how do i know that my code worked? because when i give it a value in the format yyyymmdd in XML file it gets printed in the same format not like yyyy-mm-dd


No comments:

Post a Comment