all groups > dotnet xml > february 2005 >
You're in the

dotnet xml

group:

Inline XSD schema for XML with no namespaces


Re: Inline XSD schema for XML with no namespaces Stan Kitsis [MSFT]
2/18/2005 3:48:19 PM
dotnet xml:
1. Your xml has two root elements, which is not allowed.
2. You need to move xs:schema inside employee element

<employee>
<xs:schema....
....
</xs:schema>
</employee>

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

[quoted text, click to view]

Inline XSD schema for XML with no namespaces Edward Diener
2/18/2005 6:02:14 PM
I could not find an example of an inline XSD schema for an XML document
which has no namespaces. Could someone supply one ? When I tried validating
my XML with an inline XSD schema, using XmlDocument.Load on a validating
reader set to System.Xml.ValidationType.Auto, it failed and I do not know
why.

My XML is:
<?xml version='1.0'?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name='Employee'>
<xs:complexType>
<xs:sequence>
<xs:element name='Name'>
<xs:complexType>
<xs:sequence>
<xs:element name='First' type='xs:string' />
<xs:element name='Last' type='xs:string' />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='Address'>
<xs:complexType>
<xs:sequence>
<xs:element name='Street' type='xs:string' />
<xs:element name='City' type='xs:string' />
<xs:element name='State' type='xs:string' />
<xs:element name='Zipcode' type='xs:string' />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='Phone' type='xs:string' />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<Employee>
<Name>
<First>
Edward
</First>
<Last>
Diener
</Last>
</Name>
<Address>
<Street>
Somewhere Street
</Street>
<City>
Some City
</City>
<State>
Georgia
</State>
<Zipcode>
34567
</Zipcode>
</Address>
<Phone>
4445556666
</Phone>
</Employee>


Re: Inline XSD schema for XML with no namespaces Edward Diener
2/21/2005 9:53:39 AM
In that case it appears that I can not use inline XSD schema to validate my
root element, and can only validate my root element using an external XSD
schema.

[quoted text, click to view]

AddThis Social Bookmark Button