login about faq

Hello, I am having hard time to understand correctly how to get a special position inside xml.

My xml looks like this:

<root>
    <searchRoot>
        <fruit color="red">apple</fruit>
        <fruit color="green">pear</fruit>
        <veg color="orange">carrot</veg>
        <meat animal="cow">beef</meat>
        <xyz>
            <fruit color="blue">blueberry</fruit>
            <veg color="green">broccoli</veg>
        </xyz>
        <fruit color="purple">grape</fruit>
        <cheese color="yellow">cheddar</cheese>
    </searchRoot>
    <Haus>
        <door color="white">white doors</door>
        <order orderid="12345">the order id</order>

    </Haus>
    <fruit color="red">strawberry</fruit>
    <fruit color="orange">peach</fruit>
</root>

I want to design a function I can pass to what I am searching for. In this case I search for the attribute orderid under <door> which is inside <haus>.

I was not able to get it to work. I used:

node = xml.FindChild("Haus");
node =  xml.SearchForTag(0,"door");

CkString value;
value = xml.getAttrValue("orderid");

asked Apr 28 '17 at 10:52

Rudiment's gravatar image

Rudiment
1

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×65
×5

Asked: Apr 28 '17 at 10:52

Seen: 469 times

Last updated: Apr 28 '17 at 10:52

powered by OSQA