[sldev] Format of install.xml

Joshua Bell josh at lindenlab.com
Mon Jan 5 10:05:02 PST 2009


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




More information about the SLDev mailing list