Re: [xml] getting the output of string() in the xmllint shell

On Fri, Dec 20, 2019 at 12:46:23PM +0100, Gökçe Aydos wrote:
I use xmllint in my command-line scripts. The default mode of xmllint
does not support namespaces, so when I must deal with XML files with
namespaces I use the --shell mode of xmllint.

  That sounds ... wrong

I noticed that the xpath command in the shell behaves differently than
the *xmllint --xpath* on the command line. For example if I want to
extract only the string portion of an attribute I use:

  xmllint --xpath "string(//node)"

  hum ... //node doesn't address attributes

When I want to do the same in the shell, I must use the *xpath* command,
because the *cat* command only supports node addresses.

  xpath "string(//node)"

Unfortunately the xpath command gives an output like:

  Object is a string :

Is it possible to get a clean output with xmllint without using other tools?

  your request is very confusing but you should be able to get the string
value of the attributes directly by using an XPath looking for that attribute


Daniel Veillard      | Red Hat Developers Tools
veillard redhat com  | libxml Gnome XML XSLT toolkit | virtualization library

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]