Ricky wrote:
I'm trying to programmatically select the correct download URI from
install.xml, and I've so far worked out this XPath expression to do so
for the linux64 edition of glh_linear:
"//key[text()='glh_linear']/following-sibling::map[1]/key[text()='packages']/following-sibling::map[1]/key[text()='linux64']/following-sibling::map[1]/uri/text()"
This seems overly complex to me. Wouldn't it be easier to do a little
more nesting in that file's format? The keys and maps are laid out as
siblings when the key could simply be attribute of a map...
It is an XML serialization of LLSD
(http://wiki.secondlife.com/wiki/LLSD). LLSD has many different
serialization formats; the XML one is element-centric and, as you have
discovered, not ideal fodder for XPath lookups.
I'm a big fan of XPath myself, so I feel your pain.
Maybe I'm just using the wrong tools?
One alternative would be to use the LLSD Python libraries where access
turns into data['glh_linear']['packages']['linux64'] or some such. For
some of our internal bash scripts that need to read from a basic map
config file we have a utility script that takes a LLSD map key and
outputs the string value.
Or write a function that maps something that looks XPath-esque but is
LLSD-specific, e.g. "LLSDQueryToXPath" that takes
"glh_linear/packages/linux64" and outputs the XPath you wrote above.
Joshua
_______________________________________________
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/SLDev
Please read the policies before posting to keep unmoderated posting privileges