org.ow2.util.xml
Class DocumentParser

java.lang.Object
  extended by org.ow2.util.xml.DocumentParser

public final class DocumentParser
extends Object

Allows to parse an xml file.

Author:
Florent Benoit

Method Summary
static Document getDocument(File file, boolean isValidating, EntityResolver entityResolver)
          Builds a new Document for a given xml file.
static Document getDocument(InputSource inputSource, boolean isValidating, EntityResolver entityResolver)
          Builds a new Document for a given xml file.
static Document getDocument(InputSource inputSource, boolean isValidating, EntityResolver entityResolver, Collection<String> schemaLocations)
          Builds a new Document for a given xml file.
static Document getDocument(InputStream stream, boolean isValidating, EntityResolver entityResolver)
          Builds a new Document for a given xml file.
static Document getDocument(URL url, boolean isValidating, EntityResolver entityResolver)
          Builds a new Document for a given xml file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDocument

public static Document getDocument(File file,
                                   boolean isValidating,
                                   EntityResolver entityResolver)
                            throws DocumentParserException
Builds a new Document for a given xml file.

Parameters:
file - the XML file.
isValidating - validate or not the xml file ?
entityResolver - the entityResolver used to validate document (if validating = true)
Returns:
an application object.
Throws:
DocumentParserException - if creating of builder fails or parsing fails.

getDocument

public static Document getDocument(URL url,
                                   boolean isValidating,
                                   EntityResolver entityResolver)
                            throws DocumentParserException
Builds a new Document for a given xml file.

Parameters:
url - the URL of the XML file.
isValidating - validate or not the xml file ?
entityResolver - the entityResolver used to validate document (if validating = true)
Returns:
an application object.
Throws:
DocumentParserException - if creating of builder fails or parsing fails.

getDocument

public static Document getDocument(InputStream stream,
                                   boolean isValidating,
                                   EntityResolver entityResolver)
                            throws DocumentParserException
Builds a new Document for a given xml file.

Parameters:
stream - the InputStream of the XML file.
isValidating - validate or not the xml file ?
entityResolver - the entityResolver used to validate document (if validating = true)
Returns:
an application object.
Throws:
DocumentParserException - if creating of builder fails or parsing fails.

getDocument

public static Document getDocument(InputSource inputSource,
                                   boolean isValidating,
                                   EntityResolver entityResolver)
                            throws DocumentParserException
Builds a new Document for a given xml file.

Parameters:
inputSource - the InputSource of the XML file.
isValidating - validate or not the xml file ?
entityResolver - the entityResolver used to validate document (if validating = true)
Returns:
an application object.
Throws:
DocumentParserException - if creating of builder fails or parsing fails.

getDocument

public static Document getDocument(InputSource inputSource,
                                   boolean isValidating,
                                   EntityResolver entityResolver,
                                   Collection<String> schemaLocations)
                            throws DocumentParserException
Builds a new Document for a given xml file.

Parameters:
inputSource - the InputSource of the XML file.
isValidating - validate or not the xml file ?
entityResolver - the entityResolver used to validate document (if validating = true)
schemaLocations - the list of external schemaLocation to force (if validating = true)
Returns:
an application object.
Throws:
DocumentParserException - if creating of builder fails or parsing fails.


Copyright © 2007-2012 OW2 Consortium. All Rights Reserved.