I'm trying to take out from AWS respond needed information. Here is cut off part of example respond:

...
                    <instanceId>i-xxxxx</instanceId>
                    <imageId>ami-xxxxx</imageId>
                    <instanceState>
                        <code>16</code>
                        <name>running</name>
                    </instanceState>
<privateDnsName>ip-xxxxxxx.ec2.internal</privateDnsName> <dnsName>ec2-xxxxxx.compute-1.amazonaws.com</dnsName>
                    <reason/>
                    <keyName>ec2key</keyName>
                    <amiLaunchIndex>0</amiLaunchIndex>
                    <productCodes>
                        <item>
<productCode>xxxxxxxxxxxxxxxxxxxx</productCode>
                            <type>marketplace</type>
                        </item>
                    </productCodes>
                    <instanceType>c3.large</instanceType>
<launchTime>2015-08-18T16:51:11.000Z</launchTime>
...

With such code im getting only information about all instance ids:

    string xmlstring = cast(string)read("test.xml");
    XmlNode newdoc = xmlstring.readDocument();
    XmlNode[]  searchlist = newdoc.parseXPath("//instanceId");
    writeln(searchlist);

What i need is that to take out from there instance id and eg LaunchTime for that instance. How can i do it using kxml?

Why there is needed that "//" before tag? In other way im not getting any respond. What is interesting when i do that same with first tag appearing in respond it is not needed. From other hand with "///" i'm getting much more information but not separated by coma.

How to drop tags from respond? I have such result of parsing by id tag:

<instanceId>i-xxxxxx</instanceId>

I need only value. Is there some equivalent to ".text" from std.xml?

Reply via email to