Difference between revisions of "XFastContextHandler"

From Apache OpenOffice Wiki
Jump to: navigation, search
(added draft documentation for the new XFastContext interface)
 
m (added idl section)
Line 8: Line 8:
 
import.
 
import.
  
= About fast and unknown events =
+
= IDL =
 
+
Like the old sax document handler the fast sax context handles the ''start'', ''end'' and ''characters'' events. Additionally it
+
handles the new ''create child event''. Except for the ''characters'' event there is a 'fast' and an 'unknown' version for each one:
+
  
 
<pre>
 
<pre>
Line 38: Line 35:
 
};  
 
};  
 
</pre>
 
</pre>
 +
 +
= About fast and unknown events =
 +
 +
Like the old sax document handler the fast sax context handles the ''start'', ''end'' and ''characters'' events. Additionally it
 +
handles the new ''create child event''. Except for the ''characters'' event there is a 'fast' and an 'unknown' version for each one:
  
 
<p>The fast versions are called for elements where
 
<p>The fast versions are called for elements where

Revision as of 16:22, 1 March 2007

See also FastParser

Abstract

A XFastContextHandler returned for an xml element will get the start, end and character events for that xml element. If will also get create child events for direct child elements. You can also return an empty reference. The parser will not send any events for this element and all its child elements. This is a simple way to skip elements that are not needed for import.

IDL

interface XFastContextHandler
{ 
	void startFastElement( [in] long Element, [in] XFastAttributeList Attribs ) 
		raises( com::sun::star::xml::sax::SAXException ); 

	void startUnknownElement( [in] string Namespace, [in] string Name, [in] XFastAttributeList Attribs ) 
			raises( com::sun::star::xml::sax::SAXException ); 

	void endFastElement( [in] long Element ) 
			raises( com::sun::star::xml::sax::SAXException ); 

	void endUnknownElement( [in] string Namespace, [in] string Name ) 
			raises( com::sun::star::xml::sax::SAXException ); 
 
	XFastContextHandler createFastChildContext( [in] long Element, [in] XFastAttributeList Attribs ) 
			raises( com::sun::star::xml::sax::SAXException ); 

	XFastContextHandler createUnknownChildContext( [in] string Namespace, [in] string Name, [in] XFastAttributeList Attribs ) 
			raises( com::sun::star::xml::sax::SAXException ); 

	void characters( [in] string aChars ) 
			raises( com::sun::star::xml::sax::SAXException ); 
}; 

About fast and unknown events

Like the old sax document handler the fast sax context handles the start, end and characters events. Additionally it handles the new create child event. Except for the characters event there is a 'fast' and an 'unknown' version for each one:

<p>The fast versions are called for elements where

if a fast element also has a namespace, the identifier of the namespace is combined with the local name identifier with the arithmetically or operation. This enables switch case operations on elements with namespaces, for example:


void AnimationNodeContext::startFastElement( sal_Int32 Element, const Reference< XFastAttributeList >& Attribs )
{
	switch( Element )
	{
	case NMSP_ANIMATION|XML_PAR:
		...
		break;
	case NMSP_SMIL|XML_NODE:
		...
		break;
	}
}

For unknown elements or elements with unknown namespaces, the unknown methods are called which uses strings for namespace url and local names.

Personal tools