I am loading the custom xml by using the following code snippet
Using java Syntax Highlighting
String itemId = "{2e80dc51-dc3b-4296-bf09-3e682aab035a}".toLowerCase();
CustomXmlDataStoragePart customXmlDataStoragePart = wordMLPackage.getCustomXmlDataStorageParts().get(itemId);
CustomXmlDataStorage customXmlDataStorage = customXmlDataStoragePart.getData();
Document doc= ((CustomXmlDataStorageImpl)customXmlDataStorage).getDocument();
// remove source of fund first row
doc.removeChild(((CustomXmlDataStorageImpl)customXmlDataStorage).xpathGetNodes("/investmentTemplate/sourceoffunds", " ").get(0));
CustomXmlDataStoragePart customXmlDataStoragePart = wordMLPackage.getCustomXmlDataStorageParts().get(itemId);
CustomXmlDataStorage customXmlDataStorage = customXmlDataStoragePart.getData();
Document doc= ((CustomXmlDataStorageImpl)customXmlDataStorage).getDocument();
// remove source of fund first row
doc.removeChild(((CustomXmlDataStorageImpl)customXmlDataStorage).xpathGetNodes("/investmentTemplate/sourceoffunds", " ").get(0));
Parsed in 0.020 seconds, using GeSHi 1.0.8.4
Following one is custom xml structure
Using xml Syntax Highlighting
<investmentTemplate>
<sourceoffunds>
<fund>
<serviceName></serviceName>
<productname>pname</productname>
<owner>owner</owner>
<value>value</value>
</fund>
<exist></exist>
</sourceoffunds>
</investmentTemplate>
<sourceoffunds>
<fund>
<serviceName></serviceName>
<productname>pname</productname>
<owner>owner</owner>
<value>value</value>
</fund>
<exist></exist>
</sourceoffunds>
</investmentTemplate>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
i want to remove the fund elment first as its mapped to ducument with static data and then want to keep on ading more fund elment here,as it will be a repeat of table row,but its give following error
- Code: Select all
org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist.
at org.apache.xerces.dom.ParentNode.internalRemoveChild(Unknown Source)
at org.apache.xerces.dom.ParentNode.removeChild(Unknown Source)
at org.apache.xerces.dom.CoreDocumentImpl.removeChild(Unknown Source)
at com.citigroup.citiplanner.factfinder.ljo.InvestmentMFSPDCASoaReport.getwordMLPackage(InvestmentMFSPDCASoaReport.java:125).
please help how to modify this xml here