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, multilingual is not supported

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

Call parameters:

  • source : String, specify the xml/html text 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 an XmlDocument object, which will be converted according to the specified language during parsing

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

Call parameters:

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

Return result:


serialize

Serialize XmlNode to string

1
static String xml.serialize(XmlNode node);

Call parameters:

Return result:

  • String , returns the serialized string

constant

ELEMENT_NODE

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

1
const xml.ELEMENT_NODE = 1;

ATTRIBUTE_NODE

The nodeType attribute constant of XmlNode , indicating that the node is an XmlAttr object

1
const xml.ATTRIBUTE_NODE = 2;

TEXT_NODE

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

1
const xml.TEXT_NODE = 3;

CDATA_SECTION_NODE

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

1
const xml.CDATA_SECTION_NODE = 4;

PROCESSING_INSTRUCTION_NODE

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

1
const xml.PROCESSING_INSTRUCTION_NODE = 7;

COMMENT_NODE

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

1
const xml.COMMENT_NODE = 8;

DOCUMENT_NODE

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

1
const xml.DOCUMENT_NODE = 9;

DOCUMENT_TYPE_NODE

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

1
const xml.DOCUMENT_TYPE_NODE = 10;