Java XML Document Parse parseDocument(String xmlString)

Here you can find the source of parseDocument(String xmlString)

Description

parse Document

License

Apache License

Declaration

public static Document parseDocument(String xmlString)
            throws SAXException, IOException, ParserConfigurationException 

Method Source Code


//package com.java2s;
/*/* ww w. j  av  a 2  s  .c  o  m*/
 * Copyright 2010 University of Chicago
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * NOTE: This is a _PROTOTYPE_ implementation and is not intended for
 *       production use.
 * @src https://svn.cagrid.org/trunk/cagrid/restsecurity/cagrid-restsecurity-common/src/main/java/org/cagrid/security/rest/util/SecurityUtil.java
 */

import java.io.ByteArrayInputStream;

import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;

import org.xml.sax.SAXException;

public class Main {
    static DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();

    public static Document parseDocument(String xmlString)
            throws SAXException, IOException, ParserConfigurationException {
        DocumentBuilder builder = builderFactory.newDocumentBuilder();
        return builder.parse(new ByteArrayInputStream(xmlString.getBytes()));
    }
}

Related

  1. parseDocument(Reader reader)
  2. parseDocument(String docText)
  3. parseDocument(String documentString)
  4. parseDocument(String documentString)
  5. parseDocument(String path)
  6. parseDocumentIntoStringXML(Document document)
  7. parseDocumentr(File f)
  8. parseFileToDocument(File f)
  9. parseHTMLDocument(String paramString)