..
/
download
.\" Automatically generated by Pandoc 2.3.1
.\"
.TH "xml\-highlight" "1" "2020\-07\-07" "" "xml\-utils"
.hy
.SH NAME
.PP
xml\-highlight \- Highlight syntax in XML documents
.SH SYNOPSIS
.IP
.nf
\f[C]
xml\-highlight\ [options]\ [<document>...]
\f[]
.fi
.SH DESCRIPTION
.PP
The \f[I]xml\-highlight\f[] tool adds syntax highlighting to program
listings in an XML document.
By default this is accomplished by wrapping detected syntax in XSL\-FO
inline elements with the proper namespace to allow a stylesheet to pass
them through to the final FO processor.
The actual elements used can be customized, however.
.PP
To enable highlighting on text in an element, include the processing
instruction \f[C]<?language\ ...?>\f[] in the element, where
\f[C]\&...\f[] is the name of the language.
.SH OPTIONS
.TP
.B \-c, \-\-classes <classes>
Use a custom class definitions file.
.RS
.RE
.TP
.B \-f, \-\-overwrite
Overwrite input XML file(s) instead of outputting to stdout.
.RS
.RE
.TP
.B \-h, \-?, \-\-help
Show help/usage message.
.RS
.RE
.TP
.B \-s, \-\-syntax <syntax>
Use a custom syntax definitions file.
.RS
.RE
.TP
.B \-\-version
Show version information.
.RS
.RE
.PP
In addition, the following options allow configuration of the XML
parser:
.TP
.B \-\-dtdload
Load the external DTD.
.RS
.RE
.TP
.B \-\-huge
Remove any internal arbitrary parser limits.
.RS
.RE
.TP
.B \-\-net
Allow network access to load external DTD and entities.
.RS
.RE
.TP
.B \-\-noent
Resolve entities.
.RS
.RE
.TP
.B \-\-xinclude
Do XInclude processing.
.RS
.RE
.TP
.B \-\-xml\-catalog <file>
Use an XML catalog when resolving entities.
Multiple catalogs may be loaded by specifying this option multiple
times.
.RS
.RE
.SH CLASS FILE FORMAT
.PP
The following describes the format of the custom class file specified
with \-c.
.SS Classes
.PP
\f[I]Markup element:\f[] <\f[C]classes\f[]>
.PP
\f[I]Attributes:\f[]
.IP \[bu] 2
None
.PP
\f[I]Child elements:\f[]
.IP \[bu] 2
<\f[C]class\f[]>
.SS Class
.PP
Represents a type of syntax and how it should be highlighted.
This element can also occur within the \f[C]syntax\f[] element or within
a particular \f[C]language\f[] element, in which case it is specific to
that language.
.PP
\f[I]Markup element:\f[] <\f[C]class\f[]>
.PP
\f[I]Attributes:\f[]
.IP \[bu] 2
\f[C]id\f[], the identifier of the class.
.PP
\f[I]Child elements:\f[]
.PP
The element \f[C]class\f[] contains one child element of any kind, which
any matching syntax will be wrapped in to.
.SS Example custom classes file
.IP
.nf
\f[C]
<classes\ xmlns:fo="http://www.w3.org/1999/XSL/Format">
<class\ id="type">
<fo:inline\ color="green"/>
</class>
<class\ id="control">
<fo:inline\ color="blue"/>
</class>
<class\ id="string">
<fo:inline\ color="red"/>
</class>
<class\ id="comment">
<fo:inline\ color="pink"/>
</class>
</classes>
\f[]
.fi
.SH SYNTAX FILE FORMAT
.PP
The following describes the format of the custom syntax file specified
with \-s.
.SS Syntax
.PP
\f[I]Markup element:\f[] <\f[C]syntax\f[]>
.PP
\f[I]Attributes:\f[]
.IP \[bu] 2
None
.PP
\f[I]Child elements:\f[]
.IP \[bu] 2
\f[C]class\f[]
.IP \[bu] 2
\f[C]language\f[]
.SS Language
.PP
Describes the syntax of a particular language.
.PP
\f[I]Markup element:\f[] <\f[C]language\f[]>
.PP
\f[I]Attributes:\f[]
.IP \[bu] 2
\f[C]name\f[], the identifier of the language.
.IP \[bu] 2
\f[C]caseInsensitive\f[], indicates whether keywords are
case\-insensitive in this language, with one of the following values:
.RS 2
.IP \[bu] 2
\f[C]"no"\f[] \- Keywords are case\-sensitive (default)
.IP \[bu] 2
\f[C]"yes"\f[] \- Keywords are case\-insensitive
.RE
.PP
\f[I]Child elements:\f[]
.IP \[bu] 2
<\f[C]class\f[]>
.IP \[bu] 2
<\f[C]area\f[]>
.IP \[bu] 2
<\f[C]keyword\f[]>
.SS Area
.PP
Matches a section of delimited text, such as strings, comments, etc.
.PP
\f[I]Markup element:\f[] <\f[C]area\f[]>
.PP
\f[I]Attributes:\f[]
.IP \[bu] 2
\f[C]start\f[], the opening delimiter.
.IP \[bu] 2
\f[C]end\f[], the closing delimiter.
.IP \[bu] 2
\f[C]class\f[], reference to the \f[C]class\f[] element to use for this
area.
.PP
\f[I]Child elements:\f[]
.PP
If attribute \f[C]class\f[] is not used, this element can contain one
element of any kind, in which the text matching the area will be
wrapped.
.SS Keyword
.PP
Matches a particular keyword.
.PP
\f[I]Markup element:\f[] <\f[C]keyword\f[]>
.PP
\f[I]Attributes:\f[]
.IP \[bu] 2
\f[C]match\f[], the keyword to match.
.IP \[bu] 2
\f[C]class\f[], reference to the \f[C]class\f[] element to use for this
keyword.
.PP
\f[I]Child elements:\f[]
.PP
If attribute \f[C]class\f[] is not used, this element can contain one
element of any kind, in which the text matching the keyword will be
wrapped.
.SS Example custom syntax file
.IP
.nf
\f[C]
<syntax>
<language\ name="c">
<area\ start="""\ end="""\ class="string"/>
<area\ start="/*"\ end="*/"\ class="comment"/>
<keyword\ match="if"\ class="control"/>
<keyword\ match="else"\ class="control"/>
<keyword\ match="int"\ class="type"/>
<keyword\ match="char"\ class="type"/>
</language>
</syntax>
\f[]
.fi
.SH BUILT\-IN LANGUAGES
.PP
The following is a list of language syntaxes currently built\-in to the
tool:
.IP \[bu] 2
c
.IP \[bu] 2
csharp
.IP \[bu] 2
go
.IP \[bu] 2
java
.IP \[bu] 2
javascript
.IP \[bu] 2
pascal
.IP \[bu] 2
python
.IP \[bu] 2
ruby
.IP \[bu] 2
rust
.IP \[bu] 2
sh
.IP \[bu] 2
sql
.IP \[bu] 2
xml
.IP \[bu] 2
xsl
.SH AUTHORS
khzae.net.
gopher://khzae.net/0/s1000d/xml/xml-utils/src/utils/xml-highlight/doc/xml-highlight.1