Hi Folks,
I am writing a plugin for JIRA where i have to parse XML response inside my code. I was trying many things but nothing worked for me.
What is the best way to parse XML response inside Java file. What dependency i have to put in my pom.xml ?
Community moderators have prevented the ability to post new answers.
Hi Senthil!
SaxParser is part of JDK so you can use it and no need to add extra dependencies. Just searched JIRA sources for XML parsing and see it's widely utilized there. If you have sources you can do the same by searching for "SAXParser".
Even without JIRA sources googling will reveal you a lot of documentation and tutorials .
Thanks for your input. Let me try and get back to you. I have an another question here, I was using the below imports, import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; What should be the dependency in pom.xml ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As Volodymyr mentioned, a sax parser is part of the jdk. So there is no need to add anything for that to the pom.xml. Just: import javax.xml.parsers.SAXParser; and instantiate a new parser using: SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.