On Tuesday, 20 October 2015 at 16:53:19 UTC, holo wrote:
When im checking instance name with such code:
auto test =
list.parseXPath(`//tagSet/item[key="Name"]/value`)[0].goCData;
it is compiling properly but it is breaking program when is no
name set.
I make quick workaround:
You can write a helper:
XmlNode selectSingleNode(XmlNode src, string path)
{
XmlNode[] nodes = src.parseXPath(path);
return nodes.length==0 ? null : nodes[0];
}
Then:
string test1 = node.selectSingleNode(`//instanceId`).getCData();
On Tuesday, 20 October 2015 at 13:23:47 UTC, opticron wrote:
I think part of the issue here is that holo isn't quite sure of
what information [s]he needs out of the XML reply and how to do
that with XPath. The first post mentioned getting instanceId
and launchTime, so I'll start there using
I think part of the issue here is that holo isn't quite sure of
what information [s]he needs out of the XML reply and how to do
that with XPath. The first post mentioned getting instanceId and
launchTime, so I'll start there using the AWS example XML found
here:
Select parent tags and get data from their child tags like
instanceId.
On Monday, 19 October 2015 at 11:53:08 UTC, Kagamin wrote:
On Monday, 19 October 2015 at 04:49:25 UTC, holo wrote:
Why there is needed that "//" before tag?
That's an XPath expression.
Need, to read about that XPaths.
How to drop tags from respond? I have such result of parsing
by id
Sorry i was trying to use that XPaths to take out instanceId and
laounchTime but i always get an empty respond.
//instanceId/launchTime" - empty
//instanceId/* - empty too
//instanceId.launchTime - empty too
How to take instance id and variable which im interest in or
few/all for
On Monday, 19 October 2015 at 04:49:25 UTC, holo wrote:
Why there is needed that "//" before tag?
That's an XPath expression.
How to drop tags from respond? I have such result of parsing by
id tag:
i-xx
I need only value. Is there some equivalent to ".text" from
std.xml?
Try
On Monday, 19 October 2015 at 12:54:52 UTC, Kagamin wrote:
Select parent tags and get data from their child tags like
instanceId.
void main()
{
string xmlstring = cast(string)read("test.xml");
XmlNode newdoc = xmlstring.readDocument();
XmlNode[] searchlist =
If you don't want parent tag, then:
XmlNode[] searchlist2 = newdoc.parseXPath("//launchTime");
On Monday, 19 October 2015 at 16:12:56 UTC, Kagamin wrote:
If you don't want parent tag, then:
XmlNode[] searchlist2 = newdoc.parseXPath("//launchTime");
I wanted parent tag, i think. I almost figure out what i needed,
but getCData stops working :/
void main()
{
string xmlstring =
I have no idea what i'm doing, but i did it (i just choose 1
element of array):
void main()
{
string xmlstring = cast(string)read("test.xml");
XmlNode newdoc = xmlstring.readDocument();
XmlNode[] searchlist =
newdoc.parseXPath(`//instancesSet/item`);
foreach(list;
12 matches
Mail list logo