2014-10-26 54 views
0

我已经使用XJC转换的非官方FOP模式到Java对象JAXB生成的TableCell类从FOP架构 - 没办法加挡

http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop.xsd?view=co

当写附着于模式的XML文档,我可以在<fo:table-cell/>元素内添加<fo:block/>元素;但是我看不出用编程方式使用生成的TableCell类将Block添加到TableCell的任何方式。我错过了实现这一目标的方法吗?

http://pastebin.com/raw.php?i=Xs6gjE3T

回答

0

检查markerOrBlockOrBlockContainer财产。

@XmlElements({ 
    @XmlElement(name = "block-container", required = true, type = BlockContainer.class), 
    @XmlElement(name = "retrieve-marker", required = true, type = RetrieveMarker.class), 
    @XmlElement(name = "list-block", required = true, type = ListBlock.class), 
    @XmlElement(name = "table", required = true, type = Table.class), 
    @XmlElement(name = "float", required = true, type = Float.class), 
    @XmlElement(name = "multi-properties", required = true, type = MultiProperties.class), 
    @XmlElement(name = "table-and-caption", required = true, type = TableAndCaption.class), 
    @XmlElement(name = "footnote", required = true, type = Footnote.class), 
    @XmlElement(name = "marker", required = true, type = Marker.class), 
    @XmlElement(name = "multi-switch", required = true, type = MultiSwitch.class), 
    @XmlElement(name = "block", required = true, type = Block.class), 
    @XmlElement(name = "wrapper", required = true, type = Wrapper.class) 
}) 
protected List<Object> markerOrBlockOrBlockContainer; 

将可能:

myTableCell.getMarkerOrBlockOrBlockContainer().add(myBlock); 

你得到,因为重复choice构建的这个 “异类” 属性:

<choice maxOccurs = "unbounded"> 
    <group ref = "fo:marker_List"/> 
    <group ref = "fo:block_List"/> 
    <group ref = "fo:neutral_List"/> 
    <group ref = "fo:float_List"/> 
    <group ref = "fo:footnote_List"/> 
    </choice> 
+0

*拍打头部* ... – Black 2014-10-28 00:48:47