Javolution 6.0.0 java
|
Public Member Functions | |
XMLStreamReader | createXMLStreamReader (Reader reader) throws XMLStreamException |
XMLStreamReader | createXMLStreamReader (InputStream stream) throws XMLStreamException |
XMLStreamReader | createXMLStreamReader (InputStream stream, String encoding) throws XMLStreamException |
void | setProperty (String name, Object value) throws IllegalArgumentException |
Object | getProperty (String name) throws IllegalArgumentException |
boolean | isPropertySupported (String name) |
XMLInputFactory | clone () |
Static Public Attributes | |
static final String | IS_COALESCING = "javolution.xml.stream.isCoalescing" |
static final String | IS_VALIDATING = "javolution.xml.stream.isValidating" |
static final String | ENTITIES = "javolution.xml.stream.entities" |
The OSGi factory service to create XMLStreamReader instances. For each bundle, a distinct factory instance is returned and can be individually configured (if not enough the factory can be cloned). [code] import javolution.xml.stream.*; public class Activator implements BundleActivator { public void start(BundleContext bc) throws Exception {
// Configures factory. ServiceTracker<XMLInputFactory, XMLInputFactory> tracker = new ServiceTracker<>(bc, XMLInputFactory.class, null); tracker.open(); tracker.getService().setProperty(IS_COALESCING, true); // Instantiates a reader. String xml = "<test>This is a test</test>"; CharSequenceReader in = new CharSequenceReader().setInput(xml); XMLStreamReader reader = tracker.getService().createXMLStreamReader(in); // Parses XML. while (reader.hasNext()) { int eventType = reader.next(); if (eventType == XMLStreamConstants.CHARACTERS) { System.out.println(reader.getText()); } } // Closes the reader which may be recycled back to the factory. reader.close();
} }[/code]
Definition at line 54 of file XMLInputFactory.java.
XMLInputFactory javolution.xml.stream.XMLInputFactory.clone | ( | ) |
Returns a clone of this factory which can be independently configured.
Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.
Referenced by javolution.xml.internal.stream.XMLInputFactoryImpl.clone().
XMLStreamReader javolution.xml.stream.XMLInputFactory.createXMLStreamReader | ( | InputStream | stream | ) | throws XMLStreamException |
Returns a XML stream reader for the specified input stream (encoding autodetected).
stream | the input stream to read from. |
XMLStreamException |
Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.
XMLStreamReader javolution.xml.stream.XMLInputFactory.createXMLStreamReader | ( | InputStream | stream, |
String | encoding | ||
) | throws XMLStreamException |
Returns a XML stream reader for the specified input stream using the specified encoding.
stream | the input stream to read from. |
encoding | the character encoding of the stream. |
XMLStreamException |
Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.
XMLStreamReader javolution.xml.stream.XMLInputFactory.createXMLStreamReader | ( | Reader | reader | ) | throws XMLStreamException |
Returns a XML stream reader for the specified I/O reader.
reader | the XML data to read from. |
XMLStreamException |
Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.
Object javolution.xml.stream.XMLInputFactory.getProperty | ( | String | name | ) | throws IllegalArgumentException |
Gets the value of a feature/property from the underlying implementation.
name | the name of the property (may not be null). |
IllegalArgumentException | if the property is not supported. |
Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.
boolean javolution.xml.stream.XMLInputFactory.isPropertySupported | ( | String | name | ) |
Queries the set of properties that this factory supports.
name | the name of the property. |
true
if the property is supported; false
otherwise. Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.
void javolution.xml.stream.XMLInputFactory.setProperty | ( | String | name, |
Object | value | ||
) | throws IllegalArgumentException |
Allows the user to set specific feature/property on the underlying implementation. The underlying implementation is not required to support every setting of every property in the specification and may use IllegalArgumentException
to signal that an unsupported property may not be set with the specified value.
name | the name of the property. |
value | the value of the property |
IllegalArgumentException | if the property is not supported. |
Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.
|
static |
Property used to specify additional entities to be recognized by the readers (type: java.util.Map
, default: null
). For example:[code] FastMap<String, String> HTML_ENTITIES = new FastMap<String, String>(); HTML_ENTITIES.put("nbsp", " "); HTML_ENTITIES.put("copy", "©"); HTML_ENTITIES.put("eacute", "é"); ... XMLInputFactory factory = factoryRef.getService(); factory.setProperty(ENTITIES, HTML_ENTITIES); [/code]
Definition at line 80 of file XMLInputFactory.java.
Referenced by javolution.xml.internal.stream.XMLInputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamReaderImpl.getProperty(), javolution.xml.internal.stream.XMLInputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLInputFactoryImpl.setProperty().
|
static |
The property that requires the parser to coalesce adjacent character data sections.
Definition at line 60 of file XMLInputFactory.java.
Referenced by javolution.xml.internal.stream.XMLInputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamReaderImpl.getProperty(), javolution.xml.internal.stream.XMLInputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLInputFactoryImpl.setProperty().
|
static |
The property that requires the parser to validate the input data.
Definition at line 65 of file XMLInputFactory.java.