Can some one kindly help me on below qurery?
I need to read the element's name of the XML schema.For an examle,The part of the XML schema is given below
<xs:complexType name=” departmentType”>
<xs:sequence>
<xs:attribute name=”did” type= “xs:ID” use=”required” />
<xs:element name=”dname” type= “xs:string”/>
<xs:element name=”location” type= “xs:string”/>
<xs:element name=”Manager” type=”EmployeeType” minOccurs=”1” maxOccurs=”1”/> <!- - if partial participation(step 1, ii => minOccurs=”0”-->
</xs:sequence>
</xs:complexType>
I wanted to read "dname","location" and "Manager" then put thse to an array that will hold the name of the elements in the XML schema. I couldn't be able to read the element's name using the below code since it's returing only "xs:element". Even I tried Localname instead of name still no results.
XmlTextReader textReader = new XmlTextReader("C:\\books.xsd"); // Read until end of file
while (textReader.Read())
{
XmlNodeType nType = textReader.NodeType;
if (nType == XmlNodeType.Element)
Console.WriteLine("Element:" + textReader.Name.ToString());
}
Thanks
Can some kindly get me the solution for the below query?
I wanted to read "dname","location" and "Manager" then put that to an array that will hold the name of the elements in the XML schema. I couldn't be able to read the element's name using the below code since it's returing only "xs:element". Even I tried Localname instead of name still no results.