|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |
class CDomReader: public Sax::CXmlReader { public: CDomReader( CToolkitBase *pToolkitBase, Dom::INode *pNode=NULL); ~CDomReader(); public: void SetFeature( const WCHAR *pszName, bool bValue); bool GetFeature(const WCHAR *pszName); void SetProperty( const WCHAR *pszName, CInterface *pValue); CInterface *GetProperty(const WCHAR *pszName); void SetEntityResolver(Sax::CEntityResolver *pResolver); Sax::CEntityResolver *GetEntityResolver(); void SetDtdHandler(Sax::CDtdHandler *pHandler); Sax::CDtdHandler *GetDtdHandler(); void SetContentHandler(Sax::CContentHandler *pHandler); Sax::CContentHandler *GetContentHandler(); void SetErrorHandler(Sax::CErrorHandler *pHandler); Sax::CErrorHandler *GetErrorHandler(); void Parse(Sax::CInputSource *pInput); void Parse(const WCHAR *pszSystemId); public: void SetNamespaces(bool bNamespaces); bool GetNamespaces(); void SetInputSource(Sax::CInputSource *pInputSource); Sax::CInputSource *GetInputSource(); void Start(); public: void SetNode(Dom::INode *pNode); Dom::XNode GetNode(); }; typedef XInterface<CDomReader> XDomReader;
The DOM reader.
This is the subclass of SAX XML reader, which reads an XML document fragment from the sub-tree of the source DOM/XDM document, and generates a stream of SAX content events.
Both DOM and XDM document models are supported. (See
Dom
for a general discussion concerning DOM
and XDM document models).
This class effectively implements an adapter from DOM/XDM to SAX.
An arbitrary DOM/XDM node can serve as a root of a sub-tree
containing the source data. If the root node represents the
DOM/XDM document, the content of the entire document will
be transformed into a sequence of events. If the root node has
any other type, the content of the sub-tree rooted at this
node, including the node itself, will be transformed into
a sequence of events.
In any case, the generated sequence of events will be started
with the
StartDocument
event and terminated with
the
EndDocument
, even if the root node does
not represent the entire document.
For each particular DOM reader, an application programmer can specify, whether this reader must perform SAX namespace processing.
CToolkitBase, Sax::CDtdHandler, Sax::CEntityResolver, Sax::CContentHandler, Sax::CErrorHandler, Sax::CInputSource, Dom::INode
Constructor/Destructor Summary | |
CDomReader
(CToolkitBase *pToolkitBase, Dom::INode *pNode=NULL);
����������Constructs the DOM reader. |
|
~CDomReader
();
����������Destroys the DOM reader. |
Function Summary | |
void
|
SetFeature
(const WCHAR *pszName, bool bValue);
����������Sets the state of a feature. |
bool
|
GetFeature
(const WCHAR *pszName);
����������Looks up the value of a feature. |
void
|
SetProperty
(const WCHAR *pszName, CInterface *pValue);
����������Sets the value of a property. |
CInterface�*
|
GetProperty
(const WCHAR *pszName);
����������Looks up the value of a property. |
void
|
SetEntityResolver
(Sax::CEntityResolver *pResolver);
����������Allows an application to register an entity resolver. |
Sax::CEntityResolver�*
|
GetEntityResolver
();
����������Gets the current entity resolver. |
void
|
SetDtdHandler
(Sax::CDtdHandler *pHandler);
����������Allows an application to register a DTD event handler. |
Sax::CDtdHandler�*
|
GetDtdHandler
();
����������Gets the current DTD handler. |
void
|
SetContentHandler
(Sax::CContentHandler *pHandler);
����������Allows an application to register a content event handler. |
Sax::CContentHandler�*
|
GetContentHandler
();
����������Gets the current content handler. |
void
|
SetErrorHandler
(Sax::CErrorHandler *pHandler);
����������Allows an application to register an error event handler. |
Sax::CErrorHandler�*
|
GetErrorHandler
();
����������Gets the current error handler. |
void
|
Parse
(Sax::CInputSource *pInput);
����������Parses an XML document. |
void
|
Parse
(const WCHAR *pszSystemId);
����������Parses an XML document from a system identifier (URI). |
void
|
SetNamespaces
(bool bNamespaces);
����������Specifies whether content events generated by the reader provide namespace information. |
bool
|
GetNamespaces
();
����������Tests whether content events generated by the reader provide namespace information. |
void
|
SetInputSource
(Sax::CInputSource *pInputSource);
����������Sets the input source. |
Sax::CInputSource�*
|
GetInputSource
();
����������Gets the current input source. |
void
|
Start
();
����������Starts the DOM reader. |
void
|
SetNode
(Dom::INode *pNode);
����������Sets the root node of a sub-tree containing the source data. |
Dom::XNode
|
GetNode
();
����������Returns the root node of a sub-tree containing the source data. |
Constructor/Destructor Detail |
CDomReader( CToolkitBase *pToolkitBase, Dom::INode *pNode=NULL);
Constructs the DOM reader.
pToolkitBase
- the master toolkit basepNode
- the optional root of the sub-tree in
the DOM document serving as the source for this DOM reader.
If set to
NULL
at construction time, it must be
specified using the
SetNode
method before starting
this DOM reader.~CDomReader();
Destroys the DOM reader.
Function Detail |
void SetFeature( const WCHAR *pszName, bool bValue);
Sets the state of a feature.
See
Sax::CXmlReader::SetFeature
for a detailed
discussion concerning SAX reader features.
pszName
- the feature name, which is a fully-qualified URIbValue
- the requested state of the feature
(
true
or
false
)bool GetFeature(const WCHAR *pszName);
Looks up the value of a feature.
See
Sax::CXmlReader::GetFeature
for a detailed
discussion concerning SAX reader features.
pszName
- the feature name, which is a fully-qualified URItrue
or
false
)void SetProperty( const WCHAR *pszName, CInterface *pValue);
Sets the value of a property.
See
Sax::CXmlReader::SetProperty
for a detailed
discussion concerning SAX reader properties.
pszName
- the property name, which is a fully-qualified URIpValue
- the requested value for the property,
which is an interface pointerCInterface *GetProperty(const WCHAR *pszName);
Looks up the value of a property.
See
Sax::CXmlReader::GetProperty
for a detailed
discussion concerning SAX reader properties.
pszName
- the property name, which is a fully-qualified URIvoid SetEntityResolver(Sax::CEntityResolver *pResolver);
Allows an application to register an entity resolver.
Note that DOM readers do not use entity resolvers, and this method is a stub implemented for the formal SAX compatibility only.
pResolver
- the entity resolverSax::CEntityResolver *GetEntityResolver();
Gets the current entity resolver.
NULL
if none has been registeredvoid SetDtdHandler(Sax::CDtdHandler *pHandler);
Allows an application to register a DTD event handler.
Note that DOM readers do not generate DTD events, and this method is a stub implemented for the formal SAX compatibility only.
pHandler
- the DTD handlerSax::CDtdHandler *GetDtdHandler();
Gets the current DTD handler.
NULL
if none has been registeredvoid SetContentHandler(Sax::CContentHandler *pHandler);
Allows an application to register a content event handler.
pHandler
- the content handlerSax::CContentHandler *GetContentHandler();
Gets the current content handler.
NULL
if none has been registeredvoid SetErrorHandler(Sax::CErrorHandler *pHandler);
Allows an application to register an error event handler.
Note that DOM readers do not generate error events, and this method is a stub implemented for the formal SAX compatibility only.
pHandler
- the error handlerSax::CErrorHandler *GetErrorHandler();
Gets the current error handler.
NULL
if none has been registeredvoid Parse(Sax::CInputSource *pInput);
Parses an XML document.
Note that, although implementing SAX XML reader interface,
DOM readers are not true XML parsers, and this method is a stub
implemented for the formal SAX compatibility only. When called, this method
throws
Sax::CSaxNotSupportedException
.
pInput
- the input source for
the top-level of the XML documentvoid Parse(const WCHAR *pszSystemId);
Parses an XML document from a system identifier (URI).
Note that, although implementing SAX XML reader interface,
DOM readers are not true XML parsers, and this method is a stub
implemented for the formal SAX compatibility only. When called, this method
throws
Sax::CSaxNotSupportedException
.
pszSystemId
- the system identifier (URI)void SetNamespaces(bool bNamespaces);
Specifies whether content events generated by the reader provide namespace information.
bNamespaces
-
true
if content events
generated by this reader must provide namespace information;
false
otherwisebool GetNamespaces();
Tests whether content events generated by the reader provide namespace information.
true
if content events
generated by this reader provide namespace information;
false
otherwisevoid SetInputSource(Sax::CInputSource *pInputSource);
Sets the input source.
Note that, although implementing SAX XML reader interface,
DOM readers are not true XML parsers, and this method is a stub
implemented for the formal SAX compatibility only. When called, this method
throws
Sax::CSaxNotSupportedException
.
pInputSource
- the input sourceSax::CInputSource *GetInputSource();
Gets the current input source.
Note that, although implementing SAX XML reader interface,
DOM readers are not true XML parsers, and this method is a stub
implemented for the formal SAX compatibility only. When called, this method
throws
Sax::CSaxNotSupportedException
.
NULL
if none has been registeredvoid Start();
Starts the DOM reader.
When started, the DOM reader will provide information about the source DOM/XDM document fragment through the registered content handler.
This method is synchronous: it will not return until reading has ended. If a client application wants to terminate the reader early, it should throw an exception.
void SetNode(Dom::INode *pNode);
Sets the root node of a sub-tree containing the source data.
This function cannot be called if the reader is started
(that is, the member function
Start
was called
and had not finished processing yet).
pNode
- the root node of a sub-tree
containing the source data. Both DOM and XDM document models
are supported.Dom::XNode GetNode();
Returns the root node of a sub-tree containing the source data.
|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |