I've the below xsd file. I am trying to append few tag. However traversing with xsd schema can be one of the possible solution. Here I just want to append few nodes like.
<xs:element name="Prefix" type="xs:string"/> TO
<xs:element name="Prefix" type="xs:string" minOccurs="0" />
<xs:element name="EventReasonCode" type="xs:string"/> TO
<xs:element name="EventReasonCode" type="xs:string" minOccurs="0" />
Full XSD
<?xml version="1.0"?>
<xs:schema xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:ns1="http://tempuri.org/MergePatient.xsd" xmlns:ns2="http://tempuri.org/MergePatient/MergePatient.xsd" xmlns="http://tempuri.org/MergePatient.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns3="http://tempuri.org/MergePatient/MergePatient/MergePatient.xsd" targetNamespace="http://tempuri.org/MergePatient/MergePatient/MergePatient.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified" id="MergePatient">
<xs:element name="MergePatient">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="PatientName" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="MiddleName" type="xs:string" minOccurs="0"/>
<xs:element name="Prefix" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="EventReasonCode" type="xs:string"/>
</xs:sequence>
</xs:complexType>
Tried So far
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("file.XSD");
XmlElement elem = xmlDoc.DocumentElement;
XmlNodeList xNodes1 = xmlDoc.SelectNodes("//xs:element[xs:complexType/xs:sequence]");
Unable to read the tag with the path above.