示例#1
0
"""

import string, cStringIO

from pyxml.dom import Node, EMPTY_NAMESPACE
from pyxml.xpath import ExpandedNameWrapper
from pyxml.xpath import NamespaceNode
from pyxml.xpath import NaN, Inf
from pyxml.xpath import Util, Conversions
from pyxml.xpath import NAMESPACE_NODE
from pyxml.xpath import CompiletimeException, RuntimeException
from pyxml.utils import boolean

from pyxml.FtCore import get_translator

_ = get_translator("xpath")


class Types:
    NumberType = 0
    StringType = 1
    BooleanType = 2
    NodeSetType = 3
    ObjectType = 4


import types
try:
    g_stringTypes = [types.StringType, types.UnicodeType]
except:
    g_stringTypes = [types.StringType]
示例#2
0
from pyxml.dom import INVALID_MODIFICATION_ERR, NAMESPACE_ERR, INVALID_ACCESS_ERR
from pyxml.dom import VALIDATION_ERR

# EventException
from pyxml.dom import UNSPECIFIED_EVENT_TYPE_ERR

#Range Exceptions
from pyxml.dom import BAD_BOUNDARYPOINTS_ERR
from pyxml.dom import INVALID_NODE_TYPE_ERR

# Fourthought Exceptions
from pyxml.dom import XML_PARSE_ERR

from pyxml.FtCore import get_translator

_ = get_translator("dom")


DOMExceptionStrings = {
    INDEX_SIZE_ERR: _("Index error accessing NodeList or NamedNodeMap"),
    DOMSTRING_SIZE_ERR: _("DOMString exceeds maximum size"),
    HIERARCHY_REQUEST_ERR: _("Node manipulation results in invalid parent/child relationship."),
    WRONG_DOCUMENT_ERR: _("Node is from a different document"),
    INVALID_CHARACTER_ERR: _("Invalid or illegal character"),
    NO_DATA_ALLOWED_ERR: _("Node does not support data"),
    NO_MODIFICATION_ALLOWED_ERR: _("Attempt to modify a read-only object"),
    NOT_FOUND_ERR: _("Node does not exist in this context"),
    NOT_SUPPORTED_ERR: _("Object or operation not supported"),
    INUSE_ATTRIBUTE_ERR: _("Attribute already in use by an element"),
    INVALID_STATE_ERR: _("Object is not, or is no longer, usable"),
    SYNTAX_ERR: _("Specified string is invalid or illegal"),
示例#3
0
from pyxml.dom import INVALID_MODIFICATION_ERR, NAMESPACE_ERR, INVALID_ACCESS_ERR
from pyxml.dom import VALIDATION_ERR

# EventException
from pyxml.dom import UNSPECIFIED_EVENT_TYPE_ERR

#Range Exceptions
from pyxml.dom import BAD_BOUNDARYPOINTS_ERR
from pyxml.dom import INVALID_NODE_TYPE_ERR

# Fourthought Exceptions
from pyxml.dom import XML_PARSE_ERR

from pyxml.FtCore import get_translator

_ = get_translator("dom")

DOMExceptionStrings = {
    INDEX_SIZE_ERR:
    _("Index error accessing NodeList or NamedNodeMap"),
    DOMSTRING_SIZE_ERR:
    _("DOMString exceeds maximum size"),
    HIERARCHY_REQUEST_ERR:
    _("Node manipulation results in invalid parent/child relationship."),
    WRONG_DOCUMENT_ERR:
    _("Node is from a different document"),
    INVALID_CHARACTER_ERR:
    _("Invalid or illegal character"),
    NO_DATA_ALLOWED_ERR:
    _("Node does not support data"),
    NO_MODIFICATION_ALLOWED_ERR:
示例#4
0
from pyxml.xpath import RuntimeException, CompiletimeException

from pyxml.FtCore import get_translator

_ = get_translator("xpath")

COMPILETIME = {
    CompiletimeException.INTERNAL: _('There is an internal bug in 4XPath.  Please report this error code to [email protected]: %s'),
    CompiletimeException.SYNTAX: _('Parse error at line %d, column %d: %s'),
    CompiletimeException.PROCESSING: _('Error evaluating expression.'),
    #CompiletimeException.: _(''),
    }

RUNTIME = {
    RuntimeException.INTERNAL: _('There is an internal bug in 4XPath.  Please report this error code to [email protected]: %s'),

    RuntimeException.NO_CONTEXT: _('An XPath Context object is required in order to evaluate an expression.'),
    RuntimeException.UNDEFINED_VARIABLE: _('Variable undefined: ("%s", "%s").'),
    RuntimeException.UNDEFINED_PREFIX: _('Undefined namespace prefix: "%s".'),
    RuntimeException.WRONG_ARGUMENTS: _('Error in arguments to %s: %s'),
    #RuntimeException.: _(''),
    }