EDN Admin
Well-known member
Hi everybody,
I am currently working on making a XML reader class using XPath. These XML files are result of tests done on a IC and generally they look like this (But they can contain more Pins Count and more VIPair Counts)
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; utf-8<span style="color:Black; "<span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; Document<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Device<span style="color:Blue; >NEC555<span style="color:Blue; </<span style="color:#A31515; Device<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pins <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pin<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Number<span style="color:Blue; >A1<span style="color:Blue; </<span style="color:#A31515; Number<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curves <span style="color:Red; Count <span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PreStress<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-2<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.003<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-1<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.002<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-0<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.001<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PreFail<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-2<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.003<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-1<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.002<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-0<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.001<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PostFail<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curves<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Pin<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pin<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Number<span style="color:Blue; >B1<span style="color:Blue; </<span style="color:#A31515; Number<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curves <span style="color:Red; Count <span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PreStress<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-3<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.005<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-1<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.002<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-0<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.001<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PreFail<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-3<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.003<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-1<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.002<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-0<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.001<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PostFail<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curves<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Pin<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Pins<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Document<span style="color:Blue; >
[/code]
I am using the following method to return name of the Pins in the file, The first method is to see how many pins are in the xml file and second is to determine name of each pin:
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; //See how many pins are in the file
<span style="color:Blue; public <span style="color:Blue; int PinsCountAll()
{
pinsCount = <span style="color:Blue; int.Parse(xml.SelectSingleNode(<span style="color:#A31515; "//Document/Pins/@Count").Value);
<span style="color:Blue; return pinsCount;
}
<span style="color:Green; //Get name of each pin and put in an array
<span style="color:Blue; public <span style="color:Blue; string[] PinNamesAll()
{
pinNames = <span style="color:Blue; new <span style="color:Blue; string[PinsCountAll()];
XPathNodeIterator it = nav.Select(<span style="color:#A31515; "//Document/Pins/Pin");
<span style="color:Blue; int i = 0;
<span style="color:Blue; while (it.MoveNext())
{
<span style="color:Blue; this.pinNames = it.Current.SelectSingleNode(<span style="color:#A31515; "Number").Value;
i++;
}
<span style="color:Blue; return pinNames;
}
[/code]
These two above methods are working perfectly, but the problem is I am working on a way to retrive two more details from these XML files:
1- I want to know a single pin had what kind of tests? That is if for example we take pin A1, since it has <VIPairs Count="0 under <type>PostFail</Type> node, it has no result (That is <VIPair> of voltage and current).
I came up with this following method but it does not give me a result:
<div style="color:Black;background-color:White; <pre>
<span style="color:Gray; /// <span style="color:Gray; <summary>
<span style="color:Gray; ///<span style="color:Green; Returns number of pins in a test type (PreStress, PreFail or PostFail)
<span style="color:Gray; /// <span style="color:Gray; </summary>
<span style="color:Gray; /// <span style="color:Gray; <param name="type <span style="color:Green; STRING type</param>
<span style="color:Gray; /// <span style="color:Gray; <returns><span style="color:Green; int</returns>
<span style="color:Blue; public <span style="color:Blue; int PinsCountInType(<span style="color:Blue; string type)
{
<span style="color:Blue; int pinCountInType = 0;
XPathNodeIterator it1 = nav.Select(<span style="color:#A31515; "//Document/Pins/Pin");
<span style="color:Blue; foreach (<span style="color:Blue; string pin <span style="color:Blue; in PinNamesAll())
{
<span style="color:Blue; while (it1.MoveNext())
{
<span style="color:Blue; if (pin == it1.Current.SelectSingleNode(<span style="color:#A31515; "Number").Value)
{
XPathNodeIterator it2 = nav.Select(<span style="color:#A31515; "//Documents/Pins/Pin/Curves/Curve");
<span style="color:Blue; while (it2.MoveNext())
{
<span style="color:Blue; if (it2.Current.SelectSingleNode(<span style="color:#A31515; "Type").Value == type)
{
<span style="color:Blue; if (<span style="color:Blue; int.Parse(xml.SelectSingleNode(<span style="color:#A31515; "//Document/Pins/Pin/Curves/Curve/VIPairs/@Count").Value) > 0)
{
pinCountInType++;
}
}
}
}
}
}
<span style="color:Blue; return pinCountInType++;
}
[/code]
Would be nice if you can help me to make the above method to work!
2- Other problem is I have no idea how is it possible to make an array for each pin and put test type and numbers in it for example I need to have somehing like:
<div style="color:Black;background-color:White; <pre>
array (
(
<span style="color:#A31515; "pin" => <span style="color:#A31515; "A1",
<span style="color:#A31515; "testType" => <span style="color:#A31515; "PreStress"
)
,
(
<span style="color:#A31515; "Volt1" = -1,
<span style="color:#A31515; "Curnt1" = -0.003
)
<span style="color:Green; //And so on
[/code]
I now I want so much from you but I need some clues how to do these stuff!
Thanks!
View the full article
I am currently working on making a XML reader class using XPath. These XML files are result of tests done on a IC and generally they look like this (But they can contain more Pins Count and more VIPair Counts)
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; encoding<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; utf-8<span style="color:Black; "<span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; Document<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Device<span style="color:Blue; >NEC555<span style="color:Blue; </<span style="color:#A31515; Device<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pins <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pin<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Number<span style="color:Blue; >A1<span style="color:Blue; </<span style="color:#A31515; Number<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curves <span style="color:Red; Count <span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PreStress<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-2<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.003<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-1<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.002<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-0<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.001<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PreFail<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-2<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.003<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-1<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.002<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-0<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.001<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PostFail<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curves<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Pin<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Pin<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Number<span style="color:Blue; >B1<span style="color:Blue; </<span style="color:#A31515; Number<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curves <span style="color:Red; Count <span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PreStress<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-3<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.005<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-1<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.002<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-0<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.001<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PreFail<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-3<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.003<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-1<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.002<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Voltage<span style="color:Blue; >-0<span style="color:Blue; </<span style="color:#A31515; Voltage<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Current<span style="color:Blue; >-0.001<span style="color:Blue; </<span style="color:#A31515; Current<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPair<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Type<span style="color:Blue; >PostFail<span style="color:Blue; </<span style="color:#A31515; Type<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; VIPairs <span style="color:Red; Count<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; VIPairs<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curve<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Curves<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Pin<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Pins<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; Document<span style="color:Blue; >
[/code]
I am using the following method to return name of the Pins in the file, The first method is to see how many pins are in the xml file and second is to determine name of each pin:
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; //See how many pins are in the file
<span style="color:Blue; public <span style="color:Blue; int PinsCountAll()
{
pinsCount = <span style="color:Blue; int.Parse(xml.SelectSingleNode(<span style="color:#A31515; "//Document/Pins/@Count").Value);
<span style="color:Blue; return pinsCount;
}
<span style="color:Green; //Get name of each pin and put in an array
<span style="color:Blue; public <span style="color:Blue; string[] PinNamesAll()
{
pinNames = <span style="color:Blue; new <span style="color:Blue; string[PinsCountAll()];
XPathNodeIterator it = nav.Select(<span style="color:#A31515; "//Document/Pins/Pin");
<span style="color:Blue; int i = 0;
<span style="color:Blue; while (it.MoveNext())
{
<span style="color:Blue; this.pinNames = it.Current.SelectSingleNode(<span style="color:#A31515; "Number").Value;
i++;
}
<span style="color:Blue; return pinNames;
}
[/code]
These two above methods are working perfectly, but the problem is I am working on a way to retrive two more details from these XML files:
1- I want to know a single pin had what kind of tests? That is if for example we take pin A1, since it has <VIPairs Count="0 under <type>PostFail</Type> node, it has no result (That is <VIPair> of voltage and current).
I came up with this following method but it does not give me a result:
<div style="color:Black;background-color:White; <pre>
<span style="color:Gray; /// <span style="color:Gray; <summary>
<span style="color:Gray; ///<span style="color:Green; Returns number of pins in a test type (PreStress, PreFail or PostFail)
<span style="color:Gray; /// <span style="color:Gray; </summary>
<span style="color:Gray; /// <span style="color:Gray; <param name="type <span style="color:Green; STRING type</param>
<span style="color:Gray; /// <span style="color:Gray; <returns><span style="color:Green; int</returns>
<span style="color:Blue; public <span style="color:Blue; int PinsCountInType(<span style="color:Blue; string type)
{
<span style="color:Blue; int pinCountInType = 0;
XPathNodeIterator it1 = nav.Select(<span style="color:#A31515; "//Document/Pins/Pin");
<span style="color:Blue; foreach (<span style="color:Blue; string pin <span style="color:Blue; in PinNamesAll())
{
<span style="color:Blue; while (it1.MoveNext())
{
<span style="color:Blue; if (pin == it1.Current.SelectSingleNode(<span style="color:#A31515; "Number").Value)
{
XPathNodeIterator it2 = nav.Select(<span style="color:#A31515; "//Documents/Pins/Pin/Curves/Curve");
<span style="color:Blue; while (it2.MoveNext())
{
<span style="color:Blue; if (it2.Current.SelectSingleNode(<span style="color:#A31515; "Type").Value == type)
{
<span style="color:Blue; if (<span style="color:Blue; int.Parse(xml.SelectSingleNode(<span style="color:#A31515; "//Document/Pins/Pin/Curves/Curve/VIPairs/@Count").Value) > 0)
{
pinCountInType++;
}
}
}
}
}
}
<span style="color:Blue; return pinCountInType++;
}
[/code]
Would be nice if you can help me to make the above method to work!
2- Other problem is I have no idea how is it possible to make an array for each pin and put test type and numbers in it for example I need to have somehing like:
<div style="color:Black;background-color:White; <pre>
array (
(
<span style="color:#A31515; "pin" => <span style="color:#A31515; "A1",
<span style="color:#A31515; "testType" => <span style="color:#A31515; "PreStress"
)
,
(
<span style="color:#A31515; "Volt1" = -1,
<span style="color:#A31515; "Curnt1" = -0.003
)
<span style="color:Green; //And so on
[/code]
I now I want so much from you but I need some clues how to do these stuff!
Thanks!
View the full article