|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |
class CContentHandler: virtual public CInterface { public: CContentHandler(); virtual ~CContentHandler(); public: virtual void SetDocumentLocator(CLocator *pLocator) = 0; virtual void StartDocument() = 0; virtual void EndDocument() = 0; virtual void StartPrefixMapping( const WCHAR *pszPrefix, const WCHAR *pszUri) = 0; virtual void EndPrefixMapping(const WCHAR *pszPrefix) = 0; virtual void StartElement( const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName, CAttributes *pAtts) = 0; virtual void EndElement( const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName) = 0; virtual void Characters( const WCHAR *pCh, int nLength) = 0; virtual void IgnorableWhitespace( const WCHAR *pCh, int nLength) = 0; virtual void ProcessingInstruction( const WCHAR *pszTarget, const WCHAR *pszData) = 0; virtual void SkippedEntity(const WCHAR *pszName) = 0; }; typedef XInterface<CContentHandler> XContentHandler;
The interface for receiving notification of the logical content of a document.
This is the main interface that most SAX applications
implement: if the application needs to be informed of basic parsing
events, it implements this interface and registers an instance with
the SAX reader using the
CXmlReader::SetContentHandler
method. The reader uses the instance to report
basic document-related events like the start and end of elements
and character data.
The order of events in this interface is very important, and
mirrors the order of information in the document itself. For
example, all of an element's content (character data, processing
instructions, and/or subelements) will appear, in order, between
the
StartElement
event and
the corresponding
EndElement
event.
CAttributes, CLocator
Constructor/Destructor Summary | |
CContentHandler
();
����������Constructs the content handler. |
|
~CContentHandler
();
����������Destroys the content handler. |
Function Summary | |
void
|
SetDocumentLocator
(CLocator *pLocator);
����������Receives an object for locating the origin of SAX document events. |
void
|
StartDocument
();
����������Receives notification of the beginning of a document. |
void
|
EndDocument
();
����������Receives notification of the end of a document. |
void
|
StartPrefixMapping
(const WCHAR *pszPrefix, const WCHAR *pszUri);
����������Begins the scope of a prefix-URI namespace mapping. |
void
|
EndPrefixMapping
(const WCHAR *pszPrefix);
����������Ends the scope of a prefix-URI mapping. |
void
|
StartElement
(const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName, CAttributes *pAtts);
����������Receives notification of the beginning of an element. |
void
|
EndElement
(const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName);
����������Receives notification of the end of an element. |
void
|
Characters
(const WCHAR *pCh, int nLength);
����������Receives notification of character data. |
void
|
IgnorableWhitespace
(const WCHAR *pCh, int nLength);
����������Receives notification of ignorable whitespace in element content. |
void
|
ProcessingInstruction
(const WCHAR *pszTarget, const WCHAR *pszData);
����������Receives notification of a processing instruction. |
void
|
SkippedEntity
(const WCHAR *pszName);
����������Receives notification of a skipped entity. |
Constructor/Destructor Detail |
CContentHandler();
Constructs the content handler.
virtual ~CContentHandler();
Destroys the content handler.
Function Detail |
virtual void SetDocumentLocator(CLocator *pLocator) = 0;
Receives an object for locating the origin of SAX document events.
A SAX reader is strongly encouraged (though not absolutely
required) to supply a locator: if it does so, it must supply
the locator to the application by invoking this method before
invoking any of the other methods in the
CContentHandler
class.
The locator allows the application to determine the end position of any document-related event, even if the reader is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.
Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.
pLocator
- the object that can return the location of
any SAX document eventvirtual void StartDocument() = 0;
Receives notification of the beginning of a document.
The SAX reader will invoke this method only once, before any
other methods in this interface or in
CDtdHandler
(except for
SetDocumentLocator
).
virtual void EndDocument() = 0;
Receives notification of the end of a document.
The SAX reader will invoke this method only once, and it will be the last method invoked during the parse. The reader shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.
virtual void StartPrefixMapping( const WCHAR *pszPrefix, const WCHAR *pszUri) = 0;
Begins the scope of a prefix-URI namespace mapping.
The information from this event is not necessary for
normal namespace processing: the SAX XML reader will
automatically replace prefixes for element and attribute
names when the
http://xml.org/sax/features/namespaces
feature is
true
(the default).
There are cases, however, when applications need to
use prefixes in character data or in attribute values,
where they cannot safely be expanded automatically; the
Start/EndPrefixMapping
event supplies the information
to the application to expand prefixes in those contexts
itself, if necessary.
Note that
Start/EndPrefixMapping
events are not
guaranteed to be properly nested relative to each-other:
all
StartPrefixMapping
events will occur before the
corresponding
StartElement
event,
and all
EndPrefixMapping
events will occur after the corresponding
EndElement
event, but their order is not otherwise guaranteed.
There should never be
Start/EndPrefixMapping
events for the
"xml"
prefix, since it is predeclared and immutable.
pszPrefix
- the namespace prefix being declaredpszUri
- the namespace URI the prefix is mapped tovirtual void EndPrefixMapping(const WCHAR *pszPrefix) = 0;
Ends the scope of a prefix-URI mapping.
See
StartPrefixMapping
for details.
This event will always occur after the corresponding
EndElement
event, but the order of
EndPrefixMapping
events is not otherwise guaranteed.
pszPrefix
- the prefix that was being mappedvirtual void StartElement( const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName, CAttributes *pAtts) = 0;
Receives notification of the beginning of an element.
The reader will invoke this method at the beginning of every
element in the XML document; there will be a corresponding
EndElement
event for every
StartElement
event
(even when the element is empty). All of the element's content will be
reported, in order, before the corresponding
EndElement
event.
This event allows up to three name components for each element:
Any or all of these may be provided, depending on the
values of the
http://xml.org/sax/features/namespaces
and the
http://xml.org/sax/features/namespace-prefixes
properties:
true
(the default), and are
optional when the namespaces property is
false
(if one is
specified, both must be);true
, and is optional when the namespace-prefixes property
is
false
(the default).Note that the attribute list provided will contain only
attributes with explicit values (specified or defaulted):
#IMPLIED
attributes will be omitted. The attribute list
will contain attributes used for namespace declarations
(
xmlns*
attributes) only if the
http://xml.org/sax/features/namespace-prefixes
property is true (it is false by default, and support for a
true value is optional).
pszUri
- the namespace URI, or the empty string if the
element has no namespace URI or if namespace
processing is not being performedpszLocalName
- the local name (without prefix), or the
empty string if namespace processing is not being
performedpszQName
- the qualified name (with prefix), or the
empty string if qualified names are not availablepAtts
- the list of
attributes attached to the element; if
there are no attributes, it shall be an empty
attribute listvirtual void EndElement( const WCHAR *pszUri, const WCHAR *pszLocalName, const WCHAR *pszQName) = 0;
Receives notification of the end of an element.
The SAX reader will invoke this method at the end of every
element in the XML document; there will be a corresponding
StartElement
event for every
EndElement
event (even when the element is empty).
For information on the names, see
StartElement
.
pszUri
- the namespace URI, or the empty string if the
element has no namespace URI or if namespace
processing is not being performedpszLocalName
- the local name (without prefix), or the
empty string if namespace processing is not being
performedpszQName
- the qualified name (with prefix), or the
empty string if qualified names are not availablevirtual void Characters( const WCHAR *pCh, int nLength) = 0;
Receives notification of character data.
The reader will call this method to report each chunk of character data. SAX readers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the locator provides useful information.
The application must not attempt to read from the array outside of the specified range.
Note that some readers will report whitespace in element
content using the
IgnorableWhitespace
method rather than this one (readers which implement
validating parsers must do so).
pCh
- the array of
characters from the XML documentnLength
- the number of characters to read from the arrayvirtual void IgnorableWhitespace( const WCHAR *pCh, int nLength) = 0;
Receives notification of ignorable whitespace in element content.
Readers which implement validating parsers must use this method to report each chunk of whitespace in element content (see the W3C XML 1.0 recommendation, section 2.10); readers implementing non-validating parsers may also use this method if they are capable of parsing and using content models.
SAX readers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the locator provides useful information.
The application must not attempt to read from the array outside of the specified range.
pCh
- the array of
characters from the XML documentnLength
- the number of characters to read from the arrayvirtual void ProcessingInstruction( const WCHAR *pszTarget, const WCHAR *pszData) = 0;
Receives notification of a processing instruction.
The reader will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.
A SAX reader must never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.
pszTarget
- the processing instruction targetpszData
- the processing instruction data, or the empty string if
none was supplied; does not include any
whitespace separating it from the targetvirtual void SkippedEntity(const WCHAR *pszName) = 0;
Receives notification of a skipped entity.
The reader will invoke this method once for each entity
skipped. Non-validating processors may skip entities if they
have not seen the declarations (because, for example, the
entity was declared in an external DTD subset). All processors
may skip external entities, depending on the values of the
http://xml.org/sax/features/external-general-entities
and the
http://xml.org/sax/features/external-parameter-entities
properties.
pszName
- the name of the skipped entity.
If it is a
parameter entity, the name will begin with
'%'
, and if
it is the external DTD subset, it will be the string
"[dtd]"
.
|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |