├── AUTHORS ├── COPYING ├── ChangeLog ├── Copyright ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README.md ├── TODO ├── aclocal.m4 ├── compile ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.ac ├── depcomp ├── doc ├── doc.mk ├── gen-doc ├── html.css ├── replace-PROG-VERSION.xsl ├── xmlstar-fodoc-style.xsl ├── xmlstarlet-man.xml ├── xmlstarlet-ug.html ├── xmlstarlet-ug.pdf ├── xmlstarlet-ug.ps ├── xmlstarlet-ug.xml ├── xmlstarlet.1 └── xmlstarlet.txt ├── examples ├── N-order ├── bigxml ├── bigxml-dtd ├── bigxml-embed ├── bigxml-embed-ref ├── bigxml-relaxng ├── bigxml-well-formed ├── bigxml-xsd ├── c14n-default-attr ├── c14n-newlines ├── c14n1 ├── c14n2 ├── command-help ├── count1 ├── countnode1 ├── delete1 ├── docbook1 ├── dtd │ ├── bigxml.dtd │ ├── tab-obj.dtd │ └── table.dtd ├── dtd1 ├── dtd2 ├── dtd3 ├── dtd4 ├── ed-2op ├── ed-append ├── ed-backref-delete ├── ed-backref1 ├── ed-backref2 ├── ed-expr ├── ed-insert ├── ed-literal ├── ed-move ├── ed-namespace ├── ed-nop ├── ed-subnode ├── elem-depth ├── elem-uniq ├── elem1 ├── elem2 ├── elem3 ├── escape1 ├── exslt-ed ├── exslt1 ├── external-entity ├── findfile1 ├── foreach-literal.sh ├── foreach-xpath.sh ├── genxml1 ├── hello1 ├── html │ └── hello1.html ├── j2ee │ └── web.xml ├── localname1 ├── look1 ├── move1 ├── noindent1 ├── ns1 ├── pyx ├── pyx-ns ├── rdf │ └── em.rdf ├── recover1 ├── relaxng │ ├── address-bad.xml │ ├── address.rng │ ├── address.xml │ └── bigxml.rng ├── rename-attr1 ├── rename-elem1 ├── results │ ├── N-order.out │ ├── bigxml-dtd.out │ ├── bigxml-embed-ref.out │ ├── bigxml-embed.out │ ├── bigxml-relaxng.out │ ├── bigxml-well-formed.out │ ├── bigxml-xsd.out │ ├── bigxml.out │ ├── c14n-default-attr.out │ ├── c14n-newlines.out │ ├── c14n1.out │ ├── c14n2.out │ ├── command-help.out │ ├── count1.out │ ├── countnode1.out │ ├── delete1.out │ ├── docbook1.out │ ├── dtd1.out │ ├── dtd2.out │ ├── dtd3.out │ ├── dtd4.out │ ├── ed-2op.out │ ├── ed-append.out │ ├── ed-backref-delete.out │ ├── ed-backref1.out │ ├── ed-backref2.out │ ├── ed-expr.out │ ├── ed-insert.out │ ├── ed-literal.out │ ├── ed-move.out │ ├── ed-namespace.out │ ├── ed-nop.out │ ├── ed-subnode.out │ ├── elem-depth.out │ ├── elem-uniq.out │ ├── elem1.out │ ├── elem2.out │ ├── elem3.out │ ├── escape1.out │ ├── exslt-ed.out │ ├── exslt1.out │ ├── external-entity.out │ ├── findfile1.out │ ├── genxml1.out │ ├── hello1.out │ ├── localname1.out │ ├── look1.out │ ├── move1.out │ ├── noindent1.out │ ├── ns1.out │ ├── pyx-ns.out │ ├── pyx.out │ ├── recover1.out │ ├── rename-attr1.out │ ├── rename-elem1.out │ ├── schema1.out │ ├── sel-if.out │ ├── sel-literal.out │ ├── sel-many-values.out │ ├── sel-root.out │ ├── sel-xpath-c.out │ ├── sel-xpath-i.out │ ├── sel-xpath-m.out │ ├── sel-xpath-v.out │ ├── sel1.out │ ├── sort1.out │ ├── sort2.out │ ├── sort3.out │ ├── structure1.out │ ├── sum1.out │ ├── tab1.out │ ├── table1.out │ ├── table2.out │ ├── table3.out │ ├── tree1.out │ ├── unicode1.out │ ├── update-attr1.out │ ├── update-elem1.out │ ├── valid1.out │ ├── xinclude1.out │ ├── xsl-param1.out │ └── xsl-sum1.out ├── schema1 ├── sel-if ├── sel-literal ├── sel-many-values ├── sel-root ├── sel-xpath-c ├── sel-xpath-i ├── sel-xpath-m ├── sel-xpath-v ├── sel1 ├── sgml │ └── docbook1.sgml ├── sort1 ├── sort2 ├── sort3 ├── structure1 ├── sum1 ├── svg │ └── sample.svg ├── tab1 ├── table1 ├── table2 ├── table3 ├── tests.mk ├── tree1 ├── unicode1 ├── update-attr1 ├── update-elem1 ├── valid1 ├── vxml │ └── root.vxml ├── wsdl │ └── quote.wsdl ├── xinclude1 ├── xmi │ └── example.xmi ├── xml │ ├── S0.xml │ ├── books.xml │ ├── c14n-default-attr.xml │ ├── c14n.xml │ ├── c14n.xpath │ ├── disclaimer.xml │ ├── document.xml │ ├── entity.xml │ ├── external-pe.xml │ ├── foo.dtd │ ├── foo.xml │ ├── malformed.xml │ ├── structure.xml │ ├── tab-bad.xml │ ├── tab-obj.xml │ ├── table.xml │ ├── unicode.xml │ ├── unsorted.xml │ ├── xmlstarlet-pad.xml │ └── xmlstarlet-xsa.xml ├── xmlstarlet ├── xmlstarlet.msys ├── xsd │ ├── bigxml.xsd │ └── table.xsd ├── xsl-param1 ├── xsl-sum1 ├── xsl │ ├── cat.xsl │ ├── hello1.xsl │ ├── param1.xsl │ └── sum1.xsl ├── xsp │ └── dynamic.xsp ├── xsql │ └── jobserve.xsql └── xupdate │ └── insxml.xup ├── install-sh ├── m4 ├── quiet-rule.m4 └── xstar-check-libs.m4 ├── missing ├── solaris └── package │ ├── sol8-sparc │ ├── build │ ├── pkginfo │ ├── pkginfo.in │ └── prototype │ └── sol9-sparc │ ├── build │ ├── pkginfo │ ├── pkginfo.in │ └── prototype ├── src ├── c14n-usage.txt ├── depyx-usage.txt ├── edit-usage.txt ├── elem-usage.txt ├── escape-usage.txt ├── escape.h ├── format-usage.txt ├── ls-usage.txt ├── pyx-usage.txt ├── select-usage.txt ├── sources.mk ├── trans-usage.txt ├── trans.c ├── trans.h ├── unescape-usage.txt ├── usage.txt ├── validate-usage.txt ├── xml.c ├── xml_C14N.c ├── xml_depyx.c ├── xml_edit.c ├── xml_elem.c ├── xml_escape.c ├── xml_format.c ├── xml_ls.c ├── xml_pyx.c ├── xml_select.c ├── xml_trans.c ├── xml_validate.c └── xmlstar.h ├── test-driver ├── tests ├── runAllTests.sh └── runTest.sh ├── usage2c.awk ├── version.h ├── xmlstarlet.sln ├── xmlstarlet.spec.in └── xmlstarlet.vcproj /AUTHORS: -------------------------------------------------------------------------------- 1 | Mikhail Grushinskiy 2 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Copyright: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2004 Mikhail Grushinskiy. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Basic Installation 2 | ================== 3 | 4 | These are generic installation instructions. 5 | 6 | The `configure' shell script attempts to guess correct values for 7 | various system-dependent variables used during compilation. It uses 8 | those values to create a `Makefile' in each directory of the package. 9 | It may also create one or more `.h' files containing system-dependent 10 | definitions. Finally, it creates a shell script `config.status' that 11 | you can run in the future to recreate the current configuration, a file 12 | `config.cache' that saves the results of its tests to speed up 13 | reconfiguring, and a file `config.log' containing compiler output 14 | (useful mainly for debugging `configure'). 15 | 16 | If you need to do unusual things to compile the package, please try 17 | to figure out how `configure' could check whether to do them, and mail 18 | diffs or instructions to the address given in the `README' so they can 19 | be considered for the next release. If at some point `config.cache' 20 | contains results you don't want to keep, you may remove or edit it. 21 | 22 | The file `configure.in' is used to create `configure' by a program 23 | called `autoconf'. You only need `configure.in' if you want to change 24 | it or regenerate `configure' using a newer version of `autoconf'. 25 | 26 | The simplest way to compile this package is: 27 | 28 | 1. `cd' to the directory containing the package's source code and type 29 | `./configure' to configure the package for your system. If you're 30 | using `csh' on an old version of System V, you might need to type 31 | `sh ./configure' instead to prevent `csh' from trying to execute 32 | `configure' itself. 33 | 34 | Running `configure' takes awhile. While running, it prints some 35 | messages telling which features it is checking for. 36 | 37 | 2. Type `make' to compile the package. 38 | 39 | 3. Optionally, type `make check' to run any self-tests that come with 40 | the package. 41 | 42 | 4. Type `make install' to install the programs and any data files and 43 | documentation. 44 | 45 | 5. You can remove the program binaries and object files from the 46 | source code directory by typing `make clean'. To also remove the 47 | files that `configure' created (so you can compile the package for 48 | a different kind of computer), type `make distclean'. There is 49 | also a `make maintainer-clean' target, but that is intended mainly 50 | for the package's developers. If you use it, you may have to get 51 | all sorts of other programs in order to regenerate files that came 52 | with the distribution. 53 | 54 | Compilers and Options 55 | ===================== 56 | 57 | Some systems require unusual options for compilation or linking that 58 | the `configure' script does not know about. You can give `configure' 59 | initial values for variables by setting them in the environment. Using 60 | a Bourne-compatible shell, you can do that on the command line like 61 | this: 62 | CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure 63 | 64 | Or on systems that have the `env' program, you can do it like this: 65 | env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure 66 | 67 | Compiling For Multiple Architectures 68 | ==================================== 69 | 70 | You can compile the package for more than one kind of computer at the 71 | same time, by placing the object files for each architecture in their 72 | own directory. To do this, you must use a version of `make' that 73 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 74 | directory where you want the object files and executables to go and run 75 | the `configure' script. `configure' automatically checks for the 76 | source code in the directory that `configure' is in and in `..'. 77 | 78 | If you have to use a `make' that does not supports the `VPATH' 79 | variable, you have to compile the package for one architecture at a time 80 | in the source code directory. After you have installed the package for 81 | one architecture, use `make distclean' before reconfiguring for another 82 | architecture. 83 | 84 | Installation Names 85 | ================== 86 | 87 | By default, `make install' will install the package's files in 88 | `/usr/local/bin', `/usr/local/man', etc. You can specify an 89 | installation prefix other than `/usr/local' by giving `configure' the 90 | option `--prefix=PATH'. 91 | 92 | You can specify separate installation prefixes for 93 | architecture-specific files and architecture-independent files. If you 94 | give `configure' the option `--exec-prefix=PATH', the package will use 95 | PATH as the prefix for installing programs and libraries. 96 | Documentation and other data files will still use the regular prefix. 97 | 98 | In addition, if you use an unusual directory layout you can give 99 | options like `--bindir=PATH' to specify different values for particular 100 | kinds of files. Run `configure --help' for a list of the directories 101 | you can set and what kinds of files go in them. 102 | 103 | If the package supports it, you can cause programs to be installed 104 | with an extra prefix or suffix on their names by giving `configure' the 105 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 106 | 107 | Optional Features 108 | ================= 109 | 110 | Some packages pay attention to `--enable-FEATURE' options to 111 | `configure', where FEATURE indicates an optional part of the package. 112 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 113 | is something like `gnu-as' or `x' (for the X Window System). The 114 | `README' should mention any `--enable-' and `--with-' options that the 115 | package recognizes. 116 | 117 | For packages that use the X Window System, `configure' can usually 118 | find the X include and library files automatically, but if it doesn't, 119 | you can use the `configure' options `--x-includes=DIR' and 120 | `--x-libraries=DIR' to specify their locations. 121 | 122 | Specifying the System Type 123 | ========================== 124 | 125 | There may be some features `configure' can not figure out 126 | automatically, but needs to determine by the type of host the package 127 | will run on. Usually `configure' can figure that out, but if it prints 128 | a message saying it can not guess the host type, give it the 129 | `--host=TYPE' option. TYPE can either be a short name for the system 130 | type, such as `sun4', or a canonical name with three fields: 131 | CPU-COMPANY-SYSTEM 132 | 133 | See the file `config.sub' for the possible values of each field. If 134 | `config.sub' isn't included in this package, then this package doesn't 135 | need to know the host type. 136 | 137 | If you are building compiler tools for cross-compiling, you can also 138 | use the `--target=TYPE' option to select the type of system they will 139 | produce code for and the `--build=TYPE' option to select the type of 140 | system on which you are compiling the package. 141 | 142 | Sharing Defaults 143 | ================ 144 | 145 | If you want to set default values for `configure' scripts to share, 146 | you can create a site shell script called `config.site' that gives 147 | default values for variables like `CC', `cache_file', and `prefix'. 148 | `configure' looks for `PREFIX/share/config.site' if it exists, then 149 | `PREFIX/etc/config.site' if it exists. Or, you can set the 150 | `CONFIG_SITE' environment variable to the location of the site script. 151 | A warning: not all `configure' scripts look for a site script. 152 | 153 | Operation Controls 154 | ================== 155 | 156 | `configure' recognizes the following options to control how it 157 | operates. 158 | 159 | `--cache-file=FILE' 160 | Use and save the results of the tests in FILE instead of 161 | `./config.cache'. Set FILE to `/dev/null' to disable caching, for 162 | debugging `configure'. 163 | 164 | `--help' 165 | Print a summary of the options to `configure', and exit. 166 | 167 | `--quiet' 168 | `--silent' 169 | `-q' 170 | Do not print messages saying which checks are being made. To 171 | suppress all normal output, redirect it to `/dev/null' (any error 172 | messages will still be shown). 173 | 174 | `--srcdir=DIR' 175 | Look for the package's source code in directory DIR. Usually 176 | `configure' can determine that directory automatically. 177 | 178 | `--version' 179 | Print the version of Autoconf used to generate the `configure' 180 | script, and exit. 181 | 182 | `configure' also accepts some other, not widely useful, options. 183 | 184 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = Copyright examples solaris tests 2 | WIN32_DIST = README TODO Copyright COPYING AUTHORS ChangeLog INSTALL NEWS xml.exe 3 | WIN32_doc_DIST = $(generated_docs) doc/html.css 4 | 5 | ACLOCAL_AMFLAGS = -I m4 6 | if GCC 7 | AM_CFLAGS = -Wall -pedantic 8 | endif 9 | 10 | GIT_DESCRIBE = git describe --tags --dirty 11 | 12 | # TODO: figure out why log removal is needed and/or make it completely automatic 13 | dist-hook: 14 | @for log in $(srcdir)/examples/*.log ; do if [ -f "$$log" ] ; then \ 15 | rm $(srcdir)/examples/*.log ; \ 16 | echo 'ERROR: log files need to cleaned BEFORE making tarball, try again'; exit 1 ; fi ; done 17 | @ if [ -d .git ] ; then \ 18 | if [ $(VERSION) != `$(GIT_DESCRIBE)` ] ; then \ 19 | echo 'ERROR: version mismatch, rerun autoconf -f' ; exit 1 ; fi ; \ 20 | $(SED) 's/\[m4_esyscmd_s(\[$(GIT_DESCRIBE)\])\]/[$(VERSION)]/' \ 21 | $(srcdir)/configure.ac > $(distdir)/configure.ac ; fi 22 | 23 | cleantar: 24 | @(rm -f xmlstarlet*.tar.gz) 25 | 26 | rpm: cleantar distdir xmlstarlet.spec 27 | cp xmlstarlet.spec $(distdir) 28 | $(AMTAR) -czf $(distdir).tar.gz $(distdir) 29 | rpmbuild -ta $(distdir).tar.gz 30 | 31 | $(distdir)-win32.zip: $(WIN32_DIST) $(WIN32_doc_DIST) 32 | mkdir -p /tmp/$(distdir)/doc 33 | cp $^ /tmp/$(distdir) 34 | cd /tmp/$(distdir) && mv $(notdir $(WIN32_doc_DIST)) /tmp/$(distdir)/doc 35 | strip /tmp/$(distdir)/xml.exe 36 | cd /tmp && zip -9 --symlinks --recurse-paths --to-crlf --move \ 37 | $(distdir)-win32.zip $(distdir) 38 | mv /tmp/$(distdir)-win32.zip . 39 | 40 | dist-win32: $(distdir)-win32.zip 41 | 42 | version.h: VERSION 43 | @if [ -d .git ] ; then \ 44 | VERSION=`$(GIT_DESCRIBE)`; \ 45 | else VERSION=$(VERSION) ; fi; \ 46 | NEW_VERSION="#define VERSION \"$$VERSION\""; \ 47 | OLD_VERSION=`cat version.h 2>/dev/null` ; \ 48 | if [ "$$NEW_VERSION" != "$$OLD_VERSION" ] ; then \ 49 | echo "$$NEW_VERSION" > version.h ; \ 50 | echo "version.h: $$NEW_VERSION"; fi 51 | VERSION: 52 | 53 | # need to build version.h even if dependency files haven't been 54 | # generated 55 | src/xml.o : version.h 56 | 57 | 58 | 59 | # testing 60 | include examples/tests.mk 61 | 62 | # building executable 63 | bin_PROGRAMS = xml 64 | 65 | include src/sources.mk 66 | xml_SOURCES += version.h 67 | nodist_xml_SOURCES = $(generated_usage_sources) 68 | EXTRA_DIST += $(usage_texts) usage2c.awk 69 | 70 | .txt.c: 71 | $(AM_V_GEN)$(AWK) -f $(srcdir)/usage2c.awk $< > $@ 72 | $(generated_usage_sources) : usage2c.awk 73 | 74 | 75 | # doc 76 | include doc/doc.mk 77 | 78 | man_MANS = $(manpage) 79 | dist_doc_DATA = $(userguide_gen) doc/html.css $(txtguide) 80 | EXTRA_DIST += $(manpage_src) $(userguide_src) $(txtguide_src) 81 | EXTRA_DIST += $(buildfiles_docs) $(manpage) 82 | 83 | 84 | CLEANFILES = version.h $(generated_usage_sources) 85 | MAINTAINERCLEANFILES = $(manpage) $(userguide_gen) $(txtguide) 86 | 87 | .PHONY: cleantar rpm dist-win32 VERSION doc 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > XMLStarlet is a command line XML toolkit which can be used to transform, 2 | query, validate, and edit XML documents and files using simple set of shell 3 | commands in similar way it is done for plain text files using grep/sed/awk/ 4 | tr/diff/patch. 5 | 6 | ### Change Notice 7 | 8 | This project fork from [XMLStarlet 1.6.1](http://xmlstar.sourceforge.net/), and add a very important function(at least for me ^_^ ), 9 | It can insert a complex node element with ed(edit) command. 10 | 11 | Example(add property into hadoop/core-site.xml file): 12 | 13 | ``` 14 | xmlstarlet ed -s /configuration -t elem -n "" -v "hadoop.tmp.dir/usr/hadoop/tmpfs.defaultFShdfs://localhost:9000" hadoop/core-site.xml 15 | ``` 16 | 17 | Old xmlstarlet Result(The value is escaped): 18 | ``` 19 | 20 | 21 | 22 | <><property><name>hadoop.tmp.dir</name><value>/usr/hadoop/tmp</value></property><property><name>fs.defaultFS</name><value>hdfs://localhost:9000</value></property> 23 | ``` 24 | 25 | New xmlstarlet Result(This is what I wanted): 26 | ``` 27 | 28 | 29 | 30 | hadoop.tmp.dir/usr/hadoop/tmpfs.defaultFShdfs://localhost:9000 31 | ``` 32 | 33 | Notice: 34 | 35 | 1.If there is only one node element in value, then can set the name by -n. 36 | Sample(1): 37 | 38 | ``` 39 | xml ed -s /configuration -t elem -n "property" -v "fs.defaultFShdfs://localhost:9000" hadoop/core-site.xml 40 | ``` 41 | 42 | 2.If there are multi node elements in value, must set the name value to "" by -n and set the value with the node name(refer the first example). 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | 1. xml ed option is highly incomplete 2 | 2. How about XUpdate? (see http://www.xmldb.org/) 3 | 3. just do grep TODO src/*.c and you'll figure it out 4 | 4. generate xsd/DTD (best guess) from given XML document 5 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* don't have O_BINARY */ 4 | #undef HAVE_DECL_O_BINARY 5 | 6 | /* have exslt*XpathCtxtRegister() */ 7 | #undef HAVE_EXSLT_XPATH_REGISTER 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_INTTYPES_H 11 | 12 | /* Define to 1 if you have the `lstat' function. */ 13 | #undef HAVE_LSTAT 14 | 15 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and 16 | to 0 otherwise. */ 17 | #undef HAVE_MALLOC 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #undef HAVE_MEMORY_H 21 | 22 | /* Define to 1 if your system has a GNU libc compatible `realloc' function, 23 | and to 0 otherwise. */ 24 | #undef HAVE_REALLOC 25 | 26 | /* Define to 1 if you have the `setmode' function. */ 27 | #undef HAVE_SETMODE 28 | 29 | /* Define to 1 if you have the `stat' function. */ 30 | #undef HAVE_STAT 31 | 32 | /* Define to 1 if you have the header file. */ 33 | #undef HAVE_STDINT_H 34 | 35 | /* Define to 1 if you have the header file. */ 36 | #undef HAVE_STDLIB_H 37 | 38 | /* Define to 1 if you have the header file. */ 39 | #undef HAVE_STRINGS_H 40 | 41 | /* Define to 1 if you have the header file. */ 42 | #undef HAVE_STRING_H 43 | 44 | /* Define to 1 if you have the header file. */ 45 | #undef HAVE_SYS_STAT_H 46 | 47 | /* Define to 1 if you have the header file. */ 48 | #undef HAVE_SYS_TYPES_H 49 | 50 | /* Define to 1 if you have the header file. */ 51 | #undef HAVE_UNISTD_H 52 | 53 | /* Define to 1 if `lstat' dereferences a symlink specified with a trailing 54 | slash. */ 55 | #undef LSTAT_FOLLOWS_SLASHED_SYMLINK 56 | 57 | /* Define to the address where bug reports for this package should be sent. */ 58 | #undef PACKAGE_BUGREPORT 59 | 60 | /* Define to the full name of this package. */ 61 | #undef PACKAGE_NAME 62 | 63 | /* Define to the full name and version of this package. */ 64 | #undef PACKAGE_STRING 65 | 66 | /* Define to the one symbol short name of this package. */ 67 | #undef PACKAGE_TARNAME 68 | 69 | /* Define to the home page for this package. */ 70 | #undef PACKAGE_URL 71 | 72 | /* Define to the version of this package. */ 73 | #undef PACKAGE_VERSION 74 | 75 | /* Define to 1 if you have the ANSI C header files. */ 76 | #undef STDC_HEADERS 77 | 78 | /* Using the Win32 Socket implementation */ 79 | #undef _WINSOCKAPI_ 80 | 81 | /* needed to get lstat declaration in -ansi mode */ 82 | #undef _XOPEN_SOURCE 83 | 84 | /* Define to rpl_malloc if the replacement function should be used. */ 85 | #undef malloc 86 | 87 | /* Define to `int' if does not define. */ 88 | #undef mode_t 89 | 90 | /* Define to rpl_realloc if the replacement function should be used. */ 91 | #undef realloc 92 | 93 | /* Define to `unsigned int' if does not define. */ 94 | #undef size_t 95 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ([2.62]) 2 | AC_INIT([XMLStarlet], [m4_esyscmd_s([git describe --tags --dirty])], 3 | [http://sourceforge.net/projects/xmlstar/support], 4 | [], 5 | [http://xmlstar.sourceforge.net/]) 6 | AC_REVISION(AC_PACKAGE_VERSION) 7 | 8 | AM_INIT_AUTOMAKE([1.11 foreign -Wall subdir-objects no-define std-options parallel-tests color-tests]) 9 | AM_SILENT_RULES([yes]) 10 | AM_MAINTAINER_MODE 11 | 12 | [LIBXML_REQUIRED_VERSION=2.6.27] 13 | [LIBXSLT_REQUIRED_VERSION=1.1.9] 14 | 15 | XSTAR_LIB_ARGS_WITH([LIBXML], [with-src]) 16 | XSTAR_LIB_ARGS_WITH([LIBXSLT], [with-src]) 17 | XSTAR_LIB_ARGS_WITH([LIBICONV]) 18 | 19 | AC_ARG_ENABLE([static-libs], 20 | [AS_HELP_STRING([--enable-static-libs], 21 | [link statically with libxml2 and lib(e)xslt @<:@default=no@:>@])], 22 | [STATIC_LIBS=$enableval], 23 | [STATIC_LIBS=no]) 24 | 25 | AS_IF([test -r doc/xmlstarlet.1], [LACK_DOCS=no], [LACK_DOCS=yes]) 26 | 27 | AC_ARG_ENABLE([build_docs], 28 | [AS_HELP_STRING([--enable-build-docs], 29 | [include rules to build documentation files])], 30 | [], [enable_build_docs=$LACK_DOCS]) 31 | 32 | dnl 33 | dnl Check the environment 34 | dnl 35 | 36 | AC_DEFINE([_XOPEN_SOURCE], [500], [needed to get lstat declaration in -ansi mode]) 37 | 38 | AC_CANONICAL_HOST 39 | AC_PROG_CC 40 | AM_CONDITIONAL([GCC], [test x$GCC = xyes]) 41 | AS_IF([test x$GCC = xyes], [CFLAGS="-ansi $CFLAGS"]) 42 | AM_PROG_CC_C_O 43 | AC_ARG_PROGRAM dnl Transforming Program Names When Installing 44 | AC_PROG_SED 45 | AC_PROG_AWK 46 | 47 | XSTAR_LIB_CHECK([LIBXML], [xml2-config]) 48 | 49 | AS_IF([test "x$LIBXML_SRCDIR" != x], 50 | [LIBXML_INCDIR="$LIBXML_SRCDIR/include"]) 51 | [: ${LIBXML_INCDIR="$LIBXML_PREFIX/include/libxml2"}] 52 | 53 | AS_IF([test "x$STATIC_LIBS" != xno], 54 | [LIBXML_CPPFLAGS="-I$LIBXML_INCDIR -DLIBXML_STATIC"], 55 | [LIBXML_CPPFLAGS="-I$LIBXML_INCDIR"]) 56 | 57 | AS_IF([test "x$STATIC_LIBS" != xno], 58 | [LIBXML_LIBS="$LIBXML_LIBDIR/libxml2.a"], 59 | [LIBXML_LIBS="-lxml2"]) 60 | [LIBXML_LDFLAGS="-L$LIBXML_LIBDIR"] 61 | 62 | 63 | XSTAR_LIB_CHECK([LIBXSLT], [xslt-config]) 64 | 65 | AS_IF([test "x$LIBXSLT_SRCDIR" != x], 66 | [XSLTPROC_PATH="$LIBXSLT_SRCDIR/xsltproc:$PATH" 67 | LIBXSLT_INCDIR="$LIBXSLT_SRCDIR" 68 | LIBXSLT_LDFLAGS="-L$LIBXSLT_SRCDIR/libexslt/.libs -L$LIBXSLT_SRCDIR/libxslt/.libs" 69 | AS_IF([test "x$STATIC_LIBS" != xno], 70 | [LIBXSLT_LIBS="$LIBXSLT_SRCDIR/libexslt/.libs/libexslt.a $LIBXSLT_SRCDIR/libxslt/.libs/libxslt.a"])], 71 | [XSLTPROC_PATH="$PATH" 72 | LIBXSLT_LDFLAGS="-L$LIBXSLT_LIBDIR" 73 | AS_IF([test "x$STATIC_LIBS" != xno], 74 | [LIBXSLT_LIBS="$LIBXSLT_LIBDIR/libexslt.a $LIBXSLT_LIBDIR/libxslt.a"])]) 75 | 76 | AS_IF([test x"$enable_build_docs" = xyes], 77 | [AC_PATH_PROG(XSLTPROC, xsltproc, [none], [$XSLTPROC_PATH]) 78 | AS_IF([test "$XSLTPROC" = none], [AC_MSG_ERROR([xsltproc not found, unable to build documentation])]) 79 | 80 | AC_PATH_PROG(FOP, fop, [none]) 81 | AM_CONDITIONAL([HAVE_FOP], [test x"$FOP" != xnone]) 82 | 83 | AC_PATH_PROG(PDF2PS, pdf2ps, [none]) 84 | AM_CONDITIONAL([HAVE_PDF2PS], [test x"$PDF2PS" != xnone])], 85 | 86 | [# these don't get used when BUILD_DOCS is false but Automake 87 | # will get cranky if we don't set the conditional 88 | AM_CONDITIONAL([HAVE_FOP], [false]) 89 | AM_CONDITIONAL([HAVE_PDF2PS], [false])]) 90 | 91 | AM_CONDITIONAL([BUILD_DOCS], [test x"$enable_build_docs" = xyes]) 92 | 93 | 94 | AS_IF([test "x$STATIC_LIBS" = xno], 95 | [LIBXSLT_LIBS="-lexslt -lxslt"]) 96 | 97 | [: ${LIBXSLT_INCDIR="$LIBXSLT_PREFIX/include"}] 98 | [LIBXSLT_CPPFLAGS="-I$LIBXSLT_INCDIR"] 99 | 100 | 101 | [WIN32_EXTRA_LDFLAGS=] 102 | [WIN32_EXTRA_LIBS=] 103 | 104 | AS_CASE(["${host}"], 105 | [*-hpux*], 106 | [AS_IF([test "x$GCC" != "xyes"], 107 | [CFLAGS="-Ae"])], 108 | [*mingw*], 109 | [WIN32_EXTRA_LIBS='-lwsock32' 110 | AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])]) 111 | 112 | AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK 113 | AC_FUNC_MALLOC 114 | AC_FUNC_REALLOC 115 | AC_TYPE_MODE_T 116 | AC_TYPE_SIZE_T 117 | 118 | # The trick with USER_LIBS allows make LIBS=-lfoo to add rather than 119 | # replace the libraries from ./configure 120 | [USER_LIBS="$LIBS"] 121 | [LIBS=] 122 | # shared libraries link to dependant libraries automatically 123 | AS_IF([test "x$STATIC_LIBS" != xno], 124 | [AC_SEARCH_LIBS([dlopen], [dl], [], [], "$USER_LIBS") 125 | AC_SEARCH_LIBS([sqrt], [m], [], [], "$USER_LIBS") 126 | AC_SEARCH_LIBS([iconv_open], [iconv], [], 127 | [AC_SEARCH_LIBS([libiconv_open], [iconv], [], [], "$USER_LIBS")], "$USER_LIBS") 128 | AC_SEARCH_LIBS([clock_gettime], [rt], [], [], "$USER_LIBS") 129 | AC_SEARCH_LIBS([deflate], [z], [], [], "$USER_LIBS") 130 | AC_SEARCH_LIBS([gcry_cipher_encrypt], [gcrypt], [], [], "$USER_LIBS") 131 | 132 | # Checks for inet libraries: 133 | AC_SEARCH_LIBS([gethostent], [nsl], [], [], "$USER_LIBS") 134 | AC_SEARCH_LIBS([setsockopt], [socket net network], [], [], "$USER_LIBS") 135 | AC_SEARCH_LIBS([connect], [inet], [], [], "$USER_LIBS")]) 136 | 137 | AC_CHECK_FUNCS_ONCE([lstat stat]) 138 | 139 | AC_CHECK_DECL([O_BINARY], [AC_DEFINE([HAVE_DECL_O_BINARY],1,[have O_BINARY])], 140 | [AC_DEFINE([HAVE_DECL_O_BINARY],0,[don't have O_BINARY])], [[ 141 | #include 142 | #include 143 | ]]) 144 | AC_CHECK_FUNCS_ONCE([setmode]) 145 | 146 | # check for exslt*XpathCtxtRegister() functions 147 | [OLD_CPPFLAGS="$CPPFLAGS" 148 | CPPFLAGS="$LIBXSLT_CPPFLAGS $LIBXML_CPPFLAGS $CPPFLAGS"] 149 | AC_CHECK_DECL([exsltDateXpathCtxtRegister], 150 | [AC_DEFINE([HAVE_EXSLT_XPATH_REGISTER],1,[have exslt*XpathCtxtRegister()]) 151 | HAVE_EXSLT_XPATH_REGISTER=1], 152 | [AC_DEFINE([HAVE_EXSLT_XPATH_REGISTER],0,[have exslt*XpathCtxtRegister()]) 153 | HAVE_EXSLT_XPATH_REGISTER=0], 154 | [#include ]) 155 | 156 | AM_CONDITIONAL([HAVE_EXSLT_XPATH_REGISTER], [test $HAVE_EXSLT_XPATH_REGISTER = 1]) 157 | [CPPFLAGS="$OLD_CPPFLAGS"] 158 | 159 | # put warnings about missing docs at the end, so there is a better 160 | # chance of seeing them. 161 | AS_IF([test x$LACK_DOCS = xyes], 162 | [AS_IF([test "$FOP" = none], 163 | [AC_MSG_WARN([fop not installed, unable to build pdf documentation])]) 164 | AS_IF([test "$PDF2PS" = none], 165 | [AC_MSG_WARN([pdf2ps not installed, unable to build postscript documentation])])]) 166 | 167 | # make flags 168 | AC_SUBST([AM_CPPFLAGS], ["$LIBXSLT_CPPFLAGS $LIBXML_CPPFLAGS"]) 169 | AC_SUBST([AM_LDFLAGS], ["$LIBXSLT_LDFLAGS $LIBXML_LDFLAGS"]) 170 | AC_SUBST([LDADD], ["$LIBXSLT_LIBS $LIBXML_LIBS $WIN32_EXTRA_LIBS $LIBS"]) 171 | AC_SUBST([LIBS], ["$USER_LIBS"]) 172 | AC_SUBST([LIBXML_REQUIRED_VERSION]) 173 | AC_SUBST([LIBXSLT_REQUIRED_VERSION]) 174 | 175 | AC_SUBST([SED]) 176 | 177 | np_SILENT_RULE([FOP]) 178 | np_SILENT_RULE([DOCBOOK], [DBOOK]) 179 | 180 | AC_SUBST(PACKAGE_NAME) 181 | AC_SUBST(PACKAGE_TARNAME) 182 | AC_SUBST(PACKAGE_VERSION) 183 | 184 | dnl for the spec file 185 | 186 | AC_CONFIG_HEADERS([config.h]) 187 | AC_CONFIG_FILES([ 188 | xmlstarlet.spec 189 | Makefile 190 | solaris/package/sol8-sparc/pkginfo 191 | solaris/package/sol9-sparc/pkginfo 192 | ]) 193 | AC_OUTPUT 194 | 195 | -------------------------------------------------------------------------------- /doc/doc.mk: -------------------------------------------------------------------------------- 1 | userguide = doc/xmlstarlet-ug 2 | userguide_gen = $(userguide).html 3 | if HAVE_FOP 4 | userguide_gen += $(userguide).pdf 5 | if HAVE_PDF2PS 6 | userguide_gen += $(userguide).ps 7 | endif 8 | endif 9 | userguide_src = $(srcdir)/$(userguide).xml 10 | 11 | txtguide = doc/xmlstarlet.txt 12 | txtguide_src = $(srcdir)/doc/gen-doc 13 | 14 | manpage = doc/xmlstarlet.1 15 | manpage_src = $(srcdir)/doc/xmlstarlet-man.xml 16 | 17 | generated_docs = $(userguide_gen) $(txtguide) $(manpage) 18 | buildfiles_docs = $(srcdir)/doc/replace-PROG-VERSION.xsl $(srcdir)/doc/xmlstar-fodoc-style.xsl 19 | 20 | DOCBOOK_PARAMS = \ 21 | --param section.autolabel 1 \ 22 | --stringparam generate.toc 'book toc,title' 23 | 24 | EDIT_XML = $(XSLTPROC) \ 25 | --stringparam VERSION '$(VERSION)' \ 26 | --stringparam PROG "`echo xml | $(SED) '$(program_transform_name)'`" \ 27 | $(srcdir)/doc/replace-PROG-VERSION.xsl 28 | 29 | if BUILD_DOCS 30 | 31 | .xml.html: 32 | $(V_DOCBOOK)$(EDIT_XML) $< | $(XSLTPROC) $(DOCBOOK_PARAMS) \ 33 | --stringparam html.stylesheet html.css \ 34 | http://docbook.sourceforge.net/release/xsl-ns/current/html/docbook.xsl \ 35 | - > $@ 36 | 37 | .xml.fo: 38 | $(V_DOCBOOK)$(EDIT_XML) $< | $(XSLTPROC) $(DOCBOOK_PARAMS) $(srcdir)/doc/xmlstar-fodoc-style.xsl - > $@ 39 | 40 | if HAVE_FOP 41 | .fo.pdf: 42 | $(V_FOP)$(FOP) -q $< $@ 43 | endif 44 | if HAVE_PDF2PS 45 | .pdf.ps: 46 | $(AM_V_GEN)$(PDF2PS) $< $@ 47 | endif 48 | 49 | $(userguide).html : $(userguide_src) 50 | 51 | $(manpage): $(manpage_src) 52 | $(V_DOCBOOK)$(EDIT_XML) $< | $(XSLTPROC) -o $@ \ 53 | http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl \ 54 | - 55 | 56 | $(txtguide): $(txtguide_src) $(usage_texts) 57 | $(AM_V_GEN)srcdir=$(srcdir) SED=$(SED) transform='$(program_transform_name)' $< ./xml > $@ 58 | 59 | clean-doc: 60 | rm -f $(generated_docs) 61 | 62 | endif BUILD_DOCS 63 | 64 | # NOTE: if put inside "if BUILD_DOCS" automake issues a warning 65 | .PHONY: clean-doc 66 | -------------------------------------------------------------------------------- /doc/gen-doc: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | : "${SED=sed}" 4 | XMLSTARLET=$1 5 | STAR_NAME=`echo xml | ${SED} "$transform"` 6 | 7 | { 8 | echo "" 9 | echo "" 10 | echo " XMLSTARLET USER'S GUIDE" 11 | echo "" 12 | echo " see also http://xmlstar.sourceforge.net/" 13 | echo "" 14 | echo "" 15 | 16 | echo "" 17 | echo "" 18 | echo "1. BASIC COMMAND LINE OPTIONS" 19 | echo "====================================================" 20 | echo "" 21 | echo "$STAR_NAME --help" 22 | $SED '/^#/d' src/usage.txt 23 | 24 | echo "" 25 | echo "" 26 | echo "" 27 | echo "2. Select/Query XML documents" 28 | echo "====================================================" 29 | echo "" 30 | echo "$STAR_NAME sel --help" 31 | $SED '/^#/d' src/select-usage.txt 32 | 33 | echo "" 34 | echo "" 35 | echo "" 36 | echo "3. Editing XML documents" 37 | echo "====================================================" 38 | echo "" 39 | echo "$STAR_NAME ed --help" 40 | $SED '/^#/d' src/edit-usage.txt 41 | 42 | echo "" 43 | echo "" 44 | echo "" 45 | echo "4. Using XSLT to transform XML documents" 46 | echo "====================================================" 47 | echo "" 48 | echo "$STAR_NAME tr --help" 49 | $SED '/^#/d' src/trans-usage.txt 50 | 51 | echo "" 52 | echo "" 53 | echo "" 54 | echo "5. Formatting XML documents" 55 | echo "====================================================" 56 | echo "" 57 | echo "$STAR_NAME fo --help" 58 | $SED '/^#/d' src/format-usage.txt 59 | 60 | echo "" 61 | echo "" 62 | echo "" 63 | echo "6. Validating XML documents" 64 | echo "====================================================" 65 | echo "" 66 | echo "$STAR_NAME val --help" 67 | $SED '/^#/d' src/validate-usage.txt 68 | 69 | echo "" 70 | echo "" 71 | echo "" 72 | echo "7. Displaying structure of XML documents" 73 | echo "====================================================" 74 | echo "" 75 | echo "$STAR_NAME el --help" 76 | $SED '/^#/d' src/elem-usage.txt 77 | 78 | echo "" 79 | echo "" 80 | echo "" 81 | echo "" 82 | echo "8. Escape/Unescape special XML characters" 83 | echo "====================================================" 84 | echo "" 85 | echo "$STAR_NAME esc --help" 86 | $SED '/^#/d' src/escape-usage.txt 87 | 88 | echo "" 89 | echo "" 90 | echo "" 91 | echo "" 92 | echo "9. List directory as XML" 93 | echo "====================================================" 94 | echo "" 95 | echo "$STAR_NAME ls --help" 96 | $SED '/^#/d' src/ls-usage.txt 97 | 98 | echo "" 99 | echo "" 100 | echo "" 101 | echo "" 102 | echo "10. XML canonicalization" 103 | echo "====================================================" 104 | echo "" 105 | echo "$STAR_NAME c14n --help" 106 | $SED '/^#/d' src/c14n-usage.txt 107 | 108 | echo "" 109 | echo "" 110 | echo "" 111 | echo "" 112 | echo "11. Convert XML into PYX format (based on ESIS - ISO 8879)" 113 | echo "====================================================" 114 | echo "" 115 | echo "$STAR_NAME pyx --help" 116 | $SED '/^#/d' src/pyx-usage.txt 117 | 118 | echo "" 119 | echo "" 120 | echo "" 121 | echo "" 122 | echo "12. Examples:" 123 | echo "====================================================" 124 | echo "" 125 | echo "Input1" 126 | echo "examples/xml/table.xml" 127 | echo "" 128 | cat "$srcdir"/examples/xml/table.xml 129 | echo "" 130 | echo "" 131 | echo "Input2" 132 | echo "examples/xml/tab-obj.xml" 133 | echo "" 134 | cat "$srcdir"/examples/xml/tab-obj.xml 135 | echo "" 136 | echo "" 137 | echo "Input3" 138 | echo "examples/html/hello1.html" 139 | echo "" 140 | cat "$srcdir"/examples/html/hello1.html 141 | echo "" 142 | echo "" 143 | echo "Input4" 144 | echo "examples/sgml/docbook1.sgml" 145 | echo "" 146 | cat "$srcdir"/examples/sgml/docbook1.sgml 147 | echo "" 148 | echo "" 149 | echo "Stylesheet1" 150 | echo "examples/xsl/sum1.xsl" 151 | echo "" 152 | cat "$srcdir"/examples/xsl/sum1.xsl 153 | echo "" 154 | echo "" 155 | echo "Stylesheet2" 156 | echo "examples/xsl/hello1.xsl" 157 | echo "" 158 | cat "$srcdir"/examples/xsl/hello1.xsl 159 | echo "" 160 | echo "" 161 | echo "Stylesheet3" 162 | echo "examples/xsl/param1.xsl" 163 | echo "" 164 | cat "$srcdir"/examples/xsl/param1.xsl 165 | echo "" 166 | echo "" 167 | 168 | echo "" 169 | 170 | for eg in "$srcdir"/examples/*[0-9] 171 | do 172 | if [ -x "$eg" ] 173 | then 174 | echo "Command:" 175 | sed -e '/^#!/d' "$eg" 176 | echo "Result Output:" 177 | cat "$srcdir"/examples/results/`basename $eg`.out 178 | echo "" 179 | echo "" 180 | fi 181 | done 182 | 183 | echo "" 184 | } | $SED -e "s:\./xmlstarlet:$STAR_NAME:g; s:PROG:$STAR_NAME:g" 185 | 186 | 187 | -------------------------------------------------------------------------------- /doc/html.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #FFFFFF; 3 | } 4 | 5 | h1, h2, h3, h4, h5 { 6 | color: #800000; 7 | font-family: sans-serif; 8 | } 9 | 10 | span.term { 11 | font-weight: bold; 12 | } 13 | 14 | div.sidebar { 15 | background: #F0F0F0; 16 | border: 1px solid gray; 17 | padding: 5px; 18 | margin: 20px; 19 | } 20 | 21 | pre.programlisting { 22 | background: #F0F0F0; 23 | border: 1px solid gray; 24 | padding: 2px; 25 | font-size: 10pt; 26 | white-space: pre; 27 | } 28 | -------------------------------------------------------------------------------- /doc/replace-PROG-VERSION.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/xmlstar-fodoc-style.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | bold 12 | normal 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /doc/xmlstarlet-man.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 2012 8 | 9 | 10 | 11 | Mikhail 12 | Grushinskiy 13 | 14 | XMLStarlet creator. 15 | 16 | 17 | Version 18 | 19 | 20 | 21 | xmlstarlet 22 | 1 23 | XMLStarlet Manual 24 | 25 | 26 | 27 | xmlstarlet 28 | 29 | command line XML/XSLT toolkit 30 | 31 | 32 | 33 | 34 | 35 | options 36 | command 37 | cmd-options 38 | 39 | 40 | 41 | 42 | Introduction 43 | 44 | XMLStarlet is a set of command line utilities (tools) which can be 45 | used to transform, query, validate, and edit XML documents and files using 46 | simple set of shell commands in similar way it is done for plain text 47 | files using UNIX grep, sed, awk, diff, patch, join, etc commands. This set 48 | of command line utilities can be used by those who deal with many XML 49 | documents on UNIX shell command prompt as well as for automated XML 50 | processing with shell scripts. 51 | 52 | 53 | 54 | Options 55 | 56 | 57 | 58 | 59 | 60 | 61 | Display the version of 62 | xmlstarlet. 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | Display help. 71 | 72 | 73 | 74 | 75 | 76 | 77 | Commands 78 | 79 | 80 | command 81 | for command specific help 82 | 83 | Available commands include: 84 | 85 | 86 | 87 | 88 | 89 | 90 | Edit/update XML document(s). 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | Select data or query XML document(s) (XPATH, 99 | etc). 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | Transform XML documents(s) using XSLT. 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | Validate XML document(s) 116 | (well-formed/DTD/XSD/RelaxNG). 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | Format XML document(s). 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | Display element structure of XML document. 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | XML canonicalization. 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | List directory as XML. 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | Escape special XML characters. 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | Unescape special XML characters. 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | Convert XML into PYX format (based on ESIS - ISO 173 | 8879). 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Convert PYX into XML. 182 | 183 | 184 | 185 | 186 | 187 | 188 | References 189 | 190 | XMLStarlet is a command line toolkit to query/edit/check/transform 191 | XML documents (for more information see 192 | http://xmlstar.sourceforge.net/). 193 | 194 | 195 | 196 | Bugs 197 | Report bugs to the mailing list, 198 | xmlstar-devel@lists.sourceforge.net or the bug tracker: . 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /doc/xmlstarlet-ug.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishjam/xmlstarlet/a9ab520db89d68c812ed38fc605c7e2b34265e05/doc/xmlstarlet-ug.html -------------------------------------------------------------------------------- /doc/xmlstarlet-ug.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishjam/xmlstarlet/a9ab520db89d68c812ed38fc605c7e2b34265e05/doc/xmlstarlet-ug.pdf -------------------------------------------------------------------------------- /doc/xmlstarlet.1: -------------------------------------------------------------------------------- 1 | '\" t 2 | .\" Title: xmlstarlet 3 | .\" Author: Mikhail Grushinskiy 4 | .\" Generator: DocBook XSL-NS Stylesheets v1.76.1 5 | .\" Date: 08/26/2012 6 | .\" Manual: XMLStarlet Manual 7 | .\" Source: Version 1.4.0 8 | .\" Language: English 9 | .\" 10 | .TH "XMLSTARLET" "1" "08/26/2012" "Version 1.4.0" "XMLStarlet Manual" 11 | .\" ----------------------------------------------------------------- 12 | .\" * Define some portability stuff 13 | .\" ----------------------------------------------------------------- 14 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | .\" http://bugs.debian.org/507673 16 | .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html 17 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | .ie \n(.g .ds Aq \(aq 19 | .el .ds Aq ' 20 | .\" ----------------------------------------------------------------- 21 | .\" * set default formatting 22 | .\" ----------------------------------------------------------------- 23 | .\" disable hyphenation 24 | .nh 25 | .\" disable justification (adjust text to left margin only) 26 | .ad l 27 | .\" ----------------------------------------------------------------- 28 | .\" * MAIN CONTENT STARTS HERE * 29 | .\" ----------------------------------------------------------------- 30 | .SH "NAME" 31 | xmlstarlet \- command line XML/XSLT toolkit 32 | .SH "SYNOPSIS" 33 | .HP \w'\fBxml\fR\ 'u 34 | \fBxml\fR [\fIoptions\fR...] {\fIcommand\fR} [\fIcmd\-options\fR...] 35 | .SH "INTRODUCTION" 36 | .PP 37 | XMLStarlet 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\&. 38 | .SH "OPTIONS" 39 | .PP 40 | \fB\-\-version\fR 41 | .RS 4 42 | Display the version of 43 | xmlstarlet\&. 44 | .RE 45 | .PP 46 | \fB\-\-help\fR 47 | .RS 4 48 | Display help\&. 49 | .RE 50 | .SH "COMMANDS" 51 | .PP 52 | \fBxml\fR 53 | \fIcommand\fR 54 | \fB\-\-help\fR 55 | for command specific help 56 | .PP 57 | Available commands include: 58 | .PP 59 | \fBed (or edit)\fR 60 | .RS 4 61 | Edit/update XML document(s)\&. 62 | .RE 63 | .PP 64 | \fBsel (or select)\fR 65 | .RS 4 66 | Select data or query XML document(s) (XPATH, etc)\&. 67 | .RE 68 | .PP 69 | \fBtr (or transform)\fR 70 | .RS 4 71 | Transform XML documents(s) using XSLT\&. 72 | .RE 73 | .PP 74 | \fBval (or validate)\fR 75 | .RS 4 76 | Validate XML document(s) (well\-formed/DTD/XSD/RelaxNG)\&. 77 | .RE 78 | .PP 79 | \fBfo (or format)\fR 80 | .RS 4 81 | Format XML document(s)\&. 82 | .RE 83 | .PP 84 | \fBel (or elements)\fR 85 | .RS 4 86 | Display element structure of XML document\&. 87 | .RE 88 | .PP 89 | \fBc14n (or canonic)\fR 90 | .RS 4 91 | XML canonicalization\&. 92 | .RE 93 | .PP 94 | \fBls (or list)\fR 95 | .RS 4 96 | List directory as XML\&. 97 | .RE 98 | .PP 99 | \fBesc (or escape)\fR 100 | .RS 4 101 | Escape special XML characters\&. 102 | .RE 103 | .PP 104 | \fBunesc (or unescape)\fR 105 | .RS 4 106 | Unescape special XML characters\&. 107 | .RE 108 | .PP 109 | \fBpyx (or xmln)\fR 110 | .RS 4 111 | Convert XML into PYX format (based on ESIS \- ISO 8879)\&. 112 | .RE 113 | .PP 114 | \fBp2x (or depyx)\fR 115 | .RS 4 116 | Convert PYX into XML\&. 117 | .RE 118 | .SH "REFERENCES" 119 | .PP 120 | XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar\&.sourceforge\&.net/)\&. 121 | .SH "BUGS" 122 | .PP 123 | Report bugs to the mailing list, 124 | xmlstar\-devel@lists\&.sourceforge\&.net 125 | or the bug tracker: 126 | \m[blue]\fB\%http://sourceforge.net/tracker/?group_id=66612&atid=515106\fR\m[]\&. 127 | .SH "AUTHOR" 128 | .PP 129 | \fBMikhail Grushinskiy\fR 130 | .RS 4 131 | XMLStarlet creator\&. 132 | .RE 133 | .SH "COPYRIGHT" 134 | .br 135 | Copyright \(co 2012 136 | .br 137 | -------------------------------------------------------------------------------- /doc/xmlstarlet.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishjam/xmlstarlet/a9ab520db89d68c812ed38fc605c7e2b34265e05/doc/xmlstarlet.txt -------------------------------------------------------------------------------- /examples/N-order: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # make sure -N after other option is allowed 3 | ./xmlstarlet sel -T -N n=n -t -v /n:x xml/foo.xml 2>&1 >/dev/null 4 | ./xmlstarlet ed -P -N n=n -d /n:x xml/foo.xml 2>&1 >/dev/null 5 | -------------------------------------------------------------------------------- /examples/bigxml: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # check error messages on lines past 2^16 3 | 4 | SEDLINUM_PROG='s/^\([^:][^:]*:[0-9]\{4\}\)[0-9]\.[0-9][0-9]*:.*$/\1x/p' 5 | 6 | xmldoc() 7 | { 8 | BAD="$1" 9 | DOCTYPE="$2" 10 | 11 | echo '' 12 | [ -n "$DOCTYPE" ] && echo "$DOCTYPE" 13 | echo '' 14 | ${AWK:-awk} 'BEGIN{for(i=0; i < 69999; i++) print ""}' < /dev/null 15 | echo "$BAD" 16 | echo '' 17 | } 18 | -------------------------------------------------------------------------------- /examples/bigxml-dtd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . ./bigxml 3 | xmldoc 'foo' \ 4 | | ./xmlstarlet val --dtd dtd/bigxml.dtd --err - 2>&1 >/dev/null \ 5 | | ${SED:-sed} -n "$SEDLINUM_PROG" 6 | -------------------------------------------------------------------------------- /examples/bigxml-embed: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . ./bigxml 3 | xmldoc ' foo ' \ 4 | ' ]>' \ 5 | | ./xmlstarlet val --embed --err - \ 6 | 2>&1 >/dev/null | ${SED:-sed} -n "$SEDLINUM_PROG" 7 | -------------------------------------------------------------------------------- /examples/bigxml-embed-ref: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . ./bigxml 3 | xmldoc 'foo' '' \ 4 | | ./xmlstarlet val --embed --err - 2>&1 >/dev/null \ 5 | | ${SED:-sed} -n "$SEDLINUM_PROG" \ 6 | | head -n 1 # a bug in libxml 2.9.0 causes extra errors to be 7 | # printed, so we take just the first 8 | -------------------------------------------------------------------------------- /examples/bigxml-relaxng: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . ./bigxml 3 | xmldoc ' foo ' | ./xmlstarlet val --relaxng relaxng/bigxml.rng --err - \ 4 | 2>&1 >/dev/null | ${SED:-sed} -n "$SEDLINUM_PROG" 5 | -------------------------------------------------------------------------------- /examples/bigxml-well-formed: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . ./bigxml 3 | xmldoc '' | ./xmlstarlet val --well-formed --err - \ 4 | 2>&1 >/dev/null | ${SED:-sed} -n "$SEDLINUM_PROG" 5 | -------------------------------------------------------------------------------- /examples/bigxml-xsd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . ./bigxml 3 | xmldoc '' | ./xmlstarlet val --xsd xsd/bigxml.xsd --err - \ 4 | 2>&1 >/dev/null | ${SED:-sed} -n "$SEDLINUM_PROG" 5 | -------------------------------------------------------------------------------- /examples/c14n-default-attr: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet c14n xml/c14n-default-attr.xml 3 | -------------------------------------------------------------------------------- /examples/c14n-newlines: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet c14n xml/c14n.xml | tr '\r' R | grep R 3 | -------------------------------------------------------------------------------- /examples/c14n1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # XML canonicalization 3 | ./xmlstarlet c14n --with-comments ../examples/xml/structure.xml ; echo $? 4 | -------------------------------------------------------------------------------- /examples/c14n2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # XML exclusive canonicalization 3 | ./xmlstarlet c14n --exc-with-comments ../examples/xml/c14n.xml ../examples/xml/c14n.xpath 4 | -------------------------------------------------------------------------------- /examples/command-help: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -n "$EXEEXT" ] && [ "$OSTYPE" = MSYS ] ; then 4 | EXEEXT=.exe 5 | fi 6 | 7 | for command in ed sel tr val fo el c14n ls esc unesc pyx p2x ; do 8 | ./xmlstarlet $command --help | ${SED:-sed} -n \ 9 | "s@^\\(Usage: \\).*xml$EXEEXT\\( $command\\).*@\\1xml\\2@p" 10 | done 11 | -------------------------------------------------------------------------------- /examples/count1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Count elements matching XPath expression 3 | ./xmlstarlet sel -T -t -v "count(/xml/table/rec/numField)" xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/countnode1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Count all nodes in XML document 3 | ./xmlstarlet sel -T -t -f -o " " -v "count(//node())" --nl xml/table.xml xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/delete1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Delete elements matching XPath expression 3 | ./xmlstarlet ed -d '/xml/table/rec[@id="2"]' xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/docbook1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Generate HTML from given SGML docbook document 3 | ./xmlstarlet tr --omit-decl --docbook /usr/share/sgml/docbook/yelp/docbook/html/docbook.xsl sgml/docbook1.sgml | \ 4 | ./xmlstarlet fo --html --indent-spaces 2 5 | -------------------------------------------------------------------------------- /examples/dtd/bigxml.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /examples/dtd/tab-obj.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/dtd/table.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/dtd1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Validate XML document against DTD 3 | ./xmlstarlet val --dtd dtd/table.dtd xml/tab-obj.xml >/dev/null 2>&1; echo $? 4 | -------------------------------------------------------------------------------- /examples/dtd2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Validate XML document against DTD 3 | ./xmlstarlet val --dtd dtd/table.dtd xml/table.xml >/dev/null 2>&1; echo $? 4 | -------------------------------------------------------------------------------- /examples/dtd3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Validate XML document against DTD 3 | ./xmlstarlet val --dtd xml/foo.dtd xml/foo.xml 2>/dev/null 4 | -------------------------------------------------------------------------------- /examples/dtd4: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # make sure we don't look for embedded dtd if not asked 3 | ./xmlstarlet val --dtd dtd/table.dtd xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/ed-2op: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed -a '/xml/table/rec[@id=1]' -t elem -n newrec -v value -d '/xml/table/rec[@id!=1]' xml/table.xml 3 | -------------------------------------------------------------------------------- /examples/ed-append: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed -a '/xml/table/rec[@id=1]' -t elem -n newrec -v value xml/table.xml 3 | -------------------------------------------------------------------------------- /examples/ed-backref-delete: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed \ 3 | -s /xml/table/rec -t elem -n new-field -v new-value \ 4 | -d '$prev' \ 5 | -i '$prev' -t attr -n new-attr -v new-attr-value \ 6 | xml/table.xml 7 | -------------------------------------------------------------------------------- /examples/ed-backref1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed \ 3 | -s /xml/table/rec -t elem -n new-field -v new-value \ 4 | -i '$prev' -t attr -n new-attr -v new-attr-value \ 5 | xml/table.xml 6 | -------------------------------------------------------------------------------- /examples/ed-backref2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #./xmlstarlet ed \ 3 | -s /xml/table/rec -t elem -n new-field -v new-value \ 4 | --var new-field '$prev' \ 5 | -i '$new-field' -t attr -n new-attr -v new-attr-value \ 6 | -s '$new-field' -t elem -n new-subelem -v '' \ 7 | xml/table.xml | ./xmlstarlet c14n 8 | 9 | ./xmlstarlet ed -s /xml/table/rec -t elem -n "" \ 10 | -v 'new-value' \ 11 | xml/table.xml | ./xmlstarlet c14n 12 | -------------------------------------------------------------------------------- /examples/ed-expr: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed \ 3 | -u /xml/table/rec/@id -x .+1 \ 4 | -a /xml/table -t elem -n highest-record -v '' \ 5 | -u '$xstar:prev' -x '/xml/table/rec[numField=math:max(../rec/numField)]' \ 6 | xml/table.xml 7 | -------------------------------------------------------------------------------- /examples/ed-insert: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed -i '/xml/table/rec[@id=1]' -t attr -n first -v yes xml/table.xml 3 | # insert empty element 4 | ./xmlstarlet ed -i '/foo' -t elem -n first -v "" xml/entity.xml -------------------------------------------------------------------------------- /examples/ed-literal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed -u /doc -v '"<>& " & < >' xml/foo.xml 3 | -------------------------------------------------------------------------------- /examples/ed-move: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed -m '/xml/table/rec[@id=1]/@id' '/xml/table' xml/table.xml 3 | -------------------------------------------------------------------------------- /examples/ed-namespace: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed -d "//namespace::xsi" xml/S0.xml 3 | -------------------------------------------------------------------------------- /examples/ed-nop: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # libxml2 returns a NULL nodeset instead of an empty nodeset for this 3 | # xpath expression 4 | ./xmlstarlet ed -S -N n=nn -d /n:doc/foo xml/foo.xml 5 | -------------------------------------------------------------------------------- /examples/ed-subnode: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet ed -s '/xml/table/rec[@id=1]' -t elem -n newrec -v value xml/table.xml 3 | -------------------------------------------------------------------------------- /examples/elem-depth: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # display unique elements up to depth 2 3 | ./xmlstarlet el -d2 ./xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/elem-uniq: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # display unique elements 3 | ./xmlstarlet el -u ./xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/elem1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Display element structure of XML document 3 | ./xmlstarlet el ./xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/elem2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Display element structure of XML document (including attributes) 3 | ./xmlstarlet el -a ./xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/elem3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Display element structure of XML document (including attribute values) 3 | ./xmlstarlet el -v ./xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/escape1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Escape special XML characters 3 | cat xml/structure.xml | ./xmlstarlet esc 4 | -------------------------------------------------------------------------------- /examples/exslt-ed: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Use EXSLT functions 3 | echo '' | ./xmlstarlet ed -O -u /x -x 'date:day-name("2011-09-24")' 4 | echo '' | ./xmlstarlet ed -O -u /x -x 'math:abs(-1000)' 5 | echo 'aba' | ./xmlstarlet ed -O -u /x -x 'count(set:distinct(/x/*))' 6 | -------------------------------------------------------------------------------- /examples/exslt1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Calculate EXSLT (XSLT extentions) XPath value 3 | echo "" | ./xmlstarlet sel -T -t -v "math:abs(-1000)" --nl 4 | -------------------------------------------------------------------------------- /examples/external-entity: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet sel -t -c //foo xml/external-pe.xml | ./xmlstarlet c14n 3 | echo 4 | ./xmlstarlet sel -T -t -v //foo --nl xml/external-pe.xml 5 | -------------------------------------------------------------------------------- /examples/findfile1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Find XML files matching XPath expression (containing 'object' element) 3 | ./xmlstarlet sel -T -t -m //object -f --nl xml/table.xml xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/foreach-literal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | the_test abc 3 | the_test "a'c" 4 | the_test 'a"c' 5 | the_test a\'\"c 6 | the_test \"\'a\'b\"\" 7 | the_test '!@#$%^&*()_+-=~`\|'\''";:/?.>,<[]{}' 8 | the_test ']]>' 9 | -------------------------------------------------------------------------------- /examples/foreach-xpath.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | the_test "'abc'" 3 | the_test \"a\'c\" 4 | the_test \'a\"c\' 5 | the_test 'concat("a'\''", '\'\"c\'\) 6 | the_test 'concat('\'\"\',\ \"\'a\'b\",\ \'\"\"\'\) 7 | the_test 'concat("!@#$%^&*()_+-=~`\|'\'\",\''";:/?.>,<[]{}'\'\) 8 | the_test '"]]>"' 9 | -------------------------------------------------------------------------------- /examples/genxml1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Generate XML document using command line xml sel 3 | echo "" | ./xmlstarlet sel -t -m / -e xml -e child -a data -o value | ./xmlstarlet c14n 4 | echo 5 | -------------------------------------------------------------------------------- /examples/hello1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Apply XSLT stylesheet to HTML input file 3 | ./xmlstarlet tr --html xsl/hello1.xsl html/hello1.html 4 | -------------------------------------------------------------------------------- /examples/html/hello1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello World 4 | 5 | 6 | 7 |
Hello World!
8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/j2ee/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TestServlet 6 | TestServlet 7 | 8 | 9 | TestServlet 10 | /TestServlet 11 | 12 | 13 | TestServlet.html 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/localname1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Use local-name() XSLT function in XPath expression 3 | ./xmlstarlet sel -T -t -v "//*[local-name()='query']" --nl xsql/jobserve.xsql 4 | -------------------------------------------------------------------------------- /examples/look1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Select text value of an XML element mathing given XPath expression 3 | ./xmlstarlet sel -T -t -m "/xml/table/rec[@id='2']" -v numField --nl xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/move1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Move element node 3 | echo '' | ./xmlstarlet ed -m "//b" "//a" 4 | 5 | -------------------------------------------------------------------------------- /examples/noindent1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Format XML document disabling indent 3 | cat xml/tab-obj.xml | ./xmlstarlet fo --noindent 4 | -------------------------------------------------------------------------------- /examples/ns1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Predefine namespaces for XPath expressions 3 | ./xmlstarlet sel -T -N xsql=urn:oracle-xsql -t -v /xsql:query --nl xsql/jobserve.xsql 4 | -------------------------------------------------------------------------------- /examples/pyx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet pyx xml/books.xml | ./xmlstarlet depyx | ./xmlstarlet c14n 3 | -------------------------------------------------------------------------------- /examples/pyx-ns: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet pyx xml/c14n.xml | ./xmlstarlet depyx | ./xmlstarlet c14n 3 | -------------------------------------------------------------------------------- /examples/rdf/em.rdf: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | Eric Miller 6 | 7 | Dr. 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/recover1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Recover malformed XML document 3 | ./xmlstarlet fo -R xml/malformed.xml 2>/dev/null 4 | -------------------------------------------------------------------------------- /examples/relaxng/address-bad.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | John Smith 4 | js@example.com 5 | 6 | 7 | Fred Bloggs 8 | fb@example.net 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/relaxng/address.rng: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/relaxng/address.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | John Smith 4 | js@example.com 5 | 6 | 7 | Fred Bloggs 8 | fb@example.net 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/relaxng/bigxml.rng: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/rename-attr1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Rename attributes 3 | ./xmlstarlet ed -r "//*/@id" -v ID xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/rename-elem1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Rename elements 3 | ./xmlstarlet ed -r "/xml/table/rec" -v record xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/results/N-order.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishjam/xmlstarlet/a9ab520db89d68c812ed38fc605c7e2b34265e05/examples/results/N-order.out -------------------------------------------------------------------------------- /examples/results/bigxml-dtd.out: -------------------------------------------------------------------------------- 1 | -:7000x 2 | -------------------------------------------------------------------------------- /examples/results/bigxml-embed-ref.out: -------------------------------------------------------------------------------- 1 | -:7000x 2 | -------------------------------------------------------------------------------- /examples/results/bigxml-embed.out: -------------------------------------------------------------------------------- 1 | -:7000x 2 | -------------------------------------------------------------------------------- /examples/results/bigxml-relaxng.out: -------------------------------------------------------------------------------- 1 | -:7000x 2 | -------------------------------------------------------------------------------- /examples/results/bigxml-well-formed.out: -------------------------------------------------------------------------------- 1 | -:7000x 2 | -------------------------------------------------------------------------------- /examples/results/bigxml-xsd.out: -------------------------------------------------------------------------------- 1 | -:7000x 2 | -------------------------------------------------------------------------------- /examples/results/bigxml.out: -------------------------------------------------------------------------------- 1 | -:7000x 2 | -------------------------------------------------------------------------------- /examples/results/c14n-default-attr.out: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/results/c14n-newlines.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishjam/xmlstarlet/a9ab520db89d68c812ed38fc605c7e2b34265e05/examples/results/c14n-newlines.out -------------------------------------------------------------------------------- /examples/results/c14n1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 0 15 | -------------------------------------------------------------------------------- /examples/results/c14n2.out: -------------------------------------------------------------------------------- 1 | 2 | content 3 | -------------------------------------------------------------------------------- /examples/results/command-help.out: -------------------------------------------------------------------------------- 1 | Usage: xml ed 2 | Usage: xml sel 3 | Usage: xml tr 4 | Usage: xml val 5 | Usage: xml fo 6 | Usage: xml el 7 | Usage: xml c14n 8 | Usage: xml ls 9 | Usage: xml esc 10 | Usage: xml unesc 11 | Usage: xml pyx 12 | Usage: xml p2x 13 | -------------------------------------------------------------------------------- /examples/results/count1.out: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /examples/results/countnode1.out: -------------------------------------------------------------------------------- 1 | xml/table.xml 32 2 | xml/tab-obj.xml 41 3 | -------------------------------------------------------------------------------- /examples/results/delete1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 9 | -23 10 | stringValue 11 | 12 |
13 |
14 | -------------------------------------------------------------------------------- /examples/results/docbook1.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishjam/xmlstarlet/a9ab520db89d68c812ed38fc605c7e2b34265e05/examples/results/docbook1.out -------------------------------------------------------------------------------- /examples/results/dtd1.out: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /examples/results/dtd2.out: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /examples/results/dtd3.out: -------------------------------------------------------------------------------- 1 | xml/foo.xml - invalid 2 | -------------------------------------------------------------------------------- /examples/results/dtd4.out: -------------------------------------------------------------------------------- 1 | xml/table.xml - valid 2 | -------------------------------------------------------------------------------- /examples/results/ed-2op.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | value 9 |
10 |
11 | -------------------------------------------------------------------------------- /examples/results/ed-append.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | value 9 | 10 | 346 11 | Text Value 12 | 13 | 14 | -23 15 | stringValue 16 | 17 |
18 |
19 | -------------------------------------------------------------------------------- /examples/results/ed-backref-delete.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 9 | 346 10 | Text Value 11 | 12 | 13 | -23 14 | stringValue 15 | 16 |
17 |
18 | -------------------------------------------------------------------------------- /examples/results/ed-backref1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | new-value 8 | 9 | 10 | 346 11 | Text Value 12 | new-value 13 | 14 | 15 | -23 16 | stringValue 17 | new-value 18 | 19 |
20 |
21 | -------------------------------------------------------------------------------- /examples/results/ed-backref2.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 123 5 | String Value 6 | new-value 7 | 8 | 9 | 346 10 | Text Value 11 | new-value 12 | 13 | 14 | -23 15 | stringValue 16 | new-value 17 | 18 |
19 |
-------------------------------------------------------------------------------- /examples/results/ed-expr.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 9 | 346 10 | Text Value 11 | 12 | 13 | -23 14 | stringValue 15 | 16 |
17 | 18 | 19 | 346 20 | Text Value 21 | 22 | 23 |
24 | -------------------------------------------------------------------------------- /examples/results/ed-insert.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 9 | 346 10 | Text Value 11 | 12 | 13 | -23 14 | stringValue 15 | 16 |
17 |
18 | 19 | 20 | bar 21 | -------------------------------------------------------------------------------- /examples/results/ed-literal.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | "<>& &quot; &amp; &lt; &gt; 4 | -------------------------------------------------------------------------------- /examples/results/ed-move.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 9 | 346 10 | Text Value 11 | 12 | 13 | -23 14 | stringValue 15 | 16 |
17 |
18 | -------------------------------------------------------------------------------- /examples/results/ed-namespace.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/results/ed-nop.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This is a "foo" line. 5 | This is a "bar" line. 6 | This is another "foo" line. 7 | 8 | -------------------------------------------------------------------------------- /examples/results/ed-subnode.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | value 8 | 9 | 10 | 346 11 | Text Value 12 | 13 | 14 | -23 15 | stringValue 16 | 17 |
18 |
19 | -------------------------------------------------------------------------------- /examples/results/elem-depth.out: -------------------------------------------------------------------------------- 1 | xml 2 | xml/table 3 | -------------------------------------------------------------------------------- /examples/results/elem-uniq.out: -------------------------------------------------------------------------------- 1 | xml 2 | xml/table 3 | xml/table/rec 4 | xml/table/rec/numField 5 | xml/table/rec/object 6 | xml/table/rec/object/property 7 | xml/table/rec/stringField 8 | -------------------------------------------------------------------------------- /examples/results/elem1.out: -------------------------------------------------------------------------------- 1 | xml 2 | xml/table 3 | xml/table/rec 4 | xml/table/rec/numField 5 | xml/table/rec/stringField 6 | xml/table/rec/object 7 | xml/table/rec/object/property 8 | xml/table/rec/object/property 9 | xml/table/rec 10 | xml/table/rec/numField 11 | xml/table/rec/stringField 12 | xml/table/rec 13 | xml/table/rec/numField 14 | xml/table/rec/stringField 15 | -------------------------------------------------------------------------------- /examples/results/elem2.out: -------------------------------------------------------------------------------- 1 | xml 2 | xml/table 3 | xml/table/rec 4 | xml/table/rec/@id 5 | xml/table/rec/numField 6 | xml/table/rec/stringField 7 | xml/table/rec/object 8 | xml/table/rec/object/@name 9 | xml/table/rec/object/property 10 | xml/table/rec/object/property/@name 11 | xml/table/rec/object/property 12 | xml/table/rec/object/property/@name 13 | xml/table/rec 14 | xml/table/rec/@id 15 | xml/table/rec/numField 16 | xml/table/rec/stringField 17 | xml/table/rec 18 | xml/table/rec/@id 19 | xml/table/rec/numField 20 | xml/table/rec/stringField 21 | -------------------------------------------------------------------------------- /examples/results/elem3.out: -------------------------------------------------------------------------------- 1 | xml 2 | xml/table 3 | xml/table/rec[@id='1'] 4 | xml/table/rec/numField 5 | xml/table/rec/stringField 6 | xml/table/rec/object[@name='Obj1'] 7 | xml/table/rec/object/property[@name='size'] 8 | xml/table/rec/object/property[@name='type'] 9 | xml/table/rec[@id='2'] 10 | xml/table/rec/numField 11 | xml/table/rec/stringField 12 | xml/table/rec[@id='3'] 13 | xml/table/rec/numField 14 | xml/table/rec/stringField 15 | -------------------------------------------------------------------------------- /examples/results/escape1.out: -------------------------------------------------------------------------------- 1 | <a1> 2 | <a11> 3 | <a111> 4 | <a1111/> 5 | </a111> 6 | <a112> 7 | <a1121/> 8 | </a112> 9 | </a11> 10 | <a12/> 11 | <a13> 12 | <a131/> 13 | </a13> 14 | </a1> 15 | -------------------------------------------------------------------------------- /examples/results/exslt-ed.out: -------------------------------------------------------------------------------- 1 | Saturday 2 | 1000 3 | 2 4 | -------------------------------------------------------------------------------- /examples/results/exslt1.out: -------------------------------------------------------------------------------- 1 | 1000 2 | -------------------------------------------------------------------------------- /examples/results/external-entity.out: -------------------------------------------------------------------------------- 1 | bar 2 | bar 3 | -------------------------------------------------------------------------------- /examples/results/findfile1.out: -------------------------------------------------------------------------------- 1 | xml/tab-obj.xml 2 | -------------------------------------------------------------------------------- /examples/results/genxml1.out: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /examples/results/hello1.out: -------------------------------------------------------------------------------- 1 | Hello World! -------------------------------------------------------------------------------- /examples/results/localname1.out: -------------------------------------------------------------------------------- 1 | 2 | SELECT substr(title,1,26) short_title, title, location, skills 3 | FROM job 4 | WHERE UPPER(title) LIKE '%ORACLE%' 5 | ORDER BY first_posted DESC 6 | 7 | -------------------------------------------------------------------------------- /examples/results/look1.out: -------------------------------------------------------------------------------- 1 | 346 2 | -------------------------------------------------------------------------------- /examples/results/move1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |
7 | -------------------------------------------------------------------------------- /examples/results/noindent1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 10 9 | Data 10 | 11 | 12 | 13 | 346 14 | Text Value 15 | 16 | 17 | -23 18 | stringValue 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /examples/results/ns1.out: -------------------------------------------------------------------------------- 1 | 2 | SELECT substr(title,1,26) short_title, title, location, skills 3 | FROM job 4 | WHERE UPPER(title) LIKE '%ORACLE%' 5 | ORDER BY first_posted DESC 6 | 7 | -------------------------------------------------------------------------------- /examples/results/pyx-ns.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | content 4 | 5 | -------------------------------------------------------------------------------- /examples/results/pyx.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Atlas Shrugged 5 | Ayn Rand 6 | 0525934189

7 |
8 | Next Book 9 | 10 | A Burnt-Out Case 11 | Graham Greene 12 | 0140185399

13 |
14 |
-------------------------------------------------------------------------------- /examples/results/recover1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | foo 4 | ... 5 | 6 | -------------------------------------------------------------------------------- /examples/results/rename-attr1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 10 9 | Data 10 | 11 | 12 | 13 | 346 14 | Text Value 15 | 16 | 17 | -23 18 | stringValue 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /examples/results/rename-elem1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 10 9 | Data 10 | 11 | 12 | 13 | 346 14 | Text Value 15 | 16 | 17 | -23 18 | stringValue 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /examples/results/schema1.out: -------------------------------------------------------------------------------- 1 | xml/tab-obj.xml 2 | 1 3 | -------------------------------------------------------------------------------- /examples/results/sel-if.out: -------------------------------------------------------------------------------- 1 | yes 2 | all 3 | no 4 | all 5 | maybe 6 | all 7 | -------------------------------------------------------------------------------- /examples/results/sel-literal.out: -------------------------------------------------------------------------------- 1 | abc 2 | a'c 3 | a"c 4 | a'"c 5 | "'a'b"" 6 | !@#$%^&*()_+-=~`\|'";:/?.>,<[]{} 7 | ]]> 8 | -------------------------------------------------------------------------------- /examples/results/sel-many-values.out: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 -------------------------------------------------------------------------------- /examples/results/sel-root.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /examples/results/sel-xpath-c.out: -------------------------------------------------------------------------------- 1 | abc 2 | a'c 3 | a"c 4 | a'"c 5 | "'a'b"" 6 | !@#$%^&*()_+-=~`\|'";:/?.>,<[]{} 7 | ]]> 8 | -------------------------------------------------------------------------------- /examples/results/sel-xpath-i.out: -------------------------------------------------------------------------------- 1 | abc 2 | a'c 3 | a"c 4 | a'"c 5 | "'a'b"" 6 | !@#$%^&*()_+-=~`\|'";:/?.>,<[]{} 7 | ]]> 8 | -------------------------------------------------------------------------------- /examples/results/sel-xpath-m.out: -------------------------------------------------------------------------------- 1 | abc 2 | a'c 3 | a"c 4 | a'"c 5 | "'a'b"" 6 | !@#$%^&*()_+-=~`\|'";:/?.>,<[]{} 7 | ]]> 8 | -------------------------------------------------------------------------------- /examples/results/sel-xpath-v.out: -------------------------------------------------------------------------------- 1 | abc 2 | a'c 3 | a"c 4 | a'"c 5 | "'a'b"" 6 | !@#$%^&*()_+-=~`\|'";:/?.>,<[]{} 7 | ]]> 8 | -------------------------------------------------------------------------------- /examples/results/sel1.out: -------------------------------------------------------------------------------- 1 | 123String Value 2 | 346Text Value 3 | -23stringValue 4 | -------------------------------------------------------------------------------- /examples/results/sort1.out: -------------------------------------------------------------------------------- 1 | 3|-23|stringValue 2 | 2|346|Text Value 3 | 1|123|String Value 4 | -------------------------------------------------------------------------------- /examples/results/sort2.out: -------------------------------------------------------------------------------- 1 | A 2 | a 3 | E 4 | e 5 | B 6 | b 7 | C 8 | c 9 | D 10 | d 11 | -------------------------------------------------------------------------------- /examples/results/sort3.out: -------------------------------------------------------------------------------- 1 | a 2 | A 3 | b 4 | B 5 | c 6 | C 7 | d 8 | D 9 | e 10 | E 11 | -------------------------------------------------------------------------------- /examples/results/structure1.out: -------------------------------------------------------------------------------- 1 | a1 2 | a1.a11 3 | a1.a11.a111 4 | a1.a11.a111.a1111 5 | a1.a11.a112 6 | a1.a11.a112.a1121 7 | a1.a12 8 | a1.a13 9 | a1.a13.a131 10 | -------------------------------------------------------------------------------- /examples/results/sum1.out: -------------------------------------------------------------------------------- 1 | 446 2 | -------------------------------------------------------------------------------- /examples/results/tab1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 10 9 | Data 10 | 11 | 12 | 13 | 346 14 | Text Value 15 | 16 | 17 | -23 18 | stringValue 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /examples/results/table1.out: -------------------------------------------------------------------------------- 1 | 1|123|String Value 2 | 2|346|Text Value 3 | 3|-23|stringValue 4 | -------------------------------------------------------------------------------- /examples/results/table2.out: -------------------------------------------------------------------------------- 1 | 1|123|String Value 2 | 2|346|Text Value 3 | 3|-23|stringValue 4 | -------------------------------------------------------------------------------- /examples/results/table3.out: -------------------------------------------------------------------------------- 1 | =================== 2 | 1|123|String Value 3 | 2|346|Text Value 4 | 3|-23|stringValue 5 | =================== 6 | -------------------------------------------------------------------------------- /examples/results/tree1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0525934189 5 | 6 | 7 | 0140185399 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/results/unicode1.out: -------------------------------------------------------------------------------- 1 | français 2 | français 3 | français 4 | -------------------------------------------------------------------------------- /examples/results/update-attr1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 10 9 | Data 10 | 11 | 12 | 13 | 346 14 | Text Value 15 | 16 | 17 | -23 18 | stringValue 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /examples/results/update-elem1.out: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | String Value 7 | 8 | 10 9 | Data 10 | 11 | 12 | 13 | 346 14 | Text Value 15 | 16 | 17 | -23 18 | stringValue 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /examples/results/valid1.out: -------------------------------------------------------------------------------- 1 | =============================================== 2 | Well-Formedness Validation Tests 3 | - 1 ------------------------------------------- 4 | xml/table.xml - valid 5 | xml/tab-obj.xml - valid 6 | xml/tab-bad.xml - invalid 7 | 1 8 | - 2 ------------------------------------------- 9 | xml/table.xml 10 | xml/tab-obj.xml 11 | 1 12 | - 3 ------------------------------------------- 13 | xml/tab-bad.xml 14 | 1 15 | - 4 ------------------------------------------- 16 | 0 17 | =============================================== 18 | DTD Validation Tests 19 | - 1 ------------------------------------------- 20 | xml/table.xml - valid 21 | xml/tab-obj.xml - invalid 22 | xml/tab-bad.xml - invalid 23 | 1 24 | - 2 ------------------------------------------- 25 | xml/table.xml 26 | 1 27 | - 3 ------------------------------------------- 28 | xml/tab-obj.xml 29 | xml/tab-bad.xml 30 | 1 31 | - 4 ------------------------------------------- 32 | 0 33 | =============================================== 34 | Schema Validation Tests 35 | - 1 ------------------------------------------- 36 | xml/table.xml - valid 37 | xml/tab-obj.xml - invalid 38 | xml/tab-bad.xml - invalid 39 | 1 40 | - 2 ------------------------------------------- 41 | xml/table.xml 42 | 1 43 | - 3 ------------------------------------------- 44 | xml/tab-obj.xml 45 | xml/tab-bad.xml 46 | 1 47 | - 4 ------------------------------------------- 48 | 0 49 | =============================================== 50 | RelaxNG Schema Validation Tests 51 | - 1 ------------------------------------------- 52 | relaxng/address.xml - valid 53 | relaxng/address-bad.xml - invalid 54 | 1 55 | - 2 ------------------------------------------- 56 | relaxng/address.xml 57 | 1 58 | - 3 ------------------------------------------- 59 | relaxng/address-bad.xml 60 | 1 61 | - 4 ------------------------------------------- 62 | 0 63 | -------------------------------------------------------------------------------- /examples/results/xinclude1.out: -------------------------------------------------------------------------------- 1 | 2 |

120 Mz is adequate for an average home user.

3 | 4 |

The opinions represented herein represent those of the individual 5 | and should not be interpreted as official policy endorsed by this 6 | organization.

7 |
8 |
-------------------------------------------------------------------------------- /examples/results/xsl-param1.out: -------------------------------------------------------------------------------- 1 | Count=3 2 | -------------------------------------------------------------------------------- /examples/results/xsl-sum1.out: -------------------------------------------------------------------------------- 1 | 446 2 | -------------------------------------------------------------------------------- /examples/schema1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Validate against XSD schema 3 | ./xmlstarlet val -b -s xsd/table.xsd xml/table.xml xml/tab-obj.xml 2>/dev/null; echo $? 4 | -------------------------------------------------------------------------------- /examples/sel-if: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo '' | ./xmlstarlet sel -T -t -i 'true()' -o yes -n --else -o no -n -b -o all -n 3 | echo '' | ./xmlstarlet sel -T -t -i 'false()' -o yes -n --else -o no -n -b -o all -n 4 | echo '' | ./xmlstarlet sel -T -t -i 'false()' -o yes -n --elif 'true()' -o maybe -n --else -o no -n -b -o all -n 5 | -------------------------------------------------------------------------------- /examples/sel-literal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | the_test() { 3 | ./xmlstarlet sel --text -t -m /doc -o "$1" --nl xml/foo.xml 4 | } 5 | 6 | . "${srcdir-..}"/examples/foreach-literal.sh 7 | -------------------------------------------------------------------------------- /examples/sel-many-values: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./xmlstarlet sel -T -t -v //@id xml/table.xml 3 | -------------------------------------------------------------------------------- /examples/sel-root: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo '' | ./xmlstarlet sel --root -t -c / | ./xmlstarlet c14n 3 | echo 4 | echo '' | ./xmlstarlet sel --root -t -c / -t -c / | ./xmlstarlet c14n 5 | echo 6 | -------------------------------------------------------------------------------- /examples/sel-xpath-c: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | the_test() { 3 | ./xmlstarlet sel --text -t -m /doc -c "$1" --nl xml/foo.xml 4 | } 5 | 6 | . "${srcdir-..}"/examples/foreach-xpath.sh 7 | -------------------------------------------------------------------------------- /examples/sel-xpath-i: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | the_test() { 3 | ./xmlstarlet sel --text -t -i "$1" -v "$1" --nl xml/foo.xml 4 | } 5 | 6 | . "${srcdir-..}"/examples/foreach-xpath.sh 7 | -------------------------------------------------------------------------------- /examples/sel-xpath-m: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | the_test() { 3 | ./xmlstarlet sel --text -t -m "/*[boolean($1)]" -v "$1" --nl xml/foo.xml 4 | } 5 | 6 | . "${srcdir-..}"/examples/foreach-xpath.sh 7 | -------------------------------------------------------------------------------- /examples/sel-xpath-v: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | the_test() { 3 | ./xmlstarlet sel --text -t -m /doc -v "$1" --nl xml/foo.xml 4 | } 5 | 6 | . "${srcdir-..}"/examples/foreach-xpath.sh 7 | -------------------------------------------------------------------------------- /examples/sel1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # xsl:copy-of in xml sel command 3 | ./xmlstarlet sel -B -t -e ROOT -m /xml/table/rec -c . -n xml/table.xml | ./xmlstarlet c14n 4 | -------------------------------------------------------------------------------- /examples/sgml/docbook1.sgml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | DocBook document example 8 | 9 | Mikhail 10 | Grushinskiy 11 | 12 | 13 | 14 | 2002 15 | Mikhail Grushinskiy 16 | 17 | 18 | 19 | 20 | Sample document 21 | 22 | A simple DocBook example document. 23 | 24 | 25 | 26 | XMLStarlet Example 27 | 28 | The XMLStarlet command line toolkit 29 | allows querying/checking/editing/transforming/formatting XML documents 30 | from command line 31 | 32 | To find out more on how to use the 33 | XMLStarlet for XML processing, point 34 | your browser to http://xmlstar.sourceforge.net/. 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/sort1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Query XML document and produce sorted text table 3 | ./xmlstarlet sel -T -t -m /xml/table/rec -s D:N:- "@id" -v "concat(@id,'|',numField,'|',stringField)" -n xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/sort2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Sort on two fields 3 | ./xmlstarlet sel -T -t -m /root/elem -s A:N:U @rank -s A:T:U @name -v @name -n xml/unsorted.xml 4 | 5 | -------------------------------------------------------------------------------- /examples/sort3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # lower case first 3 | ./xmlstarlet sel -T -t -m /root/elem -s A:T:L @name -v @name -n xml/unsorted.xml 4 | 5 | -------------------------------------------------------------------------------- /examples/structure1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Print structure of XML element using xml sel (advanced XPath expressions and xml sel command usage) 3 | ./xmlstarlet sel -T -t -m '//*' \ 4 | -m 'ancestor-or-self::*' -v 'name()' -i 'not(position()=last())' -o . -b -b -n \ 5 | xml/structure.xml 6 | -------------------------------------------------------------------------------- /examples/sum1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Calculating running sum on XML document 3 | ./xmlstarlet sel -T -t -v "sum(/xml/table/rec/numField)" --nl xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/svg/sample.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | Four separate rectangles 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | -------------------------------------------------------------------------------- /examples/tab1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Indent XML document with tabs 3 | cat xml/tab-obj.xml | ./xmlstarlet fo --indent-tab 4 | -------------------------------------------------------------------------------- /examples/table1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Generate plain text table from XML document 3 | ./xmlstarlet sel -T -t -m /xml/table/rec -v "@id" -o "|" -v numField -o "|" -v stringField -n xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/table2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Generate plain text table from XML document 3 | ./xmlstarlet sel -T -t -m /xml/table/rec -v "concat(@id,'|',numField,'|',stringField)" -n xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/table3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Generate plain text table from XML document 3 | ./xmlstarlet sel -T \ 4 | -t -o "===================" -n \ 5 | -m xml/table/rec -v "concat(@id,'|',numField,'|',stringField)" -n \ 6 | -t -o "===================" -n xml/table.xml 7 | -------------------------------------------------------------------------------- /examples/tests.mk: -------------------------------------------------------------------------------- 1 | AM_TESTS_ENVIRONMENT = abs_builddir=$(abs_builddir) \ 2 | EXEEXT=$(EXEEXT) SED=$(SED) AWK=$(AWK) SHELL=$(SHELL); \ 3 | export abs_buildir; export EXEEXT; export SED; export AWK; export SHELL; 4 | 5 | LOG_COMPILER = $(SHELL) $(srcdir)/tests/runTest.sh 6 | 7 | # split tests into fast and slow, so we can run just the fast ones 8 | 9 | SLOW_TESTS =\ 10 | examples/bigxml-dtd\ 11 | examples/bigxml-embed-ref\ 12 | examples/bigxml-embed\ 13 | examples/bigxml-relaxng\ 14 | examples/bigxml-well-formed\ 15 | examples/bigxml-xsd 16 | 17 | QUICK_TESTS =\ 18 | examples/c14n-default-attr\ 19 | examples/c14n-newlines\ 20 | examples/c14n1\ 21 | examples/c14n2\ 22 | examples/command-help\ 23 | examples/count1\ 24 | examples/countnode1\ 25 | examples/delete1\ 26 | examples/dtd1\ 27 | examples/dtd2\ 28 | examples/dtd3\ 29 | examples/dtd4\ 30 | examples/ed-2op\ 31 | examples/ed-append\ 32 | examples/ed-backref-delete\ 33 | examples/ed-backref1\ 34 | examples/ed-backref2\ 35 | examples/ed-expr\ 36 | examples/ed-insert\ 37 | examples/ed-literal\ 38 | examples/ed-move\ 39 | examples/ed-namespace\ 40 | examples/ed-nop\ 41 | examples/ed-subnode\ 42 | examples/elem1\ 43 | examples/elem2\ 44 | examples/elem3\ 45 | examples/elem-depth\ 46 | examples/elem-uniq\ 47 | examples/escape1\ 48 | examples/exslt-ed\ 49 | examples/exslt1\ 50 | examples/external-entity\ 51 | examples/findfile1\ 52 | examples/genxml1\ 53 | examples/hello1\ 54 | examples/localname1\ 55 | examples/look1\ 56 | examples/move1\ 57 | examples/N-order\ 58 | examples/noindent1\ 59 | examples/ns1\ 60 | examples/pyx\ 61 | examples/pyx-ns\ 62 | examples/recover1\ 63 | examples/rename-attr1\ 64 | examples/rename-elem1\ 65 | examples/schema1\ 66 | examples/sel-literal\ 67 | examples/sel-if\ 68 | examples/sel-many-values\ 69 | examples/sel-root\ 70 | examples/sel-xpath-c\ 71 | examples/sel-xpath-i\ 72 | examples/sel-xpath-m\ 73 | examples/sel-xpath-v\ 74 | examples/sel1\ 75 | examples/sort1\ 76 | examples/sort2\ 77 | examples/sort3\ 78 | examples/structure1\ 79 | examples/sum1\ 80 | examples/tab1\ 81 | examples/table1\ 82 | examples/table2\ 83 | examples/table3\ 84 | examples/unicode1\ 85 | examples/update-attr1\ 86 | examples/update-elem1\ 87 | examples/valid1\ 88 | examples/xinclude1\ 89 | examples/xsl-param1\ 90 | examples/xsl-sum1 91 | 92 | # default to all the tests 93 | TESTS = $(SLOW_TESTS) $(QUICK_TESTS) 94 | 95 | # qcheck is just tests listed in QUICK_TESTS 96 | qcheck : 97 | @$(MAKE) TESTS="$(QUICK_TESTS)" check 98 | 99 | XFAIL_TESTS =\ 100 | examples/bigxml-dtd\ 101 | examples/ed-namespace 102 | 103 | if !HAVE_EXSLT_XPATH_REGISTER 104 | XFAIL_TESTS += examples/exslt-ed 105 | endif 106 | -------------------------------------------------------------------------------- /examples/tree1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Print subtree of elements having given element as a descendant (advanced XPath) 3 | ./xmlstarlet ed -d '//node()[not(descendant-or-self::isbn or parent::isbn)] | //*[parent::isbn]' xml/books.xml 4 | 5 | -------------------------------------------------------------------------------- /examples/unicode1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Select from XML document containing unicode characters 3 | ./xmlstarlet sel -T -t -m "//test[@lang='français']/@lang" -v . -n xml/unicode.xml 4 | -------------------------------------------------------------------------------- /examples/update-attr1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Update value of an attribute 3 | ./xmlstarlet ed -u '/xml/table/rec[@id=3]/@id' -v 5 xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/update-elem1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Update value of an element 3 | ./xmlstarlet ed -u '/xml/table/rec[@id=1]/numField' -v 0 xml/tab-obj.xml 4 | -------------------------------------------------------------------------------- /examples/valid1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Validate XML documents using well-formedness/DTD/XSD/RelaxNG checks 3 | echo "===============================================" 4 | echo "Well-Formedness Validation Tests" 5 | echo "- 1 -------------------------------------------" 6 | ./xmlstarlet val xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 7 | echo "- 2 -------------------------------------------" 8 | ./xmlstarlet val -g xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 9 | echo "- 3 -------------------------------------------" 10 | ./xmlstarlet val -b xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 11 | echo "- 4 -------------------------------------------" 12 | ./xmlstarlet val -q xml/table.xml xml/tab-obj.xml 2>/dev/null; echo $? 13 | 14 | echo "===============================================" 15 | echo "DTD Validation Tests" 16 | echo "- 1 -------------------------------------------" 17 | ./xmlstarlet val -d dtd/table.dtd xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 18 | echo "- 2 -------------------------------------------" 19 | ./xmlstarlet val -g -d dtd/table.dtd xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 20 | echo "- 3 -------------------------------------------" 21 | ./xmlstarlet val -b -d dtd/table.dtd xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 22 | echo "- 4 -------------------------------------------" 23 | ./xmlstarlet val -q -d dtd/table.dtd xml/table.xml 2>/dev/null; echo $? 24 | 25 | echo "===============================================" 26 | echo "Schema Validation Tests" 27 | echo "- 1 -------------------------------------------" 28 | ./xmlstarlet val -s xsd/table.xsd xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 29 | echo "- 2 -------------------------------------------" 30 | ./xmlstarlet val -g -s xsd/table.xsd xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 31 | echo "- 3 -------------------------------------------" 32 | ./xmlstarlet val -b -s xsd/table.xsd xml/table.xml xml/tab-obj.xml xml/tab-bad.xml 2>/dev/null; echo $? 33 | echo "- 4 -------------------------------------------" 34 | ./xmlstarlet val -q -s xsd/table.xsd xml/table.xml 2>/dev/null; echo $? 35 | 36 | echo "===============================================" 37 | echo "RelaxNG Schema Validation Tests" 38 | echo "- 1 -------------------------------------------" 39 | ./xmlstarlet val -r relaxng/address.rng relaxng/address.xml relaxng/address-bad.xml 2>/dev/null; echo $? 40 | echo "- 2 -------------------------------------------" 41 | ./xmlstarlet val -g -r relaxng/address.rng relaxng/address.xml relaxng/address-bad.xml 2>/dev/null; echo $? 42 | echo "- 3 -------------------------------------------" 43 | ./xmlstarlet val -b -r relaxng/address.rng relaxng/address.xml relaxng/address-bad.xml 2>/dev/null; echo $? 44 | echo "- 4 -------------------------------------------" 45 | ./xmlstarlet val -q -r relaxng/address.rng relaxng/address.xml 2>/dev/null; echo $? 46 | -------------------------------------------------------------------------------- /examples/vxml/root.vxml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /examples/wsdl/quote.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | My first service 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /examples/xinclude1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Include one XML document into another using XInclude 3 | ./xmlstarlet tr --xinclude xsl/cat.xsl xml/document.xml | ./xmlstarlet c14n 4 | -------------------------------------------------------------------------------- /examples/xmi/example.xmi: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/xml/S0.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/xml/books.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Atlas Shrugged 6 | Ayn Rand 7 | 0525934189
8 |
9 | Next Book 10 | 11 | A Burnt-Out Case 12 | Graham Greene 13 | 0140185399
14 |
15 |
16 | -------------------------------------------------------------------------------- /examples/xml/c14n-default-attr.xml: -------------------------------------------------------------------------------- 1 | ]> 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/xml/c14n.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | content 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/xml/c14n.xpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | (//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1] 4 | 5 | -------------------------------------------------------------------------------- /examples/xml/disclaimer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

The opinions represented herein represent those of the individual 4 | and should not be interpreted as official policy endorsed by this 5 | organization.

6 |
7 | -------------------------------------------------------------------------------- /examples/xml/document.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

120 Mz is adequate for an average home user.

4 | 5 |
6 | -------------------------------------------------------------------------------- /examples/xml/entity.xml: -------------------------------------------------------------------------------- 1 | 2 | bar 3 | -------------------------------------------------------------------------------- /examples/xml/external-pe.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | ]> 7 | 8 | &entity; 9 | -------------------------------------------------------------------------------- /examples/xml/foo.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/xml/foo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This is a "foo" line. 5 | This is a "bar" line. 6 | This is another "foo" line. 7 | 8 | -------------------------------------------------------------------------------- /examples/xml/malformed.xml: -------------------------------------------------------------------------------- 1 | 2 | foo 3 | ... 4 | 5 | -------------------------------------------------------------------------------- /examples/xml/structure.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/xml/tab-bad.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 10 9 | Data 10 | 11 | 12 | 13 | 346 14 | Text Value 15 | 16 | 17 | -23 18 | stringValue 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/xml/tab-obj.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 123 6 | String Value 7 | 8 | 10 9 | Data 10 | 11 | 12 | 13 | 346 14 | Text Value 15 | 16 | 17 | -23 18 | stringValue 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /examples/xml/table.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 123 6 | String Value 7 | 8 | 9 | 346 10 | Text Value 11 | 12 | 13 | -23 14 | stringValue 15 | 16 |
17 |
18 | -------------------------------------------------------------------------------- /examples/xml/unicode.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | ]> 8 | 9 | UTF-8 character. 10 | numeric ref. 11 | entity ref. 12 | 13 | -------------------------------------------------------------------------------- /examples/xml/unsorted.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/xml/xmlstarlet-pad.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.15 5 | Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://www.asp-shareware.org/pad 6 | 7 | 8 | Mikhail Grushinskiy 9 | 10 | 11 | 12 | 13 | 14 | 15 | http://sourceforge.net/projects/xmlstar/ 16 | 17 | Mikhail 18 | Grushinskiy 19 | mgrouch@users.sourceforge.net 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | mgrouch@users.sourceforge.net 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | xmlstarlet 36 | 0.3.0 37 | 05 38 | 28 39 | 2003 40 | 41 | 42 | 43 | Freeware 44 | Major Update 45 | Install and Uninstall 46 | Unix,Linux 47 | English 48 | 49 | xmlstarlet-0.3.0.tar.gz 50 | 51 | 52 | 53 | 155073 54 | 151 55 | 0.15 56 | 57 | 58 | N 59 | 60 | Days 61 | 62 | 63 | 64 | 65 | 66 | 67 | Utilities 68 | Development Tools 69 | POSIX UNIX 70 | N 71 | N 72 | N 73 | 74 | 75 | 76 | xmlstarlet XML command line processing tool utility toolkit XSLT XSD RelaxNG validate query transform edit modify shell UNIX grep diff sed pyx 77 | XMLStarlet Command Line XML Toolkit 78 | XMLStarlet Command Line XML Toolkit 79 | XMLStarlet is a set of command line utilities (tools) 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 80 | XMLStarlet is a set of command line utilities (tools) 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. 81 | 82 | 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. 83 | XMLStarlet is a set of command line utilities (tools) 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. 84 | 85 | 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. 86 | 87 | The toolkit's feature set includes options to: 88 | 89 | Check or validate XML files (simple well-formedness check, DTD, XSD, RelaxNG) 90 | 91 | Calculate values of XPath expressions on XML files (such as running sums, etc) 92 | 93 | Search XML files for matches to given XPath expressions 94 | 95 | Apply XSLT stylesheets to XML documents (including EXSLT support, and passing parameters to stylesheets) 96 | 97 | Query XML documents (ex. query for value of some elements of attributes, sorting, etc) 98 | 99 | Modify or edit XML documents (ex. delete some elements) 100 | 101 | Format or "beautify" XML documents (as changing indentation, etc) 102 | 103 | Fetch XML documents using http:// or ftp:// URLs 104 | 105 | Browse tree structure of XML documents (in similar way to 'ls' command for directories) 106 | 107 | Include one XML document into another using XInclude 108 | 109 | XML c14n canonicalization 110 | 111 | Escape/unescape special XML characters in input text 112 | 113 | Display directories in XML format 114 | 115 | XMLStarlet is open source freeware under MIT license which allows free use and distribution for both commercial and non-commercial projects. 116 | 117 | 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 at http://sourceforge.net/forum/?group_id=66612, or XMLStarlet mailing list at http://lists.sourceforge.net/lists/listinfo/xmlstar-devel) 118 | 119 | 120 | 121 | 122 | http://xmlstar.sourceforge.net/ 123 | http://xmlstar.sourceforge.net/download.php 124 | 125 | http://xmlstar.sourceforge.net/img/xmlstarlet.png 126 | 127 | 128 | 129 | http://xmlstar.sourceforge.net/download.php 130 | http://sourceforge.net/project/showfiles.php?group_id=66612 131 | 132 | 133 | 134 | 135 | 136 | Copyright (c) 2002,2003 Mikhail Grushinskiy. All Rights Reserved. 137 | 138 | Permission is hereby granted, free of charge, to any person obtaining a copy 139 | of this software and associated documentation files (the "Software"), to deal 140 | in the Software without restriction, including without limitation the rights 141 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 142 | copies of the Software, and to permit persons to whom the Software is 143 | furnished to do so, subject to the following conditions: 144 | 145 | The above copyright notice and this permission notice shall be included in 146 | all copies or substantial portions of the Software. 147 | 148 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 149 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 150 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 151 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 152 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 153 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 154 | THE SOFTWARE. 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /examples/xml/xmlstarlet-xsa.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Mikhail Grushinskiy 8 | mgrouch@users.sourceforge.net 9 | http://xmlstar.sourceforge.net/ 10 | 11 | 12 | 13 | xmlstarlet 14 | 0.3.0 15 | 20030528 16 | http://xmlstar.sourceforge.net/ 17 | 18 | Changes since 0.2.0 19 | 1. Many improvements to 'edit' option 20 | 2. Improvements for namespaces support in 'select' option 21 | 3. Fixes for 'ls' option 22 | 4. New binaries for Solaris8-sparc/RedHat-7.3/Mandrake-9.1/ 23 | 5. Documentation and web site updates 24 | 6. Improved build scripts and make files 25 | 7. Additional examples and tests 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/xmlstarlet: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exepath=`dirname $0` 3 | xml="${abs_builddir-$exepath/..}"/xml 4 | 5 | if [ x"$OSTYPE" = xmsys ] ; then 6 | exec "$exepath/xmlstarlet.msys" "$xml" "$@" 7 | fi 8 | 9 | if [ x"$VALGRIND" = xyes ] ; then 10 | exec valgrind --error-exitcode=99 --quiet ${VALGRIND_OPTS} "$xml" "$@" 11 | fi 12 | 13 | exec "$xml" "$@" 14 | 15 | -------------------------------------------------------------------------------- /examples/xmlstarlet.msys: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xml="$1" 4 | shift 5 | 6 | # MSYS does unix -> windows path conversion if there is a leading / 7 | # but not when the argument contains a semicolon, eg: /x -> 8 | # C:\Mingw\msys\1.0\x so we double all leading /'s to avoid this 9 | 10 | nargs=$# 11 | args=() 12 | for ((i = 0; i < nargs; i++)) ; do 13 | if [[ "$1" = /* ]] && [[ "$1" != *\;* ]] ; then 14 | args[$i]="/$1" 15 | else 16 | args[$i]="$1" 17 | fi 18 | shift 19 | done 20 | 21 | exec "$xml" "${args[@]}" 22 | -------------------------------------------------------------------------------- /examples/xsd/bigxml.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/xsd/table.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/xsl-param1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Passing parameters to XSLT stylesheet 3 | ./xmlstarlet tr xsl/param1.xsl -p Count='count(/xml/table/rec)' -s Text="Count=" xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/xsl-sum1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Applying XSLT stylesheet to XML document 3 | ./xmlstarlet tr xsl/sum1.xsl xml/table.xml 4 | -------------------------------------------------------------------------------- /examples/xsl/cat.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/xsl/hello1.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | - 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/xsl/param1.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/xsl/sum1.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | - 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/xsp/dynamic.xsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | // Define a variable to hold the time of day 11 | Date now = new Date(); 12 | 13 | 14 |

15 | To the best of my knowledge, it's now 16 | 17 | now 18 |

19 |
20 |
21 | -------------------------------------------------------------------------------- /examples/xsql/jobserve.xsql: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SELECT substr(title,1,26) short_title, title, location, skills 5 | FROM job 6 | WHERE UPPER(title) LIKE '%ORACLE%' 7 | ORDER BY first_posted DESC 8 | 9 | -------------------------------------------------------------------------------- /examples/xupdate/insxml.xup: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 2 7 | 8 | Susan 9 | Long 10 | 11 | Tucson 12 | Arizona 13 | United States 14 | 430-304-3040 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /m4/quiet-rule.m4: -------------------------------------------------------------------------------- 1 | # serial 1 -*- mode: autoconf -*- 2 | # SILENT_RULE(varname, [echo = varname]) 3 | # defines V_varname to use for silent make rules 4 | AC_DEFUN([np_SILENT_RULE],[dnl 5 | m4_pushdef([varname], $1)dnl 6 | m4_pushdef([echoname], [m4_default($2, varname)])dnl 7 | # make silent rule for $1 8 | AC_SUBST(V_[]varname, ["\$(V_[]varname[]_$AM_V)"])dnl 9 | AC_SUBST(V_[]varname[]_, ["\$(V_[]varname[]_$AM_DEFAULT_VERBOSITY)"])dnl 10 | AC_SUBST(V_[]varname[]_0, ['@echo " echoname [$]@";'])dnl 11 | m4_popdef([varname], [echoname])dnl 12 | ]) 13 | -------------------------------------------------------------------------------- /m4/xstar-check-libs.m4: -------------------------------------------------------------------------------- 1 | # serial 1 -*- mode: autoconf -*- 2 | 3 | # XSTAR_LIB_ARGS_WITH(LIBXXX, [with-src = []]) 4 | dnl pass [with-src] to get the --with-libxxx-src option 5 | AC_DEFUN([XSTAR_LIB_ARGS_WITH], 6 | [m4_pushdef([LIBXXX], $1)dnl 7 | m4_pushdef([libxxx], m4_tolower(LIBXXX))dnl 8 | AC_ARG_WITH(libxxx-prefix, 9 | AS_HELP_STRING(--with-libxxx-prefix=[PFX], 10 | Specify location of libxxx), 11 | [LIBXXX()_PREFIX="$withval"]) 12 | AC_ARG_WITH(libxxx-include-prefix, 13 | AS_HELP_STRING([--with-libxxx-include-prefix=[PFX]], 14 | Specify location of libxxx headers), 15 | [LIBXXX()_INCDIR="$withval"]) 16 | AC_ARG_WITH(libxxx-libs-prefix, 17 | AS_HELP_STRING([--with-libxxx-libs-prefix=[PFX]], 18 | Specify location of libxxx libs), 19 | [LIBXXX()_LIBDIR="$withval"]) 20 | m4_if($2, [with-src], 21 | [AC_ARG_WITH(libxxx-src, 22 | AS_HELP_STRING([--with-libxxx-src=[DIR]], 23 | For libxxx that's not installed yet (sets all three above)), 24 | [LIBXXX()_SRCDIR="$withval" 25 | LIBXXX()_LIBDIR="$LIBXXX()_SRCDIR/.libs"])]) 26 | m4_popdef([libxxx], [LIBXXX])]) 27 | 28 | # XSTAR_LIB_CHECK(LIBXXX, xxx-config) 29 | # set LIBXXX_INCDIR and LIBXXX_LIBDIR based on location of xxx-config 30 | # also check xxx-config --version against LIBXXX_REQUIRED_VERSION 31 | # Ignores xxx-config if LIBXXX_SRCDIR is set 32 | AC_DEFUN([XSTAR_LIB_CHECK], 33 | [m4_pushdef([LIBXXX], $1) 34 | m4_pushdef([libxxx], m4_tolower(LIBXXX)) 35 | m4_pushdef([xxx_config], $2) 36 | AS_IF([test "x$LIBXXX()_SRCDIR" != x], 37 | [AC_MSG_NOTICE([using libxxx src dir "$LIBXXX()_SRCDIR"]) 38 | AC_MSG_WARN([not checking libxxx version])], 39 | [AC_PATH_PROG(LIBXXX()_CONFIG, xxx_config(), 40 | [], [$LIBXXX()_PREFIX/bin$PATH_SEPARATOR$PATH]) 41 | AS_IF([test "x$LIBXXX()_CONFIG" = x], 42 | [AC_MSG_FAILURE([xxx_config not found, 43 | libxxx is not installed or LIBXXX()_PREFIX is not correctly defined])]) 44 | LIBXXX()_VERSION=$($LIBXXX()_CONFIG --version) 45 | AS_VERSION_COMPARE([$LIBXXX()_VERSION], [$LIBXXX()_REQUIRED_VERSION], 46 | [AC_MSG_ERROR([xmlstarlet needs at least libxxx version $LIBXXX()_REQUIRED_VERSION (http://www.xmlsoft.org/)])]) 47 | AC_MSG_NOTICE([using libxxx-$LIBXXX()_VERSION]) 48 | LIBXXX()_PREFIX=`AS_DIRNAME($LIBXXX()_CONFIG)` 49 | LIBXXX()_PREFIX=`AS_DIRNAME($LIBXXX()_PREFIX)` 50 | : ${LIBXXX()_LIBDIR="$LIBXXX()_PREFIX/lib"}]) 51 | m4_popdef([xxx_config], [libxxx], [LIBXXX])]) 52 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common wrapper for a few potentially missing GNU programs. 3 | 4 | scriptversion=2013-10-28.13; # UTC 5 | 6 | # Copyright (C) 1996-2013 Free Software Foundation, Inc. 7 | # Originally written by Fran,cois Pinard , 1996. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | if test $# -eq 0; then 28 | echo 1>&2 "Try '$0 --help' for more information" 29 | exit 1 30 | fi 31 | 32 | case $1 in 33 | 34 | --is-lightweight) 35 | # Used by our autoconf macros to check whether the available missing 36 | # script is modern enough. 37 | exit 0 38 | ;; 39 | 40 | --run) 41 | # Back-compat with the calling convention used by older automake. 42 | shift 43 | ;; 44 | 45 | -h|--h|--he|--hel|--help) 46 | echo "\ 47 | $0 [OPTION]... PROGRAM [ARGUMENT]... 48 | 49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50 | to PROGRAM being missing or too old. 51 | 52 | Options: 53 | -h, --help display this help and exit 54 | -v, --version output version information and exit 55 | 56 | Supported PROGRAM values: 57 | aclocal autoconf autoheader autom4te automake makeinfo 58 | bison yacc flex lex help2man 59 | 60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61 | 'g' are ignored when checking the name. 62 | 63 | Send bug reports to ." 64 | exit $? 65 | ;; 66 | 67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68 | echo "missing $scriptversion (GNU Automake)" 69 | exit $? 70 | ;; 71 | 72 | -*) 73 | echo 1>&2 "$0: unknown '$1' option" 74 | echo 1>&2 "Try '$0 --help' for more information" 75 | exit 1 76 | ;; 77 | 78 | esac 79 | 80 | # Run the given program, remember its exit status. 81 | "$@"; st=$? 82 | 83 | # If it succeeded, we are done. 84 | test $st -eq 0 && exit 0 85 | 86 | # Also exit now if we it failed (or wasn't found), and '--version' was 87 | # passed; such an option is passed most likely to detect whether the 88 | # program is present and works. 89 | case $2 in --version|--help) exit $st;; esac 90 | 91 | # Exit code 63 means version mismatch. This often happens when the user 92 | # tries to use an ancient version of a tool on a file that requires a 93 | # minimum version. 94 | if test $st -eq 63; then 95 | msg="probably too old" 96 | elif test $st -eq 127; then 97 | # Program was missing. 98 | msg="missing on your system" 99 | else 100 | # Program was found and executed, but failed. Give up. 101 | exit $st 102 | fi 103 | 104 | perl_URL=http://www.perl.org/ 105 | flex_URL=http://flex.sourceforge.net/ 106 | gnu_software_URL=http://www.gnu.org/software 107 | 108 | program_details () 109 | { 110 | case $1 in 111 | aclocal|automake) 112 | echo "The '$1' program is part of the GNU Automake package:" 113 | echo "<$gnu_software_URL/automake>" 114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115 | echo "<$gnu_software_URL/autoconf>" 116 | echo "<$gnu_software_URL/m4/>" 117 | echo "<$perl_URL>" 118 | ;; 119 | autoconf|autom4te|autoheader) 120 | echo "The '$1' program is part of the GNU Autoconf package:" 121 | echo "<$gnu_software_URL/autoconf/>" 122 | echo "It also requires GNU m4 and Perl in order to run:" 123 | echo "<$gnu_software_URL/m4/>" 124 | echo "<$perl_URL>" 125 | ;; 126 | esac 127 | } 128 | 129 | give_advice () 130 | { 131 | # Normalize program name to check for. 132 | normalized_program=`echo "$1" | sed ' 133 | s/^gnu-//; t 134 | s/^gnu//; t 135 | s/^g//; t'` 136 | 137 | printf '%s\n' "'$1' is $msg." 138 | 139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140 | case $normalized_program in 141 | autoconf*) 142 | echo "You should only need it if you modified 'configure.ac'," 143 | echo "or m4 files included by it." 144 | program_details 'autoconf' 145 | ;; 146 | autoheader*) 147 | echo "You should only need it if you modified 'acconfig.h' or" 148 | echo "$configure_deps." 149 | program_details 'autoheader' 150 | ;; 151 | automake*) 152 | echo "You should only need it if you modified 'Makefile.am' or" 153 | echo "$configure_deps." 154 | program_details 'automake' 155 | ;; 156 | aclocal*) 157 | echo "You should only need it if you modified 'acinclude.m4' or" 158 | echo "$configure_deps." 159 | program_details 'aclocal' 160 | ;; 161 | autom4te*) 162 | echo "You might have modified some maintainer files that require" 163 | echo "the 'autom4te' program to be rebuilt." 164 | program_details 'autom4te' 165 | ;; 166 | bison*|yacc*) 167 | echo "You should only need it if you modified a '.y' file." 168 | echo "You may want to install the GNU Bison package:" 169 | echo "<$gnu_software_URL/bison/>" 170 | ;; 171 | lex*|flex*) 172 | echo "You should only need it if you modified a '.l' file." 173 | echo "You may want to install the Fast Lexical Analyzer package:" 174 | echo "<$flex_URL>" 175 | ;; 176 | help2man*) 177 | echo "You should only need it if you modified a dependency" \ 178 | "of a man page." 179 | echo "You may want to install the GNU Help2man package:" 180 | echo "<$gnu_software_URL/help2man/>" 181 | ;; 182 | makeinfo*) 183 | echo "You should only need it if you modified a '.texi' file, or" 184 | echo "any other file indirectly affecting the aspect of the manual." 185 | echo "You might want to install the Texinfo package:" 186 | echo "<$gnu_software_URL/texinfo/>" 187 | echo "The spurious makeinfo call might also be the consequence of" 188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189 | echo "want to install GNU make:" 190 | echo "<$gnu_software_URL/make/>" 191 | ;; 192 | *) 193 | echo "You might have modified some files without having the proper" 194 | echo "tools for further handling them. Check the 'README' file, it" 195 | echo "often tells you about the needed prerequisites for installing" 196 | echo "this package. You may also peek at any GNU archive site, in" 197 | echo "case some other package contains this missing '$1' program." 198 | ;; 199 | esac 200 | } 201 | 202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \ 203 | -e '2,$s/^/ /' >&2 204 | 205 | # Propagate the correct exit status (expected to be 127 for a program 206 | # not found, 63 for a program that failed due to version mismatch). 207 | exit $st 208 | 209 | # Local variables: 210 | # eval: (add-hook 'write-file-hooks 'time-stamp) 211 | # time-stamp-start: "scriptversion=" 212 | # time-stamp-format: "%:y-%02m-%02d.%02H" 213 | # time-stamp-time-zone: "UTC" 214 | # time-stamp-end: "; # UTC" 215 | # End: 216 | -------------------------------------------------------------------------------- /solaris/package/sol8-sparc/build: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | /usr/bin/pkgmk -o 4 | 5 | CUR_DIR=`pwd` 6 | 7 | FILE=xmlstarlet 8 | PKG=SFxmlstar 9 | VERSION=`/usr/bin/pkgparam -d /var/spool/pkg SFxmlstar VERSION` 10 | ARCH=`/usr/bin/pkgparam -d /var/spool/pkg SFxmlstar ARCH` 11 | OS=sol8 12 | BASE=local 13 | FULL_FILE=${FILE}-${VERSION}-${OS}-${ARCH}-${BASE} 14 | 15 | /usr/bin/pkgtrans -s /var/spool/pkg ${CUR_DIR}/${FULL_FILE} ${PKG} 16 | 17 | /usr/bin/gzip ${FULL_FILE} 18 | 19 | -------------------------------------------------------------------------------- /solaris/package/sol8-sparc/pkginfo: -------------------------------------------------------------------------------- 1 | # $Id: pkginfo.in,v 1.1 2003/05/10 23:21:06 mgrouch Exp $ 2 | 3 | PKG=SFxmlstar 4 | NAME="xmlstarlet Command Line XML Toolkit" 5 | ARCH=sparc 6 | VERSION=1.6.1 7 | MAXINST=1 8 | CATEGORY=application 9 | DESC="XmlStarlet Command Line XML Toolkit" 10 | CLASSES=none 11 | VENDOR="http://xmlstar.sourceforge.net/" 12 | BASEDIR=/usr/local 13 | 14 | -------------------------------------------------------------------------------- /solaris/package/sol8-sparc/pkginfo.in: -------------------------------------------------------------------------------- 1 | # $Id: pkginfo.in,v 1.1 2003/05/10 23:21:06 mgrouch Exp $ 2 | 3 | PKG=SFxmlstar 4 | NAME="xmlstarlet Command Line XML Toolkit" 5 | ARCH=sparc 6 | VERSION=@VERSION@ 7 | MAXINST=1 8 | CATEGORY=application 9 | DESC="XmlStarlet Command Line XML Toolkit" 10 | CLASSES=none 11 | VENDOR="http://xmlstar.sourceforge.net/" 12 | BASEDIR=/usr/local 13 | 14 | -------------------------------------------------------------------------------- /solaris/package/sol8-sparc/prototype: -------------------------------------------------------------------------------- 1 | i pkginfo 2 | d none bin ? ? ? 3 | d none man ? ? ? 4 | d none man/man1 ? ? ? 5 | f none bin/xml=../../../src/xml 0755 root bin 6 | f none man/man1/xmlstarlet.1=../../../doc/xmlstarlet.1 0644 root bin 7 | 8 | -------------------------------------------------------------------------------- /solaris/package/sol9-sparc/build: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | /usr/bin/pkgmk -o 4 | 5 | CUR_DIR=`pwd` 6 | 7 | FILE=xmlstarlet 8 | PKG=SFxmlstar 9 | VERSION=`/usr/bin/pkgparam -d /var/spool/pkg SFxmlstar VERSION` 10 | ARCH=`/usr/bin/pkgparam -d /var/spool/pkg SFxmlstar ARCH` 11 | OS=sol9 12 | BASE=local 13 | FULL_FILE=${FILE}-${VERSION}-${OS}-${ARCH}-${BASE} 14 | 15 | /usr/bin/pkgtrans -s /var/spool/pkg ${CUR_DIR}/${FULL_FILE} ${PKG} 16 | 17 | /usr/bin/gzip ${FULL_FILE} 18 | 19 | -------------------------------------------------------------------------------- /solaris/package/sol9-sparc/pkginfo: -------------------------------------------------------------------------------- 1 | # $Id: pkginfo.in,v 1.1 2004/02/05 03:02:31 mgrouch Exp $ 2 | 3 | PKG=SFxmlstar 4 | NAME="xmlstarlet Command Line XML Toolkit" 5 | ARCH=sparc 6 | VERSION=1.6.1 7 | MAXINST=1 8 | CATEGORY=application 9 | DESC="XmlStarlet Command Line XML Toolkit" 10 | CLASSES=none 11 | VENDOR="http://xmlstar.sourceforge.net/" 12 | BASEDIR=/usr/local 13 | 14 | -------------------------------------------------------------------------------- /solaris/package/sol9-sparc/pkginfo.in: -------------------------------------------------------------------------------- 1 | # $Id: pkginfo.in,v 1.1 2004/02/05 03:02:31 mgrouch Exp $ 2 | 3 | PKG=SFxmlstar 4 | NAME="xmlstarlet Command Line XML Toolkit" 5 | ARCH=sparc 6 | VERSION=@VERSION@ 7 | MAXINST=1 8 | CATEGORY=application 9 | DESC="XmlStarlet Command Line XML Toolkit" 10 | CLASSES=none 11 | VENDOR="http://xmlstar.sourceforge.net/" 12 | BASEDIR=/usr/local 13 | 14 | -------------------------------------------------------------------------------- /solaris/package/sol9-sparc/prototype: -------------------------------------------------------------------------------- 1 | i pkginfo 2 | d none bin ? ? ? 3 | d none man ? ? ? 4 | d none man/man1 ? ? ? 5 | f none bin/xml=../../../src/xml 0755 root bin 6 | f none man/man1/xmlstarlet.1=../../../doc/xmlstarlet.1 0644 root bin 7 | 8 | -------------------------------------------------------------------------------- /src/c14n-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: XML canonicalization 2 | Usage: PROG c14n [--net] [] [] 3 | where 4 | - input XML document file name (stdin is used if '-') 5 | - XML file containing XPath expression for 6 | c14n XML canonicalization 7 | Example: 8 | 9 | 10 | (//. | //@* | //namespace::*)[ancestor-or-self::n1:elem1] 11 | 12 | 13 | - the list of inclusive namespace prefixes 14 | (only for exclusive canonicalization) 15 | Example: 'n1 n2' 16 | 17 | is one of following: 18 | --with-comments XML file canonicalization w comments (default) 19 | --without-comments XML file canonicalization w/o comments 20 | --exc-with-comments Exclusive XML file canonicalization w comments 21 | --exc-without-comments Exclusive XML file canonicalization w/o comments 22 | 23 | -------------------------------------------------------------------------------- /src/depyx-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: Convert PYX into XML 2 | Usage: PROG p2x [] 3 | where 4 | - input PYX document file name (stdin is used if missing) 5 | 6 | The PYX format is a line-oriented representation of 7 | XML documents that is derived from the SGML ESIS format. 8 | (see ESIS - ISO 8879 Element Structure Information Set spec, 9 | ISO/IEC JTC1/SC18/WG8 N931 (ESIS)) 10 | 11 | -------------------------------------------------------------------------------- /src/edit-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: Edit XML document(s) 2 | Usage: PROG ed {} [ ... ] 3 | where 4 | - global options for editing 5 | - input XML document file name/uri (stdin otherwise) 6 | 7 | are: 8 | -P, or -S - preserve whitespace nodes. 9 | (or --pf, --ps) Note that space between attributes is not preserved 10 | -O (or --omit-decl) - omit XML declaration () 11 | -L (or --inplace) - edit file inplace 12 | -N = - predefine namespaces (name without 'xmlns:') 13 | ex: xsql=urn:oracle-xsql 14 | Multiple -N options are allowed. 15 | -N options must be last global options. 16 | --net - allow network access 17 | --help or -h - display help 18 | 19 | where 20 | -d or --delete 21 | --var 22 | -i or --insert -t (--type) elem|text|attr -n [-v (--value) ] 23 | -a or --append -t (--type) elem|text|attr -n [-v (--value) ] 24 | -s or --subnode -t (--type) elem|text|attr -n [-v (--value) ] 25 | -m or --move 26 | -r or --rename -v 27 | -u or --update -v (--value) 28 | -x (--expr) 29 | 30 | -------------------------------------------------------------------------------- /src/elem-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: Display element structure of XML document 2 | Usage: PROG el [] 3 | where 4 | - input XML document file name (stdin is used if missing) 5 | is one of: 6 | -a - show attributes as well 7 | -v - show attributes and their values 8 | -u - print out sorted unique lines 9 | -d - print out sorted unique lines up to depth 10 | 11 | -------------------------------------------------------------------------------- /src/escape-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: Escape special XML characters 2 | Usage: PROG esc [] [] 3 | where are 4 | --help - print usage 5 | (TODO: more to be added in future) 6 | if is missing stdin is used instead. 7 | 8 | -------------------------------------------------------------------------------- /src/escape.h: -------------------------------------------------------------------------------- 1 | /* $Id: escape.h,v 1.2 2005/03/12 03:24:23 mgrouch Exp $ */ 2 | 3 | #ifndef __ESCAPE_H 4 | #define __ESCAPE_H 5 | 6 | /* 7 | 8 | XMLStarlet: Command Line Toolkit to query/edit/check/transform XML documents 9 | 10 | Copyright (c) 2004 Mikhail Grushinskiy. All Rights Reserved. 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | 19 | The above copyright notice and this permission notice shall be included in 20 | all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | THE SOFTWARE. 29 | 30 | */ 31 | 32 | typedef enum { 33 | XML_C14N_NORMALIZE_ATTR = 0, 34 | XML_C14N_NORMALIZE_COMMENT = 1, 35 | XML_C14N_NORMALIZE_PI = 2, 36 | XML_C14N_NORMALIZE_TEXT = 3, 37 | XML_C14N_NORMALIZE_NOTHING = 4 38 | } xml_C14NNormalizationMode; 39 | 40 | extern xmlChar *xml_C11NNormalizeString(const xmlChar * input, 41 | xml_C14NNormalizationMode mode); 42 | 43 | #define xml_C11NNormalizeAttr( a ) \ 44 | xml_C11NNormalizeString((a), XML_C14N_NORMALIZE_ATTR) 45 | #define xml_C11NNormalizeComment( a ) \ 46 | xml_C11NNormalizeString((a), XML_C14N_NORMALIZE_COMMENT) 47 | #define xml_C11NNormalizePI( a ) \ 48 | xml_C11NNormalizeString((a), XML_C14N_NORMALIZE_PI) 49 | #define xml_C11NNormalizeText( a ) \ 50 | xml_C11NNormalizeString((a), XML_C14N_NORMALIZE_TEXT) 51 | 52 | #endif /* __ESCAPE_H */ 53 | -------------------------------------------------------------------------------- /src/format-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: Format XML document 2 | Usage: PROG fo [] 3 | where are 4 | -n or --noindent - do not indent 5 | -t or --indent-tab - indent output with tabulation 6 | -s or --indent-spaces - indent output with spaces 7 | -o or --omit-decl - omit xml declaration 8 | --net - allow network access 9 | -R or --recover - try to recover what is parsable 10 | -D or --dropdtd - remove the DOCTYPE of the input docs 11 | -C or --nocdata - replace cdata section with text nodes 12 | -N or --nsclean - remove redundant namespace declarations 13 | -e or --encode - output in the given encoding (utf-8, unicode...) 14 | #ifdef LIBXML_HTML_ENABLED 15 | -H or --html - input is HTML 16 | #endif 17 | -h or --help - print help 18 | 19 | -------------------------------------------------------------------------------- /src/ls-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: List directory as XML 2 | Usage: PROG ls [ | --help ] 3 | Lists current directory in XML format. 4 | Time is shown per ISO 8601 spec. 5 | 6 | -------------------------------------------------------------------------------- /src/pyx-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: Convert XML into PYX format (based on ESIS - ISO 8879) 2 | Usage: PROG pyx {} 3 | where 4 | - input XML document file name (stdin is used if missing) 5 | 6 | The PYX format is a line-oriented representation of 7 | XML documents that is derived from the SGML ESIS format. 8 | (see ESIS - ISO 8879 Element Structure Information Set spec, 9 | ISO/IEC JTC1/SC18/WG8 N931 (ESIS)) 10 | 11 | A non-validating, ESIS generating tool originally developed for 12 | pyxie project (see http://pyxie.sourceforge.net/) 13 | ESIS Generation by Sean Mc Grath http://www.digitome.com/sean.html 14 | 15 | -------------------------------------------------------------------------------- /src/select-usage.txt: -------------------------------------------------------------------------------- 1 | XMLStarlet Toolkit: Select from XML document(s) 2 | Usage: PROG sel {