EDN Admin
Well-known member
Hi,
Im needing to extract some information from XML files, but the actual values I need are in the actual tag of the node I want to extract from, e.g.
<div style="color:black; background-color:white
<pre> <span style="color:blue <<span style="color:#a31515 HitPoints <span style="color:red xsi:type<span style="color:blue =<span style="color:black "<span style="color:blue SimpleAdjustableNumber<span style="color:black " <span style="color:red FinalValue<span style="color:blue =<span style="color:black "<span style="color:blue 408<span style="color:black "<span style="color:blue >
[/code]
Ive attempted to do something like the following (to extract that FinalValue and print it into a textBlock):
<div style="color:black; background-color:white
<pre> XmlDocument xDoc = <span style="color:blue new XmlDocument();
xDoc.Load(FilePathTextBlock.Text);
XmlNodeList monsterTotalHP = xDoc.GetElementsByTagName(<span style="color:#a31515 "HitPoints");
XmlAttributeCollection monsterTotalHPValue = monsterTotalHP[0].Attributes;<br/><br/>HPTextBlock.Text = monsterTotalHPValue + <span style="color:#a31515 "/" + monsterTotalHPValue;
[/code]
The second, related problem I have is with another bit of data that looks like the following:
<div style="color:black; background-color:white
<pre> <span style="color:blue <<span style="color:#a31515 Defenses<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Values<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 SimpleAdjustableNumber <span style="color:red xsi:type<span style="color:blue =<span style="color:black "<span style="color:blue SimpleAdjustableNumber<span style="color:black " <span style="color:red FinalValue<span style="color:blue =<span style="color:black "<span style="color:blue 23<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 AdjustmentID<span style="color:blue >High<span style="color:blue </<span style="color:#a31515 AdjustmentID<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Name<span style="color:blue >AC<span style="color:blue </<span style="color:#a31515 Name<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ID<span style="color:blue >DE5<span style="color:blue </<span style="color:#a31515 ID<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 DefaultBonus <span style="color:red xsi:type<span style="color:blue =<span style="color:black "<span style="color:blue AddNumberBonus<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Name<span style="color:blue >Ad hoc<span style="color:blue </<span style="color:#a31515 Name<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Value<span style="color:blue >-1<span style="color:blue </<span style="color:#a31515 Value<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ID<span style="color:blue >Ad hoc<span style="color:blue </<span style="color:#a31515 ID<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 DefaultBonus<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 SimpleAdjustableNumber<span style="color:blue >
...
<span style="color:blue </<span style="color:#a31515 Values<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Defenses<span style="color:blue >
[/code]
where I want to extract the FinalValue again, but also the name (in this case, AC). There are three more of these blocks from which I want to extract these items, all within <Values>, within <Defenses>... but my simple XmlNodeList technique isnt
working.
Cheers for any help
<br/>
View the full article
Im needing to extract some information from XML files, but the actual values I need are in the actual tag of the node I want to extract from, e.g.
<div style="color:black; background-color:white
<pre> <span style="color:blue <<span style="color:#a31515 HitPoints <span style="color:red xsi:type<span style="color:blue =<span style="color:black "<span style="color:blue SimpleAdjustableNumber<span style="color:black " <span style="color:red FinalValue<span style="color:blue =<span style="color:black "<span style="color:blue 408<span style="color:black "<span style="color:blue >
[/code]
Ive attempted to do something like the following (to extract that FinalValue and print it into a textBlock):
<div style="color:black; background-color:white
<pre> XmlDocument xDoc = <span style="color:blue new XmlDocument();
xDoc.Load(FilePathTextBlock.Text);
XmlNodeList monsterTotalHP = xDoc.GetElementsByTagName(<span style="color:#a31515 "HitPoints");
XmlAttributeCollection monsterTotalHPValue = monsterTotalHP[0].Attributes;<br/><br/>HPTextBlock.Text = monsterTotalHPValue + <span style="color:#a31515 "/" + monsterTotalHPValue;
[/code]
The second, related problem I have is with another bit of data that looks like the following:
<div style="color:black; background-color:white
<pre> <span style="color:blue <<span style="color:#a31515 Defenses<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Values<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 SimpleAdjustableNumber <span style="color:red xsi:type<span style="color:blue =<span style="color:black "<span style="color:blue SimpleAdjustableNumber<span style="color:black " <span style="color:red FinalValue<span style="color:blue =<span style="color:black "<span style="color:blue 23<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 AdjustmentID<span style="color:blue >High<span style="color:blue </<span style="color:#a31515 AdjustmentID<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Name<span style="color:blue >AC<span style="color:blue </<span style="color:#a31515 Name<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ID<span style="color:blue >DE5<span style="color:blue </<span style="color:#a31515 ID<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 DefaultBonus <span style="color:red xsi:type<span style="color:blue =<span style="color:black "<span style="color:blue AddNumberBonus<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Name<span style="color:blue >Ad hoc<span style="color:blue </<span style="color:#a31515 Name<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Value<span style="color:blue >-1<span style="color:blue </<span style="color:#a31515 Value<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ID<span style="color:blue >Ad hoc<span style="color:blue </<span style="color:#a31515 ID<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 DefaultBonus<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 SimpleAdjustableNumber<span style="color:blue >
...
<span style="color:blue </<span style="color:#a31515 Values<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Defenses<span style="color:blue >
[/code]
where I want to extract the FinalValue again, but also the name (in this case, AC). There are three more of these blocks from which I want to extract these items, all within <Values>, within <Defenses>... but my simple XmlNodeList technique isnt
working.
Cheers for any help
<br/>
View the full article