2014-10-26 30 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