4Suite™ API Documentation

# ► Module Ft.Xml.XUpdate

XUpdate request processing
XUpdate is specified (poorly) at
http://xmldb-org.sourceforge.net/xupdate/xupdate-wd.html
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: Processor, Reader, StringWriter, XUpdateException |  |  |  | Functions: ApplyXUpdate |  |  |  | Fields: SUPPORTED_VERSIONS, XUPDATE_NS, g_errorMessages

## Classes

class Processor

### Methods

__init__(self, reader=None)
evaluateExpression(self, context, expression)
execute(self, node, xupdate, variables=None, processorNss=None)
output(self)
Returns the current output writer
parseAVT(self, avt)
popResult(self)
pushDomResult(self, ownerDocument)
pushStringResult(self)
visit(self, context, node, preserveSpace)

class Reader(Ft.Xml.Domlette.NonvalidatingReaderBase)
A reader of XUpdate documents. Must contain a fromSrc() method that takes an Ft.Xml.InputSource and returns a Domlette document. It does not need to detect XUpdate syntax errors.

### Methods

fromSrc = parse(self, inputSource)
Reads XML from an Ft.Xml.Inputsource.InputSource, and returns a Domlette document node.

### Methods inherited from class Ft.Xml.Domlette.NonvalidatingReaderBase

__init__

### Methods inherited from class Ft.Xml.Domlette._Reader

parse, parseStream, parseString, parseUri

class StringWriter(Ft.Xml.Xslt.NullWriter.NullWriter)

### Methods

__init__(self)
getResult(self)
text(self, data)

### Methods inherited from class Ft.Xml.Xslt.NullWriter.NullWriter

attribute, comment, copyNodes, endDocument, endElement, getMediaType, getStream, namespace, processingInstruction, startDocument, startElement

class XUpdateException(Ft.FtException)
Exception class for errors specific to XUpdate processing

### Methods

__init__(self, errorCode, *args, **kwargs)

### Methods inherited from class Ft.FtException

__getattr__, __repr__, __str__

### Methods inherited from class exceptions.Exception

__getitem__

### Fields

INVALID_DOM_NODE = 100
INVALID_SELECT = 13
NO_SELECT = 11
NO_TEST = 12
NO_VERSION = 10
SYNTAX_ERROR = 1
UNKNOWN_NODE_TYPE = 101
UNRECOGNIZED_INSTRUCTION = 2
UNSUPPORTED_VERSION = 14

## Functions

ApplyXUpdate(doc, xup)
Takes 2 InputSources, one for the source document and one for the XUpdate instructions. It returns a DOM node representing the result of applying the XUpdate to the source document (the document is modified in-place).

## Fields

SUPPORTED_VERSIONS = ('1.0',)
XUPDATE_NS = 'http://www.xmldb.org/xupdate'
g_errorMessages = {1: 'Syntax error in expression %(expr)r: %(err)s', 2: 'Unrecognized instruction in XUpdate namespace: %(name)r', 10: 'Missing required version attribute', 11: 'Missing required select attribute', 12: 'Missing required "test" attribute', 13: 'select expression "%(expr)s" must evaluate to a non-empty node-set', 14: 'XUpdate version %(version)s unsupported by this implementation', 100: 'Invalid DOM node %(node)r', 101: 'Unknown node type %(nodetype)r'}