Archived Forum Post

Index of archived forum posts


How to get my data from xml

Apr 28 '17 at 10:52

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

My xml looks like this:

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

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

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");