You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Peter B. West" <pb...@powerup.com.au> on 2002/11/21 07:02:26 UTC

Re: fo validation issue

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  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: fo validation issue

Posted by "Peter B. West" <pb...@powerup.com.au>.
Oleg Tkachenko wrote:
> Peter B. West 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;)* ?
>>
> 
>> How about:
>>
> 
>>     FoXMLEvent ev = expectStartElement
>>         (FObjectSets.normalPcdataBlockInlineSet,
>>                                        XMLEvent.RETAIN_W_SPACE);
> 
> 
> Looks not bad, but what about future extensions? Does it mean we will 
> have to change this code every time new extension element or property is 
> defined?
> 

Oleg,

That depends.  If it is just a matter of extra elements, they can go 
into FObjectSets.normalPcdataBlockInlineSet, or one of the sets that 
comprise it.  In some cases, new sets and new access functions will have 
to be defined, but they will be modelled on existing ones.

Extension elements, as such, have an unpredictable semantic component 
anyway.

Peter
-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: fo validation issue

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Peter B. West 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;)* ?

> How about:
> 

>     FoXMLEvent ev = expectStartElement
>         (FObjectSets.normalPcdataBlockInlineSet,
>                                        XMLEvent.RETAIN_W_SPACE);

Looks not bad, but what about future extensions? Does it mean we will have to 
change this code every time new extension element or property is defined?

-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org