Struct Writer
Component that outputs XML data to an OutputRange
.
To format the XML data, it calls specific methods of the PrettyPrinter
, if
they are defined. Otherwise, it just prints the data with the minimal markup required.
The currently available format callbacks are:
beforeNode
, called as the first operation of outputting every XML node; expected to return a string to be printed before the nodeafterNode
, called as the last operation of outputting every XML node; expected to return a string to be printed after the nodeincreaseLevel
, called after the start of a node that may have children (like a start tag or a doctype with an internal subset)decreaseLevel
, called before the end of a node that had some children (i.e. before writing a closing tag or the end of a doctype with an internal subset)beforeAttributeName
, called to obtain a string to be used as spacing between the tag name and the first attribute name and between the attribute value and the name of the next attribute; it is not used between the value of the last attribute and the closing>
, nor between the tag name and the closing>
if the element has no attributesbeforeElementEnd
, called to obtain a string to be used as spacing before the closing>
of a tag, that is after the last attribute name or after the tag name if the element has no attributesafterAttributeName
, called to obtain a string to be used as spacing between the name of an attribute and the=
signbeforeAttributeValue
, called to obtain a string to be used as spacing between the=
sign and the value of an attributeformatAttribute(outputRange, attibuteValue)
, called to write out the value of an attributeformatAttribute(attributeValue)
, called to obtain a string that represents the formatted attribute to be printed; used when the previous method is not definedattributeDelimiter
, called to obtain a string that represents the delimiter to be used when writing attributes; used when the previous two methods are not defined; in this case the attribute is not subject to any formatting, except prepending and appending the string returned by this methodafterCommentStart
, called to obtain a string that represents the spacing to be used between the<!--
opening and the comment contentsbeforeCommentEnd
, called to obtain a string that represents the spacing to be used between the comment contents and the closing-->
betweenPITargetData
, called to obtain a string to be used as spacing between the target and data of a processing instructionbeforePIEnd
, called to obtain a string to be used as spacing between the processing instruction data and the closing?>
Template arguments
struct Writer(_StringType, alias OutRange, alias PrettyPrinter);
Methods
Name | Description |
---|---|
writeCDATA
|
Outputs a CDATA section with the given content. |
writeComment
|
Outputs a comment with the given content. |
writeProcessingInstruction
|
Outputs a processing instruction with the given target and data. |
writeText
|
Outputs a text node with the given content. |
writeXMLDeclaration
|
Outputs an XML declaration. |