Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bc9c1b15
Commit
bc9c1b15
authored
Dec 13, 2000
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added descriptions of the defined exceptions and their mapping to the
DOM recommendation.
parent
22352957
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
129 additions
and
0 deletions
+129
-0
Doc/lib/xmldom.tex
Doc/lib/xmldom.tex
+129
-0
No files found.
Doc/lib/xmldom.tex
View file @
bc9c1b15
...
@@ -119,6 +119,9 @@ so this usage is not yet documented.
...
@@ -119,6 +119,9 @@ so this usage is not yet documented.
{
Processing instruction representation.
}
{
Processing instruction representation.
}
\end{tableiii}
\end{tableiii}
An additional section describes the exceptions defined for working
with the DOM in Python.
\subsubsection
{
DOMImplementation Objects
\subsubsection
{
DOMImplementation Objects
\label
{
dom-implementation-objects
}}
\label
{
dom-implementation-objects
}}
...
@@ -594,6 +597,132 @@ whitespace character.
...
@@ -594,6 +597,132 @@ whitespace character.
\end{memberdesc}
\end{memberdesc}
\subsubsection
{
Exceptions
\label
{
dom-exceptions
}}
\versionadded
{
2.1
}
The DOM Level 2 recommendation defines a single exception,
\exception
{
DOMException
}
, and a number of constants that allow
applications to determine what sort of error occurred.
\exception
{
DOMException
}
instances carry a
\member
{
code
}
attribute
that provides the appropriate value for the specific exception.
The Python DOM interface provides the constants, but also expands the
set of exceptions so that a specific exception exists for each of the
exception codes defined by the DOM. The implementations must raise
the appropriate specific exception, each of which carries the
appropriate value for the
\member
{
code
}
attribute.
\begin{excdesc}
{
DOMException
}
Base exception class used for all specific DOM exceptions. This
exception class cannot be directly instantiated.
\end{excdesc}
\begin{excdesc}
{
DomstringSizeErr
}
Raised when a specified range of text does not fit into a string.
This is not known to be used in the Python DOM implementations, but
may be received from DOM implementations not written in Python.
\end{excdesc}
\begin{excdesc}
{
HierarchyRequestErr
}
Raised when an attempt is made to insert a node where the node type
is not allowed.
\end{excdesc}
\begin{excdesc}
{
IndexSizeErr
}
Raised when an index or size parameter to a method is negative or
exceeds the allowed values.
\end{excdesc}
\begin{excdesc}
{
InuseAttributeErr
}
Raised when an attempt is made to insert an
\class
{
Attr
}
node that
is already present elsewhere in the document.
\end{excdesc}
\begin{excdesc}
{
InvalidAccessErr
}
Raised if a parameter or an operation is not supported on the
underlying object.
\end{excdesc}
\begin{excdesc}
{
InvalidCharacterErr
}
This exception is raised when a string parameter contains a
character that is not permitted in the context it's being used in by
the XML 1.0 recommendation. For example, attempting to create an
\class
{
Element
}
node with a space in the element type name will
cause this error to be raised.
\end{excdesc}
\begin{excdesc}
{
InvalidModificationErr
}
Raised when an attempt is made to modify the type of a node.
\end{excdesc}
\begin{excdesc}
{
InvalidStateErr
}
Raised when an attempt is made to use an object that is not or is no
longer usable.
\end{excdesc}
\begin{excdesc}
{
NamespaceErr
}
If an attempt is made to change any object in a way that is not
permitted with regard to the
\citetitle
[http://www.w3.org/TR/REC-xml-names/]
{
Namespaces in XML
}
recommendation, this exception is raised.
\end{excdesc}
\begin{excdesc}
{
NotFoundErr
}
Exception when a node does not exist in the referenced context. For
example,
\method
{
NamedNodeMap.removeNamedItem()
}
will raise this if
the node passed in does not exist in the map.
\end{excdesc}
\begin{excdesc}
{
NotSupportedErr
}
Raised when the implementation does not support the requested type
of object or operation.
\end{excdesc}
\begin{excdesc}
{
NoDataAllowedErr
}
This is raised if data is specified for a node which does not
support data.
% XXX a better explanation is needed!
\end{excdesc}
\begin{excdesc}
{
NoModificationAllowedErr
}
Raised on attempts to modify an object where modifications are not
allowed (such as for read-only nodes).
\end{excdesc}
\begin{excdesc}
{
SyntaxErr
}
Raised when an invalid or illegal string is specified.
% XXX how is this different from InvalidCharacterErr ???
\end{excdesc}
\begin{excdesc}
{
WrongDocumentErr
}
Raised when a node is inserted in a different document than it
currently belongs to, and the implementation does not support
migrating the node from one document to the other.
\end{excdesc}
The exception codes defined in the DOM recommendation map to the
exceptions described above according to this table:
\begin{tableii}
{
l|l
}{
constant
}{
Constant
}{
Exception
}
\lineii
{
DOMSTRING
_
SIZE
_
ERR
}{
\exception
{
DomstringSizeErr
}}
\lineii
{
HIERARCHY
_
REQUEST
_
ERR
}{
\exception
{
HierarchyRequestErr
}}
\lineii
{
INDEX
_
SIZE
_
ERR
}{
\exception
{
IndexSizeErr
}}
\lineii
{
INUSE
_
ATTRIBUTE
_
ERR
}{
\exception
{
InuseAttributeErr
}}
\lineii
{
INVALID
_
ACCESS
_
ERR
}{
\exception
{
InvalidAccessErr
}}
\lineii
{
INVALID
_
CHARACTER
_
ERR
}{
\exception
{
InvalidCharacterErr
}}
\lineii
{
INVALID
_
MODIFICATION
_
ERR
}{
\exception
{
InvalidModificationErr
}}
\lineii
{
INVALID
_
STATE
_
ERR
}{
\exception
{
InvalidStateErr
}}
\lineii
{
NAMESPACE
_
ERR
}{
\exception
{
NamespaceErr
}}
\lineii
{
NOT
_
FOUND
_
ERR
}{
\exception
{
NotFoundErr
}}
\lineii
{
NOT
_
SUPPORTED
_
ERR
}{
\exception
{
NotSupportedErr
}}
\lineii
{
NO
_
DATA
_
ALLOWED
_
ERR
}{
\exception
{
NoDataAllowedErr
}}
\lineii
{
NO
_
MODIFICATION
_
ALLOWED
_
ERR
}{
\exception
{
NoModificationAllowedErr
}}
\lineii
{
SYNTAX
_
ERR
}{
\exception
{
SyntaxErr
}}
\lineii
{
WRONG
_
DOCUMENT
_
ERR
}{
\exception
{
WrongDocumentErr
}}
\end{tableii}
\subsection
{
Conformance
\label
{
dom-conformance
}}
\subsection
{
Conformance
\label
{
dom-conformance
}}
This section describes the conformance requirements and relationships
This section describes the conformance requirements and relationships
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment