Download: XmlStarlet Command Line XML Toolkit User’s Guide Mikhail Grushinskiy
XmlStarlet Command Line XML Toolkit User’s Guide Mikhail Grushinskiy XmlStarlet Command Line XML Toolkit User’s Guide by Mikhail Grushinskiy Table of Contents 1. Introduction... 1 1.1. About XmlStarlet ... 1 1.2. Main Features... 1 1.3. Supported Platforms... 2 2. Installation... 3 2.1. Installation on Linux ... 3 2.2. Installation on Solaris... 3 2.3. Installation on MacOS X... 3 2.4. Installation on Windows... 3 3. Getting Started... 4 3.1. Basic Command-Line Options... 4 3.2. Studying Structure of XML Document... 4 4. XmlStarlet Reference ... 7 4.1. Querying XML documents ... 7 4.2. Transfo...
Author:
Walton Shared: 7/30/19
Downloads: 154 Views: 1175
Content
XmlStarlet Command Line XML Toolkit User’s Guide Mikhail Grushinskiy, XmlStarlet Command Line XML Toolkit User’s Guide by Mikhail Grushinskiy, ] [] where is one of: ed (or edit) - Edit/Update XML document(s) sel (or select) - Select data or query XML document(s) (XPATH, etc) tr (or transform) - Transform XML document(s) using XSLT val (or validate) - Validate XML document(s) (well-formed/DTD/XSD/RelaxNG) fo (or format) - Format XML document(s) el (or elements) - Display element structure of XML document c14n (or canonic) - XML canonicalization ls (or list) - List directory as XML esc (or escape) - Escape special XML characters unesc (or unescape) - Unescape special XML characters pyx (or xmln) - Convert XML into PYX format (based on ESIS - ISO 8879) p2x (or depyx) - Convert PYX into XML are: -version - show version -help - show help Wherever file name mentioned in command help it is assumed that URL can be used instead as well. Type: xml -help for command help XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) 3.2. Studying Structure of XML Document Before you do anything with your XML document you probably would like to know its structure at first. ’el’ option could be used for this purpose. Let’s say you have the following XML document (table.xml)
xml el table.xml would produce the following output. xml xml/table xml/table/rec xml/table/rec/numField xml/table/rec/stringField xml/table/rec xml/table/rec/numField xml/table/rec/stringField xml/table/rec xml/table/rec/numField xml/table/rec/stringField Every line in this output is an XPath expression which indicates a ’path’ to elements in XML document. You would use these XPath expressions to navigate through your XML documents in other XmlStarlet options. XML documents can be pretty large but with a very simple structure. (This is espesially true for data driven XML documents ex: XML formatted result of select from SQL table). If you just interested in structure but not order of the elements you can use -u switch combined with ’el’ option. EXAMPLE: xml el -u table.xml Output: xml xml/table xml/table/rec xml/table/rec/numField xml/table/rec/stringField, Chapter 3. Getting Started If you are interested not just in elements of your XML document, but you want to see attributes as well you can use -a switch with ’el’ option. And every line of the output will still be a valid XPath expression. EXAMPLE: xml el -a table.xml Output: xml xml/table xml/table/rec xml/table/rec/@id xml/table/rec/numField xml/table/rec/stringField xml/table/rec xml/table/rec/@id xml/table/rec/numField xml/table/rec/stringField xml/table/rec xml/table/rec/@id xml/table/rec/numField xml/table/rec/stringField If you are looking for attribute values as well use -v switch of ’el’ option. And again - every line of output is a valid XPath expression. EXAMPLE: xml el -v table.xml Output: xml xml/table xml/table/rec[@id=’1’] xml/table/rec/numField xml/table/rec/stringField xml/table/rec[@id=’2’] xml/table/rec/numField xml/table/rec/stringField xml/table/rec[@id=’3’] xml/table/rec/numField xml/table/rec/stringField, {} [ ... ] where - global options for selecting - input XML document file name/uri (stdin is used if missing) - template for querying XML document with following syntax: are: -C or -comp - display generated XSLT -R or -root - print root element -T or -text - output is text (default is XML) -I or -indent - indent output -D or -xml-decl - do not omit xml declaration line -B or -noblanks - remove insignificant spaces from XML tree -N = - predefine namespaces (name without ’xmlns:’) ex: xsql=urn:oracle-xsql Multiple -N options are allowed. -net - allow fetch DTDs or entities over network -help - display help Syntax for templates: -t|-template where -c or -copy-of - print copy of XPATH expression -v or -value-of - print value of XPATH expression -o or -output - output string literal -n or -nl - print new line -f or -inp-name - print input file name (or URL) -m or -match - match XPATH expression -i or -if - check condition -e or -elem - print out element -a or -attr - add attribute -b or -break - break nesting -s or -sort op xpath - sort in order (used after -m) where op is X:Y:Z, X is A - for order="ascending" X is D - for order="descending" Y is N - for data-type="numeric" Y is T - for data-type="text" Z is U - for case-order="upper-first" Z is L - for case-order="lower-first", There can be multiple -match, -copy-of, -value-of, etc options 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" \ -t -m "xpath4" -c "xpath5" is equivalent to applying the following XSLT XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) Current implementation uses libxslt from GNOME codebase as XSLT processor (see http://xmlsoft.org/ for more details) ’select’ option allows you basically avoid writting XSLT stylesheet to perform some queries on XML documents. I.e. various combinations of command line parameters will let you to generate XSLT stylesheet and apply in to XML documents with a single command line. Very often you do not really care what XSLT was created for you ’select’ command, but in those cases when you do; you can always use -C or -comp switch which will let you see exactly which XSLT is applied to your input. ’select’ option supports many EXSLT functions in XPath expressions. Here are few examples which will help to understand how ’xml select’ works: EXAMPLE:, Count elements matching XPath expression: xml sel -t -v "count(/xml/table/rec/numField)" table.xml Input (table.xml):
Output: 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)" - , Ignoring some XSLT stuff to make it brief: - Every -t option is mapped into XSLT template. Options after ’-t’ are mapped into XSLT elements: • -v to • -c to • -e to • -a to • -s to • -m to • -i to • and so on By default subsequent options (for instance: -m) will result in nested corresponding XSLT elements ( for ’-m’). To break this nesting you would have to put ’-b’ or ’-break’ after first ’-m’. Below are few more examples: " | xml sel -t -v "math:abs(-1000)" Result output: " | xml sel -t -m / -e xml -e child -a data -o value Result Output: - SELECT substr(title,1,26) short_title, title, location, skills FROM job WHERE UPPER(title) LIKE ’%ORACLE%’ ORDER BY first_posted DESC Result output SELECT substr(title,1,26) short_title, title, location, skills FROM job WHERE UPPER(title) LIKE ’%ORACLE%’ ORDER BY first_posted DESC, Result Output: a1 a1.a11 a1.a11.a111 a1.a11.a111.a1111 a1.a11.a112 a1.a11.a112.a1121 a1.a12 a1.a13 a1.a13.a131 This example is a good demonstration of nesting control. Here is corresponding XSLT: - , ] {-p|-s =} [ ... ] where - main XSLT stylesheet for transformation - input XML document file name (stdin is used if missing), = - name and value of the parameter passed to XSLT processor -p - parameter is XPATH expression ("’string’" to quote string) -s - parameter is a string literal are: -omit-decl - omit xml declaration -show-ext - show list of extensions -val - allow validate against DTDs or schemas -net - allow fetch DTDs or entities over network -xinclude - do XInclude processing on document input -maxdepth val - increase the maximum depth -html - input document(s) is(are) in HTML format -catalogs - use SGML catalogs from $SGML_CATALOG_FILES otherwise XML catalogs starting from file:///etc/xml/catalog are activated by default XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) Current implementation uses libxslt from GNOME codebase as XSLT processor (see http://xmlsoft.org/ for more details) EXAMPLE: # Transform passing parameters to XSLT stylesheet xml tr xsl/param1.xsl -p Count=’count(/xml/table/rec)’ -s Text="Count=" xml/table.xml Input xsl/params1.xsl Output Count=3, 4.3. Editing XML documents Here is the synopsis for ’xml ed’ command: XMLStarlet Toolkit: Edit XML document(s) Usage: xml ed {} [ ... ] where - global options for editing - input XML document file name/uri (stdin is used if missing) are: -P (or -pf) - preserve original formatting -S (or -ps) - preserve non-significant spaces -O (or -omit-decl) - omit XML declaration () -N = - predefine namespaces (name without ’xmlns:’) ex: xsql=urn:oracle-xsql Multiple -N options are allowed. -N options must be last global options. -help or -h - display help where -d or -delete -i or -insert -t (-type) elem|text|attr -n -v (-value) -a or -append -t (-type) elem|text|attr -n -v (-value) -s or -subnode -t (-type) elem|text|attr -n -v (-value) -m or -move -r or -rename -v -u or -update -v (-value) -x (-expr) (-x is not implemented yet) XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) EXAMPLE: # Delete elements matching XPath expression xml ed -d "/xml/table/rec[@id=’2’]" xml/table.xml Input
Output
’ | xml ed -m "//b" "//a" Output
, 4.4. Validating XML documents Here is synopsis for ’xml val’ command: XMLStarlet Toolkit: Validate XML document(s) Usage: xml val [ ... ] where -w or -well-formed - validate well-formedness only (default) -d or -dtd - validate against DTD -s or -xsd - validate against XSD schema -r or -relaxng - validate against Relax-NG schema -e or -err - print verbose error messages on stderr -b or -list-bad - list only files which do not validate -g or -list-good - list only files which validate -q or -quiet - do not list files (return result code only) NOTE: XML Schemas are not fully supported yet due to its incomplete support in libxml (see http://xmlsoft.org) XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) ] where are -n or -noindent - do not indent -t or -indent-tab - indent output with tabulation -s or -indent-spaces - indent output with spaces -o or -omit-decl - omit xml declaration -R or -recover - try to recover what is parsable -D or -dropdtd - remove the DOCTYPE of the input docs -C or -nocdata - replace cdata section with text nodes -N or -nsclean - remove redundant namespace declarations -e or -encode - output in the given encoding (utf-8, unicode...) -H or -html - input is HTML -h or -help - print help XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/)
foo ... Output: foo ... 4.6. Canonicalization of XML documents Here is synopsis for ’xml c14n’ command: XMLStarlet Toolkit: XML canonicalization Usage: xml c14n [] [] where - input XML document file name (stdin is used if ’-’) - XML file containing XPath expression for c14n XML canonicalization Example: (//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1] - the list of inclusive namespace prefixes (only for exclusive canonicalization) Example: ’n1 n2’ is one of following: -with-comments XML file canonicalization w comments (default) -without-comments XML file canonicalization w/o comments -exc-with-comments Exclusive XML file canonicalization w comments -exc-without-comments Exclusive XML file canonicalization w/o comments XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) Output content ../examples/xml/c14n.xpath, (//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1] Output content 4.7. XML and PYX format Here is synopsis for ’xml pyx’ command: XMLStarlet Toolkit: Convert XML into PYX format (based on ESIS - ISO 8879) Usage: xml pyx {} where - input XML document file name (stdin is used if missing) The PYX format is a line-oriented representation of XML documents that is derived from the SGML ESIS format. (see ESIS - ISO 8879 Element Structure Information Set spec, ISO/IEC JTC1/SC18/WG8 N931 (ESIS)) A non-validating, ESIS generating tool originally developed for pyxie project (see http://pyxie.sourceforge.net/) ESIS Generation by Sean Mc Grath http://www.digitome.com/sean.html XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) Atlas Shrugged Ayn Rand 0525934189 , Output (books -\n (book Atype hardback -\n (title -Atlas Shrugged )title -\n (author -Ayn Rand )author -\n (isbn Aid 1 -0525934189 )isbn -\n )book -\n )books PYX is a line oriented format for XML files which can be helpful (and very efficient) when used in combination with regular line oriented UNIX command such as sed, grep, awk. ’depyx’ option is used for conversion back from PYX into XML. EXAMPLE (Delete all attributes). This should work really fast for very large XML documents. xml pyx input.xml | grep -v "^A" | xml depyx Output Atlas Shrugged Ayn Rand 0525934189 Here is an article which describes how PYX format can be used to grep XML. http://www-106.ibm.com/developerworks/xml/library/x-matters17.html (???), 4.8. Escape/Unescape special XML characters Here is synopsis for ’xml esc’ command: xml esc -help XMLStarlet Toolkit: Escape special XML characters Usage: xml esc [] [] where are -help - print usage (TODO: more to be added in future) if is missing stdin is used instead. XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) Output <a1> <a11> <a111> <a1111/> </a111> <a112> <a1121/> </a112> </a11> <a12/> <a13>, <a131/> </a13> </a1> 4.9. List directory as XML Here is synopsis for ’xml ls’ command: XMLStarlet Toolkit: List directory as XML Usage: xml ls Lists current directory in XML format. XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) , Query Page ... And the following (initially looking correct) query to print all links xml sel -t -m "//a" -c . -n would return nothing. The issue with this query is that it is not addressing element in the right namespace. XPath requires all namespaces used in XPath expression be defined. So for declared namespace in input XML, you have to do same for XPath (or XSLT). There is another important 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, Chapter 5. Common problems Example of deleting namespace declarations. Delete namespace declarations and all elements from non default namespace from the following XML document: Input (file ns2.xml) test xyz Command: xml ed -N N="http://www.c.com/xyz" -d ’//N:*’ ns2.xml | sed -e ’s/ xmlns.*=".*"//g’ Output test 5.2. Special characters Sometimes issues appear with handling of special characters, where ’special’ means in XML sence as well as in ’shell’ terms. Examples below should clear at least some of the confusions. You should not forget about the fact that your command lines are 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 ’EEE ’ | xml sel -t -m /X[@name=’foo’] -v ., Chapter 5. Common problems 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 ’EEE ’ | xml sel -t -m "/X[@name=’foo’]" -v . Another example involves XML special characters. Question: How to search for ' in text nodes? The following should help xml sel -t -m "//line[contains(text(),"’")]" -c . 5.3. Sorting Let’s take a look at XSLT produced by the following ’xml sel’ command: # Query XML document and produce sorted text table xml sel -T -t -m /xml/table/rec -s D:N:- "@id" -v "concat(@id,’|’,numField,’|’,stringField)" -n xml/table.xml - -s option of ’xml sel’ command controls ’order’, ’data-type’, and ’case-order’ attributes of element ., Chapter 5. Common problems 5.4. Validation Many questions are asked about XSD (XML schema) validation. Well, XmlStarlet relies on libxml2 which has incomplete support for XML schemas. Untill it is done in libxml2 it will not be in XmlStarlet.]
Table of Contents
1. Introduction... 1 1.1. About XmlStarlet ... 1 1.2. Main Features... 1 1.3. Supported Platforms... 2 2. Installation... 3 2.1. Installation on Linux ... 3 2.2. Installation on Solaris... 3 2.3. Installation on MacOS X... 3 2.4. Installation on Windows... 3 3. Getting Started... 4 3.1. Basic Command-Line Options... 4 3.2. Studying Structure of XML Document... 4 4. XmlStarlet Reference ... 7 4.1. Querying XML documents ... 7 4.2. Transforming XML documents... 14 4.3. Editing XML documents... 15 4.4. Validating XML documents ... 19 4.5. Formatting XML documents... 20 4.6. Canonicalization of XML documents ... 22 4.7. XML and PYX format ... 24 4.8. Escape/Unescape special XML characters... 25 4.9. List directory as XML... 27 5. Common problems... 28 5.1. Namespaces and default namespace ... 28 5.2. Special characters... 29 5.3. Sorting... 30 5.4. Validation ... 30 iii,Chapter 1. Introduction
1.1. About XmlStarlet XMLStarlet (http://xmlstar.sourceforge.net/) is a set of command line utilities (tools) which can be used to transform, query, validate, and edit XML documents and files using simple set of shell commands in similar way it is done for plain text files using UNIX grep, sed, awk, diff, patch, join, etc commands. This set of command line utilities can be used by those who deal with many XML documents on UNIX shell command prompt as well as for automated XML processing with shell scripts. XMLStarlet command line utility is written in C and uses libxml2 and libxslt from http://xmlsoft.org/. Implementation of extensive choice of options for XMLStarlet utility was only possible because of rich feature set of libxml2 and libxslt (many thanks to the developers of those libraries for great work). ’diff’ and ’patch’ options are not currently implemented. Other features need some work too. Please, send an email to the project administrator (see http://sourceforge.net/projects/xmlstar/) if you wish to help. XMLStarlet is linked statically to both libxml2 and libxslt, so generally all you need to process XML documents is one executable file. To run XmlStarlet utility you can simple type ’xml’ on command line and see list of options available. XMLStarlet is open source freeware under MIT license which allows free use and distribution for both commercial and non-commercial projects. We welcome any user’s feedback on this project which would greatly help us to improve its quality. Comments, suggestions, feature requests, bug reports can be done via SourceForge project web site (see XMLStarlet Sourceforge forums (http://sourceforge.net/forum/?group_id=66612), or XMLStarlet mailing list (http://lists.sourceforge.net/lists/listinfo/xmlstar-devel/)) 1.2. Main Features The toolkit’s feature set includes options to: • Check or validate XML files (simple well-formedness check, DTD, XSD, RelaxNG) • Calculate values of XPath expressions on XML files (such as running sums, etc) • Search XML files for matches to given XPath expressions • Apply XSLT stylesheets to XML documents (including EXSLT support, and passing parameters to stylesheets), Chapter 1. Introduction • Query XML documents (ex. query for value of some elements of attributes, sorting, etc) • Modify or edit XML documents (ex. delete some elements) • Format or "beautify" XML documents (as changing indentation, etc) • Fetch XML documents using http:// or ftp:// URLs • Browse tree structure of XML documents (in similar way to ’ls’ command for directories) • Include one XML document into another using XInclude • XML c14n canonicalization • Escape/unescape special XML characters in input text • Print directory as XML document • Convert XML into PYX format (based on ESIS - ISO 8879), and vice versa 1.3. Supported Platforms Here is a list of platforms on which XmlStarlet is known to work. • Linux • Solaris • Windows • MacOS X • FreeBSD • HP-UX You might be able to compile and make it on others too.,Chapter 2. Installation
2.1. Installation on Linux Execute the following command as root rpm -i xmlstarlet-x.x.x-1.i386.rpm where x.x.x indicates package version. You can use http://rpmfind.net (http://fr2.rpmfind.net/linux/rpm2html/search.php?query=xmlstarlet&system=&arch=) to search for RPM appropriate for your distribution. 2.2. Installation on Solaris Execute the following commands as root gunzip xmlstarlet-x.x.x-sol8-sparc-local.gz pkgadd -d xmlstarlet-x.x.x-sol8-sparc-local all 2.3. Installation on MacOS X XmlStarlet is available on MacOS in Fink. See fink.sourceforge.net (http://fink.sourceforge.net/pdb/package.php/xmlstarlet) 2.4. Installation on Windows Unzip the file xmlstarlet-x.x.x-win32.zip to some directory. To take advantage of UNIX shell scripting you might want to run XmlStarlet from Cygwin. Consider installing Cygwin (http://www.cygwin.com/) on your Windows machine.,Chapter 3. Getting Started
3.1. Basic Command-Line Options Basic command line syntax: bash-2.03$ xml XMLStarlet Toolkit: Command line utilities for XML Usage: xml [Chapter 4. XmlStarlet Reference
4.1. Querying XML documents XmlStarlet ’select’ or ’sel’ option can be used to query or search XML documents. Here is synopsis for ’xml sel’ command: XMLStarlet Toolkit: Select from XML document(s) Usage: xml selEXAMPLE
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 Output:, xml/table.xml 32 xml/tab-obj.xml 41EXAMPLE
Find XML files matching XPath expression (containing ’object’ element) xml sel -t -m //object -f xml/table.xml xml/tab-obj.xml Result output: xml/tab-obj.xmlEXAMPLE
Calculate EXSLT (XSLT extentions) XPath value echo "EXAMPLE
Adding elements and attributes using command line ’xml sel’ echo "EXAMPLE
Query XML document and produce sorted text table xml sel -T -t -m /xml/table/rec -s D:N:- "@id" -v "concat(@id,’|’,numField,’|’,stringField)" -n xml/table.xml, Result Output: 3|-23|stringValue 2|346|Text Value 1|123|String Value Equivalent stylesheetEXAMPLE
Predefine namespaces for XPath expressions xml sel -N xsql=urn:oracle-xsql -t -v /xsql:query xsql/jobserve.xsql Input (xsql/jobserve.xsql) $ cat xsql/jobserve.xsqlEXAMPLE
Print structure of XML element using xml sel (advanced XPath expressions and xml sel command usage) xml sel -T -t -m ’//*’ \ -m ’ancestor-or-self::*’ -v ’name()’ -i ’not(position()=last())’ -o . -b -b -n \ xml/structure.xml Input (xml/structure.xml)EXAMPLE
Print all links of xhtml document xml sel -net -html -T -t -m "//*[local-name()=’a’]" \ -o ’NAME: ’ -v "translate(. , ’ ’, ’ ’)" -n \ -o ’LINK: ’ -v @href -n -n \ http://xmlstar.sourceforge.net/ Sample output NAME: XmlStarlet SourceForge Site LINK: http://sourceforge.net/projects/xmlstar/ NAME: XmlStarlet CVS Source LINK: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xmlstar/ NAME: XmlStarlet on Freshmeat.Net LINK: http://freshmeat.net/projects/xmlstarlet/ NAME: XMLStarlet Sourceforge forums LINK: http://sourceforge.net/forum/?group_id=66612 NAME: XMLStarlet mailing list LINK: http://lists.sourceforge.net/lists/listinfo/xmlstar-devel 4.2. Transforming XML documents Here is synopsis for ’xml tr’ command: XMLStarlet Toolkit: Transform XML document(s) using XSLT Usage: xml tr [EXAMPLE
# Move element node echo ’EXAMPLE
# Rename attributes xml ed -r "//*/@id" -v ID xml/tab-obj.xml Output:EXAMPLE
# Rename elements xml ed -r "/xml/table/rec" -v record xml/tab-obj.xml Output:EXAMPLE
# Update value of an attribute xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 xml/tab-obj.xml Output:EXAMPLE
# Update value of an element xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 xml/tab-obj.xml Output:EXAMPLE
# Validate XML document against DTD xml val -dtd dtd/table.dtd xml/tab-obj.xml >/dev/null 2>&1; echo $? Output:EXAMPLE
# Validate against XSD schema xml val -b -s xsd/table.xsd xml/table.xml xml/tab-obj.xml 2>/dev/null; echo $? Output: xml/tab-obj.xml 4.5. Formatting XML documents Here is synopsis for ’xml fo’ command: XMLStarlet Toolkit: Format XML document, Usage: xml fo [EXAMPLE
# Format XML document disabling indent cat xml/tab-obj.xml | xml fo -noindent Output:EXAMPLE
# Recover malformed XML document xml fo -R xml/malformed.xml 2>/dev/null, Input:EXAMPLE
# XML canonicalization xml c14n -with-comments ../examples/xml/structure.xml ; echo $?, Input ../examples/xml/structure.xmlEXAMPLE
# XML exclusive canonicalization xml c14n -exc-with-comments ../examples/xml/c14n.xml ../examples/xml/c14n.xpath Input ../examples/xml/c14n.xmlEXAMPLE
xml pyx input.xml Input (input.xml)EXAMPLE
# Escape special XML characters cat xml/structure.xml | xml esc InputEXAMPLE
xml ls OutputChapter 5. Common problems
5.1. Namespaces and default namespace One of the commonly asked questions about XmlStarlet ’select’ or ’edit’ options is: "Why nothing matched for my XPath expression which seems right to me?". Common cause of these problems is not properly defining a namespace for XPath. This chapter will show several examples to illustrate these issues you might encounter. For example the following XHTML document has a default namespace declaration15
Similar documents

,TITLE.15229 Page i Wednesday, September 12, 2001 1:12 PM XML Pocket Reference ,TITLE.15229 Page ii Wednesday, September 12, 2001 1:12 PM ,TITLE.15229 Page iii Wednesday, September 12, 2001 1:12 PM XML Pocket Reference Second Edition Robert Eckstein with Michel Casabianca Beijing • Cambridge • Farnh

XMP Custom Panels b bc ADOBE SYSTEMS INCORPORATED Corporate Headquarters 345 Park Avenue San Jose, CA 95110-2704 (408) 536-6000 http://partners.adobe.com September 2003 Copyright 2003 Adobe Systems Incorporated. All rights reserved. NOTICE: All information contained herein is the property of Adobe S

Beginning ASP.NET 1.1 with Visual C#® .NET 2003 Chris Ullman John Kauffman Chris Hart Dave Sussman Daniel Maharry Wiley Publishing, Inc. Beginning ASP.NET 1.1 with Visual C#® .NET 2003 Beginning ASP.NET 1.1 with Visual C#® .NET 2003 Chris Ullman John Kauffman Chris Hart Dave Sussman Daniel Maharry W

OPTIMIZING THE DESKTOP USING SUN™ XVM VIRTUALBOX Ulrich Möller, VirtualBox Software Team Sun BluePrints™ Online Part No 820-7121-10 Revision 1.0, 11/25/08 Sun Microsystems, Inc. Table of Contents Optimizing the Desktop Using Sun™ xVM VirtualBox ..1 Sun xVM VirtualBox and Desktop Virtualization .1 Ea

MICROSOFT WEB SERVICES ENHANCEMENTS 2.0 SP3 RUNTIME END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE IMPORTANT—READ CAREFULLY: This End-User License Agreement (“EULA”) is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation (“Microsoft”) for the Microsof

ProductK009166 DATA Trailer Information Module (TIM G2) Function The Trailer Information Module (TIM G2) is a trailer mounted display for direct reading of diagnostic and trailer related information. It may also be used as a hand held diagnostic tool. It enables access to information available withi

Yammer Starter A concise, enjoyable look at using Yammer, the secure, fun-to-use private social network for your company, now from Microsoft Ralph Roberts BIRMINGHAM - MUMBAI Yammer Starter Copyright © 2012 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a ret

You Taste Like Sugar Count: 64 Wall: 4 Level: Improver Choreographer: Wil Bos – Dec. 2015 Music: "Expandable Time" by Danny Vera (album: Expandable Time) 120 bpm Intro: 16 counts S1: Dorothy x2, Pivot ½ L, ¼ L Chassé 1-2& RF step right forward, LF lock behind, RF step forward 3-4& LF step left forwa

Yii Rapid Application Development Hotsh t Become a RAD hotshot with Yii, the world's most popular PHP framework Lauren J. O'Meara James R. Hamilton III BIRMINGHAM - MUMBAI Yii Rapid Application Development Hotsh t Copyright © 2012 Packt Publishing All rights reserved. No part of this book may be rep

Mark Lauren is a certified Military Physical Training Specialist, Special Op- erations Combat Controller, triathlete, and champion Thai boxer. He has ef- fectively prepared nearly a thousand trainees for the extreme demands of the most elite levels of the Special Operations community. As an experien

The Virevent is both complex and simple to make. Center frequency shift with change in wires diameter, so dimensions cannot be a simple Freq./x.xx equation. There's a mathematical equation that can take wire diameter into account, but the goal of this tutorial is to be simple. Let's use 0.8mm copper

䄀. 䅀䍐䏐䏐䎀䏐䌰. ActiveX 䍀䎰䓰 䏰䐀䏠䑀䍐䐐䐐䎀䏠䏐䌀䎰䏠䌠 ActiveX 䍀䎰䓰 䏰䐀䏠䑀䍐䐐䐐䎀䏠䏐䌀䎰䏠䌠 䈐䏠䍀䍐䐀䍠䌀䏐䎀䍐 䇰䐀䍐䍀䎀䐐䎰䏠䌠䎀䍐 䄠䒰䐀䌀䍠䍐䏐䎀䍐 䏰䐀䎀䍰䏐䌀䐠䍐䎰䓀䏐䏠䐐䐠䎀 䄠䌠䍐䍀䍐䏐䎀䍐 䇠 䎠䏐䎀䌰䍐 䅀䎰䓰 䎠䏠䌰䏠 䏐䌀䏰䎀䐐䌀䏐䌀 䓐䐠䌀 䎠䏐䎀䌰䌀? 䇐䌀䑰䌀䎰䓀䏐䒰䍐 䐠䐀䍐䌐䏠䌠䌀䏐䎀䓰 䈀䌀䌐䏠䐠䌀 䐐 䐐䏠䏰䐀䏠䌠䏠䍀䎀䐠䍐䎰䓀䏐䒰䏀 CD-ROM 䈐䐠䎀䎰䓀 䏰䐀䏠䌰䐀䌀䏀䏀䎀䐀䏠䌠䌀䏐䎀䓰 䇐䍐䎠䏠䐠䏠䐀䒰䍐 䏠䌐䒐䎀䍐 䍰䌀䏀䍐䑰䌀䏐䎀䓰 䉰䌀䐐䐠䓀 I. 䄠䐐䐠䐰䏰䎰䍐䏐䎀䍐 䄰䎰䌀䌠䌀 1 «䆠䏠䏀䏰䏠䏐䍐

O6qecreo c orpaHil.{eHFofi oTBercrBeH4gqTbq (KoHca4rrFroPar fpvnna l,lHlgaqnrr,rp Aapqc: 9441:12. r.9Mcf. v+. Fvnu,eap ApxrrerrgpoBr a,4.,nou,1, l. rqn.8 (381) 248-71-07. flonyvarenu UHH 5507248880 Knn550701 001 p/cver Ne 4070281 0004000009327 OOO (Kf Hnrencnrn> 6anr nonyvarenn 514K 045004816 Cu6rpc

Amazing Sex by Sari Locker A Division of Macmillan General Reference A Pearson Education Macmillan Company 1633 Broadway, New York, NY 10019-6785 Page ii Copyright © 1999 by Sari Locker All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any

Radlagersätze Lenkungsteile Stoßdämpfer Bremssysteme Wheel Bearing Kits Steering and Suspension Parts Shock Absorbers Brake Systems Kits de Roulements de Roues Pièces de Direction et Suspension Amortisseurs Systèmes de Freinage Zestawy łożyskowe do kół Elementy zawieszenia Amortyzatory Systemy hamul

BABOTbr O ffiTIBHI,I HAPOIA, EOJIETIIE BHtrMAHr{,fl METO,4AU PABOT.6I" (PZ nmoa,pa tr934. ao|a') * tr[a aanttootumertbH,oeo cnoea moeapuu+d Mao llae-lyua na II Bcenumaficrou czeade pa- 6ortux u npecrnb&Hctiufr 1engmamoe, cocnxoee- urc.u,ca s e. )Itgilt4euue npoauHyuu lleaucu e rlHldpe 1934 eo?a, lBa

Ta 6Au~a KaAop JiOCmu OC1-l061-lblX Coaep>Kauue npooyKm numaHufl IIep6bte 6;uooa Kl1PHM 490 Xap.,0. ... 9 KapTocpeAbHaJJ 3aneKaHKa c MJJCOM ... 24 CBttHttHa He>KttpHM 355 y xa Vl3 AOCOOI ... 10 TeAJITttHa rrapHM ( ¢l1Ae) 158 Aecepmbt u 6btnettKa MoAO'IHbIH cyn c nep Ml1IUeAhJ0 ... 10 lJbIIIA5!Ta 6po

There is one musical contribution to The Dark Knight Rises that clearly demonstrates the amongst others- Hans sets creative goals for a project higher than you ever thought possible or importance of Hans Zimmer as a creative collaborator. It explains why, eight years ago, as a first practical. He to

The MathWorks MATLAB® and Adobe® Photoshop® Read Me The MATLAB files in this folder create a Photoshop Toolbox in MATLAB. This toolbox creates an easy to use workflow for scientist and researchers using MATLAB and Photoshop in combination. This is a set of MATLAB m files that expand MATLAB functions

И.В. орловская, Л.С. Самсонова, А.И. Скубриева Учебник английского языка ДЛЯ технических университетов и вузов Издание шестое, стереотипное Допущено Учебно-методическим объединением вузов по машиностроительным и приборостроительным специальностям в качестве учебника для студентов технических универс

Министерство образования Республики Беларусь УЧРЕЖДЕНИЕ ОБРАЗОВАНИЯ «ГРОДНЕНСКИЙ ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ ИМЕНИ ЯНКИ КУПАЛЫ» Учебное издание Калита Елена Владимировна Черниговская Анжелика Игоревна ENGLISH GRAMMAR IN PRACTICE Саввова Раиса Николаевна Карпюк Инна Владимировна ПРАКТИЧЕСКАЯ ГРАММАТИ

..: AO . 2. HannreuosaHrre H cfloco6 flpoBeAerrur 3aryrrKrr CocrqsarerbHar 3aKynra Ha npaBo 3aKJrrorreHr{s AoroBopa noAprAa Ha BbrnonHeHr.re pa6or tro peMoHTy KpoBnr.r Ha3IiaHuu TexHr.rqecKr{x cnyx6 c noABiuIoM. 3. CneAenug o rpeAMere AoroBopa (c yrasaHrreM o6rervra BbrnoJrHfleMbrx pa6or), qeHe rr c