Libraries anvil xml

namespace xml
Operations for parsing and inspecting XML documents.

Classes

class DOMHandler
extends anvil.lang.object

class Node
extends anvil.lang.object
Node in XML tree.

class SAXHandler
extends anvil.xml.DOMHandler

class SimpleHandler
extends anvil.lang.object


Exceptions

class DOMError
extends anvil.xml.XMLError

class XMLError
extends anvil.lang.throwable


Functions

string makeTag(string name)
string makeTag(string name, array attrs)
string makeTag(string name, array attrs, boolean withEnd)
Creates a image of tag with given name and attributes.

void parse(string filename, SimpleHandler handler)
void parse(string content, SimpleHandler handler)
void parse(URL source, SimpleHandler handler)
void parse(File source, SimpleHandler handler)
void parse(InputStream source, SimpleHandler handler)

Parser tagged data using simple parser (anvil.java.text.Parser). This parser never generates any errors, except possible IO error while reading from stream.

Throws IOError -  If an I/O error occured

Node parseDOM(string content [, DOMHandler handler [, array features]] )
Node parseDOM(string filename [, DOMHandler handler [, array features]] )
Node parseDOM(URL url [, DOMHandler handler [, array features]] )
Node parseDOM(File file [, DOMHandler handler [, array features]] )
Node parseDOM(InputStream stream [, DOMHandler handler, [, array features]] )

Parses document from given source and returns the root node of document object model.

Parameters handler -  DOM handler
features -  set of features
Throws XMLError -  if an XML error occured
IOError -  if an I/O error occured.

void parseSAX(string content, SAXHandler handler, [array features] )
void parseSAX(URL url, SAXHandler handler, [array features] )
void parseSAX(File file, SAXHandler handler, [array features] )
void parseSAX(InputStream stream, SAXHandler handler, [array features] )

Parses XML document using SAX parser.

Behaviour of parser can be controlled through 'features' which is array with strings mapped to booleans.

validating
Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

namespaceAware
Specifies that the parser produced by this code will provide support for XML namespaces. By default the value of this is set to false.

any other features
Supported by the SAX implementation.

Parameters handler -  SAX handler
features -  set of features
Throws XMLError -  if an XML error occured
IOError -  if an I/O error occured