Bug 40270

Summary: [PATCH] Make list item EndOfNode() method agile to strict-validation
Product: Fop - Now in Jira Reporter: Gary Reed <gary.reed>
Component: fo treeAssignee: fop-dev
Status: CLOSED FIXED    
Severity: normal Keywords: PatchAvailable
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch for AbstractListItemPart.java

Description Gary Reed 2006-08-16 19:43:18 UTC
[PATCH] This patch is needed to compensate for an error with Microsoft's Word
2003 WordprocessinML style sheet "Word2FO.xsl". McKesson is close to using FOP
at a pilot site and it would greatly help us if this change were made. I highly
doubt that we would experience a timely turn-around from Microsoft.

:::::::
As per Andreas Delmelle:

Hmm... We already allow table-bodies without child-nodes if strict validation is
turned off, so might as well add this. Not too much harm, I guess.

If it is producing list-item-labels without content --at least an empty block
would suffice-- then the stylesheet should be altered. It is resulting in FO
that does not adhere to the rules in the XSL-FO Rec, so it would be more
reasonable to change the stylesheet.

Either it should create an 'empty' list-item, with both label and body at least
containing an empty block, or it should not create a list-item at all.

:::::::
To reproduce:

<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. A patch file containing this modification is
attached.
Comment 1 Gary Reed 2006-08-16 19:45:59 UTC
Created attachment 18725 [details]
Patch for AbstractListItemPart.java
Comment 2 Chris Bowditch 2006-08-17 07:56:03 UTC
Thanks for the patch!
Comment 3 Andreas L. Delmelle 2006-08-17 10:24:55 UTC
Patch applied with very small modifications.
see: http://svn.apache.org/viewvc?rev=432201&view=rev

Thanks!
Comment 4 Glenn Adams 2012-04-01 07:09:17 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed