Here you can find the source of getRootElement(final String respuestaPost)
Parameter | Description |
---|---|
respuestaPost | a parameter |
Parameter | Description |
---|---|
ParserConfigurationException | an exception |
IOException | an exception |
SAXException | an exception |
public static Element getRootElement(final String respuestaPost) throws ParserConfigurationException, IOException, SAXException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.IOException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Element; import org.xml.sax.SAXException; public class Main { /**// www . ja va2 s.c o m * Obtiene el nodo raiz del documento xml * * @param respuestaPost * @return * @throws ParserConfigurationException * @throws IOException * @throws SAXException */ public static Element getRootElement(final String respuestaPost) throws ParserConfigurationException, IOException, SAXException { return DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(new ByteArrayInputStream(respuestaPost.getBytes())).getDocumentElement(); } }