Class XmlParserBase
source code
object --+
|
XmlParserBase
- Known Subclasses:
-
TODO write a better documentation
The idea is that subclasses define ``handle_X`` methods where X is the
unqualified tag.
Property `package` holds the package to parse into.
DEPRECATED: Property `backend` and `package_id` are useful to feed the
package's backend.
Property `current` always points to the current element (with the
ElementTree API). Note that the element will have its attribute, but not
its text nor its sub-elements. To wait for an element to be completely
constructed, invoke method `complete_current`. However, to parse
subelements, you may prefer to use methods `required`, `optional` and
`sequence`, that will check the structure of subelements, then invoke the
corresponding `handle_X` methods. Note that `required` and `optional`
will return the value returned by `handle_X` (`optional` returns None if
the element is not found).
Method `get_attribute` is a shortcut for ``current.get(k[, d])`` but
will raise a `ParseError` with the appopriate message if the attribute is
missing and no default value is provided.
Property `ns_stack` is a list of (prefix, uri) pairs used as a stack
for namespaces.
For advanced use, property `stream` holds the underlying `Stream`
instance.
See `advene.model.parsers.advene_xml` for an example.
|
__init__(self,
file_,
package,
namespace_uri,
root)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
__init__(self,
file_,
package,
namespace_uri,
root)
(Constructor)
| source code
|
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
- Overrides:
object.__init__
- (inherited documentation)
|
NB: this methods allows an *empty* sequence.
If you want a sequence with at least 1 element, use the following
pattern::
required(mytag)
sequence(mytag)
|
current
- Get Method:
- unreachable.current(self)
|
ns_stack
- Get Method:
- unreachable.ns_stack(self)
|