xml.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 10 Feb 2018 01:28:53 +0200
changeset 2227 1e9323e7ec88
parent 1912 8b81a8f0f692
child 2230 9e6ad6607a9e
permissions -rw-r--r--
Removed files: I don't longer have interest on topic.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
     1
.. -*- coding: utf-8; -*-
1277
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
======
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
 XML.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
======
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
     6
.. contents::
1905
fba288d59662 Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1489
diff changeset
     7
   :local:
1277
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
About XML.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
==========
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
 * http://xmlhack.ru
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
 * http://microformats.org/wiki/namespaces-considered-harmful
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
1409
33a935b7eabc Converting between schema formants.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    15
Converting between schema formants.
33a935b7eabc Converting between schema formants.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    16
===================================
33a935b7eabc Converting between schema formants.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    17
::
33a935b7eabc Converting between schema formants.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    18
33a935b7eabc Converting between schema formants.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    19
  $ man trang
33a935b7eabc Converting between schema formants.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    20
  trang [-I rng|rnc|dtd|xml] [-O rng|rnc|dtd|xsd] $input $output
33a935b7eabc Converting between schema formants.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    21
1444
0573e369b571 xsdtorngconverter
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
    22
See:
0573e369b571 xsdtorngconverter
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
    23
0573e369b571 xsdtorngconverter
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
    24
  http://code.google.com/p/xsdtorngconverter/
0573e369b571 xsdtorngconverter
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
    25
                That XSLT transformation converts a XSD schema to RelaxNG.
0573e369b571 xsdtorngconverter
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
    26
1277
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
relaxng-mode.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
=============
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  http://www.pantor.com/download.html
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
                RNC Emacs Mode (home page)
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
  http://www.emacswiki.org/emacs/RELAX_NG
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
                Emacs wili.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
  http://www.relaxng.org/compact-tutorial-20030326.html
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
                relaxng compact syntax tutorial
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
utilities for processing xml.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
=============================
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
xmlstar.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
--------
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
XMLStarlet is a set of command line utilities (tools) which can be used to transform,
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
query, validate, and edit XML documents and files using simple set of shell commands in
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
similar way it is done for plain text files using UNIX grep, sed, awk, diff, patch, join,
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
etc.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
  http://xmlstar.sourceforge.net/overview.php
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
                home page
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
Cygwin.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
-------
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
::
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
  cmd# setup.exe -p libxml2,libxslt
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
``libxslt`` provide ``xsltproc``, ``libxml2`` provide ``xmlcatalog`` and
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
``xmllint``.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
XPath query from CLI.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
---------------------
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
::
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
  $ xmllint --xpath $XPATH file.xml
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
Microformats.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
=============
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
  http://microformats.org/about
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
XML encoding.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
=============
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
  http://www.ietf.org/rfc/rfc3023.txt
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
                XML Media Types
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
  http://www.xml.com/pub/a/2004/07/21/dive.html
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
                XML on the Web Has Failed
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
Validation of xml files.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
========================
1489
1668fc8198e1 Validation of xml files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1444
diff changeset
    81
::
1668fc8198e1 Validation of xml files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1444
diff changeset
    82
1668fc8198e1 Validation of xml files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1444
diff changeset
    83
  $ jing schema.rng in.xml
1668fc8198e1 Validation of xml files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1444
diff changeset
    84
  $ xmllint --relaxng schema.rng in.xml
1668fc8198e1 Validation of xml files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1444
diff changeset
    85
1668fc8198e1 Validation of xml files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1444
diff changeset
    86
See:
1277
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
  http://infohost.nmt.edu/tcc/help/xml/lint.html
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
                xmllint: A validator for XML files
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
  http://www.cogsci.ed.ac.uk/~richard/rxp.html
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
                RXP - an XML parser available under the GPL
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
Validating using the DOCTYPE.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
-----------------------------
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
::
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
  $ xmllint --valid --noout file.xml
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
Validating against a specific DTD.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
----------------------------------
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
::
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
  $ xmllint --noout --dtdvalid URL file.xml
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
Validating against a Relax NG schema.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
-------------------------------------
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
::
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
  $ xmllint --noout --relaxng schema.rng file.xml
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
If your schema is in Compact Format, you can use the trang program to convert
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
it to RNG format::
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
  $ trang file.rnc file.rng
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
Validating against XSchema.
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
---------------------------
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   118
::
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
  $ xmllint --noout --schema schema.xsd file.xml
c3af4a7b5ec3 RXP - an XML parser available under the GPL
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121