Module basic module

Module xml

xml processing module

Object

Document

xml document object, see XmlDocument Object

1
XmlDocument xml.Document;

Static function

parse

Parse xml/html text and create XmlDocument Object, does not support multilingual

1 2
static XmlDocument xml.parse(String source, String type = "text/xml");

Call parameters:

  • source: String, specify the xml/html text that needs to be parsed
  • type: String, specify the text type, the default is text/xml, can also be specified as text/html

Return result:


Parse xml/html and create XmlDocument Object, it will be converted according to the specified language when parsing

1 2
static XmlDocument xml.parse(Buffer source, String type = "text/xml");

Call parameters:

  • source: Buffer, Specify the xml/html binary data that needs to be parsed
  • type: String, specify the text type, the default is text/xml, can also be specified as text/html

Return result:


serialize

Serialization XmlNode As a string

1
static String xml.serialize(XmlNode node);

Call parameters:

Return result:

  • String, Returns the serialized string

constant

ELEMENT_NODE

XmlNode The constant of the nodeType property, indicating that the node is XmlElement Object

1
const xml.ELEMENT_NODE = 1;

ATTRIBUTE_NODE

XmlNode The constant of the nodeType property, indicating that the node is XmlAttr Object

1
const xml.ATTRIBUTE_NODE = 2;

TEXT_NODE

XmlNode The constant of the nodeType property, indicating that the node is XmlText Object

1
const xml.TEXT_NODE = 3;

CDATA_SECTION_NODE

XmlNode The constant of the nodeType property, indicating that the node is XmlCDATASection Object

1
const xml.CDATA_SECTION_NODE = 4;

PROCESSING_INSTRUCTION_NODE

XmlNode The constant of the nodeType property, indicating that the node is XmlProcessingInstruction Object

1
const xml.PROCESSING_INSTRUCTION_NODE = 7;

COMMENT_NODE

XmlNode The constant of the nodeType property, indicating that the node is XmlComment Object

1
const xml.COMMENT_NODE = 8;

DOCUMENT_NODE

XmlNode The constant of the nodeType property, indicating that the node is XmlDocument Object

1
const xml.DOCUMENT_NODE = 9;

DOCUMENT_TYPE_NODE

XmlNode The constant of the nodeType property, indicating that the node is XmlDocumentType Object

1
const xml.DOCUMENT_TYPE_NODE = 10;