Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extension

Status
Not open for further replies.

dtucker

Programmer
May 9, 2006
2
US
I have a question about extentions in XML schemas.

I have a schema that looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Test" targetNamespace=" elementFormDefault="qualified" xmlns=" xmlns:mstns=" xmlns:xs=" <xs:complexType name="addressType">
<xs:sequence>
<xs:element name="street" type="xs:string" />
<xs:element name="city" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="Address">
<xs:complexType>
<xs:complexContent>
<xs:extension base="addressType">
<xs:sequence>
<xs:element name="state" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>

And an XML file that looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<Address xmlns=" <state>MD</state>
<city>Baltimore</city>
</Address>

What I want is for the Address element to have city, state, and street. My validator (Visual Studio .NET 2002) says that (in the example above), city is not an "active element" in that schema.

As best I can tell, I am not doing anything wrong. Does anybody else see a problem? Could it just be that the micrsoft validator is no good?
 
Changing the example so it is more clear. Assume the XML file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<Address xmlns=" <street>1234 Some St.</street>
<city>Baltimore</city>
<state>MD</state>
</Address>

The exact error messages I get are:

Test.xml(4): The active schema does not support the element 'city'.
Test.xml(3): The active schema does not support the element 'street'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top