Skip to main content

Module xml

Module xml 

Source
Expand description

What XML and RDF/XML can actually represent.

Two constraints of the output syntaxes are not expressible in the object model, so nothing upstream of serialization enforces them and every layer downstream assumes them.

Not every character can appear in an XML document. XML 1.0 defines the Char production, and a character outside it — a NUL, a SOH, most of the C0 range — is not merely in need of escaping: there is no representation for it, numeric character reference included. A value carrying one makes the whole document unparseable, and quick-xml neither rejects it on the way in nor notices it on the way out, so a corrupt or mis-encoded source file is the only place one comes from and this is the only place it is caught.

rdf:ID is an XML NCName. IEC 61970-552 identifiers are UUIDs, and _ followed by a UUID is always a valid one — but this crate deliberately keeps non-conforming identifiers verbatim, and a published file may identify an object with anything at all. rdf:ID="_http://host/EQ.xml#Sub1" is well-formed XML, so a well-formedness check cannot see it, and is not valid RDF/XML, so every RDF toolchain rejects it. The writer asks identifier_form which of the two serializations an identifier can carry.

Enums§

IdentifierForm
How an identifier can be written into a CIM/XML document.

Functions§

describe_char
Render a character the way a diagnostic should name it.
find_illegal
The first character of s that XML 1.0 cannot represent, with its byte offset.
has_illegal
Whether s contains a character XML 1.0 cannot represent.
identifier_form
Which serializations id — an identifier stripped of CIM/XML decoration — can carry.
is_absolute_iri
Whether s is an absolute IRI: a scheme, a colon, and something after it.
is_ncname
Whether s is an XML NCName — a Name with no colon.
is_xml_char
Whether c is in XML 1.0’s Char production.
strip_illegal
s with every character XML cannot represent removed.