XPath

Liens utiles :

XML Path Language (XPath)

Outils

Utilisation (interactive) :

  xmllint --shell <fichier>.xml
  / > help
        base         display XML base of the node
        setbase URI  change the XML base of the node
        bye          leave shell
        cat [node]   display node or current node
        cd [path]    change directory to path or to root
        dir [path]   dumps informations about the node
                     (namespace, attributes, content)
        du [path]    show the structure of the subtree under path
                       or the current node
        exit         leave shell
        help         display this help
        free         display memory usage
        load [name]  load a new document with name
        ls [path]    list contents of path or the current directory
        xpath expr   evaluate the XPath expression in that context
                     and print the result
        setns nsreg  register a namespace to a prefix
                     in the XPath evaluation context
                     format for nsreg is: prefix=[nsuri]
                     (i.e. prefix= unsets a prefix)
        pwd          display current working directory
        quit         leave shell
        save [name]  save this document to name or the original name
        write [name] write the current node to the filename
        validate     check the document for errors
        relaxng rng  validate the document agaisnt the Relax-NG schemas
        grep string  search for a string in the subtree
  / > quit
        

On peut aussi rajouter d'autres options à cette commande :

  xmllint --valid --shell tst.xml
  / > xpath /test_unit[@st=0]
  Object is a Node Set :
  Set contains 0 nodes:

  xmllint --dtdattr --shell tst.xml
  / > xpath /test_unit[@st=0]
  Object is a Node Set :
  Set contains 1 nodes:
  1  ELEMENT test_unit
      ATTRIBUTE st
        TEXT
          content=0
        

 

Valid XHTML 1.0!  Valid CSS!

Dernière mise à jour effectuée le : dimanche 20 juillet 2008, 11:03:32 (UTC+0200)

Accueil