Adding namespace to single element doesn't conform to xsd



All I want to do is add a single namespace to a single element S_NO but I can't figure it out help would be appreciated keep getting errors that when I add prefixes and stuff on the element it wont recognise the element that is called within the xsd when using xmlspy.


XML Code:



<MSG xmlns:xsi="http://ift.tt/ra1lAU" xsi:noNamespaceSchemaLocation="file:///C:/test_xml/izzypod5/test_input.xsd">
<BODY>
<bar:S_NO xmlns:bar="http://www.bar.org/">4423</bar:S_NO>
</BODY>
</MSG>


XSD Code:



<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://ift.tt/tphNwY" xmlns:bar="http://www.bar.org/">
<!-- Element Declarations -->
<xs:element name="S_NO" type="S_NOType" nillable="true">
<xs:annotation>
<xs:documentation>S_No; Mandatory Field</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="BODY" type="BODYType">
<xs:annotation>
<xs:documentation>Body</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="MSG" type="MSGType">
<xs:annotation>
<xs:documentation>Message encapsulates Body</xs:documentation>
</xs:annotation>
</xs:element>
<xs:simpleType name="S_NOType">
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="15"/>
</xs:restriction>
</xs:simpleType>
<!-- Complex Type Declarations -->
<xs:complexType name="BODYType">
<xs:sequence>
<xs:element ref="S_NO"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MSGType">
<xs:sequence>
<xs:element ref="BODY"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="REQUEST_MSGType">
<xs:sequence>
<xs:element ref="MSG"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

No comments:

Post a Comment