XmlSchema.read throws exception when an element is declared nillable
Posted
by G33kKahuna
on Stack Overflow
See other posts from Stack Overflow
or by G33kKahuna
Published on 2009-08-24T16:30:31Z
Indexed on
2010/03/21
10:01 UTC
Read the original article
Hit count: 783
xml-schema
|Xml
I have a simple schema that I am trying to read using XmlSchema.Read() method. I keep getting
The 'nillable' attribute is not supported in this context
Here is a simple code in C#
XmlSchema schema = null;
using (StreamReader reader = new StreamReader(<Path to Schema file name>)
{
schema = XmlSchema.Read(reader.BaseStream, null);
}
Below is the schema
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://xyz.com.schema.bc.mySchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xyz.com.schema.bc.mySchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="data">
<xs:complexType>
<xs:sequence>
<xs:element name="Component">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="row">
<xs:complexType>
<xs:sequence>
<xs:element name="changed_by" type="xs:string" nillable="true" />
<xs:element name="column_name" type="xs:string" nillable="true" />
<xs:element name="comment_text" type="xs:string" nillable="true" />
<xs:element name="is_approved" type="xs:string" nillable="true" />
<xs:element name="log_at" type="xs:dateTime" nillable="true" />
<xs:element name="new_val" type="xs:string" nillable="true" />
<xs:element name="old_val" type="xs:string" nillable="true" />
<xs:element name="person_id" type="xs:string" nillable="true" />
<xs:element name="poh_id" type="xs:string" nillable="true" />
<xs:element name="pol_id" type="xs:string" nillable="true" />
<xs:element name="search_name" type="xs:string" nillable="true" />
<xs:element name="unique_id" type="xs:integer" nillable="true" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:schema>
© Stack Overflow or respective owner