Reference

Types

EzXML.NodeType

A proxy type to libxml2's node struct.

Properties

NameTypeDescription
typeEzXML.NodeTypethe type of a node
nameString?the name of a node
pathStringthe absolute path to a node
contentStringthe content of a node
namespaceString?the namespace associated with a node
source

I/O

EzXML.readxmlFunction
readxml(filename)

Read filename and create an XML document.

source
readxml(input::IO)

Read input and create an XML document.

source
EzXML.readhtmlFunction
readhtml(filename)

Read filename and create an HTML document.

source
readhtml(input::IO)

Read input and create an HTML document.

source
EzXML.prettyprintFunction
prettyprint([io], node::Node)

Print node with formatting.

source
prettyprint([io], doc::Document)

Print doc with formatting.

source

Constructors

EzXML.HTMLDocumentNodeFunction
HTMLDocumentNode(uri, externalID)

Create an HTML document node.

uri and externalID are either a string or nothing.

source
EzXML.DTDNodeFunction
DTDNode(name, [systemID, [externalID]])

Create a DTD node with name, systemID, and externalID.

source

Node types

Node typeInteger
EzXML.ELEMENT_NODE1
EzXML.ATTRIBUTE_NODE2
EzXML.TEXT_NODE3
EzXML.CDATA_SECTION_NODE4
EzXML.ENTITY_REF_NODE5
EzXML.ENTITY_NODE6
EzXML.PI_NODE7
EzXML.COMMENT_NODE8
EzXML.DOCUMENT_NODE9
EzXML.DOCUMENT_TYPE_NODE10
EzXML.DOCUMENT_FRAG_NODE11
EzXML.NOTATION_NODE12
EzXML.HTML_DOCUMENT_NODE13
EzXML.DTD_NODE14
EzXML.ELEMENT_DECL15
EzXML.ATTRIBUTE_DECL16
EzXML.ENTITY_DECL17
EzXML.NAMESPACE_DECL18
EzXML.XINCLUDE_START19
EzXML.XINCLUDE_END20
EzXML.DOCB_DOCUMENT_NODE21

Node accessors

Node modifiers

Document properties

DOM tree accessors

EzXML.eachnodeFunction
eachnode(node::Node, [backward=false])

Create an iterator of child nodes.

source
EzXML.nodesFunction
nodes(node::Node, [backward=false])

Create a vector of child nodes.

source
EzXML.elementsFunction
elements(node::Node, [backward=false])

Create a vector of child elements.

source
EzXML.eachattributeFunction
eachattribute(node::Node)

Create an iterator of attributes.

source
eachattribute(reader::StreamReader)

Return an AttributeReader object for the current node of reader

source

DOM tree modifiers

EzXML.setroot!Function
setroot!(doc::Document, node::Node)

Set the root element of doc to node and return the root element.

source
EzXML.setdtd!Function
setdtd!(doc::Document, node::Node)

Set the DTD node of doc to node and return the DTD node.

source
EzXML.link!Function
link!(parent::Node, child::Node)

Link child at the end of children of parent.

source
EzXML.linknext!Function
linknext!(target::Node, node::Node)

Link node as the next sibling of target.

source
EzXML.linkprev!Function
linkprev!(target::Node, node::Node)

Link node as the prev sibling of target.

source
EzXML.addelement!Function
addelement!(parent::Node, name::AbstractString)

Add a new child element of name with no content to parent and return the new child element.

source
addelement!(parent::Node, name::AbstractString, content::AbstractString)

Add a new child element of name with content to parent and return the new child element.

source

XPath query

Base.findallMethod
findall(xpath::AbstractString, doc::Document)

Find nodes matching xpath XPath query from doc.

source
Base.findfirstMethod
findfirst(xpath::AbstractString, doc::Document)

Find the first node matching xpath XPath query from doc.

source
Base.findlastMethod
findlast(doc::Document, xpath::AbstractString)

Find the last node matching xpath XPath query from doc.

source
Base.findallMethod
findall(xpath::AbstractString, node::Node, [ns=namespaces(node)])

Find nodes matching xpath XPath query starting from node.

The ns argument is an iterator of namespace prefix and URI pairs.

source
Base.findfirstMethod
findfirst(xpath::AbstractString, node::Node, [ns=namespaces(node)])

Find the first node matching xpath XPath query starting from node.

source
Base.findlastMethod
findlast(node::Node, xpath::AbstractString, [ns=namespaces(node)])

Find the last node matching xpath XPath query starting from node.

source

Validation

EzXML.validateFunction
validate(doc::Document, [dtd::Node])

Validate doc against dtd and return the validation log.

The validation log is empty if and only if doc is valid. The DTD node in doc will be used if dtd is not passed.

source
EzXML.readdtdFunction
readdtd(filename::AbstractString)

Read filename and create a DTD node.

source

Reader node types

Node typeInteger
EzXML.READER_NONE0
EzXML.READER_ELEMENT1
EzXML.READER_ATTRIBUTE2
EzXML.READER_TEXT3
EzXML.READER_CDATA4
EzXML.READER_ENTITY_REFERENCE5
EzXML.READER_ENTITY6
EzXML.READER_PROCESSING_INSTRUCTION7
EzXML.READER_COMMENT8
EzXML.READER_DOCUMENT9
EzXML.READER_DOCUMENT_TYPE10
EzXML.READER_DOCUMENT_FRAGMENT11
EzXML.READER_NOTATION12
EzXML.READER_WHITESPACE13
EzXML.READER_SIGNIFICANT_WHITESPACE14
EzXML.READER_END_ELEMENT15
EzXML.READER_END_ENTITY16
EzXML.READER_XML_DECLARATION17

Streaming reader

EzXML.expandtreeMethod
expandtree(reader::StreamReader)

Expand the current node of reader into a full subtree that will be available until the next read of node.

Note that the expanded subtree is a read-only and temporary object. You cannot modify it or keep references to any nodes of it after reading the next node.

Currently, namespace functions and XPath query will not work on the expanded subtree.

source
EzXML.nodetypeMethod
nodetype(reader::StreamReader)

Return the type of the current node of reader.

source
EzXML.nodenameMethod
nodename(reader::StreamReader)

Return the name of the current node of reader.

source
EzXML.nodecontentMethod
nodecontent(reader::StreamReader)

Return the content of the current node of reader.

source
EzXML.nodedepthMethod
nodedepth(reader::StreamReader)

Return the depth of the current node of reader.

source
EzXML.namespaceMethod
namespace(reader::StreamReader)

Return the namespace of the current node of reader.

source
EzXML.hasnodenameMethod
hasnodename(reader::StreamReader)

Return if the current node of reader has a node name.

source