Correctly inserting HTMLChunk in WordMLPackage
Posted: Thu Apr 12, 2012 8:53 pm
Hey, we got an inconsistency-problem when adding HTML chunks to an existing wordML Package. Indexes do not match, and we don't exactly know how to solve this. Let me explain this by code. This is basically a substitution-Problem.
Is there a proper way to solve this? I am able to provide more information upon request, of course.
Thank you in advance,
Nico
Using java Syntax Highlighting
List<Object> texts = thisWordMLPackage.getMainDocumentPart()
.getJAXBNodesViaXPath(XPATH_TO_SELECT_TEXT_NODES, true);
CTAltChunk chunk = ... //Chunk creation works
//does not work
texts.set(index, chunk);
//does not work either
((JAXBElement) texts.get(index)).setValue(chunks);
// DOES WORK, but the list we receive with the .getContent() method is not congruent with the texts list, i.o.w the index from XPATH is != index of DocumentPart and the inserting is wrong.
thisWordMLPackage.getMainDocumentPart().getContent().set((index),chunk)
.getJAXBNodesViaXPath(XPATH_TO_SELECT_TEXT_NODES, true);
CTAltChunk chunk = ... //Chunk creation works
//does not work
texts.set(index, chunk);
//does not work either
((JAXBElement) texts.get(index)).setValue(chunks);
// DOES WORK, but the list we receive with the .getContent() method is not congruent with the texts list, i.o.w the index from XPATH is != index of DocumentPart and the inserting is wrong.
thisWordMLPackage.getMainDocumentPart().getContent().set((index),chunk)
Parsed in 0.015 seconds, using GeSHi 1.0.8.4
Is there a proper way to solve this? I am able to provide more information upon request, of course.
Thank you in advance,
Nico