I am quite new to docx4j, Though i could succeed in custom xml binding , I am finding difficult in binding repeated rows in a table. The following is the xml (wordprocessingMl) code
- Code: Select all
<w:sdt>
<w:sdtPr>
<w:alias w:val="Repeat" />
<w:tag
w:val="bindingrole=repeat&w:xpath=/project[1]/authors&w:storeItemID={5C774536-D99F-4F95-B4BC-725DF5804EC0}" />
<w:id w:val="1418037945" />
</w:sdtPr>
<w:sdtContent>
<w:tr w:rsidR="00E43216" w:rsidTr="001A0211">
<w:sdt>
<w:sdtPr>
<w:id w:val="12962546" />
<w:showingPlcHdr />
<w:dataBinding w:prefixMappings="xmlns:ns0='http://gsal.project'"
w:xpath="/project[1]/authors/author[1]/name" w:storeItemID="{5C774536-D99F-4F95-B4BC-725DF5804EC0}" />
<w:alias w:val="Name" />
<w:tag w:val="name" />
<w:id w:val="1418037951" />
<w:placeholder>
<w:docPart w:val="DefaultPlaceholder_22675703" />
</w:placeholder>
<w:text />
</w:sdtPr>
<w:sdtContent>
<w:tc>
<w:tcPr>
<w:tcW w:w="5508" w:type="dxa" />
</w:tcPr>
<w:p w:rsidR="006C7B17" w:rsidRDefault="001A0211">
<w:r>
<w:t>Linton</w:t>
</w:r>
</w:p>
</w:tc>
</w:sdtContent>
</w:sdt>
<w:sdt>
<w:sdtPr>
<w:id w:val="14802410" />
<w:showingPlcHdr />
<w:dataBinding w:prefixMappings="xmlns:ns0='http://gsal.project'"
w:xpath="/project[1]/authors/author[1]/role" w:storeItemID="{5C774536-D99F-4F95-B4BC-725DF5804EC0}" />
<w:alias w:val="Role" />
<w:tag w:val="role" />
<w:id w:val="1418037952" />
<w:placeholder>
<w:docPart w:val="DefaultPlaceholder_22675703" />
</w:placeholder>
<w:text />
</w:sdtPr>
<w:sdtContent>
<w:tc>
<w:tcPr>
<w:tcW w:w="5508" w:type="dxa" />
</w:tcPr>
<w:p w:rsidR="006C7B17" w:rsidRDefault="001A0211">
<w:r>
<w:t>20</w:t>
</w:r>
</w:p>
</w:tc>
</w:sdtContent>
</w:sdt>
</w:tr>
</w:sdtContent>
</w:sdt>
And this is my customexml data file
- Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project xmlns="http://gsal.project" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<title>TESTING TITTLE</title>
<authors>
<author>
<name>Linton</name>
<role>20</role>
</author>
<author>
<name>Sam</name>
<role>Project Manager</role>
</author>
</authors>
<clients>
<client>
<name/>
<type/>
<passfail/>
<address/>
<telephone/>
<employees>
<employee>
<emp_name/>
<emp_pos/>
</employee>
</employees>
</client>
</clients>
</project>
I am using the customXMLBinding.java file with smaller modification. It binds only one value in table, fails to repeat.
Can anyone please help to find what i am missing ?
Note:
I am attaching all the files for your reference .. just in case..
Thanks in advance....