4Suite™ API Documentation

# ► Module Ft.Xml.Xslt.XmlWriter

XML writer for XSLT output

    Copyright 2005 Fourthought, Inc. (USA).
    Detailed license and copyright information: http://4suite.org/COPYRIGHT
    Project home, documentation, distributions: http://4suite.org/

Classes: CdataSectionXmlWriter, XmlWriter |  |  |  | Globals: DEFAULT_GENERATED_PREFIX, EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, XML_NAMESPACE

## Classes

class CdataSectionXmlWriter(XmlWriter)
  Converts character data to CDATA sections if the character data occurs within an element defined as outputting CDATA sections.

  ### Methods

  __init__(self, outputParams, stream)
    outputParams - instance of Ft.Xml.Xslt.OutputParameters.OutputParameters stream - a stream that takes a byte stream (not a unicode object)
    Overrides: __init__ from class XmlWriter
  endElement(self, tagName, namespace=None)
    Overrides: endElement from class XmlWriter
  startElement(self, tagName, namespace=None, extraNss=None)
    Overrides: startElement from class XmlWriter
  text(self, text, escapeOutput=True)
    Overrides: text from class XmlWriter

  ### Methods inherited from class XmlWriter

  attribute, changePrefix, comment, endDocument, getStream, matchesGeneratedPrefix, namespace, processingInstruction, startDocument

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

  copyNodes, getMediaType, getResult

  ### Members inherited from class XmlWriter

  GENERATED_PREFIX
class XmlWriter(Ft.Xml.Xslt.NullWriter.NullWriter)
  Takes events such as those generated by an XSLT processor and invokes a serializer to produce XML.

  ### Methods

  __init__(self, outputParams, stream)
    outputParams - instance of Ft.Xml.Xslt.OutputParameters.OutputParameters stream - a stream that takes a byte stream (not a unicode object)
    Overrides: __init__ from class NullWriter
  attribute(self, name, value, namespace=None)
    add an attribute to an element

        name - the qualified name of the attribute
        value - the attribute value: must be Unicode
        namespace - must be Unicode or Ft.Xml.EMPTY_NAMESPACE (the default)

        Strives for "sanity".  For brilliant definition thereof, c.f. Joe English
        http://lists.xml.org/archives/xml-dev/200204/msg00170.html
        Uses terminology from that article
        See also discussions starting
        http://lists.fourthought.com/pipermail/4suite-dev/2003-March/001294.html
        http://lists.fourthought.com/pipermail/4suite-dev/2003-March/001283.html

        Note: attribute output is computed as invoked.
        This means that the ugly case

        attribute(u"foo", u"bar", "http://some-ns/")
        attribute(u"x:foo", u"baz", "http://some-ns/")

        will result in the ugly
          xmlns:org.4suite.4xslt.ns0="http://some-ns/"
          org.4suite.4xslt.ns0:foo="baz"

        The user can easily correct this by reversing the
        order of the calls

    Overrides: attribute from class NullWriter
  changePrefix(self, namespace, forbidEmpty=False)
  comment(self, body)
    Overrides: comment from class NullWriter
  endDocument(self)
    Overrides: endDocument from class NullWriter
  endElement(self, tagName, namespace=None)
    Overrides: endElement from class NullWriter
  getStream(self)
    Overrides: getStream from class NullWriter
  matchesGeneratedPrefix(self, prefix)
  namespace(self, prefix, namespace)
    Overrides: namespace from class NullWriter
  processingInstruction(self, target, data)
    Overrides: processingInstruction from class NullWriter
  startDocument(self)
    Overrides: startDocument from class NullWriter
  startElement(self, tagName, namespace=None, extraNss=None)
    Overrides: startElement from class NullWriter
  text(self, text, escapeOutput=True)
    Overrides: text from class NullWriter

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

  copyNodes, getMediaType, getResult

  ### Members

  GENERATED_PREFIX = u'org.4suite.4xslt.ns%s'

## Globals

DEFAULT_GENERATED_PREFIX = u'org.4suite.4xslt.ns'
EMPTY_NAMESPACE = None
EMPTY_PREFIX = None
XMLNS_NAMESPACE = u'http://www.w3.org/2000/xmlns/'
XML_NAMESPACE = u'http://www.w3.org/XML/1998/namespace'