H
helpful sql
Hi all,
In my code, I need all "datasetMPI" nodes in an array. Here is a portion
of my xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w10="urn:schemas-microsoft-comffice:word"
xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core"
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:ns0="http://tempuri.org/datasetMPI.xsd" w:macrosPresent="no"
w:embeddedObjPresent="no" wcxPresent="no" xml:space="preserve">
<w:body>
<wx:sect>
<ns0:datasetMPI>
<ns0:User><w>
<wPr>
<w:rPr>
<w:b/>
</w:rPr>
</wPr>
<ns0:Contact><w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>[Sender Name]</w:t>
</w:r></ns0:Contact>
</w>
<w>
<wPr>
<w:rPr>
<w:b/>
</w:rPr>
</wPr>
<ns0:Address1><w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>[Street Address]</w:t>
</w:r></ns0:Address1>
</w>
........
Now when I use the following code, the nodeListDataset list has 0 member.
As you can see above, it should contain at least one datasetMPI mode. What
am I doing wrong?
Thanks in advance.
XmlNode nodeBodySectionTemplate = null;
XmlDocument oXmlDocSectionTemplate = new XmlDocument();
XmlNamespaceManager nsm = new
XmlNamespaceManager(oXmlDocSectionTemplate.NameTable);
nsm.AddNamespace( "ns0", @"http://tempuri.org/datasetMPI.xsd");
nsm.AddNamespace( "w",
@"http://schemas.microsoft.com/office/word/2003/wordml");
oXmlDocSectionTemplate.Load(sSectionTemplateFilePath); //
sSectionTemplateFilePath points to my xml file.
if (oXmlDocSectionTemplate != null)
{
nodeBodySectionTemplate =
oXmlDocSectionTemplate.SelectSingleNode("//w:body",oNSMgr);
if (nodeBodySectionTemplate != null)
{
if (datasetMpiProposal != null)
{
XmlNodeList nodeListDataset = nodeBodySectionTemplate.SelectNodes("//ns0:" +
datasetMpiProposal.DataSetName,oNSMgr);
In my code, I need all "datasetMPI" nodes in an array. Here is a portion
of my xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w10="urn:schemas-microsoft-comffice:word"
xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core"
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:ns0="http://tempuri.org/datasetMPI.xsd" w:macrosPresent="no"
w:embeddedObjPresent="no" wcxPresent="no" xml:space="preserve">
<w:body>
<wx:sect>
<ns0:datasetMPI>
<ns0:User><w>
<wPr>
<w:rPr>
<w:b/>
</w:rPr>
</wPr>
<ns0:Contact><w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>[Sender Name]</w:t>
</w:r></ns0:Contact>
</w>
<w>
<wPr>
<w:rPr>
<w:b/>
</w:rPr>
</wPr>
<ns0:Address1><w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>[Street Address]</w:t>
</w:r></ns0:Address1>
</w>
........
Now when I use the following code, the nodeListDataset list has 0 member.
As you can see above, it should contain at least one datasetMPI mode. What
am I doing wrong?
Thanks in advance.
XmlNode nodeBodySectionTemplate = null;
XmlDocument oXmlDocSectionTemplate = new XmlDocument();
XmlNamespaceManager nsm = new
XmlNamespaceManager(oXmlDocSectionTemplate.NameTable);
nsm.AddNamespace( "ns0", @"http://tempuri.org/datasetMPI.xsd");
nsm.AddNamespace( "w",
@"http://schemas.microsoft.com/office/word/2003/wordml");
oXmlDocSectionTemplate.Load(sSectionTemplateFilePath); //
sSectionTemplateFilePath points to my xml file.
if (oXmlDocSectionTemplate != null)
{
nodeBodySectionTemplate =
oXmlDocSectionTemplate.SelectSingleNode("//w:body",oNSMgr);
if (nodeBodySectionTemplate != null)
{
if (datasetMpiProposal != null)
{
XmlNodeList nodeListDataset = nodeBodySectionTemplate.SelectNodes("//ns0:" +
datasetMpiProposal.DataSetName,oNSMgr);