Created
November 7, 2011 21:23
-
-
Save sachin-handiekar/1346229 to your computer and use it in GitHub Desktop.
Converting DOM Document to JDOM and vice versa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jdom.JDOMException; | |
import org.jdom.input.DOMBuilder; | |
import org.jdom.output.DOMOutputter; | |
public class DocumentConverter { | |
public org.jdom.Document convertDOMtoJDOM(org.w3c.dom.Document input) { | |
DOMBuilder builder = new DOMBuilder(); | |
org.jdom.Document output = builder.build(input); | |
return output; | |
} | |
public org.w3c.dom.Document convertJDOMToDOM(org.jdom.Document jdomDoc) throws JDOMException { | |
DOMOutputter outputter = new DOMOutputter(); | |
return outputter.output(jdomDoc); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment