Hi, Here are few of the Java packages that provide classes for modifying XML:
javax.xml.parsers.*javax.xml. transform.*org.xml.sax.*org.w3c.dom.*
These packages will be available as a part of JDK.
An example for modifying XML using few classes from above packages: DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); File contentTypeXML = new File(extractToFolder + "\\" + "[Content_Types].xml"); Document doc = docBuilder.parse (contentTypeXML); Element rootElement = doc.getDocumentElement(); Element override = (Element) doc.createElement("Override");int pathLengthToBeIgnored = extractToFolder.length(); -------- override.setAttribute("PartName", folderForHeader + "/header2.xml");override.setAttribute("ContentType","application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"); rootElement.appendChild(override);
Mallika
Hi,
I guess no such API is there.
You can go through the following links.
http://blog.hvorom.dk/post/2008/03/Apache---Java-API-for-Open-XML.aspx
http://channel9.msdn.com/ShowPost.aspx?PostID=292715
http://www.theserverside.com/discussions/thread.tss?thread_id=44813
In .Net framework(3.0 and 3.5) there is one API called System.IO.Packaging.Using C# and that API you can programmataically edit any office 2007 document(docx,xlsx,pptx).That means you can edit any xml file also.
Hello there,
I am presently having the same requirement which is little urgent.
Need your help.
I exaclty follow the approach suggested but it's very early to proceed for me as i just updated it manully.
Could you please let me know if this approach works fine and any solution to that could be highly appreciated.
Best Regards
Sayed