Skip to main content

Module xml

Module xml 

Source
Expand description

XML-specific contextual output encoders.

provides XML aliases for the HTML encoders, plus XML-only contexts:

§XML 1.0 aliases

§XML-only contexts

§XML 1.1

§security notes

  • for_xml_comment is 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_cdata splits CDATA sections to prevent premature closing. the caller is responsible for wrapping the output in <![CDATA[...]]>.

Functions§

for_cdata
encodes input for safe embedding in an XML CDATA section.
for_xml
encodes input for safe embedding in XML text content and quoted attributes.
for_xml11
encodes input for safe embedding in XML 1.1 text content and quoted attributes.
for_xml11_attribute
encodes input for safe embedding in a quoted XML 1.1 attribute value.
for_xml11_content
encodes input for safe embedding in XML 1.1 text content only.
for_xml_attribute
encodes input for safe embedding in a quoted XML attribute value.
for_xml_comment
encodes input for safe embedding in an XML comment (<!-- ... -->).
for_xml_content
encodes input for safe embedding in XML text content only.
write_cdata
writes the CDATA-encoded form of input to out.
write_xml
writes the XML-encoded form of input to out.
write_xml11
writes the XML-1.1-encoded form of input to out.
write_xml11_attribute
writes the XML-1.1-attribute-encoded form of input to out.
write_xml11_content
writes the XML-1.1-content-encoded form of input to out.
write_xml_attribute
writes the XML-attribute-encoded form of input to out.
write_xml_comment
writes the XML-comment-encoded form of input to out.
write_xml_content
writes the XML-content-encoded form of input to out.