Expand description
XML-specific contextual output encoders.
provides XML aliases for the HTML encoders, plus XML-only contexts:
§XML 1.0 aliases
for_xml— alias forcrate::for_htmlfor_xml_content— alias forcrate::for_html_contentfor_xml_attribute— alias forcrate::for_html_attribute
§XML-only contexts
for_xml_comment— safe for XML comment contentfor_cdata— safe for CDATA section content
§XML 1.1
for_xml11— XML 1.1 content + attributesfor_xml11_content— XML 1.1 content onlyfor_xml11_attribute— XML 1.1 attributes only
§security notes
for_xml_commentis not safe for HTML comments. HTML comments have vendor-specific extensions (e.g.,<!--[if IE]>) that make safe encoding impractical. this encoder is for XML comments only.for_cdatasplits CDATA sections to prevent premature closing. the caller is responsible for wrapping the output in<![CDATA[...]]>.
Functions§
- for_
cdata - encodes
inputfor safe embedding in an XML CDATA section. - for_xml
- encodes
inputfor safe embedding in XML text content and quoted attributes. - for_
xml11 - encodes
inputfor safe embedding in XML 1.1 text content and quoted attributes. - for_
xml11_ attribute - encodes
inputfor safe embedding in a quoted XML 1.1 attribute value. - for_
xml11_ content - encodes
inputfor safe embedding in XML 1.1 text content only. - for_
xml_ attribute - encodes
inputfor safe embedding in a quoted XML attribute value. - for_
xml_ comment - encodes
inputfor safe embedding in an XML comment (<!-- ... -->). - for_
xml_ content - encodes
inputfor safe embedding in XML text content only. - write_
cdata - writes the CDATA-encoded form of
inputtoout. - write_
xml - writes the XML-encoded form of
inputtoout. - write_
xml11 - writes the XML-1.1-encoded form of
inputtoout. - write_
xml11_ attribute - writes the XML-1.1-attribute-encoded form of
inputtoout. - write_
xml11_ content - writes the XML-1.1-content-encoded form of
inputtoout. - write_
xml_ attribute - writes the XML-attribute-encoded form of
inputtoout. - write_
xml_ comment - writes the XML-comment-encoded form of
inputtoout. - write_
xml_ content - writes the XML-content-encoded form of
inputtoout.