Javolution 6.0.0 java
javolution.xml.sax.XMLReaderImpl Class Reference
Inheritance diagram for javolution.xml.sax.XMLReaderImpl:
[legend]
Collaboration diagram for javolution.xml.sax.XMLReaderImpl:
[legend]

Public Member Functions

 XMLReaderImpl ()
 
void parse (InputStream in) throws IOException, SAXException
 
void parse (InputStream in, String encoding) throws IOException, SAXException
 
void parse (Reader reader) throws IOException, SAXException
 
void parse (InputSource input) throws IOException, SAXException
 
void parse (String systemId) throws IOException, SAXException
 
void setContentHandler (ContentHandler handler)
 
ContentHandler getContentHandler ()
 
void setErrorHandler (ErrorHandler handler)
 
ErrorHandler getErrorHandler ()
 
boolean getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException
 
void setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
 
Object getProperty (String name) throws SAXNotRecognizedException, SAXNotSupportedException
 
void setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
 
void setEntityResolver (EntityResolver resolver)
 
EntityResolver getEntityResolver ()
 
void setDTDHandler (DTDHandler handler)
 
DTDHandler getDTDHandler ()
 
void reset ()
 

Private Member Functions

void parseAll () throws XMLStreamException, SAXException
 

Private Attributes

ContentHandler _contentHandler
 
ErrorHandler _errorHandler
 
final XMLStreamReaderImpl _xmlReader = new XMLStreamReaderImpl()
 
EntityResolver _entityResolver
 
DTDHandler _dtdHandler
 

Static Private Attributes

static DefaultHandler DEFAULT_HANDLER = new DefaultHandler()
 
static final CharArray NO_CHAR = new CharArray("")
 

Detailed Description

This class provides a real-time SAX2-like XML parser; this parser is extremely fast and does not create temporary objects (no garbage generated and no GC interruption).

The parser is implemented as a SAX2 wrapper around
XMLStreamReaderImpl and share the same characteristics.

Note: This parser is a SAX2-like parser with the java.lang.String type replaced by CharArray/CharSequence in the ContentHandler, Attributes interfaces and DefaultHandler base class. If a standard SAX2 or JAXP parser is required, you may consider using the wrapping class SAX2ReaderImpl. Fast but not as fast as java.lang.String instances are dynamically allocated while parsing.

Author
Jean-Marie Dautelle
Version
4.0, June 16, 2006

Definition at line 48 of file XMLReaderImpl.java.

Constructor & Destructor Documentation

◆ XMLReaderImpl()

javolution.xml.sax.XMLReaderImpl.XMLReaderImpl ( )

Default constructor.

Definition at line 73 of file XMLReaderImpl.java.

73  {
74  // Sets default handlers.
77  }

References javolution.xml.sax.XMLReaderImpl.DEFAULT_HANDLER, javolution.xml.sax.XMLReaderImpl.setContentHandler(), and javolution.xml.sax.XMLReaderImpl.setErrorHandler().

Here is the call graph for this function:

Member Function Documentation

◆ getContentHandler()

ContentHandler javolution.xml.sax.XMLReaderImpl.getContentHandler ( )

Return the current content handler.

Returns
The current content handler, or null if none has been registered.
See also
setContentHandler

Implements javolution.xml.sax.XMLReader.

Definition at line 195 of file XMLReaderImpl.java.

195  {
196  return (_contentHandler == DEFAULT_HANDLER) ? null : _contentHandler;
197  }

References javolution.xml.sax.XMLReaderImpl._contentHandler, and javolution.xml.sax.XMLReaderImpl.DEFAULT_HANDLER.

◆ getDTDHandler()

DTDHandler javolution.xml.sax.XMLReaderImpl.getDTDHandler ( )

Return the current DTD handler.

Returns
The current DTD handler, or null if none has been registered.
See also
setDTDHandler

Implements javolution.xml.sax.XMLReader.

Definition at line 266 of file XMLReaderImpl.java.

266  {
267  return _dtdHandler;
268  }

References javolution.xml.sax.XMLReaderImpl._dtdHandler.

Referenced by javolution.xml.sax.SAX2ReaderImpl.getDTDHandler().

Here is the caller graph for this function:

◆ getEntityResolver()

EntityResolver javolution.xml.sax.XMLReaderImpl.getEntityResolver ( )

Return the current entity resolver.

Returns
The current entity resolver, or null if none has been registered.
See also
setEntityResolver

Implements javolution.xml.sax.XMLReader.

Definition at line 256 of file XMLReaderImpl.java.

256  {
257  return _entityResolver;
258  }

References javolution.xml.sax.XMLReaderImpl._entityResolver.

Referenced by javolution.xml.sax.SAX2ReaderImpl.getEntityResolver().

Here is the caller graph for this function:

◆ getErrorHandler()

ErrorHandler javolution.xml.sax.XMLReaderImpl.getErrorHandler ( )

Return the current error handler.

Returns
The current error handler, or null if none has been registered.
See also
setErrorHandler

Implements javolution.xml.sax.XMLReader.

Definition at line 209 of file XMLReaderImpl.java.

209  {
210  return (_errorHandler == DEFAULT_HANDLER) ? null : _errorHandler;
211  }

References javolution.xml.sax.XMLReaderImpl._errorHandler, and javolution.xml.sax.XMLReaderImpl.DEFAULT_HANDLER.

Referenced by javolution.xml.sax.SAX2ReaderImpl.getErrorHandler().

Here is the caller graph for this function:

◆ getFeature()

boolean javolution.xml.sax.XMLReaderImpl.getFeature ( String  name) throws SAXNotRecognizedException, SAXNotSupportedException

Look up the value of a feature flag.

The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but temporarily be unable to return its value. Some feature values may be available only in specific contexts, such as before, during, or after a parse. Also, some feature values may not be programmatically accessible. (In the case of an adapter for SAX1 org.xml.sax.Parser, there is no implementation-independent way to expose whether the underlying parser is performing validation, expanding external entities, and so forth.)

All XMLReaders are required to recognize the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.

Typical usage is something like this:

XMLReader r = new MySAXDriver();
                        // try to activate validation
try {
  r.setFeature("http://xml.org/sax/features/validation", true);
} catch (SAXException e) {
  System.err.println("Cannot activate validation."); 
}
                        // register event handlers
r.setContentHandler(new MyContentHandler());
r.setErrorHandler(new MyErrorHandler());
                        // parse the first document
try {
  r.parse("http://www.foo.com/mydoc.xml");
} catch (IOException e) {
  System.err.println("I/O exception reading XML document");
} catch (SAXException e) {
  System.err.println("XML exception reading document.");
}

Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.

Parameters
nameThe feature name, which is a fully-qualified URI.
Returns
The current value of the feature (true or false).
Exceptions
org.xml.sax.SAXNotRecognizedExceptionIf the feature value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedExceptionWhen the XMLReader recognizes the feature name but cannot determine its value at this time.
See also
setFeature

Implements javolution.xml.sax.XMLReader.

Definition at line 214 of file XMLReaderImpl.java.

215  {
216  if (name.equals("http://xml.org/sax/features/namespaces")) {
217  return true;
218  } else if (name
219  .equals("http://xml.org/sax/features/namespace-prefixes")) {
220  return true;
221  } else {
222  throw new SAXNotRecognizedException("Feature " + name
223  + " not recognized");
224  }
225  }

Referenced by javolution.xml.sax.SAX2ReaderImpl.getFeature().

Here is the caller graph for this function:

◆ getProperty()

Object javolution.xml.sax.XMLReaderImpl.getProperty ( String  name) throws SAXNotRecognizedException, SAXNotSupportedException

Look up the value of a property.

The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but temporarily be unable to return its value. Some property values may be available only in specific contexts, such as before, during, or after a parse.

XMLReaders are not required to recognize any specific property names, though an initial core set is documented for SAX2.

Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.

Parameters
nameThe property name, which is a fully-qualified URI.
Returns
The current value of the property.
Exceptions
org.xml.sax.SAXNotRecognizedExceptionIf the property value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedExceptionWhen the XMLReader recognizes the property name but cannot determine its value at this time.
See also
setProperty

Implements javolution.xml.sax.XMLReader.

Definition at line 238 of file XMLReaderImpl.java.

239  {
240  throw new SAXNotRecognizedException("Property " + name
241  + " not recognized");
242  }

Referenced by javolution.xml.sax.SAX2ReaderImpl.getProperty().

Here is the caller graph for this function:

◆ parse() [1/5]

void javolution.xml.sax.XMLReaderImpl.parse ( InputSource  input) throws IOException, SAXException

Parse an XML document.

The application can use this method to instruct the XML reader to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).

Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document). Once a parse is complete, an application may reuse the same XMLReader object, possibly with a different input source. Configuration of the XMLReader object (such as handler bindings and values established for feature flags and properties) is unchanged by completion of a parse, unless the definition of that aspect of the configuration explicitly specifies other behavior. (For example, feature flags or properties exposing characteristics of the document being parsed.)

During the parse, the XMLReader will provide information about the XML document through the registered event handlers.

This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.

Parameters
inputThe input source for the top-level of the XML document.
Exceptions
org.xml.sax.SAXExceptionAny SAX exception, possibly wrapping another exception.
j2me.io.IOExceptionAn IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See also
org.xml.sax.InputSource
setEntityResolver
setDTDHandler
setContentHandler
setErrorHandler

Implements javolution.xml.sax.XMLReader.

Definition at line 154 of file XMLReaderImpl.java.

154  {
155  Reader reader = input.getCharacterStream();
156  if (reader != null) {
157  parse(reader);
158  } else {
159  InputStream inStream = input.getByteStream();
160  if (inStream != null) {
161  parse(inStream, input.getEncoding());
162  } else {
163  parse(input.getSystemId());
164  }
165  }
166  }

References javolution.xml.sax.XMLReaderImpl.parse().

Here is the call graph for this function:

◆ parse() [2/5]

void javolution.xml.sax.XMLReaderImpl.parse ( InputStream  in) throws IOException, SAXException

Parses an XML document from the specified input stream (encoding retrieved from input source and the XML prolog if any).

Parameters
inthe input stream with unknown encoding.
Exceptions
org.xml.sax.SAXExceptionany SAX exception, possibly wrapping another exception.
IOExceptionan IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

Definition at line 90 of file XMLReaderImpl.java.

90  {
91  try {
92  _xmlReader.setInput(in);
93  parseAll();
94  } catch (XMLStreamException e) {
95  if (e.getNestedException() instanceof IOException)
96  throw (IOException) e.getNestedException();
97  throw new SAXException(e.getMessage());
98  } finally {
99  _xmlReader.reset();
100  }
101  }

References javolution.xml.sax.XMLReaderImpl._xmlReader, javolution.xml.stream.XMLStreamException.getNestedException(), javolution.xml.sax.XMLReaderImpl.parseAll(), javolution.xml.internal.stream.XMLStreamReaderImpl.reset(), and javolution.xml.internal.stream.XMLStreamReaderImpl.setInput().

Referenced by javolution.xml.sax.SAX2ReaderImpl.parse(), and javolution.xml.sax.XMLReaderImpl.parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse() [3/5]

void javolution.xml.sax.XMLReaderImpl.parse ( InputStream  in,
String  encoding 
) throws IOException, SAXException

Parses an XML document from the specified input stream and encoding.

Parameters
inthe input stream.
encodingthe input stream encoding.
Exceptions
org.xml.sax.SAXExceptionany SAX exception, possibly wrapping another exception.
IOExceptionan IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

Definition at line 114 of file XMLReaderImpl.java.

115  {
116  try {
117  _xmlReader.setInput(in, encoding);
118  parseAll();
119  } catch (XMLStreamException e) {
120  if (e.getNestedException() instanceof IOException)
121  throw (IOException) e.getNestedException();
122  throw new SAXException(e.getMessage());
123  } finally {
124  _xmlReader.reset();
125  }
126  }

References javolution.xml.sax.XMLReaderImpl._xmlReader, javolution.xml.stream.XMLStreamException.getNestedException(), javolution.xml.sax.XMLReaderImpl.parseAll(), javolution.xml.internal.stream.XMLStreamReaderImpl.reset(), and javolution.xml.internal.stream.XMLStreamReaderImpl.setInput().

Here is the call graph for this function:

◆ parse() [4/5]

void javolution.xml.sax.XMLReaderImpl.parse ( Reader  reader) throws IOException, SAXException

Parses an XML document using the specified reader.

Parameters
readerthe document reader.
Exceptions
SAXExceptionany SAX exception, possibly wrapping another exception.
IOExceptionan IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See also
javolution.io.UTF8StreamReader
javolution.io.UTF8ByteBufferReader
javolution.io.CharSequenceReader

Definition at line 140 of file XMLReaderImpl.java.

140  {
141  try {
142  _xmlReader.setInput(reader);
143  parseAll();
144  } catch (XMLStreamException e) {
145  if (e.getNestedException() instanceof IOException)
146  throw (IOException) e.getNestedException();
147  throw new SAXException(e.getMessage());
148  } finally {
149  _xmlReader.reset();
150  }
151  }

References javolution.xml.sax.XMLReaderImpl._xmlReader, javolution.xml.stream.XMLStreamException.getNestedException(), javolution.xml.sax.XMLReaderImpl.parseAll(), javolution.xml.internal.stream.XMLStreamReaderImpl.reset(), and javolution.xml.internal.stream.XMLStreamReaderImpl.setInput().

Here is the call graph for this function:

◆ parse() [5/5]

void javolution.xml.sax.XMLReaderImpl.parse ( String  systemId) throws IOException, SAXException

Parse an XML document from a system identifier (URI).

This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following:

parse(new InputSource(systemId));

If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.

Parameters
systemIdThe system identifier (URI).
Exceptions
org.xml.sax.SAXExceptionAny SAX exception, possibly wrapping another exception.
j2me.io.IOExceptionAn IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See also
parse(org.xml.sax.InputSource)

Implements javolution.xml.sax.XMLReader.

Definition at line 169 of file XMLReaderImpl.java.

169  {
170  InputStream inStream;
171  try {
172  URL url = new URL(systemId);
173  inStream = url.openStream();
174  } catch (Exception urlException) { // Try as filename.
175  try {
176  inStream = new FileInputStream(systemId);
177  } catch (Exception fileException) {
178  throw new UnsupportedOperationException("Cannot parse "
179  + systemId);
180  }
181  }
182  parse(inStream);
183  }

References javolution.xml.sax.XMLReaderImpl.parse().

Here is the call graph for this function:

◆ parseAll()

void javolution.xml.sax.XMLReaderImpl.parseAll ( ) throws XMLStreamException, SAXException
private

Parses the whole document using the real-time pull parser.

Exceptions
SAXExceptionany SAX exception, possibly wrapping another exception.
IOExceptionan IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

Definition at line 285 of file XMLReaderImpl.java.

285  {
286  int eventType = _xmlReader.getEventType();
287  if (eventType != XMLStreamConstants.START_DOCUMENT)
288  throw new SAXException("Currently parsing");
290 
291  boolean doContinue = true;
292  while (doContinue) {
293  CharArray uri, localName, qName, prefix, text;
294  switch (_xmlReader.next()) {
295  case XMLStreamConstants.START_ELEMENT:
296 
297  // Start prefix mapping.
298  for (int i = 0, count = _xmlReader.getNamespaceCount(); i < count; i++) {
299  prefix = _xmlReader.getNamespacePrefix(i);
300  prefix = (prefix == null) ? NO_CHAR : prefix; // Default namespace is ""
301  uri = _xmlReader.getNamespaceURI(i);
302  _contentHandler.startPrefixMapping(prefix, uri);
303  }
304 
305  // Start element.
306  uri = _xmlReader.getNamespaceURI();
307  uri = (uri == null) ? NO_CHAR : uri;
308  localName = _xmlReader.getLocalName();
309  qName = _xmlReader.getQName();
310  _contentHandler.startElement(uri, localName, qName,
312  break;
313 
314  case XMLStreamConstants.END_ELEMENT:
315 
316  // End element.
317  uri = _xmlReader.getNamespaceURI();
318  uri = (uri == null) ? NO_CHAR : uri;
319  localName = _xmlReader.getLocalName();
320  qName = _xmlReader.getQName();
321  _contentHandler.endElement(uri, localName, qName);
322 
323  // End prefix mapping.
324  for (int i = 0, count = _xmlReader.getNamespaceCount(); i < count; i++) {
325  prefix = _xmlReader.getNamespacePrefix(i);
326  prefix = (prefix == null) ? NO_CHAR : prefix; // Default namespace is ""
328  }
329  break;
330 
331  case XMLStreamConstants.CDATA:
332  case XMLStreamConstants.CHARACTERS:
333  text = _xmlReader.getText();
334  _contentHandler.characters(text.array(), text.offset(),
335  text.length());
336  break;
337 
338  case XMLStreamConstants.SPACE:
339  text = _xmlReader.getText();
341  text.offset(), text.length());
342  break;
343 
344  case XMLStreamConstants.PROCESSING_INSTRUCTION:
347  break;
348 
349  case XMLStreamConstants.COMMENT:
350  // Ignores.
351  break;
352 
353  case XMLStreamConstants.END_DOCUMENT:
354  doContinue = false;
355  _xmlReader.close();
356  break;
357 
358  }
359  }
360  }

References javolution.xml.sax.XMLReaderImpl._contentHandler, javolution.xml.sax.XMLReaderImpl._xmlReader, javolution.text.CharArray.array(), javolution.xml.stream.XMLStreamConstants.CDATA, javolution.xml.stream.XMLStreamConstants.CHARACTERS, javolution.xml.sax.ContentHandler.characters(), javolution.xml.internal.stream.XMLStreamReaderImpl.close(), javolution.xml.stream.XMLStreamConstants.COMMENT, javolution.xml.stream.XMLStreamConstants.END_DOCUMENT, javolution.xml.stream.XMLStreamConstants.END_ELEMENT, javolution.xml.sax.ContentHandler.endElement(), javolution.xml.sax.ContentHandler.endPrefixMapping(), javolution.xml.internal.stream.XMLStreamReaderImpl.getAttributes(), javolution.xml.internal.stream.XMLStreamReaderImpl.getEventType(), javolution.xml.internal.stream.XMLStreamReaderImpl.getLocalName(), javolution.xml.internal.stream.XMLStreamReaderImpl.getNamespaceCount(), javolution.xml.internal.stream.XMLStreamReaderImpl.getNamespacePrefix(), javolution.xml.internal.stream.XMLStreamReaderImpl.getNamespaceURI(), javolution.xml.internal.stream.XMLStreamReaderImpl.getPIData(), javolution.xml.internal.stream.XMLStreamReaderImpl.getPITarget(), javolution.xml.internal.stream.XMLStreamReaderImpl.getQName(), javolution.xml.internal.stream.XMLStreamReaderImpl.getText(), javolution.xml.sax.ContentHandler.ignorableWhitespace(), javolution.text.CharArray.length(), javolution.xml.internal.stream.XMLStreamReaderImpl.next(), javolution.xml.sax.XMLReaderImpl.NO_CHAR, javolution.text.CharArray.offset(), javolution.xml.stream.XMLStreamConstants.PROCESSING_INSTRUCTION, javolution.xml.sax.ContentHandler.processingInstruction(), javolution.xml.stream.XMLStreamConstants.SPACE, javolution.xml.stream.XMLStreamConstants.START_DOCUMENT, javolution.xml.stream.XMLStreamConstants.START_ELEMENT, javolution.xml.sax.ContentHandler.startDocument(), javolution.xml.sax.ContentHandler.startElement(), and javolution.xml.sax.ContentHandler.startPrefixMapping().

Referenced by javolution.xml.sax.XMLReaderImpl.parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void javolution.xml.sax.XMLReaderImpl.reset ( )

Definition at line 271 of file XMLReaderImpl.java.

References javolution.xml.sax.XMLReaderImpl._xmlReader, javolution.xml.sax.XMLReaderImpl.DEFAULT_HANDLER, javolution.xml.internal.stream.XMLStreamReaderImpl.reset(), javolution.xml.sax.XMLReaderImpl.setContentHandler(), and javolution.xml.sax.XMLReaderImpl.setErrorHandler().

Referenced by javolution.xml.sax.SAX2ReaderImpl.parse(), and javolution.xml.sax.SAX2ReaderImpl.reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setContentHandler()

void javolution.xml.sax.XMLReaderImpl.setContentHandler ( ContentHandler  handler)

Allow an application to register a content event handler.

If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters
handlerThe content handler.
See also
getContentHandler

Implements javolution.xml.sax.XMLReader.

Definition at line 186 of file XMLReaderImpl.java.

186  {
187  if (handler != null) {
188  _contentHandler = handler;
189  } else {
190  throw new NullPointerException();
191  }
192  }

References javolution.xml.sax.XMLReaderImpl._contentHandler.

Referenced by javolution.xml.sax.XMLReaderImpl.reset(), javolution.xml.sax.SAX2ReaderImpl.setContentHandler(), and javolution.xml.sax.XMLReaderImpl.XMLReaderImpl().

Here is the caller graph for this function:

◆ setDTDHandler()

void javolution.xml.sax.XMLReaderImpl.setDTDHandler ( DTDHandler  handler)

Allow an application to register a DTD event handler.

If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters
handlerThe DTD handler.
See also
getDTDHandler

Implements javolution.xml.sax.XMLReader.

Definition at line 260 of file XMLReaderImpl.java.

260  {
261  _dtdHandler = handler;
262  }

References javolution.xml.sax.XMLReaderImpl._dtdHandler.

Referenced by javolution.xml.sax.SAX2ReaderImpl.setDTDHandler().

Here is the caller graph for this function:

◆ setEntityResolver()

void javolution.xml.sax.XMLReaderImpl.setEntityResolver ( EntityResolver  resolver)

Allow an application to register an entity resolver.

If the application does not register an entity resolver, the XMLReader will perform its own default resolution.

Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.

Parameters
resolverThe entity resolver.
See also
getEntityResolver

Implements javolution.xml.sax.XMLReader.

Definition at line 250 of file XMLReaderImpl.java.

250  {
251  _entityResolver = resolver;
252  }

References javolution.xml.sax.XMLReaderImpl._entityResolver.

Referenced by javolution.xml.sax.SAX2ReaderImpl.setEntityResolver().

Here is the caller graph for this function:

◆ setErrorHandler()

void javolution.xml.sax.XMLReaderImpl.setErrorHandler ( ErrorHandler  handler)

Allow an application to register an error event handler.

If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters
handlerThe error handler.
See also
getErrorHandler

Implements javolution.xml.sax.XMLReader.

Definition at line 200 of file XMLReaderImpl.java.

200  {
201  if (handler != null) {
202  _errorHandler = handler;
203  } else {
204  throw new NullPointerException();
205  }
206  }

References javolution.xml.sax.XMLReaderImpl._errorHandler.

Referenced by javolution.xml.sax.XMLReaderImpl.reset(), javolution.xml.sax.SAX2ReaderImpl.setErrorHandler(), and javolution.xml.sax.XMLReaderImpl.XMLReaderImpl().

Here is the caller graph for this function:

◆ setFeature()

void javolution.xml.sax.XMLReaderImpl.setFeature ( String  name,
boolean  value 
) throws SAXNotRecognizedException, SAXNotSupportedException

Set the value of a feature flag.

The feature name is any fully-qualified URI. It is possible for an XMLReader to expose a feature value but to be unable to change the current value. Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.

All XMLReaders are required to support setting http://xml.org/sax/features/namespaces to true and http://xml.org/sax/features/namespace-prefixes to false.

Parameters
nameThe feature name, which is a fully-qualified URI.
valueThe requested value of the feature (true or false).
Exceptions
org.xml.sax.SAXNotRecognizedExceptionIf the feature value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedExceptionWhen the XMLReader recognizes the feature name but cannot set the requested value.
See also
getFeature

Implements javolution.xml.sax.XMLReader.

Definition at line 227 of file XMLReaderImpl.java.

228  {
229  if (name.equals("http://xml.org/sax/features/namespaces")
230  || name.equals("http://xml.org/sax/features/namespace-prefixes")) {
231  return; // Ignores, these features are always set.
232  } else {
233  throw new SAXNotRecognizedException("Feature " + name
234  + " not recognized");
235  }
236  }

Referenced by javolution.xml.sax.SAX2ReaderImpl.setFeature().

Here is the caller graph for this function:

◆ setProperty()

void javolution.xml.sax.XMLReaderImpl.setProperty ( String  name,
Object  value 
) throws SAXNotRecognizedException, SAXNotSupportedException

Set the value of a property.

The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to change the current value. Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.

XMLReaders are not required to recognize setting any specific property names, though a core set is defined by SAX2.

This method is also the standard mechanism for setting extended handlers.

Parameters
nameThe property name, which is a fully-qualified URI.
valueThe requested value for the property.
Exceptions
org.xml.sax.SAXNotRecognizedExceptionIf the property value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedExceptionWhen the XMLReader recognizes the property name but cannot set the requested value.

Implements javolution.xml.sax.XMLReader.

Definition at line 244 of file XMLReaderImpl.java.

245  {
246  throw new SAXNotRecognizedException("Property " + name
247  + " not recognized");
248  }

Referenced by javolution.xml.sax.SAX2ReaderImpl.setProperty().

Here is the caller graph for this function:

Member Data Documentation

◆ _contentHandler

ContentHandler javolution.xml.sax.XMLReaderImpl._contentHandler
private

◆ _dtdHandler

DTDHandler javolution.xml.sax.XMLReaderImpl._dtdHandler
private

◆ _entityResolver

EntityResolver javolution.xml.sax.XMLReaderImpl._entityResolver
private

◆ _errorHandler

ErrorHandler javolution.xml.sax.XMLReaderImpl._errorHandler
private

◆ _xmlReader

final XMLStreamReaderImpl javolution.xml.sax.XMLReaderImpl._xmlReader = new XMLStreamReaderImpl()
private

◆ DEFAULT_HANDLER

DefaultHandler javolution.xml.sax.XMLReaderImpl.DEFAULT_HANDLER = new DefaultHandler()
staticprivate

◆ NO_CHAR

final CharArray javolution.xml.sax.XMLReaderImpl.NO_CHAR = new CharArray("")
staticprivate

Definition at line 362 of file XMLReaderImpl.java.

Referenced by javolution.xml.sax.XMLReaderImpl.parseAll().


The documentation for this class was generated from the following file:
javolution.xml.sax.XMLReaderImpl.parse
void parse(InputStream in)
Definition: XMLReaderImpl.java:90
javolution.xml.sax.ContentHandler.startDocument
void startDocument()
javolution.xml.sax.XMLReaderImpl.DEFAULT_HANDLER
static DefaultHandler DEFAULT_HANDLER
Definition: XMLReaderImpl.java:53
javolution.xml.sax.ContentHandler.startPrefixMapping
void startPrefixMapping(CharArray prefix, CharArray uri)
javolution.xml.internal.stream.XMLStreamReaderImpl.getQName
CharArray getQName()
Definition: XMLStreamReaderImpl.java:315
javolution.xml.sax.XMLReaderImpl.setContentHandler
void setContentHandler(ContentHandler handler)
Definition: XMLReaderImpl.java:186
javolution.xml.internal.stream.XMLStreamReaderImpl.setInput
void setInput(InputStream in)
Definition: XMLStreamReaderImpl.java:216
javolution.xml.internal.stream.XMLStreamReaderImpl.getLocalName
CharArray getLocalName()
Definition: XMLStreamReaderImpl.java:1243
javolution.xml.sax.ContentHandler.startElement
void startElement(CharArray uri, CharArray localName, CharArray qName, Attributes atts)
javolution.xml.sax.ContentHandler.ignorableWhitespace
void ignorableWhitespace(char ch[], int start, int length)
javolution.xml.sax.ContentHandler.endElement
void endElement(CharArray uri, CharArray localName, CharArray qName)
javolution.xml.internal.stream.XMLStreamReaderImpl.next
int next()
Definition: XMLStreamReaderImpl.java:380
javolution.xml.internal.stream.XMLStreamReaderImpl.getText
CharArray getText()
Definition: XMLStreamReaderImpl.java:1321
javolution.xml.internal.stream.XMLStreamReaderImpl.getNamespaceCount
int getNamespaceCount()
Definition: XMLStreamReaderImpl.java:1258
javolution.xml.sax.XMLReaderImpl._contentHandler
ContentHandler _contentHandler
Definition: XMLReaderImpl.java:58
javolution.xml.sax.XMLReaderImpl._dtdHandler
DTDHandler _dtdHandler
Definition: XMLReaderImpl.java:264
javolution.xml.sax.XMLReaderImpl._entityResolver
EntityResolver _entityResolver
Definition: XMLReaderImpl.java:254
javolution.xml.internal.stream.XMLStreamReaderImpl.getNamespaceURI
CharArray getNamespaceURI(CharSequence prefix)
Definition: XMLStreamReaderImpl.java:1272
javolution.xml.sax.XMLReaderImpl._xmlReader
final XMLStreamReaderImpl _xmlReader
Definition: XMLReaderImpl.java:68
javolution.xml.sax.ContentHandler.characters
void characters(char ch[], int start, int length)
javolution.xml.sax.XMLReaderImpl.NO_CHAR
static final CharArray NO_CHAR
Definition: XMLReaderImpl.java:362
Exception
javolution.xml.sax.ContentHandler.endPrefixMapping
void endPrefixMapping(CharArray prefix)
javolution.xml.internal.stream.XMLStreamReaderImpl.reset
void reset()
Definition: XMLStreamReaderImpl.java:984
javolution.xml.sax.ContentHandler.processingInstruction
void processingInstruction(CharArray target, CharArray data)
javolution.xml.internal.stream.XMLStreamReaderImpl.getEventType
int getEventType()
Definition: XMLStreamReaderImpl.java:1239
javolution.xml.internal.stream.XMLStreamReaderImpl.close
void close()
Definition: XMLStreamReaderImpl.java:1181
javolution.xml.sax.XMLReaderImpl.parseAll
void parseAll()
Definition: XMLReaderImpl.java:285
javolution.xml.internal.stream.XMLStreamReaderImpl.getAttributes
Attributes getAttributes()
Definition: XMLStreamReaderImpl.java:342
javolution.xml.internal.stream.XMLStreamReaderImpl.getPIData
CharArray getPIData()
Definition: XMLStreamReaderImpl.java:1305
javolution.xml.internal.stream.XMLStreamReaderImpl.getNamespacePrefix
CharArray getNamespacePrefix(int index)
Definition: XMLStreamReaderImpl.java:1265
javolution.xml.sax.XMLReaderImpl._errorHandler
ErrorHandler _errorHandler
Definition: XMLReaderImpl.java:63
javolution.xml.internal.stream.XMLStreamReaderImpl.getPITarget
CharArray getPITarget()
Definition: XMLStreamReaderImpl.java:1313
javolution.xml.sax.XMLReaderImpl.setErrorHandler
void setErrorHandler(ErrorHandler handler)
Definition: XMLReaderImpl.java:200