Class SimpleXMLParser
- java.lang.Object
-
- com.itextpdf.text.xml.simpleparser.SimpleXMLParser
-
public final class SimpleXMLParser extends java.lang.Object
A simple XML. This parser is, like the SAX parser, an event based parser, but with much less functionality.The parser can:
- It recognizes the encoding used
- It recognizes all the elements' start tags and end tags
- It lists attributes, where attribute values can be enclosed in single or double quotes
- It recognizes the
<[CDATA[ ... ]]>
construct - It recognizes the standard entities: &, <, >, ", and ', as well as numeric entities
- It maps lines ending in
\r\n
and\r
to\n
on input, in accordance with the XML Specification, Section 2.11
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.String
escapeXML(java.lang.String s, boolean onlyASCII)
Deprecated.moved toXMLUtil.escapeXML(String, boolean)
, left here for the sake of backwards compatibilitystatic void
parse(SimpleXMLDocHandler doc, SimpleXMLDocHandlerComment comment, java.io.Reader r, boolean html)
Parses the XML document firing the events to the handler.static void
parse(SimpleXMLDocHandler doc, java.io.InputStream in)
Parses the XML document firing the events to the handler.static void
parse(SimpleXMLDocHandler doc, java.io.Reader r)
-
-
-
Method Detail
-
parse
public static void parse(SimpleXMLDocHandler doc, SimpleXMLDocHandlerComment comment, java.io.Reader r, boolean html) throws java.io.IOException
Parses the XML document firing the events to the handler.- Parameters:
doc
- the document handlercomment
- the comment handlerr
- the document. The encoding is already resolved. The reader is not closedhtml
-- Throws:
java.io.IOException
- on error
-
parse
public static void parse(SimpleXMLDocHandler doc, java.io.InputStream in) throws java.io.IOException
Parses the XML document firing the events to the handler.- Parameters:
doc
- the document handlerin
- the document. The encoding is deduced from the stream. The stream is not closed- Throws:
java.io.IOException
- on error
-
parse
public static void parse(SimpleXMLDocHandler doc, java.io.Reader r) throws java.io.IOException
- Parameters:
doc
-r
-- Throws:
java.io.IOException
-
escapeXML
@Deprecated public static java.lang.String escapeXML(java.lang.String s, boolean onlyASCII)
Deprecated.moved toXMLUtil.escapeXML(String, boolean)
, left here for the sake of backwards compatibilityEscapes a string with the appropriated XML codes.- Parameters:
s
- the string to be escapedonlyASCII
- codes above 127 will always be escaped with &#nn; iftrue
- Returns:
- the escaped string
-
-