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 "Reed, Gary" <Ga...@McKesson.com> on 2006/08/16 00:03:15 UTC

RE: confirm subscribe to fop-dev@xmlgraphics.apache.org

All,

I'm new to the FOP world and am not real familiar with the code. I've
got a situation where Word 2003 has produced an XML file (i.e.,
WordprocessingML) that's been converted to an FO file via the Microsoft
provided xsl file. The xml file contains the following snippet:

<w:listPr>
    <aml:annotation aml:id="2" aml:author="."
aml:createdate="2003-03-20T11:54:00Z" w:type="Word.Insertion"/>
</w:listPr>

Which causes the exception:

org.apache.fop.fo.ValidationException: null:2:26031: Error(2/26031):
fo:list-item-label is missing child elements. 
Required Content Model: marker* (%block;)+
	at
org.apache.fop.fo.FONode.missingChildElementError(FONode.java:407)
	at
org.apache.fop.fo.flow.AbstractListItemPart.endOfNode(AbstractListItemPa
rt.java:68)
	at
org.apache.fop.fo.flow.ListItemLabel.endOfNode(ListItemLabel.java:49)
	at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.j
ava:378)
	at
org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:194)
	at
org.apache.xalan.transformer.TransformerIdentityImpl.endElement(Transfor
merIdentityImpl.java:1103)
	at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
	at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
	at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transform
erIdentityImpl.java:494)
      
      . . .

To get around this I modified the endOfNode() method in
org.apache.fop.fo.flow.AbstractListItemPart to only throw this exception
if strict validation is configured:

    /**
     * @see org.apache.fop.fo.FONode#endOfNode
     */
    protected void endOfNode() throws FOPException {
        if (!this.blockItemFound) {
            String contentModel = "marker* (%block;)+";
            if (getUserAgent().validateStrictly()) {
                missingChildElementError(contentModel);
            }
            else {
                StringBuffer message = new
StringBuffer(errorText(getLocator()));
                message.append(getName());
                message.append(" is missing child elements. \nRequired
Content Model: "); 
                message.append(contentModel);
                getLogger().warn(message.toString());
            }
        }
    }

Does anyone see a problem with this?

Thank you,

Gary Reed
Horizon Anatomic Pathology Development 
McKesson Provider Technologies 
541.681.8265 
mailto:gary.reed@mckesson.com 
This e-mail message, including any attachments, is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.


Re: confirm subscribe to fop-dev@xmlgraphics.apache.org

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Aug 16, 2006, at 00:03, Reed, Gary wrote:

Hi,

<snip />
>
> To get around this I modified the endOfNode() method in
> org.apache.fop.fo.flow.AbstractListItemPart to only throw this  
> exception
> if strict validation is configured:
<snip />

> Does anyone see a problem with this?

Not an immediate problem, but then again, if the stylesheet produces  
invalid FO, then it would probably be wiser, in the long term, to  
submit a patch to Microsoft's XSL...


HTH!

Cheers,

Andreas