Oleg Tkachenko wrote:
I like pull parsing model in general, but how do you manage with not
such strict content model as fo:root have, e.g. fo:block with
(#PCDATA|%inline;|%block;)* ?
Oleg,
How about:
/**
* Expect that the next element will be a STARTELEMENT for one of the
* flow objects which are members of (#PCDATA|%inline;|%block;) from
* <b>6.2 Formatting Object Content</b>, including out-of-line flow
* objects which may occur except as descendants of out-of-line
* formatting objects. White space is retained, and
* will appear as #PCDATA, i.e., as an instance of FoCharacters.
* @return the <tt>FoXMLEvent</tt> found. If any other events are
* encountered return <tt>null</tt>.
*/
public FoXMLEvent expectPcdataOrInlineOrBlock()
throws FOPException, UnexpectedStartElementException
{
FoXMLEvent ev = expectStartElement
(FObjectSets.normalPcdataBlockInlineSet,
XMLEvent.RETAIN_W_SPACE);
if (ev == null)
ev = expectCharacters();
return ev;
}
/**
* Expect that the next element will be a STARTELEMENT for one of the
* flow objects which are members of (#PCDATA|%inline;|%block;) from
* <b>6.2 Formatting Object Content</b>, excluding out-of-line flow
* objects which may not occur as descendants of out-of-line formatting
* objects. White space is retained, and
* will appear as #PCDATA, i.e, as an instance of FoCharacters.
* @return the <tt>FoXMLEvent</tt> found. If any other events are
* encountered return <tt>null</tt>.
*/
public FoXMLEvent expectOutOfLinePcdataOrInlineOrBlock()
throws FOPException, UnexpectedStartElementException
{
FoXMLEvent ev = expectStartElement
(FObjectSets.outOfLinePcdataBlockInlineSet,
XMLEvent.RETAIN_W_SPACE);
if (ev == null)
ev = expectCharacters();
return ev;
}
Peter
--
Peter B. West [EMAIL PROTECTED] http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]