dxml.util

This module contains helper functions which aren't specific to the parser, the DOM, or the writer.

SymbolDescription
decodeXMLTakes a range of characters, strips carriage returns from it, and converts both character references and the predefined entity references in the range into the characters that they refer to.
asDecodedXMLThe version of decodeXML that returns a lazy range.
parseCharRefParses a character reference from the front of a range of characters.
parseStdEntityRefParses one of the predefined entity references from the start of a range of characters.
stripIndentRemoves the indent from the front of each line of a range of characters that was XML text which was formatted for human-readability.
withoutIndentThe version of stripIndent that returns a lazy range.
StdEntityRefEnum containing the string representations of the five, predefined entity references.
encodeTextEncodes characters which cannot appear in EntityType.text in their literal form.
encodeAttrEncodes characters which cannot appear in the attribute value of an element start tag in their literal form.
encodeCharRefEncodes a character as a character reference.

Members

Enums

StdEntityRef
enum StdEntityRef

The string representations of the five, entity references predefined by the XML spec.

Functions

asDecodedXML
auto asDecodedXML(R range)

Decodes any XML character references and standard XML entity references in the text as well as removing any carriage returns. It's intended to be used on the text fields of element tags and on the values of start tag attributes.

decodeXML
string decodeXML(R range)

Decodes any XML character references and standard XML entity references in the text as well as removing any carriage returns. It's intended to be used on the text fields of element tags and on the values of start tag attributes.

encodeAttr
auto encodeAttr(R text)

Returns a lazy range of code units which encodes any characters which cannot be put in an attribute value of an element tag in their literal form.

encodeCharRef
auto encodeCharRef(dchar c)

Returns a range of $(K_CHAR) containing the character reference corresponding to the given character.

encodeText
auto encodeText(R text)

Returns a lazy range of code units which encodes any characters which cannot be put in an dxml.parser.EntityType._text in their literal form.

parseCharRef
Nullable!dchar parseCharRef(ref R range)

If the given range starts with a valid, XML, character reference, it is removed from the range, and the corresponding character is returned.

parseStdEntityRef
Nullable!dchar parseStdEntityRef(ref R range)

This parses one of the five, predefined entity references mention in the XML spec from the front of a range of characters.

stripIndent
string stripIndent(R range)
withoutIndent
auto withoutIndent(R range)

Strips the indent from a character range (most likely from Entity.text). The idea is that if the XML is formatted to be human-readable, and it's multiple lines long, the lines are likely to be indented, but the application probably doesn't want that extra whitespace. So, stripIndent and withoutIndent attempt to intelligently strip off the leading whitespace.

See Also

Meta

Source

See Source File
$(LINK_TO_SRC dxml/_util.d)