Using xmllint and xpath without --shell

Discussion in 'XML' started by Neil McNaughton, Jan 7, 2005.

  1. Using

    xmllint --shell ...

    there is a great xpath parser. For instance you can do "//body" to extract
    only the <BODY of an html document.

    But how can you do this with just the commande line?

    I need a shell one liner to grab the contents of a <body> XXXX </body>
    tag...Preferably without using perl...

    Neil
     
    Neil McNaughton, Jan 7, 2005
    #1
    1. Advertising

  2. Neil McNaughton

    grouch Guest

    Neil McNaughton wrote:
    > Using
    >
    > xmllint --shell ...
    >
    > there is a great xpath parser. For instance you can do "//body" to

    extract
    > only the <BODY of an html document.
    >
    > But how can you do this with just the commande line?
    >
    > I need a shell one liner to grab the contents of a <body> XXXX

    </body>
    > tag...Preferably without using perl...
    >
    > Neil


    You can use xmlstarlet (http://xmlstar.sourceforge.net/)
    xml sel -t -v "//body" your.xml

    --MG
     
    grouch, Jan 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stan R.
    Replies:
    4
    Views:
    17,364
    Stan R.
    Jun 8, 2006
  2. Geoff

    xmllint & dom.Writer

    Geoff, Oct 16, 2006, in forum: XML
    Replies:
    2
    Views:
    512
    Joe Kesselman
    Oct 16, 2006
  3. Replies:
    2
    Views:
    1,379
  4. Samuel A. Falvo II
    Replies:
    0
    Views:
    486
    Samuel A. Falvo II
    Oct 8, 2008
  5. sky
    Replies:
    1
    Views:
    2,139
    Manuel Collado
    Dec 12, 2012
Loading...

Share This Page