4Suite™ API Documentation

# ► Module Ft.Xml.Domlette

Abstraction module for Domlette usage. Domlette is a DOM-like library tailored for use in XPath/XSLT.
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: EntityReaderBase, NoExtDtdReaderBase, NonvalidatingReaderBase, ValidatingReaderBase |  |  |  | Functions: ConvertDocument, GetAllNs, NonvalParse, PrettyPrint, SeekNss, ValParse |  |  |  | Fields: EntityReader, NoExtDtdReader, NonvalidatingReader, ValidatingReader, implementation

## Classes

class EntityReaderBase(_Reader)
Base class to be used by all readers which can accept well-formed EPEs. Non-validating only. Allows an InputSource factory to be specified. Allows control over whether the external DTD subset is read.

### Methods

__init__(self, inputSourceFactory=None)

### Methods inherited from class _Reader

parse, parseStream, parseString, parseUri

class NoExtDtdReaderBase(_Reader)
Base class to be used by all non-validating readers that do not need to read the external DTD subset. Allows an InputSource factory to be specified.

### Methods

__init__(self, inputSourceFactory=None)

### Methods inherited from class _Reader

parse, parseStream, parseString, parseUri

class NonvalidatingReaderBase(_Reader)
Base class to be used by all non-validating readers. Allows an InputSource factory to be specified. Allows control over whether the external DTD subset is read.

### Methods

__init__(self, inputSourceFactory=None)

### Methods inherited from class _Reader

parse, parseStream, parseString, parseUri

class ValidatingReaderBase(_Reader)
Base class to be used by all validating readers. Allows an InputSource factory to be specified.

### Methods

__init__(self, inputSourceFactory=None)

### Methods inherited from class _Reader

parse, parseStream, parseString, parseUri

## Functions

ConvertDocument(oldDocument, documentURI=u'')
Since foreign DOMs are not supported within 4Suite, this function lets users create a Domlette DOM from whatever DOM they are using.
If the documentURI is not specified, it will try and get it from
the document using DOM L3 attributes documentURI, then baseURI. If
no URI is found, a warning is issued and a urn:uuid is generated
for it.
GetAllNs(node)
GetAllNs(node) -> dict
Get all of the namespaces defined in scope of this node.
NonvalParse(isrc[, readExtDtd[, parseAsEntity]])
nonvalParse(isrc[, readExtDtd[, parseAsEntity]]) -> Document
PrettyPrint(root, stream=<open file '<stdout>', mode 'w' at 0x345198>, encoding='UTF-8', asHtml=None)
Given a Node instance assumed to be the root of a DOM or Domlette tree, this function serializes the document to the given stream or stdout, using the given encoding (UTF-8 is the default). Extra whitespace is added to the output for visual formatting. The asHtml flag can be used to force HTML-style serialization of an XML DOM. Otherwise, the DOM type (HTML or XML) is automatically determined. This function does nothing if root is not a Node.
It is preferable that users import this from Ft.Xml.Domlette
rather than directly from Ft.Xml.Lib.Print.
SeekNss(node)
SeekNss(node) -> dict
Traverses the tree to seek an approximate set of defined namespaces.
ValParse(isrc, readExtDtd=True)

## Fields

EntityReader = <Ft.Xml.Domlette.EntityReaderBase instance>
Non-validating reader instance that accepts well-formed XML External Parsed Entities, created from EntityReader() with no constructor arguments.
Uses the default InputSource factory. If you need to change it,
reassign the inputSourceFactory attribute, or, preferably, just
create a new EntityReader instance.
NoExtDtdReader = <Ft.Xml.Domlette.NoExtDtdReaderBase instance>
The default non-validating, external DTD subset-ignoring reader instance, created from NoExtDtdReaderBase() with no constructor arguments.
Uses the default InputSource factory. If you need to change it,
reassign the inputSourceFactory attribute, or, preferably, just
create a new NoExtDtdReaderBase instance.
NonvalidatingReader = <Ft.Xml.Domlette.NonvalidatingReaderBase instance>
The default non-validating reader instance, created from NonvalidatingReaderBase() with no constructor arguments.
Uses the default InputSource factory. If you need to change it,
reassign the inputSourceFactory attribute, or, preferably, just
create a new NonvalidatingReaderBase instance.
ValidatingReader = <Ft.Xml.Domlette.ValidatingReaderBase instance>
The default validating reader instance, created from ValidatingReaderBase() with no constructor arguments.
Uses the default InputSource factory. If you need to change it,
reassign the inputSourceFactory attribute, or, preferably, just
create a new ValidatingReaderBase instance.
implementation = <DOMImplementation>
The DOMImplementation interface provides a number of methods for performing operations that are independent of any particular instance of the document object model.