| java.lang.Object com.rimfaxe.xml.xmlreader.Parser
Parser | public class Parser (Code) | | Provides a simple interface to the XML parser.
This is an example of the Facade design pattern.
There are two types of parse methods: DOM methods which parse into a DOM tree
and SAX methods in which the parser calls a client-provided hander. The XML can be proved
either as characters (in a String, character array, or Reader) or as bytes
(in a File, byte array, or InputStream). In the latter case the Unicode encoding is
first guessed by looking at the first few characters and then possibly confirmed
by reading an encoding declaration on the first line of the XML. In some cases the declared
encoding may be different to the guessed encoding and the parser will have to re-start reading
the bytes.
Copyright (C) 2002 Hewlett-Packard Company.
This file is part of Sparta, an XML Parser, DOM, and XPath library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. This library
is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See Also: GNU Lesser General Public License version: $Date: 2002/12/13 23:09:24 $ $Revision: 1.2 $ author: Eamonn O'Brien-Strain author: Sergio Marti |
Method Summary | |
public static Document | parse(String systemId, Reader reader) DOM parsing of XML in a character stream, using a default log. | public static Document | parse(String systemId, Reader reader, ParseLog log) DOM parsing of XML in a character stream. | public static Document | parse(File file, ParseLog log) DOM parsing of XML in a file. | public static Document | parse(File file) DOM parsing of XML in a file, using a default log. | public static Document | parse(String xml) DOM parsing of XML in a String. | public static Document | parse(char[] xml) DOM parsing of XML in a character array (this is the fastest parse method). | public static Document | parse(byte[] xml) Parse XML to DOM, figuring out the encoding using the first few characters and possibly
an encoding declaration on the first line of the XML.
Parameters: xml - stored in an array of bytes in some Unicode encoding. | public static Document | parse(String systemId, Reader reader, ParseLog log, String encoding) DOM parsing of XML in a character stream, specifying the Unicode encoding. | public static Document | parse(String systemId, InputStream istream, ParseLog log) DOM parsing of XML encoded in a byte stream. | public static Document | parse(String systemId, InputStream istream) DOM parsing of XML encoded in a byte stream, using a default log. | public static Document | parse(String systemId, InputStream istream, ParseLog log, String guessedEncoding) DOM parsing of XML encoded in a character stream, specifying the Unicode encoding. | public static void | parse(String systemId, Reader reader, ParseHandler ph) SAX parsing of XML in character stream, using default log. | public static void | parse(String systemId, Reader reader, ParseLog log, ParseHandler ph) SAX parsing of XML in character stream. | public static void | parse(File file, ParseLog log, ParseHandler ph) SAX parsing of XML in a file. | public static void | parse(File file, ParseHandler ph) SAX parsing of XML in a file, using default log. | public static void | parse(String xml, ParseHandler ph) SAX parsing of XML in a string. | public static void | parse(char[] xml, ParseHandler ph) SAX parsing of XML in a character array. | public static void | parse(byte[] xml, ParseHandler ph) SAX parsing of XML encoded in a byte array. | public static void | parse(String systemId, InputStream istream, ParseLog log, ParseHandler ph) SAX parsing of XML encoded in a byte stream, using default log. | public static void | parse(String systemId, InputStream istream, ParseHandler ph) SAX parsing of XML encoded in a byte stream. | public static void | parse(String systemId, InputStream istream, ParseLog log, String guessedEncoding, ParseHandler ph) SAX parsing of XML encoded in a byte stream, specifying the Unicode encoding. | public static void | parse(String systemId, Reader reader, ParseLog log, String encoding, ParseHandler ph) SAX parsing of XML encoded in a character stream, specifying the Unicode encoding. |
parse | public static Document parse(byte[] xml) throws ParseException, IOException(Code) | | Parse XML to DOM, figuring out the encoding using the first few characters and possibly
an encoding declaration on the first line of the XML.
Parameters: xml - stored in an array of bytes in some Unicode encoding. the DOM Document resulting from the parsing throws: ParseException - on parse error |
|
|