[Zope3-checkins] CVS: zopeproducts/xmldom/interfaces - loadsave.py:1.1

Philipp von Weitershausen philikon@philikon.de
Thu, 19 Jun 2003 18:56:52 -0400


Update of /cvs-repository/zopeproducts/xmldom/interfaces
In directory cvs.zope.org:/tmp/cvs-serv27237

Added Files:
	loadsave.py 
Log Message:
Added interface for DOM Level 3 Load and Save. See
http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
for more information.


=== Added File zopeproducts/xmldom/interfaces/loadsave.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
DOM interfaces for the DOM Level 3 'Load and Save' feature

See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html for more
detailled information

$Id: loadsave.py,v 1.1 2003/06/19 22:56:51 philikon Exp $
"""

from zope.interface import Interface, Attribute

class IDOMImplementationLS(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    #
    # Definition Group DOMImplementationLSMode
    #

    MODE_ASYNCHRONOUS = Attribute("MODE_ASYNCHRONOUS")
    MODE_SYNCHRONOUS  = Attribute("MODE_ASYNCHRONOUS")

    #
    # Methods
    #

    def createDOMInput():
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def createDOMParser(mode, schemaType):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def createDOMSerializer():
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

class IDOMParser(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    #
    # Definition Group ACTION_TYPES
    #

    ACTION_APPEND_AS_CHILDREN = Attribute("ACTION_APPEND_AS_CHILDREN")
    ACTION_INSERT_AFTER       = Attribute("ACTION_INSERT_AFTER")
    ACTION_INSERT_BEFORE      = Attribute("ACTION_INSERT_BEFORE")
    ACTION_REPLACE            = Attribute("ACTION_REPLACE")
    ACTION_REPLACE_CHILDREN   = Attribute("ACTION_REPLACE_CHILDREN")

    #
    # Attributes
    #

    async = Attribute(
        "async",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    busy = Attribute(
        "busy",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    config = Attribute(
        "config",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    filter = Attribute(
        "filter",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    #
    # Methods
    #

    def abort():
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def parse(inputsource):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def parseURI(uri):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def parseWithContext(input, context, action):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

class IDOMInput(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    baseURI = Attribute(
        "baseURI",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    byteStream = Attribute(
        "byteStream",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    certified = Attribute(
        "certified",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    #XXX the spec says "Depending on the language binding in use, this
    #attribute may not be available." about this attribute.    
    characterStream = Attribute(
        "characterStream",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    encoding = Attribute(
        "encoding",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    publicId = Attribute(
        "publicId",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    stringData = Attribute(
        "stringData",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    systemId = Attribute(
        "systemId",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

class IDOMResourceResolver(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    def resolveResource(publicId, systemId, baseURI):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

class IDOMParserFilter(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    #
    # Definition group Constants returned by startElement and acceptNode
    #

    FILTER_ACCEPT    = Attribute("FILTER_ACCEPT")
    FILTER_INTERRUPT = Attribute("FILTER_INTERRUPT")
    FILTER_REJECT    = Attribute("FILTER_REJECT")
    FILTER_SKIP      = Attribute("FILTER_SKIP")

    #
    # Attributes
    #

    whatToShow = Attribute(
        "whatToShow",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    #
    # Methods
    #

    def acceptNode(node):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def startElement(element):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

class ILSProgressEvent(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    input = Attribute(
        "input",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    position = Attribute(
        "position",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    totalSize = Attribute(
        "totalSize",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

class ILSLoadEvent(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    input = Attribute(
        "input",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    newDocument = Attribute(
        "newDocument",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

class IDOMSerializer(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    #
    # Attributes
    #

    config = Attribute(
        "config",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    filter = Attribute(
        "filter",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    newLine = Attribute(
        "newLine",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    #
    # Methods
    #

    def write(node, destination):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def writeToSTring(node):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def writeURI(node, URI):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

class IDOMOutput(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    byteStream = Attribute(
        "byteStream",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    #XXX the spec says "Depending on the language binding in use, this
    #attribute may not be available." about this attribute.    
    characterStream = Attribute(
        "characterStream",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    encoding = Attribute(
        "encoding",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    systemId = Attribute(
        "systemId",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

class IDOMSerializerFilter(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    whatToShow = Attribute(
        "whatToShow",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

#
# Convenience Interfaces
#
# The spec (http://www.w3.org/TR/DOM-Level-3-LS/load-save.html) says:
#
# "The interfaces defined in this section provide no direct
# functionality that cannot be achieved with the load and save
# interfaces defined in the earlier sections of this
# specification. These interfaces are defined for developer
# convenience only, and supporting them is optional."
#

class IDocumentLS(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    async = Attribute(
        "async",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )

    def abort():
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def load(uri):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def loadXML(source):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

    def saveXML(node):
        """
        See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
        """

class IElementLS(Interface):
    """
    See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html
    """

    markupContent = Attribute(
        "markupContent",
        "See http://www.w3.org/TR/DOM-Level-3-LS/load-save.html"
        )