mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-03-28 21:16:20 +01:00
xml: marchersimon requested changes
This commit is contained in:
parent
8815c90985
commit
aa67236fc3
6 changed files with 20 additions and 20 deletions
|
@ -5,23 +5,23 @@
|
|||
|
||||
- Delete elements matching an XPATH from an XML document:
|
||||
|
||||
`xml edit --delete {{"XPATH1"}} {{path/to/input.xml|URI}}`
|
||||
`xml edit --delete "{{XPATH1}}" {{path/to/input.xml|URI}}`
|
||||
|
||||
- Move an element node of an XML document from XPATH1 to XPATH2:
|
||||
|
||||
`xml edit --move {{"XPATH1"}} {{"XPATH2"}} {{path/to/input.xml|URI}}`
|
||||
`xml edit --move "{{XPATH1}}" "{{XPATH2}}" {{path/to/input.xml|URI}}`
|
||||
|
||||
- Rename all attributes named "id" to "ID":
|
||||
|
||||
`xml edit --rename {{"//*/@id"}} -v {{"ID"}} {{path/to/input.xml|URI}}`
|
||||
`xml edit --rename "{{//*/@id}}" -v "{{ID}}" {{path/to/input.xml|URI}}`
|
||||
|
||||
- Rename XML elements of "table" named "rec" to "record":
|
||||
- Rename the XML elements of "table" named "rec" to "record":
|
||||
|
||||
`xml edit --rename {{"/xml/table/rec"}} -v {{"record"}} {{path/to/input.xml|URI}}`
|
||||
`xml edit --rename "{{/xml/table/rec}}" -v "{{record}}" {{path/to/input.xml|URI}}`
|
||||
|
||||
- Update the value of XML table record ID=3 to 5:
|
||||
- Update the XML table record with "id=3" to the value "id=5":
|
||||
|
||||
`xml edit --update {{"xml/table/rec[@id=3]/@id"}} -v {{5}} {{path/to/input.xml|URI}}`
|
||||
`xml edit --update "{{xml/table/rec[@id=3]/@id}}" -v {{5}} {{path/to/input.xml|URI}}`
|
||||
|
||||
- Display help for the `edit` subcommand:
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# xml elements
|
||||
|
||||
> Extract elements and display structure of an XML document.
|
||||
> Extract elements and display the structure of an XML document.
|
||||
> More information: <http://xmlstar.sourceforge.net/docs.php>.
|
||||
|
||||
- Extract elements from an XML document (producing XPATH expressions):
|
||||
|
||||
`xml elements {{path/to/input.xml|URI}} > {{path/to/elements}}`
|
||||
`xml elements {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
|
||||
|
||||
- Extract elements and their attributes from an XML document:
|
||||
|
||||
`xml elements -a {{path/to/input.xml|URI}} > {{path/to/elements}}`
|
||||
`xml elements -a {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
|
||||
|
||||
- Extract elements and their attributes and values from an XML document:
|
||||
|
||||
`xml elements -v {{path/to/input.xml|URI}} > {{path/to/elements}}`
|
||||
`xml elements -v {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
|
||||
|
||||
- Print sorted unique elements from an XML document to see its structure:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# xml list
|
||||
|
||||
> List a directory's contents (like 'ls') in XML format.
|
||||
> List a directory's contents (like `ls`) in XML format.
|
||||
> More information: <http://xmlstar.sourceforge.net/docs.php>.
|
||||
|
||||
- Write the current directory's listing to an XML document:
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
|
||||
- Select all elements matching "XPATH1" and print the value of the element "XPATH2":
|
||||
|
||||
`xml select --template --match {{"XPATH1"}} --value-of {{"XPATH2"}} {{path/to/input.xml|URI}}`
|
||||
`xml select --template --match "{{XPATH1}}" --value-of "{{XPATH2}}" {{path/to/input.xml|URI}}`
|
||||
|
||||
- Match "XPATH1" and print the value of "XPATH2" as text with new-lines:
|
||||
|
||||
`xml select --text --template --match {{"XPATH1"}} --value-of {{"XPATH2"}} --nl {{path/to/input.xml|URI}}`
|
||||
`xml select --text --template --match "{{XPATH1}}" --value-of "{{XPATH2}}" --nl {{path/to/input.xml|URI}}`
|
||||
|
||||
- Count the elements of "XPATH1":
|
||||
|
||||
`xml select --template --value-of "count({{XPATH1}})" {{path/to/input.xml|URI}}`
|
||||
|
||||
- Count all nodes in XML document(s):
|
||||
- Count all nodes in one or more XML documents:
|
||||
|
||||
`xml select --text --template --inp-name --output " " --value-of "count(node())" --nl {{path/to/input1.xml|URI}} {{path/to/input2.xml|URI}}`
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
- Transform an XML document using an XSL stylesheet, passing one XPATH parameter and one literal string parameter:
|
||||
|
||||
`xml transform {{path/to/stylesheet.xsl}} -p {{"Count='count(/xml/table/rec)'"}} -s {{Text="Count="}} {{path/to/input.xml|URI}}`
|
||||
`xml transform {{path/to/stylesheet.xsl}} -p "{{Count='count(/xml/table/rec)'}}" -s {{Text="Count="}} {{path/to/input.xml|URI}}`
|
||||
|
||||
- Display help for the `transform` subcommand:
|
||||
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
> Validate XML documents.
|
||||
> More information: <http://xmlstar.sourceforge.net/docs.php>.
|
||||
|
||||
- Validate XML document(s) for well-formedness only:
|
||||
- Validate one or more XML documents for well-formedness only:
|
||||
|
||||
`xml validate {{path/to/input1.xml|URI}} {{input2.xml ...}}`
|
||||
|
||||
- Validate XML document(s) against a Document Type Definition (DTD):
|
||||
- Validate one or more XML documents against a Document Type Definition (DTD):
|
||||
|
||||
`xml validate --dtd {{path/to/schema.dtd}} {{path/to/input1.xml|URI}} {{input2.xml ...}}`
|
||||
|
||||
- Validate XML document(s) against an XML Schema Definition (XSD):
|
||||
- Validate one or more XML documents against an XML Schema Definition (XSD):
|
||||
|
||||
`xml validate --xsd {{path/to/schema.xsd}} {{path/to/input1.xml|URI}} {{input2.xml ...}}`
|
||||
|
||||
- Validate XML document(s) against a Relax NG schema (RNG):
|
||||
- Validate one or more XML documents against a Relax NG schema (RNG):
|
||||
|
||||
`xml validate --relaxng {{path/to/schema.rng}} {{path/to/input1.xml|URI}} {{input2.xml ...}}`
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue