N
needin4mation
Hi, Visual Studio created this schema for me:
<xs:schema id="NewDataSet"
targetNamespace="http://tempuri.org/Directions2.xsd"
xmlns:mstns="http://tempuri.org/Directions2.xsd"
xmlns="http://tempuri.org/Directions2.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
But I cannot reference it in my code. I tried:
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("mstns", "http://tempuri.org/Directions2.xsd");
oldLoc = root.SelectSingleNode("//mstns:NewDataSet/Locations[@agid=1]",
nsmgr);
But it never finds the data. I know it is the namespace because if I
take this line out of my xml file it works (without all the
XmlNamespaceManager problems). XML File:
<?xml version="1.0" encoding="utf-8"?>
<NewDataSet xmlns="http://tempuri.org/Directions2.xsd">
Thanks for any hints.
<xs:schema id="NewDataSet"
targetNamespace="http://tempuri.org/Directions2.xsd"
xmlns:mstns="http://tempuri.org/Directions2.xsd"
xmlns="http://tempuri.org/Directions2.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
But I cannot reference it in my code. I tried:
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("mstns", "http://tempuri.org/Directions2.xsd");
oldLoc = root.SelectSingleNode("//mstns:NewDataSet/Locations[@agid=1]",
nsmgr);
But it never finds the data. I know it is the namespace because if I
take this line out of my xml file it works (without all the
XmlNamespaceManager problems). XML File:
<?xml version="1.0" encoding="utf-8"?>
<NewDataSet xmlns="http://tempuri.org/Directions2.xsd">
Thanks for any hints.