RickBeddoe
Programmer
I was going to post this in the XML forum, but I think this is more C# related.
I have the following schema file:
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE xs:schema [
3 <!ELEMENT xs:schema ANY>
4 <!ELEMENT xs:element ANY>
5 <!ATTLIST xs:element id ID #REQUIRED>
6 ]>
7
8 <xs:schema xmlns:xs="9 <xs:element id="MyElement" type="Monetary" />
10 </xs:schema>
I have the following code to access this document and element:
1 XmlDocument dtsAll = new XmlDocument();
2 string dtsAllName =@"c:\mySchema.xsd";
3 dtsAll.Load(dtsAllName);
4 XmlElement dtsAllElm = dtsAll.GetElementById(attr);
This will allow me to then access the 'type' attribute and extract it's value:
1 string allType = dtsAllElm.GetAttribute("type");
I would like to know if there is a way to do this without using DTD (either embedded as shown or linked). I have looked at using the XSLT and Schema namespace, but I'm not exactly sure how to implement them.
Thanks,
Rick
I have the following schema file:
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE xs:schema [
3 <!ELEMENT xs:schema ANY>
4 <!ELEMENT xs:element ANY>
5 <!ATTLIST xs:element id ID #REQUIRED>
6 ]>
7
8 <xs:schema xmlns:xs="9 <xs:element id="MyElement" type="Monetary" />
10 </xs:schema>
I have the following code to access this document and element:
1 XmlDocument dtsAll = new XmlDocument();
2 string dtsAllName =@"c:\mySchema.xsd";
3 dtsAll.Load(dtsAllName);
4 XmlElement dtsAllElm = dtsAll.GetElementById(attr);
This will allow me to then access the 'type' attribute and extract it's value:
1 string allType = dtsAllElm.GetAttribute("type");
I would like to know if there is a way to do this without using DTD (either embedded as shown or linked). I have looked at using the XSLT and Schema namespace, but I'm not exactly sure how to implement them.
Thanks,
Rick