Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4065418
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:58:49+00:00 2026-05-20T15:58:49+00:00

I have a XML file template like this that comes from some IC chips,

  • 0

I have a XML file template like this that comes from some IC chips, I want to be able to store each Pins Test type datas as an array so later I can draw it on a cartesian graph.

The data structure is like this:
<NUMBER></NUMBER> is name of the IC’s particular pin
<Curve Count=""> is number of tests done to a pin
<Type></Type> is type of test

and there are some voltage values and current values that I have to put in an array so I can use it later.

Anyway! My question is how can I get these values? I do not ask for a direct answer (but it is appriciated) but some guide that make me to find the thread is really appriciated.

EDIT: If somone kindly give me a code to have 3 voltage and 3 current values from A1 I can easily get the idea and continue myself.

This XML looks likes this:

<?xml version="1.0" encoding="utf-8"?>
<Document>
  <Device>NEC555</Device>
  <Pins Count="3">
    <Pin>
      <Number>A1</Number>
      <Curves Count ="3">
        <Curve>
          <Type>PreStress</Type>
          <VIPairs Count="3">
            <VIPair>
              <Voltage>-2</Voltage>
              <Current>-0.003</Current>
            </VIPair>
            <VIPair>
              <Voltage>-1</Voltage>
              <Current>-0.002</Current>
            </VIPair>
            <VIPair>
              <Voltage>-0</Voltage>
              <Current>-0.001</Current>
            </VIPair>
          </VIPairs>
        </Curve>
        <Curve>
          <Type>PreFail</Type>
          <VIPairs Count="3">
            <VIPair>
              <Voltage>-2</Voltage>
              <Current>-0.003</Current>
            </VIPair>
            <VIPair>
              <Voltage>-1</Voltage>
              <Current>-0.002</Current>
            </VIPair>
            <VIPair>
              <Voltage>-0</Voltage>
              <Current>-0.001</Current>
            </VIPair>
          </VIPairs>
        </Curve>
        <Curve>
          <Type>PostFail</Type>
          <VIPairs Count="0">
          </VIPairs>
        </Curve>
      </Curves>
    </Pin>
    <Pin>
      <Number>B1</Number>
      <Curves Count ="3">
        <Curve>
          <Type>PreStress</Type>
          <VIPairs Count="3">
            <VIPair>
              <Voltage>-3</Voltage>
              <Current>-0.005</Current>
            </VIPair>
            <VIPair>
              <Voltage>-1</Voltage>
              <Current>-0.002</Current>
            </VIPair>
            <VIPair>
              <Voltage>-0</Voltage>
              <Current>-0.001</Current>
            </VIPair>
          </VIPairs>
        </Curve>
        <Curve>
          <Type>PreFail</Type>
          <VIPairs Count="3">
            <VIPair>
              <Voltage>-3</Voltage>
              <Current>-0.003</Current>
            </VIPair>
            <VIPair>
              <Voltage>-1</Voltage>
              <Current>-0.002</Current>
            </VIPair>
            <VIPair>
              <Voltage>-0</Voltage>
              <Current>-0.001</Current>
            </VIPair>
          </VIPairs>
        </Curve>
        <Curve>
          <Type>PostFail</Type>
          <VIPairs Count="0">
          </VIPairs>
        </Curve>
      </Curves>
    </Pin>
  </Pins>
</Document>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:58:50+00:00Added an answer on May 20, 2026 at 3:58 pm

    Much as I like using LINQ and XDocument, this is a case where XPath is simpler.

    Given your XML, this XPath finds all of the VIPair elements under a Pin element with a given Number and under a Curve element with a given Type:

    /Document/Device/Pins/Pin[Number='A1']/Curves/Curve[Type='PreStress']/VIPairs/VIPair
    

    Using an XmlDocument, the code to get your three voltage and current values would look like this:

    string number = "A1";
    string type = "PreStress"
    string xpath = string.Format(
       "/Document/Device/Pins/Pin[Number='{0}']/Curves/Curve[Type='{1}']/VIPairs/VIPair",
       number,
       type);
    foreach (XmlElement viPair in doc.SelectNodes(xpath))
    {
       string current = viPair.SelectSingleNode("Current").Value;
       string voltage = viPair.SelectSingleNode("Voltage").Value;
    }
    

    Using an XDocument, the code would be:

    var values = doc.XPathSelectElements(xpath)
       .Select(x => new { Voltage = x.Element("Voltage").Value(),
                          Current = x.Element("Current").Value() });
    

    Unless your document’s been previously validated against a schema, you may want to make the last node test in the XPath VIPair[Current and Voltage], so that the code doesn’t fail if there’s a VIPair element that’s missing one of those child elements. (Alternatively, you might actually want the code to throw an exception if that happens; it really depends on the quality of the source data.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a T4 template that generates classes from an xml file. How can
I have an XML file that starts like this: <Elements name=Entities xmlns=XS-GenerationToolElements> I'll have
I have an XML file, which I open in F# like this: let Bookmarks(xmlFile:string)
I have a XML File like that <?xml version=1.0 encoding=utf-8 ?> <Configurations> <EmailConfiguration> <userName>xxxx</userName>
I have an xml file like this: <root> <item> <name>one</name> <status>good</status> </item> <item> <name>two</name>
I have an XML file that I want to transform using an XSLT. It
I've got a 2-part question... I have some XML that looks like: <trans-unit id=70
I have an xml file providing data for a datagrid in Flex 2 that
I have an XML file that encodes a directed acyclic graph (DAG) that represents
I have an xml file where I need to comment out a whole piece

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.