D
David
Hi,
I am having problems...
CompactFramework doesn't appear to have XPath, so I need to find another way
to navigate the document. I am struggling to find a solution.
If I were to try bringing the document into a dataset using ReadXml, I have
other problems about nested branches being the same name. This means I have
to find another solution. (I created a schema, but still have the problem
with ReadXml)
Here is what I have so far...
XmlDocument xmlSourceDoc = new XmlDocument();
xmlSourceDoc.Load(FileName);
XmlNodeList myList = xmlSourceDoc.GetElementsByTagName("PartId");
foreach (XmlNode node in myList)
{
if (node.HasChildNodes)
{
foreach (XmlNode cNode in node.ChildNodes)
{
switch (cNode.Name)
{
case "Name":
{
PartName.Text = cNode.InnerText;
break;
}
case "PartNumber":
{
PartNo.Text = cNode.InnerText;
break;
}
}
}
}
}
myList = xmlSourceDoc.GetElementsByTagName("PartRegions");
foreach (XmlNode node in myList)
{
XmlDocument innerDoc = new XmlDocument();
innerDoc.LoadXml(node.InnerXml);
XmlNodeList RegionsList = innerDoc.GetElementsByTagName("PartRegions");
foreach (XmlNode innerNode in RegionsList)
{
if (innerNode.HasChildNodes)
{
foreach (XmlNode cNode in innerNode.ChildNodes)
{
switch (cNode.Name)
{
case "Name":
{
PartName.Text = cNode.InnerText;
break;
}
case "PartNumber":
{
PartNo.Text = cNode.InnerText;
break;
}
}
}
}
}
}
My xml is structured like...
Part
PartId (nodes under here)
PartOperations
PartImages
PartImage
PartRegions
PartRegions
GridRef <-- This is one of the nodes I need, no
children
Features
PartFeature
(various nodes under PartFeature)
PartRegions
GridRef
Features
PartFeature
etc. etc.
I need to get items out of the PartId and then loop through the partregions.
Any help would be really appreciated. I am really struggling otherwise.
I am developing in .NET 1.1 with the latest version of windows mobile
(though the emulator is Windows Mobile 2003)
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
I am having problems...
CompactFramework doesn't appear to have XPath, so I need to find another way
to navigate the document. I am struggling to find a solution.
If I were to try bringing the document into a dataset using ReadXml, I have
other problems about nested branches being the same name. This means I have
to find another solution. (I created a schema, but still have the problem
with ReadXml)
Here is what I have so far...
XmlDocument xmlSourceDoc = new XmlDocument();
xmlSourceDoc.Load(FileName);
XmlNodeList myList = xmlSourceDoc.GetElementsByTagName("PartId");
foreach (XmlNode node in myList)
{
if (node.HasChildNodes)
{
foreach (XmlNode cNode in node.ChildNodes)
{
switch (cNode.Name)
{
case "Name":
{
PartName.Text = cNode.InnerText;
break;
}
case "PartNumber":
{
PartNo.Text = cNode.InnerText;
break;
}
}
}
}
}
myList = xmlSourceDoc.GetElementsByTagName("PartRegions");
foreach (XmlNode node in myList)
{
XmlDocument innerDoc = new XmlDocument();
innerDoc.LoadXml(node.InnerXml);
XmlNodeList RegionsList = innerDoc.GetElementsByTagName("PartRegions");
foreach (XmlNode innerNode in RegionsList)
{
if (innerNode.HasChildNodes)
{
foreach (XmlNode cNode in innerNode.ChildNodes)
{
switch (cNode.Name)
{
case "Name":
{
PartName.Text = cNode.InnerText;
break;
}
case "PartNumber":
{
PartNo.Text = cNode.InnerText;
break;
}
}
}
}
}
}
My xml is structured like...
Part
PartId (nodes under here)
PartOperations
PartImages
PartImage
PartRegions
PartRegions
GridRef <-- This is one of the nodes I need, no
children
Features
PartFeature
(various nodes under PartFeature)
PartRegions
GridRef
Features
PartFeature
etc. etc.
I need to get items out of the PartId and then loop through the partregions.
Any help would be really appreciated. I am really struggling otherwise.
I am developing in .NET 1.1 with the latest version of windows mobile
(though the emulator is Windows Mobile 2003)
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available