diff -uNr xmlstarlet-1.0.1-original/doc/gen-doc xmlstarlet-1.0.1/doc/gen-doc --- xmlstarlet-1.0.1-original/doc/gen-doc 2003-06-11 21:55:14.000000000 -0400 +++ xmlstarlet-1.0.1/doc/gen-doc 2005-11-22 18:20:09.000000000 -0500 @@ -14,8 +14,8 @@ echo "1. BASIC COMMAND LINE OPTIONS" echo "====================================================" echo "" -echo "xml" -../src/xml 2>&1 +echo "xmlstarlet" +../src/xmlstarlet 2>&1 echo "" echo "" @@ -23,8 +23,8 @@ echo "2. Select/Query XML documents" echo "====================================================" echo "" -echo "xml sel --help" -../src/xml sel --help 2>&1 +echo "xmlstarlet sel --help" +../src/xmlstarlet sel --help 2>&1 echo "" echo "" @@ -32,8 +32,8 @@ echo "3. Editing XML documents" echo "====================================================" echo "" -echo "xml ed --help" -../src/xml ed --help 2>&1 +echo "xmlstarlet ed --help" +../src/xmlstarlet ed --help 2>&1 echo "" echo "" @@ -41,8 +41,8 @@ echo "4. Using XSLT to transform XML documents" echo "====================================================" echo "" -echo "xml tr --help" -../src/xml tr --help 2>&1 +echo "xmlstarlet tr --help" +../src/xmlstarlet tr --help 2>&1 echo "" echo "" @@ -50,8 +50,8 @@ echo "5. Formatting XML documents" echo "====================================================" echo "" -echo "xml fo --help" -../src/xml fo --help 2>&1 +echo "xmlstarlet fo --help" +../src/xmlstarlet fo --help 2>&1 echo "" echo "" @@ -59,8 +59,8 @@ echo "6. Validating XML documents" echo "====================================================" echo "" -echo "xml val --help" -../src/xml val --help 2>&1 +echo "xmlstarlet val --help" +../src/xmlstarlet val --help 2>&1 echo "" echo "" @@ -68,8 +68,8 @@ echo "7. Displaying structure of XML documents" echo "====================================================" echo "" -echo "xml el --help" -../src/xml el --help 2>&1 +echo "xmlstarlet el --help" +../src/xmlstarlet el --help 2>&1 echo "" echo "" @@ -78,8 +78,8 @@ echo "8. Escape/Unescape special XML characters" echo "====================================================" echo "" -echo "xml esc --help" -../src/xml esc --help 2>&1 +echo "xmlstarlet esc --help" +../src/xmlstarlet esc --help 2>&1 echo "" echo "" @@ -88,8 +88,8 @@ echo "9. List directory as XML" echo "====================================================" echo "" -echo "xml ls --help" -../src/xml ls --help 2>&1 +echo "xmlstarlet ls --help" +../src/xmlstarlet ls --help 2>&1 echo "" echo "" @@ -98,8 +98,8 @@ echo "10. XML canonicalization" echo "====================================================" echo "" -echo "xml c14n --help" -../src/xml c14n --help 2>&1 +echo "xmlstarlet c14n --help" +../src/xmlstarlet c14n --help 2>&1 echo "" echo "" @@ -108,8 +108,8 @@ echo "11. Convert XML into PYX format (based on ESIS - ISO 8879)" echo "====================================================" echo "" -echo "xml pyx --help" -../src/xml pyx --help 2>&1 +echo "xmlstarlet pyx --help" +../src/xmlstarlet pyx --help 2>&1 echo "" echo "" @@ -178,6 +178,6 @@ done echo "" -} | sed -e "s#./xmlstarlet#xml#g" +} diff -uNr xmlstarlet-1.0.1-original/doc/xmlstarlet-man.xml xmlstarlet-1.0.1/doc/xmlstarlet-man.xml --- xmlstarlet-1.0.1-original/doc/xmlstarlet-man.xml 2004-02-21 17:20:42.000000000 -0500 +++ xmlstarlet-1.0.1/doc/xmlstarlet-man.xml 2005-11-22 18:17:38.000000000 -0500 @@ -84,7 +84,7 @@ Commands - Type: xml <command> --help <ENTER> for command + Type: xmlstarlet <command> --help <ENTER> for command help Available commands include: diff -uNr xmlstarlet-1.0.1-original/doc/xmlstarlet-ug.xml xmlstarlet-1.0.1/doc/xmlstarlet-ug.xml --- xmlstarlet-1.0.1-original/doc/xmlstarlet-ug.xml 2005-01-07 00:11:39.000000000 -0500 +++ xmlstarlet-1.0.1/doc/xmlstarlet-ug.xml 2005-11-22 18:16:11.000000000 -0500 @@ -1,6 +1,8 @@ +"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ + +]> XmlStarlet Command Line XML Toolkit User's Guide @@ -298,7 +300,7 @@ Basic command line syntax: bash-2.03$ xml XMLStarlet Toolkit: Command line utilities for XML -Usage: xml [<options>] <command> [<cmd-options>] +Usage: &XMLSTARLET; [<options>] <command> [<cmd-options>] where <command> is one of: ed (or edit) - Edit/Update XML document(s) sel (or select) - Select data or query XML document(s) (XPATH, etc) @@ -318,7 +320,7 @@ Wherever file name mentioned in command help it is assumed that URL can be used instead as well. -Type: xml <command> --help <ENTER> for command help +Type: &XMLSTARLET; <command> --help <ENTER> for command help XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) @@ -350,7 +352,7 @@ </table> </xml> - xml el table.xml + &XMLSTARLET; el table.xml would produce the following output. @@ -379,7 +381,7 @@ EXAMPLE: - xml el -u table.xml + &XMLSTARLET; el -u table.xml Output: @@ -396,7 +398,7 @@ EXAMPLE: - xml el -a table.xml + &XMLSTARLET; el -a table.xml Output: @@ -421,7 +423,7 @@ EXAMPLE: - xml el -v table.xml + &XMLSTARLET; el -v table.xml Output: @@ -448,10 +450,10 @@ Querying XML documents XmlStarlet 'select' or 'sel' option can be used to query or search - XML documents. Here is synopsis for 'xml sel' command: + XML documents. Here is synopsis for '&XMLSTARLET; sel' command: XMLStarlet Toolkit: Select from XML document(s) -Usage: xml sel <global-options> {<template>} [ <xml-file> ... ] +Usage: &XMLSTARLET; sel <global-options> {<template>} [ <xml-file> ... ] where <global-options> - global options for selecting <xml-file> - input XML document file name/uri (stdin is used if missing) @@ -495,7 +497,7 @@ in a single template. The effect of applying command line templates can be illustrated with the following XSLT analogue -xml sel -t -c "xpath0" -m "xpath1" -m "xpath2" -v "xpath3" \ +&XMLSTARLET; sel -t -c "xpath0" -m "xpath1" -m "xpath2" -v "xpath3" \ -t -m "xpath4" -c "xpath5" is equivalent to applying the following XSLT @@ -549,7 +551,7 @@ - xml sel -t -v "count(/xml/table/rec/numField)" table.xml + &XMLSTARLET; sel -t -v "count(/xml/table/rec/numField)" table.xml Input (table.xml): @@ -578,7 +580,7 @@ Let's take a close look what it did internally. For that we will use '-C' option - $ xml sel -C -t -v "count(/xml/table/rec/numField)" + $ &XMLSTARLET; sel -C -t -v "count(/xml/table/rec/numField)" <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" @@ -668,7 +670,7 @@ Count all nodes in XML documents. Print input name and node count after it. - xml sel -t -f -o " " -v "count(//node())" xml/table.xml xml/tab-obj.xml + &XMLSTARLET; sel -t -f -o " " -v "count(//node())" xml/table.xml xml/tab-obj.xml Output: @@ -682,7 +684,7 @@ Find XML files matching XPath expression (containing 'object' element) - xml sel -t -m //object -f xml/table.xml xml/tab-obj.xml + &XMLSTARLET; sel -t -m //object -f xml/table.xml xml/tab-obj.xml Result output: @@ -694,7 +696,7 @@ Calculate EXSLT (XSLT extentions) XPath value - echo "<x/>" | xml sel -t -v "math:abs(-1000)" + echo "<x/>" | &XMLSTARLET; sel -t -v "math:abs(-1000)" Result output: @@ -704,9 +706,9 @@ EXAMPLE - Adding elements and attributes using command line 'xml sel' + Adding elements and attributes using command line '&XMLSTARLET; sel' - echo "<x/>" | xml sel -t -m / -e xml -e child -a data -o value + echo "<x/>" | &XMLSTARLET; sel -t -m / -e xml -e child -a data -o value Result Output: @@ -718,7 +720,7 @@ Query XML document and produce sorted text table - xml sel -T -t -m /xml/table/rec -s D:N:- "@id" \ + &XMLSTARLET; sel -T -t -m /xml/table/rec -s D:N:- "@id" \ -v "concat(@id,'|',numField,'|',stringField)" -n xml/table.xml Result Output: @@ -751,7 +753,7 @@ Predefine namespaces for XPath expressions - xml sel -N xsql=urn:oracle-xsql -t -v /xsql:query xsql/jobserve.xsql + &XMLSTARLET; sel -N xsql=urn:oracle-xsql -t -v /xsql:query xsql/jobserve.xsql Input (xsql/jobserve.xsql) @@ -777,10 +779,10 @@ EXAMPLE - Print structure of XML element using xml sel (advanced XPath - expressions and xml sel command usage) + Print structure of XML element using &XMLSTARLET; sel (advanced XPath + expressions and &XMLSTARLET; sel command usage) - xml sel -T -t -m '//*' \ + &XMLSTARLET; sel -T -t -m '//*' \ -m 'ancestor-or-self::*' -v 'name()' -i 'not(position()=last())' -o . -b -b -n \ xml/structure.xml @@ -843,7 +845,7 @@ Print all links of xhtml document - xml sel --net --html -T -t -m "//*[local-name()='a']" \ + &XMLSTARLET; sel --net --html -T -t -m "//*[local-name()='a']" \ -o 'NAME: ' -v "translate(. , '&#10;', ' ')" -n \ -o 'LINK: ' -v @href -n -n \ http://xmlstar.sourceforge.net/ @@ -872,10 +874,10 @@ Transforming XML documents - Here is synopsis for 'xml tr' command: + Here is synopsis for '&XMLSTARLET; tr' command: XMLStarlet Toolkit: Transform XML document(s) using XSLT -Usage: xml tr [<options>] <xsl-file> {-p|-s <name>=<value>} [ <xml-file-or-uri> ... ] +Usage: &XMLSTARLET; tr [<options>] <xsl-file> {-p|-s <name>=<value>} [ <xml-file-or-uri> ... ] where <xsl-file> - main XSLT stylesheet for transformation <xml-file> - input XML document file name (stdin is used if missing) @@ -904,7 +906,7 @@ EXAMPLE: # Transform passing parameters to XSLT stylesheet -xml tr xsl/param1.xsl -p Count='count(/xml/table/rec)' -s Text="Count=" xml/table.xml +&XMLSTARLET; tr xsl/param1.xsl -p Count='count(/xml/table/rec)' -s Text="Count=" xml/table.xml Input xsl/params1.xsl @@ -934,10 +936,10 @@ Editing XML documents - Here is the synopsis for 'xml ed' command: + Here is the synopsis for '&XMLSTARLET; ed' command: XMLStarlet Toolkit: Edit XML document(s) -Usage: xml ed <global-options> {<action>} [ <xml-file-or-uri> ... ] +Usage: &XMLSTARLET; ed <global-options> {<action>} [ <xml-file-or-uri> ... ] where <global-options> - global options for editing <xml-file-or-uri> - input XML document file name/uri (stdin is used if missing) @@ -969,7 +971,7 @@ EXAMPLE: # Delete elements matching XPath expression -xml ed -d "/xml/table/rec[@id='2']" xml/table.xml +&XMLSTARLET; ed -d "/xml/table/rec[@id='2']" xml/table.xml Input @@ -1011,7 +1013,7 @@ EXAMPLE # Move element node -echo '<x id="1"><a/><b/></x>' | xml ed -m "//b" "//a" +echo '<x id="1"><a/><b/></x>' | &XMLSTARLET; ed -m "//b" "//a" Output @@ -1026,7 +1028,7 @@ EXAMPLE # Rename attributes -xml ed -r "//*/@id" -v ID xml/tab-obj.xml +&XMLSTARLET; ed -r "//*/@id" -v ID xml/tab-obj.xml Output: @@ -1056,7 +1058,7 @@ EXAMPLE # Rename elements -xml ed -r "/xml/table/rec" -v record xml/tab-obj.xml +&XMLSTARLET; ed -r "/xml/table/rec" -v record xml/tab-obj.xml Output: @@ -1086,7 +1088,7 @@ EXAMPLE # Update value of an attribute -xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 xml/tab-obj.xml +&XMLSTARLET; ed -u "/xml/table/rec[@id=3]/@id" -v 5 xml/tab-obj.xml Output: @@ -1116,7 +1118,7 @@ EXAMPLE # Update value of an element -xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 xml/tab-obj.xml +&XMLSTARLET; ed -u "/xml/table/rec[@id=1]/numField" -v 0 xml/tab-obj.xml Output: @@ -1147,10 +1149,10 @@ Validating XML documents - Here is synopsis for 'xml val' command: + Here is synopsis for '&XMLSTARLET; val' command: XMLStarlet Toolkit: Validate XML document(s) -Usage: xml val <options> [ <xml-file-or-uri> ... ] +Usage: &XMLSTARLET; val <options> [ <xml-file-or-uri> ... ] where <options> -w or --well-formed - validate well-formedness only (default) -d or --dtd <dtd-file> - validate against DTD @@ -1171,7 +1173,7 @@ EXAMPLE # Validate XML document against DTD -xml val --dtd dtd/table.dtd xml/tab-obj.xml >/dev/null 2>&1; echo $? +&XMLSTARLET; val --dtd dtd/table.dtd xml/tab-obj.xml >/dev/null 2>&1; echo $? Output: @@ -1182,7 +1184,7 @@ EXAMPLE # Validate against XSD schema -xml val -b -s xsd/table.xsd xml/table.xml xml/tab-obj.xml 2>/dev/null; echo $? +&XMLSTARLET; val -b -s xsd/table.xsd xml/table.xml xml/tab-obj.xml 2>/dev/null; echo $? Output: @@ -1195,10 +1197,10 @@ Formatting XML documents - Here is synopsis for 'xml fo' command: + Here is synopsis for '&XMLSTARLET; fo' command: XMLStarlet Toolkit: Format XML document -Usage: xml fo [<options>] <xml-file> +Usage: &XMLSTARLET; fo [<options>] <xml-file> where <options> are -n or --noindent - do not indent -t or --indent-tab - indent output with tabulation @@ -1219,7 +1221,7 @@ EXAMPLE # Format XML document disabling indent -cat xml/tab-obj.xml | xml fo --noindent +cat xml/tab-obj.xml | &XMLSTARLET; fo --noindent Output: @@ -1249,7 +1251,7 @@ EXAMPLE # Recover malformed XML document -xml fo -R xml/malformed.xml 2>/dev/null +&XMLSTARLET; fo -R xml/malformed.xml 2>/dev/null Input: @@ -1272,10 +1274,10 @@ Canonicalization of XML documents - Here is synopsis for 'xml c14n' command: + Here is synopsis for '&XMLSTARLET; c14n' command: XMLStarlet Toolkit: XML canonicalization -Usage: xml c14n <mode> <xml-file> [<xpath-file>] [<inclusive-ns-list>] +Usage: &XMLSTARLET; c14n <mode> <xml-file> [<xpath-file>] [<inclusive-ns-list>] where <xml-file> - input XML document file name (stdin is used if '-') <xpath-file> - XML file containing XPath expression for @@ -1303,7 +1305,7 @@ EXAMPLE # XML canonicalization -xml c14n --with-comments ../examples/xml/structure.xml ; echo $? +&XMLSTARLET; c14n --with-comments ../examples/xml/structure.xml ; echo $? Input ../examples/xml/structure.xml @@ -1345,7 +1347,7 @@ EXAMPLE # XML exclusive canonicalization -xml c14n --exc-with-comments ../examples/xml/c14n.xml ../examples/xml/c14n.xpath +&XMLSTARLET; c14n --exc-with-comments ../examples/xml/c14n.xml ../examples/xml/c14n.xpath Input @@ -1377,10 +1379,10 @@ XML and PYX format - Here is synopsis for 'xml pyx' command: + Here is synopsis for '&XMLSTARLET; pyx' command: XMLStarlet Toolkit: Convert XML into PYX format (based on ESIS - ISO 8879) -Usage: xml pyx {<xml-file>} +Usage: &XMLSTARLET; pyx {<xml-file>} where <xml-file> - input XML document file name (stdin is used if missing) @@ -1399,7 +1401,7 @@ EXAMPLE - xml pyx input.xml + &XMLSTARLET; pyx input.xml Input (input.xml) @@ -1446,7 +1448,7 @@ EXAMPLE (Delete all attributes). This should work really fast for very large XML documents. - xml pyx input.xml | grep -v "^A" | xml depyx + &XMLSTARLET; pyx input.xml | grep -v "^A" | &XMLSTARLET; depyx Output @@ -1466,11 +1468,11 @@ Escape/Unescape special XML characters - Here is synopsis for 'xml esc' command: + Here is synopsis for '&XMLSTARLET; esc' command: - xml esc --help + &XMLSTARLET; esc --help XMLStarlet Toolkit: Escape special XML characters -Usage: xml esc [<options>] [<string>] +Usage: &XMLSTARLET; esc [<options>] [<string>] where <options> are --help - print usage (TODO: more to be added in future) @@ -1483,7 +1485,7 @@ EXAMPLE # Escape special XML characters -cat xml/structure.xml | xml esc +cat xml/structure.xml | &XMLSTARLET; esc Input @@ -1525,10 +1527,10 @@ List directory as XML - Here is synopsis for 'xml ls' command: + Here is synopsis for '&XMLSTARLET; ls' command: XMLStarlet Toolkit: List directory as XML -Usage: xml ls +Usage: &XMLSTARLET; ls Lists current directory in XML format. XMLStarlet is a command line toolkit to query/edit/check/transform @@ -1537,7 +1539,7 @@ EXAMPLE - xml ls + &XMLSTARLET; ls Output @@ -1583,7 +1585,7 @@ And the following (initially looking correct) query to print all links - xml sel -t -m "//a" -c . -n + &XMLSTARLET; sel -t -m "//a" -c . -n would return nothing. The issue with this query is that it is not addressing element <a> in the right namespace. XPath requires all @@ -1593,7 +1595,7 @@ detail: namespace equivalency is determined not by namespace prefix, but by URI. See query below, which would return expected result - xml sel -N x="http://www.w3.org/1999/xhtml" -t -m "//x:a" -c . -n + &XMLSTARLET; sel -N x="http://www.w3.org/1999/xhtml" -t -m "//x:a" -c . -n Example of deleting namespace declarations. @@ -1608,7 +1610,7 @@ </doc> - Command:xml ed -N N="http://www.c.com/xyz" -d '//N:*' ns2.xml | \ + Command:&XMLSTARLET; ed -N N="http://www.c.com/xyz" -d '//N:*' ns2.xml | \ sed -e 's/ xmlns.*=".*"//g' Output<doc> @@ -1629,29 +1631,29 @@ executed by shell and shell does substitutions of its special characters too. So for example, one may ask: - "Why does the following query return nothing?"echo '<X name="foo">EEE</X>' | xml sel -t -m /X[@name='foo'] -v . + "Why does the following query return nothing?"echo '<X name="foo">EEE</X>' | &XMLSTARLET; sel -t -m /X[@name='foo'] -v . The answer lies in the way shell substitues 'foo', which simply becomes foo before the command is run. So the correct way to write that would be - echo '<X name="foo">EEE</X>' | xml sel -t -m "/X[@name='foo']" -v . + echo '<X name="foo">EEE</X>' | &XMLSTARLET; sel -t -m "/X[@name='foo']" -v . Another example involves XML special characters. Question: How to search for &apos; in text nodes? - The following should helpxml sel -t -m "//line[contains(text(),&quot;'&quot;)]" -c . + The following should help&XMLSTARLET; sel -t -m "//line[contains(text(),&quot;'&quot;)]" -c . Sorting - Let's take a look at XSLT produced by the following 'xml sel' + Let's take a look at XSLT produced by the following '&XMLSTARLET; sel' command: # Query XML document and produce sorted text table -xml sel -T -t -m /xml/table/rec -s D:N:- "@id" \ +&XMLSTARLET; sel -T -t -m /xml/table/rec -s D:N:- "@id" \ -v "concat(@id,'|',numField,'|',stringField)" -n xml/table.xml @@ -1672,7 +1674,7 @@ </xsl:stylesheet> - -s option of 'xml sel' command controls 'order', 'data-type', and + -s option of '&XMLSTARLET; sel' command controls 'order', 'data-type', and 'case-order' attributes of <xsl:sort/> element .