Using xmlstarlet and OpenOffice

Bruce Dawson jbd at codemeta.com
Sun Feb 28 18:03:13 EST 2010


Has anyone used xmlstarlet (a command-line xml parser) to get data from
content.xml (OpenOffice) files?

It seems to be complaining about Undefined namespace prefix, and I can't
seem to figure out what it wants.

Some background: I'm trying to create some shell scripts that will
extract (and possibly replace) particular elements from OO documents.
xmlstarlet seems perfectly suited for this task, but I can't figure out
what name space it wants or if I'm doing something wrong.

I'm using (all on one line):

jbd at dawson:~/Desktop/oo-xmlstarlet$ xmlstarlet sel -T -N
office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" -t -v
office:document-content/office:body/office:text/text:p/text:span/text:text-input
content.xml

And that's returning:

XPath error : Undefined namespace prefix
xmlXPathCompiledEval: evaluation failed
runtime error: element value-of
XPath evaluation returned no result.

Any help would be most appreciated.

--Bruce



More information about the gnhlug-discuss mailing list