Page 1 of 1

unmarshallFromTemplate insert xml problem

PostPosted: Fri Mar 30, 2012 3:12 am
by plutology
Hi All,

We are new to docx4j.
We are trying to determine the limitations of unmarshallFromTemplate()
The goal is to move the body content of one document as replacement string for a tag.

// pass: mappings.put( "aok.relatedEfforts", "radius > 3.0 nm" );
// fail: mappings.put( "aok.relatedEfforts", "radius <= 3.0 nm" );
// pass: mappings.put( "aok.relatedEfforts", "<w:t>text for the Related Effort block</w:t>" );

When testing string replacement, any string with a '<' throws assorted org.xml.sax.SAXParseExceptions.
Unrelated, large block of word xml did not replace a tag in other tests.

Recommendation for another API or proper use of the unmarshallFromTemplate appreciated.

Cheers,
Kevin

Re: unmarshallFromTemplate insert xml problem

PostPosted: Fri Mar 30, 2012 8:36 am
by jason
Hi Kevin

Does it work if you use &lt; instead of the less than symbol?

It is not designed to support inserting WordML fragments, although I guess it could be extended to support some of these easily enough.

I would recommend you use the custom xml data binding API, which is much more powerful. See the sub-forum and www.opendope.org for more info.

cheers .. Jason

Re: unmarshallFromTemplate insert xml problem

PostPosted: Sat Mar 31, 2012 8:03 am
by plutology
Thanks for the quick response Jason.

We will check out the sub forum suggestion.

Kevin