LibreOffice
LibreOffice 6.2 SDK API Reference
Public Member Functions | List of all members
XFastParser Interface Reference

specifies a SAX parser that uses integer values for known XML names (elements, attributes and attribute values). More...

import"XFastParser.idl";

Inheritance diagram for XFastParser:
XInterface FastParser

Public Member Functions

void parseStream ([in] InputSource aInputSource) raises ( SAXException, com::sun::star::io::IOException )
 parses an XML document from a stream. More...
 
void setFastDocumentHandler ([in] XFastDocumentHandler Handler)
 Application must register a document event handler to get sax events for the parsed stream. More...
 
void setTokenHandler ([in] XFastTokenHandler Handler)
 must be registered to translate known XML names to integer tokens. More...
 
void registerNamespace ([in] string NamespaceURL, [in] long NamespaceToken) raises ( com::sun::star::lang::IllegalArgumentException )
 registers a known namespace url with the given integer token. More...
 
void setErrorHandler ([in] XErrorHandler Handler)
 allows an application to register an error event handler. More...
 
void setEntityResolver ([in] XEntityResolver Resolver)
 allows an application to register a DTD-Handler. More...
 
void setLocale ([in] com::sun::star::lang::Locale locale)
 sets a locale specified for localization of warnings and error messages. More...
 
string getNamespaceURL ([in] string prefix) raises ( com::sun::star::lang::IllegalArgumentException )
 Gets the namespace url string. More...
 
void setNamespaceHandler ([in] XFastNamespaceHandler Handler)
 
- Public Member Functions inherited from XInterface
any queryInterface ([in] type aType)
 queries for a new interface to an existing UNO object. More...
 
void acquire ()
 increases the reference counter by one. More...
 
void release ()
 decreases the reference counter by one. More...
 

Detailed Description

specifies a SAX parser that uses integer values for known XML names (elements, attributes and attribute values).

The parser also handles namespaces and allows to have individual contexts for each XML element.

Before parsing is possible you have to set your XFastDocumentHandler using setFastDocumentHandler().

Parsing starts with calling parseStream(). If the parser finds a valid XML file with the given InputSource, it calls XFastDocumentHandler::startDocument() first.

This parser generates either "fast" events that use integer token values for namespaces, elements and attributes or "unknown" events for elements that are unknown.

A namespace is unknown if the namespace URL was not registered with registerNamespace().

An element is unknown if no XFastTokenHandler is set or if the XFastTokenHandler does not return a valid identifier for the elements local name. An element is also unknown if the elements local name is known but it uses a namespace that is unknown.

Setting a XFastTokenHandler with setTokenHandler() is optional, but without a XFastTokenHandler you will only get unknown sax events. This can be useful if you are only interested in the namespace handling and/or the context feature.

For each element the parser sends a create child element event to the elements parent context by calling XFastContextHandler::createFastChildContext() for known elements or XFastContextHandler::createUnknownChildContext() for unknown elements.
The parent context for the root element is the XFastDocumentHandler itself.

If the parent context returns an empty reference, no further events for the element and all of its children are created.

If a valid context is returned this context gets a start event by a call to XFastContextHandler::startFastElement() for known elements or XFastContextHandler::startUnknownElement() for unknown elements.

After processing all its child elements the context gets an end event by a call to XFastContextHandler::endFastElement() for known elements or XFastContextHandler::endUnknownElement() for unknown elements.

It is valid to return one instance of XFastContextHandler more than once. It is even possible to only use the XFastDocumentHandler by always returning a reference to itself for each create child context event.

After the last element is processed the parser generates an end document event at the XFastDocumentHandler by calling XFastDocumentHandler::endDocument().

See also
http://wiki.openoffice.org/wiki/FastParser

Member Function Documentation

string getNamespaceURL ( [in] string  prefix)
raises (com::sun::star::lang::IllegalArgumentException
)

Gets the namespace url string.

void parseStream ( [in] InputSource  aInputSource)
raises ( SAXException,
com::sun::star::io::IOException
)

parses an XML document from a stream.

Set the desired handlers before calling this method.

void registerNamespace ( [in] string  NamespaceURL,
[in] long  NamespaceToken 
)
raises (com::sun::star::lang::IllegalArgumentException
)

registers a known namespace url with the given integer token.


Parameters
NamespaceURLthe namespace URL.
NamespaceTokenan integer token that must be greater than FastToken::NAMESPACE.
void setEntityResolver ( [in] XEntityResolver  Resolver)

allows an application to register a DTD-Handler.

void setErrorHandler ( [in] XErrorHandler  Handler)

allows an application to register an error event handler.

Note that the error handler can throw an exception when an error or warning occurs. Note that an exception is thrown by the parser when an unrecoverable (fatal) error occurs.

void setFastDocumentHandler ( [in] XFastDocumentHandler  Handler)

Application must register a document event handler to get sax events for the parsed stream.

void setLocale ( [in] com::sun::star::lang::Locale  locale)

sets a locale specified for localization of warnings and error messages.

Set the language of the error messages. Useful when the parsing errors will be presented to the user.

void setNamespaceHandler ( [in] XFastNamespaceHandler  Handler)
Since
LibreOffice 5.3
void setTokenHandler ( [in] XFastTokenHandler  Handler)

must be registered to translate known XML names to integer tokens.


The documentation for this interface was generated from the following file: