Javolution 6.0.0 java
javolution.xml.stream.XMLInputFactory Interface Reference
Inheritance diagram for javolution.xml.stream.XMLInputFactory:
[legend]
Collaboration diagram for javolution.xml.stream.XMLInputFactory:
[legend]

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"
 

Detailed Description

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]

Author
Jean-Marie Dautelle
Version
6.0 December 12, 2012

Definition at line 54 of file XMLInputFactory.java.

Member Function Documentation

◆ clone()

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().

Here is the caller graph for this function:

◆ createXMLStreamReader() [1/3]

XMLStreamReader javolution.xml.stream.XMLInputFactory.createXMLStreamReader ( InputStream  stream) throws XMLStreamException

Returns a XML stream reader for the specified input stream (encoding autodetected).

Parameters
streamthe input stream to read from.
Returns
a xml stream reader possibly recycled.
Exceptions
XMLStreamException

Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.

◆ createXMLStreamReader() [2/3]

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.

Parameters
streamthe input stream to read from.
encodingthe character encoding of the stream.
Returns
a xml stream reader possibly recycled.
Exceptions
XMLStreamException

Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.

◆ createXMLStreamReader() [3/3]

XMLStreamReader javolution.xml.stream.XMLInputFactory.createXMLStreamReader ( Reader  reader) throws XMLStreamException

Returns a XML stream reader for the specified I/O reader.

Parameters
readerthe XML data to read from.
Exceptions
XMLStreamException

Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.

◆ getProperty()

Object javolution.xml.stream.XMLInputFactory.getProperty ( String  name) throws IllegalArgumentException

Gets the value of a feature/property from the underlying implementation.

Parameters
namethe name of the property (may not be null).
Returns
the value of the property.
Exceptions
IllegalArgumentExceptionif the property is not supported.

Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.

◆ isPropertySupported()

boolean javolution.xml.stream.XMLInputFactory.isPropertySupported ( String  name)

Queries the set of properties that this factory supports.

Parameters
namethe name of the property.
Returns
true if the property is supported; false otherwise.

Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.

◆ setProperty()

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.

Parameters
namethe name of the property.
valuethe value of the property
Exceptions
IllegalArgumentExceptionif the property is not supported.

Implemented in javolution.xml.internal.stream.XMLInputFactoryImpl.

Member Data Documentation

◆ ENTITIES

final String javolution.xml.stream.XMLInputFactory.ENTITIES = "javolution.xml.stream.entities"
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().

◆ IS_COALESCING

final String javolution.xml.stream.XMLInputFactory.IS_COALESCING = "javolution.xml.stream.isCoalescing"
static

◆ IS_VALIDATING

final String javolution.xml.stream.XMLInputFactory.IS_VALIDATING = "javolution.xml.stream.isValidating"
static

The property that requires the parser to validate the input data.

Definition at line 65 of file XMLInputFactory.java.


The documentation for this interface was generated from the following file: