Find JSRs
Submit this Search


Ad Banner
 
 
 
 

BlenderRev of jaxp14-api

BlenderRev of jaxp14-api

BlenderRev generated at Fri Dec 9 12:56:15 2005
jaxp14-api generated at Fri Nov 4 14:42:00 2005
jaxp13-api generated at Fri Nov 4 12:50:11 2005

javax.xml.datatype (0 interfaces, 4 classes, 12 methods, 1 fields)

DatatypeConfigurationException DatatypeFactory Duration XMLGregorianCalendar

javax.xml.parsers (0 interfaces, 2 classes, 5 methods, 0 fields)

DocumentBuilderFactory SAXParserFactory

javax.xml.stream (10 interfaces, 5 classes, 187 methods, 27 fields)

EventFilter FactoryConfigurationError Location StreamFilter XMLEventFactory XMLEventReader XMLEventWriter XMLInputFactory XMLOutputFactory XMLReporter XMLResolver XMLStreamConstants XMLStreamException XMLStreamReader XMLStreamWriter

javax.xml.stream.events (14 interfaces, 0 classes, 59 methods, 0 fields)

Attribute Characters Comment DTD EndDocument EndElement EntityDeclaration EntityReference Namespace NotationDeclaration ProcessingInstruction StartDocument StartElement XMLEvent

javax.xml.stream.util (2 interfaces, 2 classes, 66 methods, 0 fields)

EventReaderDelegate StreamReaderDelegate XMLEventAllocator XMLEventConsumer

javax.xml.transform (1 interfaces, 2 classes, 4 methods, 0 fields)

ErrorListener Transformer TransformerFactory

javax.xml.transform.stax (0 interfaces, 2 classes, 12 methods, 0 fields)

StAXResult StAXSource

javax.xml.validation (0 interfaces, 6 classes, 14 methods, 0 fields)

Schema SchemaFactory SchemaFactoryLoader TypeInfoProvider Validator ValidatorHandler

javax.xml.xpath (3 interfaces, 1 classes, 7 methods, 0 fields)

XPath XPathExpression XPathFactory XPathVariableResolver

org.w3c.dom (3 interfaces, 0 classes, 9 methods, 0 fields)

DOMImplementation Document Node

javax.xml.datatype.DatatypeConfigurationException

DatatypeConfigurationException.CLASS_COMMENT

public class DatatypeConfigurationException
extends java.lang.Exception

Indicates a serious configuration error.

TODO: support all constructors

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor
See Also:
Serialized Form
public class DatatypeConfigurationException
extends java.lang.Exception

Indicates a serious configuration error.

TODO: support all constructors

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor
See Also:
Serialized Form
public class DatatypeConfigurationException
extends java.lang.Exception

Indicates a serious configuration error.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor
See Also:
Serialized Form

javax.xml.datatype.DatatypeFactory (10 methods) (1 field)

CLASS_COMMENT
DATATYPEFACTORY_IMPLEMENTATION_CLASS
newDuration(boolean, int, int, int, int, int, int)
newDuration(boolean, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigDecimal)
newDurationDayTime(boolean, int, int, int, int)
newDurationDayTime(boolean, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger)
newDurationDayTime(java.lang.String)
newDurationYearMonth(boolean, int, int)
newDurationYearMonth(boolean, java.math.BigInteger, java.math.BigInteger)
newDurationYearMonth(java.lang.String)
newInstance()
newInstance(java.lang.String, java.lang.ClassLoader)

DatatypeFactory.CLASS_COMMENT

public abstract class DatatypeFactory
extends java.lang.Object

Factory that creates new javax.xml.datatype Object s that map XML to/from Java Object s.

newInstance() is used to create a new DatatypeFactory. The following implementation resolution mechanisms are used in the following order:

  1. If the system property specified by DATATYPEFACTORY_PROPERTY , "javax.xml.datatype.DatatypeFactory ", exists, a class with the name of the property's value is instantiated. Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException .
  2. If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a Properties Object. The Properties Object is then queried for the property as documented in the prior step and processed as documented in the prior step.
  3. The services resolution mechanism is used, e.g. META-INF/services/java.xml.datatype.DatatypeFactory. Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException .
  4. The final mechanism is to attempt to instantiate the Class specified by DATATYPEFACTORY_IMPLEMENTATION_CLASS . , " javax.xml.datatype.DatatypeFactoryImpl ". Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException .

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli , Jeff Suttor , Neeraj Bajaj
public abstract class DatatypeFactory
extends java.lang.Object

Factory that creates new javax.xml.datatype Objects that map XML to/from Java Objects.

newInstance() is used to create a new DatatypeFactory. The following implementation resolution mechanisms are used in the following order:

  1. If the system property specified by DATATYPEFACTORY_PROPERTY, "javax.xml.datatype.DatatypeFactory", exists, a class with the name of the property's value is instantiated. Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException.
  2. If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a Properties Object. The Properties Object is then queried for the property as documented in the prior step and processed as documented in the prior step.
  3. The services resolution mechanism is used, e.g. META-INF/services/java.xml.datatype.DatatypeFactory. Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException.
  4. The final mechanism is to attempt to instantiate the Class specified by DATATYPEFACTORY_IMPLEMENTATION_CLASS, "javax.xml.datatype.DatatypeFactoryImpl". Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli, Jeff Suttor
public abstract class DatatypeFactory
extends java.lang.Object

Factory that creates new javax.xml.datatype Objects that map XML to/from Java Objects.

newInstance() is used to create a new DatatypeFactory. The following implementation resolution mechanisms are used in the following order:

  1. If the system property specified by DATATYPEFACTORY_PROPERTY, "javax.xml.datatype.DatatypeFactory", exists, a class with the name of the property's value is instantiated. Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException.
  2. If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a Properties Object. The Properties Object is then queried for the property as documented in the prior step and processed as documented in the prior step.
  3. The services resolution mechanism is used, e.g. META-INF/services/java.xml.datatype.DatatypeFactory. Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException.
  4. The final mechanism is to attempt to instantiate the Class specified by DATATYPEFACTORY_IMPLEMENTATION_CLASS. Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli, Jeff Suttor, Neeraj Bajaj

DatatypeFactory.DATATYPEFACTORY_IMPLEMENTATION_CLASS

DATATYPEFACTORY_IMPLEMENTATION_CLASS


public static final java.lang.String DATATYPEFACTORY_IMPLEMENTATION_CLASS

Default implementation class name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3 . 1.3.

Implementers should specify the name of an appropriate class to be instantiated if no other implementation resolution mechanism succeeds. Default value is org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.

Users should not refer to this field; it is intended only to document a factory implementation detail.

See Also:
Constant Field Values

DATATYPEFACTORY_IMPLEMENTATION_CLASS

public static final java.lang.String DATATYPEFACTORY_IMPLEMENTATION_CLASS

Default implementation class name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3.

Default value is org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.

See Also:
Constant Field Values

DATATYPEFACTORY_IMPLEMENTATION_CLASS

public static final java.lang.String DATATYPEFACTORY_IMPLEMENTATION_CLASS

Default implementation class name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3.

Implementers should specify the name of an appropriate class to be instantiated if no other implementation resolution mechanism succeeds.

Users should not refer to this field; it is intended only to document a factory implementation detail.

DatatypeFactory.newDuration(boolean, int, int, int, int, int, int)

newDuration


public Duration newDuration(boolean isPositive,
                            int years,
                            int months,
                            int days,
                            int hours,
                            int minutes,
                            int seconds)

Obtain a new instance of a Duration specifying the Duration as isPositive, years, months, days, hours, minutes, seconds.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
years - of this Duration
months - of this Duration
days - of this Duration
hours - of this Duration
minutes - of this Duration
seconds - of this Duration
Returns:
New Duration created from the specified values.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a Duration : if any of the fields is negative. .
See Also:
newDuration( boolean isPositive, BigInteger years, BigInteger months, BigInteger days, BigInteger hours, BigInteger minutes, BigDecimal seconds)

newDuration

public Duration newDuration(boolean isPositive,
                            int years,
                            int months,
                            int days,
                            int hours,
                            int minutes,
                            int seconds)

Obtain a new instance of a Duration specifying the Duration as isPositive, years, months, days, hours, minutes, seconds.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
years - of this Duration
months - of this Duration
days - of this Duration
hours - of this Duration
minutes - of this Duration
seconds - of this Duration
Returns:
New Duration created from the specified values.
Throws:
java.lang.IllegalArgumentException - If values are not a valid representation of a Duration.
See Also:
newDuration( boolean isPositive, BigInteger years, BigInteger months, BigInteger days, BigInteger hours, BigInteger minutes, BigDecimal seconds)

newDuration

public Duration newDuration(boolean isPositive,
                            int years,
                            int months,
                            int days,
                            int hours,
                            int minutes,
                            int seconds)

Obtain a new instance of a Duration specifying the Duration as isPositive, years, months, days, hours, minutes, seconds.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
years - of this Duration
months - of this Duration
days - of this Duration
hours - of this Duration
minutes - of this Duration
seconds - of this Duration
Returns:
New Duration created from the specified values.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a Duration: if any of the fields is negative.
See Also:
newDuration( boolean isPositive, BigInteger years, BigInteger months, BigInteger days, BigInteger hours, BigInteger minutes, BigDecimal seconds)

DatatypeFactory.newDuration(boolean, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigDecimal)

newDuration


public abstract Duration newDuration(boolean isPositive,
                                     java.math.BigInteger years,
                                     java.math.BigInteger months,
                                     java.math.BigInteger days,
                                     java.math.BigInteger hours,
                                     java.math.BigInteger minutes,
                                     java.math.BigDecimal seconds)

Obtain a new instance of a Duration specifying the Duration as isPositive, years, months, days, hours, minutes, seconds.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
years - of this Duration
months - of this Duration
days - of this Duration
hours - of this Duration
minutes - of this Duration
seconds - of this Duration
Returns:
New Duration created from the specified values.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a Duration : if all the fields (years, months, ...) are null or if any of the fields is negative. .
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

newDuration

public abstract Duration newDuration(boolean isPositive,
                                     java.math.BigInteger years,
                                     java.math.BigInteger months,
                                     java.math.BigInteger days,
                                     java.math.BigInteger hours,
                                     java.math.BigInteger minutes,
                                     java.math.BigDecimal seconds)

Obtain a new instance of a Duration specifying the Duration as isPositive, years, months, days, hours, minutes, seconds.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
years - of this Duration
months - of this Duration
days - of this Duration
hours - of this Duration
minutes - of this Duration
seconds - of this Duration
Returns:
New Duration created from the specified values.
Throws:
java.lang.IllegalArgumentException - If values are not a valid representation of a Duration.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

newDuration

public abstract Duration newDuration(boolean isPositive,
                                     java.math.BigInteger years,
                                     java.math.BigInteger months,
                                     java.math.BigInteger days,
                                     java.math.BigInteger hours,
                                     java.math.BigInteger minutes,
                                     java.math.BigDecimal seconds)

Obtain a new instance of a Duration specifying the Duration as isPositive, years, months, days, hours, minutes, seconds.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
years - of this Duration
months - of this Duration
days - of this Duration
hours - of this Duration
minutes - of this Duration
seconds - of this Duration
Returns:
New Duration created from the specified values.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a Duration: if all the fields (years, months, ...) are null or if any of the fields is negative.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

DatatypeFactory.newDurationDayTime(boolean, int, int, int, int)

newDurationDayTime


public Duration newDurationDayTime(boolean isPositive,
                                   int day,
                                   int hour,
                                   int minute,
                                   int second)

Create a Duration of type xdt:dayTimeDuration using the specified day , hour , minute and second as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
day - Day of Duration.
hour - Hour of Duration.
minute - Minute of Duration.
second - Second of Duration.
Returns:
New Duration created with the specified day , hour , minute and second.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a - If any values would create an invalid Duration : if any of the fields (day, hour, ...) is negative. .

newDurationDayTime

public Duration newDurationDayTime(boolean isPositive,
                                   int day,
                                   int hour,
                                   int minute,
                                   int second)

Create a Duration of type xdt:dayTimeDuration using the specified day, hour, minute and second as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
day - Day of Duration.
hour - Hour of Duration.
minute - Minute of Duration.
second - Second of Duration.
Returns:
New Duration created with the specified day, hour, minute and second.
Throws:
java.lang.IllegalArgumentException - If any values would create an invalid Duration.

newDurationDayTime

public Duration newDurationDayTime(boolean isPositive,
                                   int day,
                                   int hour,
                                   int minute,
                                   int second)

Create a Duration of type xdt:dayTimeDuration using the specified day, hour, minute and second as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
day - Day of Duration.
hour - Hour of Duration.
minute - Minute of Duration.
second - Second of Duration.
Returns:
New Duration created with the specified day, hour, minute and second.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a Duration: if any of the fields (day, hour, ...) is negative.

DatatypeFactory.newDurationDayTime(boolean, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger, java.math.BigInteger)

newDurationDayTime


public Duration newDurationDayTime(boolean isPositive,
                                   java.math.BigInteger day,
                                   java.math.BigInteger hour,
                                   java.math.BigInteger minute,
                                   java.math.BigInteger second)

Create a Duration of type xdt:dayTimeDuration using the specified day , hour , minute and second as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
day - Day of Duration.
hour - Hour of Duration.
minute - Minute of Duration.
second - Second of Duration.
Returns:
New Duration created with the specified day , hour , minute and second.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a - If any values would create an invalid Duration : if all the fields (day, hour, ...) are null or if any of the fields is negative. .
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

newDurationDayTime

public Duration newDurationDayTime(boolean isPositive,
                                   java.math.BigInteger day,
                                   java.math.BigInteger hour,
                                   java.math.BigInteger minute,
                                   java.math.BigInteger second)

Create a Duration of type xdt:dayTimeDuration using the specified day, hour, minute and second as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
day - Day of Duration.
hour - Hour of Duration.
minute - Minute of Duration.
second - Second of Duration.
Returns:
New Duration created with the specified day, hour, minute and second.
Throws:
java.lang.IllegalArgumentException - If any values would create an invalid Duration.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

newDurationDayTime

public Duration newDurationDayTime(boolean isPositive,
                                   java.math.BigInteger day,
                                   java.math.BigInteger hour,
                                   java.math.BigInteger minute,
                                   java.math.BigInteger second)

Create a Duration of type xdt:dayTimeDuration using the specified day, hour, minute and second as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
day - Day of Duration.
hour - Hour of Duration.
minute - Minute of Duration.
second - Second of Duration.
Returns:
New Duration created with the specified day, hour, minute and second.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a Duration: if all the fields (day, hour, ...) are null or if any of the fields is negative.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

DatatypeFactory.newDurationDayTime(java.lang.String)

newDurationDayTime


public Duration newDurationDayTime(java.lang.String lexicalRepresentation)

Create a Duration of type xdt:dayTimeDuration by parsing its String representation, " PnDTnHnMnS ", XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

All four values are set and availabe from the created Duration

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

Parameters:
lexicalRepresentation - Lexical representation of a duration.
Returns:
New Duration created using the specified lexicalRepresentation.
Throws:
java.lang.IllegalArgumentException - If lexicalRepresentation is not a valid representation of a Duration expressed only in terms of days and time. - If the given string does not conform to the aforementioned specification.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.
java.lang.NullPointerException - If lexicalRepresentation is null.

newDurationDayTime

public Duration newDurationDayTime(java.lang.String lexicalRepresentation)

Create a Duration of type xdt:dayTimeDuration by parsing its String representation, "PnDTnHnMnS", XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

All four values are set and availabe from the created Duration

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

Parameters:
lexicalRepresentation - Lexical representation of a duration.
Returns:
New Duration created using the specified lexicalRepresentation.
Throws:
java.lang.IllegalArgumentException - If the given string does not conform to the aforementioned specification.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.
java.lang.NullPointerException - If lexicalRepresentation is null.

newDurationDayTime

public Duration newDurationDayTime(java.lang.String lexicalRepresentation)

Create a Duration of type xdt:dayTimeDuration by parsing its String representation, "PnDTnHnMnS", XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

All four values are set and availabe from the created Duration

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

Parameters:
lexicalRepresentation - Lexical representation of a duration.
Returns:
New Duration created using the specified lexicalRepresentation.
Throws:
java.lang.IllegalArgumentException - If lexicalRepresentation is not a valid representation of a Duration expressed only in terms of days and time.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.
java.lang.NullPointerException - If lexicalRepresentation is null.

DatatypeFactory.newDurationYearMonth(boolean, int, int)

newDurationYearMonth


public Duration newDurationYearMonth(boolean isPositive,
                                     int year,
                                     int month)

Create a Duration of type xdt:yearMonthDuration using the specified year and month as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
year - Year of Duration.
month - Month of Duration.
Returns:
New Duration created using the specified year and month.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a - If any values would create an invalid Duration : if any of the fields (year, month) is negative. .

newDurationYearMonth

public Duration newDurationYearMonth(boolean isPositive,
                                     int year,
                                     int month)

Create a Duration of type xdt:yearMonthDuration using the specified year and month as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
year - Year of Duration.
month - Month of Duration.
Returns:
New Duration created using the specified year and month.
Throws:
java.lang.IllegalArgumentException - If any values would create an invalid Duration.

newDurationYearMonth

public Duration newDurationYearMonth(boolean isPositive,
                                     int year,
                                     int month)

Create a Duration of type xdt:yearMonthDuration using the specified year and month as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
year - Year of Duration.
month - Month of Duration.
Returns:
New Duration created using the specified year and month.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a Duration: if any of the fields (year, month) is negative.

DatatypeFactory.newDurationYearMonth(boolean, java.math.BigInteger, java.math.BigInteger)

newDurationYearMonth


public Duration newDurationYearMonth(boolean isPositive,
                                     java.math.BigInteger year,
                                     java.math.BigInteger month)

Create a Duration of type xdt:yearMonthDuration using the specified year and month as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
year - Year of Duration.
month - Month of Duration.
Returns:
New Duration created using the specified year and month.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a - If any values would create an invalid Duration : if all of the fields (year, month) are null or if any of the fields is negative. .
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

newDurationYearMonth

public Duration newDurationYearMonth(boolean isPositive,
                                     java.math.BigInteger year,
                                     java.math.BigInteger month)

Create a Duration of type xdt:yearMonthDuration using the specified year and month as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
year - Year of Duration.
month - Month of Duration.
Returns:
New Duration created using the specified year and month.
Throws:
java.lang.IllegalArgumentException - If any values would create an invalid Duration.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

newDurationYearMonth

public Duration newDurationYearMonth(boolean isPositive,
                                     java.math.BigInteger year,
                                     java.math.BigInteger month)

Create a Duration of type xdt:yearMonthDuration using the specified year and month as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

A null value indicates that field isnot set.

Parameters:
isPositive - Set to false to create a negative duration. When the length of the duration is zero, this parameter will be ignored.
year - Year of Duration.
month - Month of Duration.
Returns:
New Duration created using the specified year and month.
Throws:
java.lang.IllegalArgumentException - If the values are not a valid representation of a Duration: if all of the fields (year, month) are null or if any of the fields is negative.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.

DatatypeFactory.newDurationYearMonth(java.lang.String)

newDurationYearMonth


public Duration newDurationYearMonth(java.lang.String lexicalRepresentation)

Create a Duration of type xdt:yearMonthDuration by parsing its String representation, " PnYnM ", XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

The datatype xdt:yearMonthDuration is a subtype of xs:duration whose lexical representation contains only year and month components. This datatype resides in the namespace XMLConstants.W3C_XPATH_DATATYPE_NS_URI .

Both values are set and availabe from the created Duration

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

Parameters:
lexicalRepresentation - Lexical representation of a duration.
Returns:
New Duration created using the specified lexicalRepresentation.
Throws:
java.lang.IllegalArgumentException - If the lexicalRepresentation is not a valid representation of a Duration expressed only in terms of years and months. does not conform to the specification.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.
java.lang.NullPointerException - If lexicalRepresentation is null.

newDurationYearMonth

public Duration newDurationYearMonth(java.lang.String lexicalRepresentation)

Create a Duration of type xdt:yearMonthDuration by parsing its String representation, "PnYnM", XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

The datatype xdt:yearMonthDuration is a subtype of xs:duration whose lexical representation contains only year and month components. This datatype resides in the namespace XMLConstants.W3C_XPATH_DATATYPE_NS_URI.

Both values are set and availabe from the created Duration

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

Parameters:
lexicalRepresentation - Lexical representation of a duration.
Returns:
New Duration created using the specified lexicalRepresentation.
Throws:
java.lang.IllegalArgumentException - If the lexicalRepresentation does not conform to the specification.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.
java.lang.NullPointerException - If lexicalRepresentation is null.

newDurationYearMonth

public Duration newDurationYearMonth(java.lang.String lexicalRepresentation)

Create a Duration of type xdt:yearMonthDuration by parsing its String representation, "PnYnM", XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.

The datatype xdt:yearMonthDuration is a subtype of xs:duration whose lexical representation contains only year and month components. This datatype resides in the namespace XMLConstants.W3C_XPATH_DATATYPE_NS_URI.

Both values are set and availabe from the created Duration

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

Parameters:
lexicalRepresentation - Lexical representation of a duration.
Returns:
New Duration created using the specified lexicalRepresentation.
Throws:
java.lang.IllegalArgumentException - If lexicalRepresentation is not a valid representation of a Duration expressed only in terms of years and months.
java.lang.UnsupportedOperationException - If implementation cannot support requested values.
java.lang.NullPointerException - If lexicalRepresentation is null.

DatatypeFactory.newInstance()

newInstance


public static DatatypeFactory newInstance()
                                   throws DatatypeConfigurationException

Obtain a new instance of a DatatypeFactory.

The implementation resolution mechanisms are defined in this Class 's documentation.

Returns:
New instance of a DatatypeFactory DocumentBuilderFactory
Throws:
DatatypeConfigurationException - If the implementation is not available or cannot be instantiated.
See Also:
newInstance(String factoryClassName, ClassLoader classLoader)

newInstance

public static DatatypeFactory newInstance()
                                   throws DatatypeConfigurationException

Obtain a new instance of a DatatypeFactory.

The implementation resolution mechanisms are defined in this Class's documentation.

Returns:
New instance of a DocumentBuilderFactory
Throws:
DatatypeConfigurationException - If the implementation is not available or cannot be instantiated.

newInstance

public static DatatypeFactory newInstance()
                                   throws DatatypeConfigurationException

Obtain a new instance of a DatatypeFactory.

The implementation resolution mechanisms are defined in this Class's documentation.

Returns:
New instance of a DatatypeFactory
Throws:
DatatypeConfigurationException - If the implementation is not available or cannot be instantiated.
See Also:
newInstance(String factoryClassName, ClassLoader classLoader)

DatatypeFactory.newInstance(java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static DatatypeFactory newInstance(java.lang.String factoryClassName,
                                          java.lang.ClassLoader classLoader)
                                   throws DatatypeConfigurationException

Obtain a new instance of a DatatypeFactory from class name. This function is useful when there are multiple providers in the classpath. It gives more control to the application as it can specify which provider should be loaded.

Once an application has obtained a reference to a DatatypeFactory it can use the factory to configure and obtain datatype instances.

Tip for Trouble-shooting

Setting the jaxp.debug system property will cause this method to print a lot of debug messages to System.err about what it is doing and where it is looking at.

If you have problems try:

 java -Djaxp.debug=1 YourProgram ....
 

Parameters:
factoryClassName - fully qualified factory class name that provides implementation of javax.xml.datatype.DatatypeFactory.
classLoader - ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.
Returns:
New instance of a DatatypeFactory
Throws:
DatatypeConfigurationException - if factoryClassName is null, or the factory class cannot be loaded, instantiated.
See Also:
newInstance()

javax.xml.datatype.Duration (1 method)

CLASS_COMMENT
equals(java.lang.Object)

Duration.CLASS_COMMENT

public abstract class Duration
extends java.lang.Object

Immutable representation of a time span as defined in the W3C XML Schema 1.0 specification.

A Duration object represents a period of Gregorian time, which consists of six fields (years, months, days, hours, minutes, and seconds) plus a sign (+/-) field.

The first five fields have non-negative (>=0) integers or null (which represents that the field is not set), and the seconds field has a non-negative decimal or null. A negative sign indicates a negative duration.

This class provides a number of methods that make it easy to use for the duration datatype of XML Schema 1.0 with the errata.

Order relationship

Duration objects only have partial order, where two values A and B maybe either:

  1. A<B (A is shorter than B)
  2. A>B (A is longer than B)
  3. A==B (A and B are of the same duration)
  4. A<>B (Comparison between A and B is indeterminate)
*

For example, 30 days cannot be meaningfully compared to one month. The compare(Duration duration) method implements this relationship.

See the isLongerThan(Duration) method for details about the order relationship among Duration objects.

Operations over Duration

This class provides a set of basic arithmetic operations, such as addition, subtraction and multiplication. Because durations don't have total order, an operation could fail for some combinations of operations. For example, you cannot subtract 15 days from 1 month. See the javadoc of those methods for detailed conditions where this could happen.

Also, division of a duration by a number is not provided because the Duration class can only deal with finite precision decimal numbers. For example, one cannot represent 1 sec divided by 3.

However, you could substitute a division by 3 with multiplying by numbers such as 0.3 or 0.333.

Range of allowed values

Because some operations of Duration rely on Calendar even though Duration can hold very large or very small values, some of the methods may not work correctly on such Duration s. The impacted methods document their dependency on Calendar .

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli , Kohsuke Kawaguchi , Jeff Suttor , Sunitha Reddy
See Also:
XMLGregorianCalendar.add(Duration)
public abstract class Duration
extends java.lang.Object

Immutable representation of a time span as defined in the W3C XML Schema 1.0 specification.

A Duration object represents a period of Gregorian time, which consists of six fields (years, months, days, hours, minutes, and seconds) plus a sign (+/-) field.

The first five fields have non-negative (>=0) integers or null (which represents that the field is not set), and the seconds field has a non-negative decimal or null. A negative sign indicates a negative duration.

This class provides a number of methods that make it easy to use for the duration datatype of XML Schema 1.0 with the errata.

Order relationship

Duration objects only have partial order, where two values A and B maybe either:

  1. A<B (A is shorter than B)
  2. A>B (A is longer than B)
  3. A==B (A and B are of the same duration)
  4. A<>B (Comparison between A and B is indeterminate)
*

For example, 30 days cannot be meaningfully compared to one month. The compare(Duration duration) method implements this relationship.

See the isLongerThan(Duration) method for details about the order relationship among Duration objects.

Operations over Duration

This class provides a set of basic arithmetic operations, such as addition, subtraction and multiplication. Because durations don't have total order, an operation could fail for some combinations of operations. For example, you cannot subtract 15 days from 1 month. See the javadoc of those methods for detailed conditions where this could happen.

Also, division of a duration by a number is not provided because the Duration class can only deal with finite precision decimal numbers. For example, one cannot represent 1 sec divided by 3.

However, you could substitute a division by 3 with multiplying by numbers such as 0.3 or 0.333.

Range of allowed values

Because some operations of Duration rely on Calendar even though Duration can hold very large or very small values, some of the methods may not work correctly on such Durations. The impacted methods document their dependency on Calendar.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli, Kohsuke Kawaguchi, Jeff Suttor
See Also:
XMLGregorianCalendar.add(Duration)
public abstract class Duration
extends java.lang.Object

Immutable representation of a time span as defined in the W3C XML Schema 1.0 specification.

A Duration object represents a period of Gregorian time, which consists of six fields (years, months, days, hours, minutes, and seconds) plus a sign (+/-) field.

The first five fields have non-negative (>=0) integers or null (which represents that the field is not set), and the seconds field has a non-negative decimal or null. A negative sign indicates a negative duration.

This class provides a number of methods that make it easy to use for the duration datatype of XML Schema 1.0 with the errata.

Order relationship

Duration objects only have partial order, where two values A and B maybe either:

  1. A<B (A is shorter than B)
  2. A>B (A is longer than B)
  3. A==B (A and B are of the same duration)
  4. A<>B (Comparison between A and B is indeterminate)

For example, 30 days cannot be meaningfully compared to one month. The compare(Duration duration) method implements this relationship.

See the isLongerThan(Duration) method for details about the order relationship among Duration objects.

Operations over Duration

This class provides a set of basic arithmetic operations, such as addition, subtraction and multiplication. Because durations don't have total order, an operation could fail for some combinations of operations. For example, you cannot subtract 15 days from 1 month. See the javadoc of those methods for detailed conditions where this could happen.

Also, division of a duration by a number is not provided because the Duration class can only deal with finite precision decimal numbers. For example, one cannot represent 1 sec divided by 3.

However, you could substitute a division by 3 with multiplying by numbers such as 0.3 or 0.333.

Range of allowed values

Because some operations of Duration rely on Calendar even though Duration can hold very large or very small values, some of the methods may not work correctly on such Durations. The impacted methods document their dependency on Calendar.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli, Kohsuke Kawaguchi, Jeff Suttor, Sunitha Reddy
See Also:
XMLGregorianCalendar.add(Duration)

Duration.equals(java.lang.Object)

equals


public boolean equals(java.lang.Object duration)

Checks if this duration object has the same duration as another Duration object.

For example, "P1D" (1 day) is equal to "PT24H" (24 hours).

Duration X is equal to Y if and only if time instant t+X and t+Y are the same for all the test time instants specified in the section 3.2.6.2 of the XML Schema 1.0 specification.

Note that there are cases where two Duration s are "incomparable" to each other, like one month and 30 days. For example,

 !new Duration("P1M").isShorterThan(new Duration("P30D"))
 !new Duration("P1M").isLongerThan(new Duration("P30D"))
 !new Duration("P1M").equals(new Duration("P30D"))
 

Overrides:
equals in class java.lang.Object
Parameters:
duration - The object to compare this - A non-null valid Duration against. object.
Returns:
true if this duration is the same length as duration. false if duration is not a null , is not a Duration object, object or its length is different from this duration.
Throws:
java.lang.UnsupportedOperationException - If the underlying implementation cannot reasonably process the request, e.g. W3C XML Schema allows for arbitrarily large/small/precise values, the request may be beyond the implementations capability.
java.lang.NullPointerException - if parameter is null.
See Also:
compare(Duration duration)

equals

public boolean equals(java.lang.Object duration)

Checks if this duration object has the same duration as another Duration object.

For example, "P1D" (1 day) is equal to "PT24H" (24 hours).

Duration X is equal to Y if and only if time instant t+X and t+Y are the same for all the test time instants specified in the section 3.2.6.2 of the XML Schema 1.0 specification.

Note that there are cases where two Durations are "incomparable" to each other, like one month and 30 days. For example,

 !new Duration("P1M").isShorterThan(new Duration("P30D"))
 !new Duration("P1M").isLongerThan(new Duration("P30D"))
 !new Duration("P1M").equals(new Duration("P30D"))
 

Overrides:
equals in class java.lang.Object
Parameters:
duration - A non-null valid Duration object.
Returns:
true if this duration is the same length as duration. false if duration is not a Duration object or its length is different from this duration.
Throws:
java.lang.UnsupportedOperationException - If the underlying implementation cannot reasonably process the request, e.g. W3C XML Schema allows for arbitrarily large/small/precise values, the request may be beyond the implementations capability.
java.lang.NullPointerException - if parameter is null.
See Also:
compare(Duration duration)

equals

public boolean equals(java.lang.Object duration)

Checks if this duration object has the same duration as another Duration object.

For example, "P1D" (1 day) is equal to "PT24H" (24 hours).

Duration X is equal to Y if and only if time instant t+X and t+Y are the same for all the test time instants specified in the section 3.2.6.2 of the XML Schema 1.0 specification.

Note that there are cases where two Durations are "incomparable" to each other, like one month and 30 days. For example,

 !new Duration("P1M").isShorterThan(new Duration("P30D"))
 !new Duration("P1M").isLongerThan(new Duration("P30D"))
 !new Duration("P1M").equals(new Duration("P30D"))
 

Overrides:
equals in class java.lang.Object
Parameters:
duration - The object to compare this Duration against.
Returns:
true if this duration is the same length as duration. false if duration is null, is not a Duration object, or its length is different from this duration.
Throws:
java.lang.UnsupportedOperationException - If the underlying implementation cannot reasonably process the request, e.g. W3C XML Schema allows for arbitrarily large/small/precise values, the request may be beyond the implementations capability.
See Also:
compare(Duration duration)

javax.xml.datatype.XMLGregorianCalendar (1 method)

CLASS_COMMENT
equals(java.lang.Object)

XMLGregorianCalendar.CLASS_COMMENT

public abstract class XMLGregorianCalendar
extends java.lang.Object
implements java.lang.Cloneable

Representation for W3C XML Schema 1.0 date/time datatypes. Specifically, these date/time datatypes are DatatypeConstants.DATETIME , DatatypeConstants.TIME , DatatypeConstants.DATE , DatatypeConstants.GYEARMONTH , DatatypeConstants.GMONTHDAY , DatatypeConstants.GYEAR , DatatypeConstants.GMONTH , and DatatypeConstants.GDAY defined in the XML Namespace "http://www.w3.org/2001/XMLSchema". These datatypes are normatively defined in W3C XML Schema 1.0 Part 2, Section 3.2.7-14.

The table below defines the mapping between XML Schema 1.0 date/time datatype fields and this class' fields. It also summarizes the value constraints for the date and time fields defined in W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats .

Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation
XML Schema 1.0
datatype
field
Related
XMLGregorianCalendar
Accessor(s)
Value Range
year getYear() + getEon() or
getEonAndYear()
getYear() is a value between -(10^9-1) to (10^9)-1 or DatatypeConstants.FIELD_UNDEFINED .
getEon() is high order year value in billion of years.
getEon() has values greater than or equal to (10^9) or less than or equal to -(10^9). A value of null indicates field is undefined.
Given that XML Schema 1.0 errata states that the year zero will be a valid lexical value in a future version of XML Schema, this class allows the year field to be set to zero. Otherwise, the year field value is handled exactly as described in the errata and [ISO-8601-1988]. Note that W3C XML Schema 1.0 validation does not allow for the year field to have a value of zero.
month getMonth() 1 to 12 or DatatypeConstants.FIELD_UNDEFINED
day getDay() Independent of month, max range is 1 to 31 or DatatypeConstants.FIELD_UNDEFINED .
The normative value constraint stated relative to month field's value is in W3C XML Schema 1.0 Part 2, Appendix D.
hour getHour() 0 to 24 or DatatypeConstants.FIELD_UNDEFINED . For a value of 24, the minute and second field must be zero per XML Schema Errata.
minute getMinute() 0 to 59 or DatatypeConstants.FIELD_UNDEFINED
second getSecond() + getMillisecond() /1000 or
getSecond() + getFractionalSecond()
getSecond() from 0 to 60 or DatatypeConstants.FIELD_UNDEFINED .
(Note: 60 only allowable for leap second.)
getFractionalSecond() allows for infinite precision over the range from 0.0 to 1.0 when the getSecond() is defined.
FractionalSecond is optional and has a value of null when it is undefined.
getMillisecond() is the convenience millisecond precision of value of getFractionalSecond() .
timezone getTimezone() Number of minutes or DatatypeConstants.FIELD_UNDEFINED . Value range from -14 hours (-14 * 60 minutes) to 14 hours (14 * 60 minutes).

All maximum value space constraints listed for the fields in the table above are checked by factory methods, @{link DatatypeFactory}, setter methods and parse methods of this class. IllegalArgumentException is thrown when a parameter's value is outside the value constraint for the field or if the composite values constitute an invalid XMLGregorianCalendar instance (for example, if the 31st of June is specified).

The following operations are defined for this class:

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli , Kohsuke Kawaguchi , Jeff Suttor , Sunitha Reddy
See Also:
Duration , DatatypeFactory
public abstract class XMLGregorianCalendar
extends java.lang.Object
implements java.lang.Cloneable

Representation for W3C XML Schema 1.0 date/time datatypes. Specifically, these date/time datatypes are DatatypeConstants.DATETIME, DatatypeConstants.TIME, DatatypeConstants.DATE, DatatypeConstants.GYEARMONTH, DatatypeConstants.GMONTHDAY, DatatypeConstants.GYEAR, DatatypeConstants.GMONTH, and DatatypeConstants.GDAY defined in the XML Namespace "http://www.w3.org/2001/XMLSchema". These datatypes are normatively defined in W3C XML Schema 1.0 Part 2, Section 3.2.7-14.

The table below defines the mapping between XML Schema 1.0 date/time datatype fields and this class' fields. It also summarizes the value constraints for the date and time fields defined in W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats.

Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation
XML Schema 1.0
datatype
field
Related
XMLGregorianCalendar
Accessor(s)
Value Range
year getYear() + getEon() or
getEonAndYear()
getYear() is a value between -(10^9-1) to (10^9)-1 or DatatypeConstants.FIELD_UNDEFINED.
getEon() is high order year value in billion of years.
getEon() has values greater than or equal to (10^9) or less than or equal to -(10^9). A value of null indicates field is undefined.
Given that XML Schema 1.0 errata states that the year zero will be a valid lexical value in a future version of XML Schema, this class allows the year field to be set to zero. Otherwise, the year field value is handled exactly as described in the errata and [ISO-8601-1988]. Note that W3C XML Schema 1.0 validation does not allow for the year field to have a value of zero.
month getMonth() 1 to 12 or DatatypeConstants.FIELD_UNDEFINED
day getDay() Independent of month, max range is 1 to 31 or DatatypeConstants.FIELD_UNDEFINED.
The normative value constraint stated relative to month field's value is in W3C XML Schema 1.0 Part 2, Appendix D.
hour getHour() 0 to 24 or DatatypeConstants.FIELD_UNDEFINED. For a value of 24, the minute and second field must be zero per XML Schema Errata.
minute getMinute() 0 to 59 or DatatypeConstants.FIELD_UNDEFINED
second getSecond() + getMillisecond()/1000 or
getSecond() + getFractionalSecond()
getSecond() from 0 to 60 or DatatypeConstants.FIELD_UNDEFINED.
(Note: 60 only allowable for leap second.)
getFractionalSecond() allows for infinite precision over the range from 0.0 to 1.0 when the getSecond() is defined.
FractionalSecond is optional and has a value of null when it is undefined.
getMillisecond() is the convenience millisecond precision of value of getFractionalSecond().
timezone getTimezone() Number of minutes or DatatypeConstants.FIELD_UNDEFINED. Value range from -14 hours (-14 * 60 minutes) to 14 hours (14 * 60 minutes).

All maximum value space constraints listed for the fields in the table above are checked by factory methods, @{link DatatypeFactory}, setter methods and parse methods of this class. IllegalArgumentException is thrown when a parameter's value is outside the value constraint for the field or if the composite values constitute an invalid XMLGregorianCalendar instance (for example, if the 31st of June is specified).

The following operations are defined for this class:

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli, Kohsuke Kawaguchi, Jeff Suttor
See Also:
Duration, DatatypeFactory
public abstract class XMLGregorianCalendar
extends java.lang.Object
implements java.lang.Cloneable

Representation for W3C XML Schema 1.0 date/time datatypes. Specifically, these date/time datatypes are DatatypeConstants.DATETIME, DatatypeConstants.TIME, DatatypeConstants.DATE, DatatypeConstants.GYEARMONTH, DatatypeConstants.GMONTHDAY, DatatypeConstants.GYEAR, DatatypeConstants.GMONTH, and DatatypeConstants.GDAY defined in the XML Namespace "http://www.w3.org/2001/XMLSchema". These datatypes are normatively defined in W3C XML Schema 1.0 Part 2, Section 3.2.7-14.

The table below defines the mapping between XML Schema 1.0 date/time datatype fields and this class' fields. It also summarizes the value constraints for the date and time fields defined in W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats.

Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation
XML Schema 1.0
datatype
field
Related
XMLGregorianCalendar
Accessor(s)
Value Range
year getYear() + getEon() or
getEonAndYear()
getYear() is a value between -(10^9-1) to (10^9)-1 or DatatypeConstants.FIELD_UNDEFINED.
getEon() is high order year value in billion of years.
getEon() has values greater than or equal to (10^9) or less than or equal to -(10^9). A value of null indicates field is undefined.
Given that XML Schema 1.0 errata states that the year zero will be a valid lexical value in a future version of XML Schema, this class allows the year field to be set to zero. Otherwise, the year field value is handled exactly as described in the errata and [ISO-8601-1988]. Note that W3C XML Schema 1.0 validation does not allow for the year field to have a value of zero.
month getMonth() 1 to 12 or DatatypeConstants.FIELD_UNDEFINED
day getDay() Independent of month, max range is 1 to 31 or DatatypeConstants.FIELD_UNDEFINED.
The normative value constraint stated relative to month field's value is in W3C XML Schema 1.0 Part 2, Appendix D.
hour getHour() 0 to 24 or DatatypeConstants.FIELD_UNDEFINED. For a value of 24, the minute and second field must be zero per XML Schema Errata.
minute getMinute() 0 to 59 or DatatypeConstants.FIELD_UNDEFINED
second getSecond() + getMillisecond()/1000 or
getSecond() + getFractionalSecond()
getSecond() from 0 to 60 or DatatypeConstants.FIELD_UNDEFINED.
(Note: 60 only allowable for leap second.)
getFractionalSecond() allows for infinite precision over the range from 0.0 to 1.0 when the getSecond() is defined.
FractionalSecond is optional and has a value of null when it is undefined.
getMillisecond() is the convenience millisecond precision of value of getFractionalSecond().
timezone getTimezone() Number of minutes or DatatypeConstants.FIELD_UNDEFINED. Value range from -14 hours (-14 * 60 minutes) to 14 hours (14 * 60 minutes).

All maximum value space constraints listed for the fields in the table above are checked by factory methods, @{link DatatypeFactory}, setter methods and parse methods of this class. IllegalArgumentException is thrown when a parameter's value is outside the value constraint for the field or if the composite values constitute an invalid XMLGregorianCalendar instance (for example, if the 31st of June is specified).

The following operations are defined for this class:

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Joseph Fialli, Kohsuke Kawaguchi, Jeff Suttor, Sunitha Reddy
See Also:
Duration, DatatypeFactory

XMLGregorianCalendar.equals(java.lang.Object)

equals


public boolean equals(java.lang.Object obj)

Compares this calendar to the specified object. The result is Indicates whether parameter true obj if and only if the argument is not null and is an XMLGregorianCalendar object that represents the same instant in time as this object. is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
obj - to compare.
Returns:
true when obj is an instance of XMLGregorianCalendar and compare(XMLGregorianCalendar obj) returns DatatypeConstants.EQUAL , otherwise false.
Throws:
java.lang.NullPointerException - If obj is null.

equals

public boolean equals(java.lang.Object obj)

Indicates whether parameter obj is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
obj - to compare.
Returns:
true when obj is an instance of XMLGregorianCalendar and compare(XMLGregorianCalendar obj) returns DatatypeConstants.EQUAL, otherwise false.
Throws:
java.lang.NullPointerException - If obj is null.

equals

public boolean equals(java.lang.Object obj)

Compares this calendar to the specified object. The result is true if and only if the argument is not null and is an XMLGregorianCalendar object that represents the same instant in time as this object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - to compare.
Returns:
true when obj is an instance of XMLGregorianCalendar and compare(XMLGregorianCalendar obj) returns DatatypeConstants.EQUAL, otherwise false.

javax.xml.parsers.DocumentBuilderFactory (4 methods)

CLASS_COMMENT
getSchema()
newInstance(java.lang.String, java.lang.ClassLoader)
setFeature(java.lang.String, boolean)
setSchema(javax.xml.validation.Schema)

DocumentBuilderFactory.CLASS_COMMENT

public abstract class DocumentBuilderFactory
extends java.lang.Object

Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents.

Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor Jeff Suttor , Neeraj Bajaj
public abstract class DocumentBuilderFactory
extends java.lang.Object

Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents.

Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor
public abstract class DocumentBuilderFactory
extends java.lang.Object

Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents.

Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor, Neeraj Bajaj

DocumentBuilderFactory.getSchema()

getSchema


public Schema getSchema()
Gets the Schema object specified through the setSchema(Schema schema) method.

Returns:
the Schema object that was last set through the setSchema(Schema) method, or null if the method was not invoked since a DocumentBuilderFactory SAXParserFactory is created.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

getSchema

public Schema getSchema()
Gets the Schema object specified through the setSchema(Schema schema) method.

Returns:
the Schema object that was last set through the setSchema(Schema) method, or null if the method was not invoked since a SAXParserFactory is created.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

getSchema

public Schema getSchema()
Gets the Schema object specified through the setSchema(Schema schema) method.

Returns:
the Schema object that was last set through the setSchema(Schema) method, or null if the method was not invoked since a DocumentBuilderFactory is created.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

DocumentBuilderFactory.newInstance(java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static DocumentBuilderFactory newInstance(java.lang.String factoryClassName,
                                                 java.lang.ClassLoader classLoader)

Obtain a new instance of a DocumentBuilderFactory from class name. This function is useful when there are multiple providers in the classpath. It gives more control to the application as it can specify which provider should be loaded.

Once an application has obtained a reference to a DocumentBuilderFactory it can use the factory to configure and obtain parser instances.

Tip for Trouble-shooting

Setting the jaxp.debug system property will cause this method to print a lot of debug messages to System.err about what it is doing and where it is looking at.

If you have problems try:

 java -Djaxp.debug=1 YourProgram ....
 

Parameters:
factoryClassName - fully qualified factory class name that provides implementation of javax.xml.parsers.DocumentBuilderFactory.
classLoader - ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.
Returns:
New instance of a DocumentBuilderFactory
Throws:
FactoryConfigurationError - if factoryClassName is null, or the factory class cannot be loaded, instantiated.
See Also:
newInstance()

DocumentBuilderFactory.setFeature(java.lang.String, boolean)

setFeature


public abstract void setFeature(java.lang.String name,
                                boolean value)
                         throws ParserConfigurationException

Set a feature for this DocumentBuilderFactory and DocumentBuilder s created by this factory.

Feature names are fully qualified URI s. Implementations may define their own features. A An ParserConfigurationException is thrown if this DocumentBuilderFactory or the DocumentBuilder s it creates cannot support the feature. It is possible for a an DocumentBuilderFactory to expose a feature value but be unable to change its state.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING feature. When the feature is:

Parameters:
name - Feature name.
value - Is feature state true or false.
Throws:
ParserConfigurationException - if this DocumentBuilderFactory or the DocumentBuilder s it creates cannot support this feature.
java.lang.NullPointerException - If the name parameter is null.

setFeature

public abstract void setFeature(java.lang.String name,
                                boolean value)
                         throws ParserConfigurationException

Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.

Feature names are fully qualified URIs. Implementations may define their own features. An ParserConfigurationException is thrown if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support the feature. It is possible for an DocumentBuilderFactory to expose a feature value but be unable to change its state.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING feature. When the feature is:

Parameters:
name - Feature name.
value - Is feature state true or false.
Throws:
ParserConfigurationException - if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support this feature.
java.lang.NullPointerException - If the name parameter is null.

setFeature

public abstract void setFeature(java.lang.String name,
                                boolean value)
                         throws ParserConfigurationException

Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.

Feature names are fully qualified URIs. Implementations may define their own features. A ParserConfigurationException is thrown if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support the feature. It is possible for a DocumentBuilderFactory to expose a feature value but be unable to change its state.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING feature. When the feature is:

Parameters:
name - Feature name.
value - Is feature state true or false.
Throws:
ParserConfigurationException - if this DocumentBuilderFactory or the DocumentBuilders it creates cannot support this feature.
java.lang.NullPointerException - If the name parameter is null.

DocumentBuilderFactory.setSchema(javax.xml.validation.Schema)

setSchema


public void setSchema(Schema schema)

Set the Schema to be used by parsers created from this factory.

When a Schema is non-null, a parser will use a validator created from it to validate documents before it passes information down to the application.

When errors are found by the validator, the parser is responsible to report them to the user-specified ErrorHandler DOMErrorHandler (or if the error handler is not set, ignore them or throw them), just like any other errors found by the parser itself. In other words, if the user-specified ErrorHandler DOMErrorHandler is set, it must receive those errors, and if not, they must be treated according to the implementation specific default error handling rules.

A validator may modify the outcome of a parse (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive modified DOM trees.

Initialy, null is set as the Schema .

This processing will take effect even if the isValidating() method returns false.

It is an error to use the http://java.sun.com/xml/jaxp/properties/schemaSource property and/or the http://java.sun.com/xml/jaxp/properties/schemaLanguage property in conjunction with a Schema object. Such configuration will cause a ParserConfigurationException exception when the newDocumentBuilder() is invoked.

Note for implmentors

A parser must be able to work with any Schema implementation. However, parsers and schemas are allowed to use implementation-specific custom mechanisms as long as they yield the result described in the specification.

Parameters:
schema - Schema to use or null to remove a schema.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

setSchema

public void setSchema(Schema schema)

Set the Schema to be used by parsers created from this factory.

When a Schema is non-null, a parser will use a validator created from it to validate documents before it passes information down to the application.

When errors are found by the validator, the parser is responsible to report them to the user-specified DOMErrorHandler (or if the error handler is not set, ignore them or throw them), just like any other errors found by the parser itself. In other words, if the user-specified DOMErrorHandler is set, it must receive those errors, and if not, they must be treated according to the implementation specific default error handling rules.

A validator may modify the outcome of a parse (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive modified DOM trees.

Initialy, null is set as the Schema.

This processing will take effect even if the isValidating() method returns false.

It is an error to use the http://java.sun.com/xml/jaxp/properties/schemaSource property and/or the http://java.sun.com/xml/jaxp/properties/schemaLanguage property in conjunction with a Schema object. Such configuration will cause a ParserConfigurationException exception when the newDocumentBuilder() is invoked.

Note for implmentors

A parser must be able to work with any Schema implementation. However, parsers and schemas are allowed to use implementation-specific custom mechanisms as long as they yield the result described in the specification.

Parameters:
schema - Schema to use or null to remove a schema.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

setSchema

public void setSchema(Schema schema)

Set the Schema to be used by parsers created from this factory.

When a Schema is non-null, a parser will use a validator created from it to validate documents before it passes information down to the application.

When errors are found by the validator, the parser is responsible to report them to the user-specified ErrorHandler (or if the error handler is not set, ignore them or throw them), just like any other errors found by the parser itself. In other words, if the user-specified ErrorHandler is set, it must receive those errors, and if not, they must be treated according to the implementation specific default error handling rules.

A validator may modify the outcome of a parse (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive modified DOM trees.

Initialy, null is set as the Schema.

This processing will take effect even if the isValidating() method returns false.

It is an error to use the http://java.sun.com/xml/jaxp/properties/schemaSource property and/or the http://java.sun.com/xml/jaxp/properties/schemaLanguage property in conjunction with a Schema object. Such configuration will cause a ParserConfigurationException exception when the newDocumentBuilder() is invoked.

Note for implmentors

A parser must be able to work with any Schema implementation. However, parsers and schemas are allowed to use implementation-specific custom mechanisms as long as they yield the result described in the specification.

Parameters:
schema - Schema to use or null to remove a schema.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

javax.xml.parsers.SAXParserFactory (1 method)

CLASS_COMMENT
newInstance(java.lang.String, java.lang.ClassLoader)

SAXParserFactory.CLASS_COMMENT

public abstract class SAXParserFactory
extends java.lang.Object

Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents.

Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor Jeff Suttor , Neeraj Bajaj
public abstract class SAXParserFactory
extends java.lang.Object

Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents.

Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor
public abstract class SAXParserFactory
extends java.lang.Object

Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents.

Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Jeff Suttor, Neeraj Bajaj

SAXParserFactory.newInstance(java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static SAXParserFactory newInstance(java.lang.String factoryClassName,
                                           java.lang.ClassLoader classLoader)

Obtain a new instance of a SAXParserFactory from class name. This function is useful when there are multiple providers in the classpath. It gives more control to the application as it can specify which provider should be loaded.

Once an application has obtained a reference to a SAXParserFactory it can use the factory to configure and obtain parser instances.

Tip for Trouble-shooting

Setting the jaxp.debug system property will cause this method to print a lot of debug messages to System.err about what it is doing and where it is looking at.

If you have problems, try:

 java -Djaxp.debug=1 YourProgram ....
 

Parameters:
factoryClassName - fully qualified factory class name that provides implementation of javax.xml.parsers.DocumentBuilderFactory.
classLoader - ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.
Returns:
New instance of a SAXParserFactory
Throws:
FactoryConfigurationError - if factoryClassName is null, or the factory class cannot be loaded, instantiated.
See Also:
newInstance()

javax.xml.stream.EventFilter (New) (1 method)

CLASS_COMMENT
accept(javax.xml.stream.events.XMLEvent)

EventFilter.CLASS_COMMENT (New)

public interface EventFilter

This interface declares a simple filter interface that one can create to filter XMLEventReaders

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

EventFilter.accept(javax.xml.stream.events.XMLEvent) (New)

accept

boolean accept(XMLEvent event)
Tests whether this event is part of this stream. This method will return true if this filter accepts this event and false otherwise.

Parameters:
event - the event to test
Returns:
true if this filter accepts this event, false otherwise

javax.xml.stream.FactoryConfigurationError (New) (7 methods)

CLASS_COMMENT
FactoryConfigurationError()
FactoryConfigurationError(java.lang.Exception)
FactoryConfigurationError(java.lang.Exception, java.lang.String)
FactoryConfigurationError(java.lang.String)
FactoryConfigurationError(java.lang.String, java.lang.Exception)
getException()
getMessage()

FactoryConfigurationError.CLASS_COMMENT (New)

public class FactoryConfigurationError
extends java.lang.Error

An error class for reporting factory configuration errors.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
Serialized Form

FactoryConfigurationError.FactoryConfigurationError() (New)

FactoryConfigurationError

public FactoryConfigurationError()
Default constructor

FactoryConfigurationError.FactoryConfigurationError(java.lang.Exception) (New)

FactoryConfigurationError

public FactoryConfigurationError(java.lang.Exception e)
Construct an exception with a nested inner exception

Parameters:
e - the exception to nest

FactoryConfigurationError.FactoryConfigurationError(java.lang.Exception, java.lang.String) (New)

FactoryConfigurationError

public FactoryConfigurationError(java.lang.Exception e,
                                 java.lang.String msg)
Construct an exception with a nested inner exception and a message

Parameters:
e - the exception to nest
msg - the message to report

FactoryConfigurationError.FactoryConfigurationError(java.lang.String) (New)

FactoryConfigurationError

public FactoryConfigurationError(java.lang.String msg)
Construct an exception with associated message

Parameters:
msg - the message to report

FactoryConfigurationError.FactoryConfigurationError(java.lang.String, java.lang.Exception) (New)

FactoryConfigurationError

public FactoryConfigurationError(java.lang.String msg,
                                 java.lang.Exception e)
Construct an exception with a nested inner exception and a message

Parameters:
msg - the message to report
e - the exception to nest

FactoryConfigurationError.getException() (New)

getException

public java.lang.Exception getException()
Return the nested exception (if any)

Returns:
the nested exception or null

FactoryConfigurationError.getMessage() (New)

getMessage

public java.lang.String getMessage()
Report the message associated with this error

Overrides:
getMessage in class java.lang.Throwable
Returns:
the string value of the message

javax.xml.stream.Location (New) (5 methods)

CLASS_COMMENT
getCharacterOffset()
getColumnNumber()
getLineNumber()
getPublicId()
getSystemId()

Location.CLASS_COMMENT (New)

public interface Location

Provides information on the location of an event. All the information provided by a Location is optional. For example an application may only report line numbers.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

Location.getCharacterOffset() (New)

getCharacterOffset

int getCharacterOffset()
Return the byte or character offset into the input source this location is pointing to. If the input source is a file or a byte stream then this is the byte offset into that stream, but if the input source is a character media then the offset is the character offset. Returns -1 if there is no offset available.

Returns:
the current offset

Location.getColumnNumber() (New)

getColumnNumber

int getColumnNumber()
Return the column number where the current event ends, returns -1 if none is available.

Returns:
the current column number

Location.getLineNumber() (New)

getLineNumber

int getLineNumber()
Return the line number where the current event ends, returns -1 if none is available.

Returns:
the current line number

Location.getPublicId() (New)

getPublicId

java.lang.String getPublicId()
Returns the public ID of the XML

Returns:
the public ID, or null if not available

Location.getSystemId() (New)

getSystemId

java.lang.String getSystemId()
Returns the system ID of the XML

Returns:
the system ID, or null if not available

javax.xml.stream.StreamFilter (New) (1 method)

CLASS_COMMENT
accept(javax.xml.stream.XMLStreamReader)

StreamFilter.CLASS_COMMENT (New)

public interface StreamFilter

This interface declares a simple filter interface that one can create to filter XMLStreamReaders

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

StreamFilter.accept(javax.xml.stream.XMLStreamReader) (New)

accept

boolean accept(XMLStreamReader reader)
Tests whether the current state is part of this stream. This method will return true if this filter accepts this event and false otherwise. The method should not change the state of the reader when accepting a state.

Parameters:
reader - the event to test
Returns:
true if this filter accepts this event, false otherwise

javax.xml.stream.XMLEventFactory (New) (29 methods)

CLASS_COMMENT
XMLEventFactory()
createAttribute(java.lang.String, java.lang.String)
createAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
createAttribute(javax.xml.namespace.QName, java.lang.String)
createCData(java.lang.String)
createCharacters(java.lang.String)
createComment(java.lang.String)
createDTD(java.lang.String)
createEndDocument()
createEndElement(java.lang.String, java.lang.String, java.lang.String)
createEndElement(java.lang.String, java.lang.String, java.lang.String, java.util.Iterator)
createEndElement(javax.xml.namespace.QName, java.util.Iterator)
createEntityReference(java.lang.String, javax.xml.stream.events.EntityDeclaration)
createIgnorableSpace(java.lang.String)
createNamespace(java.lang.String)
createNamespace(java.lang.String, java.lang.String)
createProcessingInstruction(java.lang.String, java.lang.String)
createSpace(java.lang.String)
createStartDocument()
createStartDocument(java.lang.String)
createStartDocument(java.lang.String, java.lang.String)
createStartDocument(java.lang.String, java.lang.String, boolean)
createStartElement(java.lang.String, java.lang.String, java.lang.String)
createStartElement(java.lang.String, java.lang.String, java.lang.String, java.util.Iterator, java.util.Iterator)
createStartElement(java.lang.String, java.lang.String, java.lang.String, java.util.Iterator, java.util.Iterator, javax.xml.namespace.NamespaceContext)
createStartElement(javax.xml.namespace.QName, java.util.Iterator, java.util.Iterator)
newInstance()
newInstance(java.lang.String, java.lang.ClassLoader)
setLocation(javax.xml.stream.Location)

XMLEventFactory.CLASS_COMMENT (New)

public abstract class XMLEventFactory
extends java.lang.Object

This interface defines a utility class for creating instances of XMLEvents

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
StartElement, EndElement, ProcessingInstruction, Comment, Characters, StartDocument, EndDocument, DTD

XMLEventFactory.XMLEventFactory() (New)

XMLEventFactory

protected XMLEventFactory()

XMLEventFactory.createAttribute(java.lang.String, java.lang.String) (New)

createAttribute

public abstract Attribute createAttribute(java.lang.String localName,
                                          java.lang.String value)
Create a new Attribute

Parameters:
localName - the local name of the XML name of the attribute, localName cannot be null
value - the attribute value to set, may not be null
Returns:
the Attribute with specified values

XMLEventFactory.createAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String) (New)

createAttribute

public abstract Attribute createAttribute(java.lang.String prefix,
                                          java.lang.String namespaceURI,
                                          java.lang.String localName,
                                          java.lang.String value)
Create a new Attribute

Parameters:
prefix - the prefix of this attribute, may not be null
namespaceURI - the attribute value is set to this value, may not be null
localName - the local name of the XML name of the attribute, localName cannot be null
value - the attribute value to set, may not be null
Returns:
the Attribute with specified values

XMLEventFactory.createAttribute(javax.xml.namespace.QName, java.lang.String) (New)

createAttribute

public abstract Attribute createAttribute(QName name,
                                          java.lang.String value)
Create a new Attribute

Parameters:
name - the qualified name of the attribute, may not be null
value - the attribute value to set, may not be null
Returns:
the Attribute with specified values

XMLEventFactory.createCData(java.lang.String) (New)

createCData

public abstract Characters createCData(java.lang.String content)
Create a Characters event with the CData flag set to true

Parameters:
content - the string to create
Returns:
a Characters event

XMLEventFactory.createCharacters(java.lang.String) (New)

createCharacters

public abstract Characters createCharacters(java.lang.String content)
Create a Characters event, this method does not check if the content is all whitespace. To create a space event use #createSpace(String)

Parameters:
content - the string to create
Returns:
a Characters event

XMLEventFactory.createComment(java.lang.String) (New)

createComment

public abstract Comment createComment(java.lang.String text)
Create a comment

Parameters:
text - The text of the comment a Comment event

XMLEventFactory.createDTD(java.lang.String) (New)

createDTD

public abstract DTD createDTD(java.lang.String dtd)
Create a document type definition event This string contains the entire document type declaration that matches the doctypedecl in the XML 1.0 specification

Parameters:
dtd - the text of the document type definition
Returns:
a DTD event

XMLEventFactory.createEndDocument() (New)

createEndDocument

public abstract EndDocument createEndDocument()
Creates a new instance of an EndDocument event

Returns:
an EndDocument event

XMLEventFactory.createEndElement(java.lang.String, java.lang.String, java.lang.String) (New)

createEndElement

public abstract EndElement createEndElement(java.lang.String prefix,
                                            java.lang.String namespaceUri,
                                            java.lang.String localName)
Create a new EndElement

Parameters:
namespaceUri - the uri of the QName of the new StartElement
localName - the local name of the QName of the new StartElement
prefix - the prefix of the QName of the new StartElement
Returns:
an instance of the requested EndElement

XMLEventFactory.createEndElement(java.lang.String, java.lang.String, java.lang.String, java.util.Iterator) (New)

createEndElement

public abstract EndElement createEndElement(java.lang.String prefix,
                                            java.lang.String namespaceUri,
                                            java.lang.String localName,
                                            java.util.Iterator namespaces)
Create a new EndElement

Parameters:
namespaceUri - the uri of the QName of the new StartElement
localName - the local name of the QName of the new StartElement
prefix - the prefix of the QName of the new StartElement
namespaces - an unordered set of objects that implement Namespace that have gone out of scope, may be null
Returns:
an instance of the requested EndElement

XMLEventFactory.createEndElement(javax.xml.namespace.QName, java.util.Iterator) (New)

createEndElement

public abstract EndElement createEndElement(QName name,
                                            java.util.Iterator namespaces)
Create a new EndElement

Parameters:
name - the qualified name of the EndElement
namespaces - an optional unordered set of objects that implement Namespace that have gone out of scope, may be null
Returns:
an instance of the requested EndElement

XMLEventFactory.createEntityReference(java.lang.String, javax.xml.stream.events.EntityDeclaration) (New)

createEntityReference

public abstract EntityReference createEntityReference(java.lang.String name,
                                                      EntityDeclaration declaration)
Creates a new instance of a EntityReference event

Parameters:
name - The name of the reference
declaration - the declaration for the event
Returns:
an EntityReference event

XMLEventFactory.createIgnorableSpace(java.lang.String) (New)

createIgnorableSpace

public abstract Characters createIgnorableSpace(java.lang.String content)
Create an ignorable space

Parameters:
content - the space to create
Returns:
a Characters event

XMLEventFactory.createNamespace(java.lang.String) (New)

createNamespace

public abstract Namespace createNamespace(java.lang.String namespaceURI)
Create a new default Namespace

Parameters:
namespaceURI - the default namespace uri
Returns:
the Namespace with the specified value

XMLEventFactory.createNamespace(java.lang.String, java.lang.String) (New)

createNamespace

public abstract Namespace createNamespace(java.lang.String prefix,
                                          java.lang.String namespaceUri)
Create a new Namespace

Parameters:
prefix - the prefix of this namespace, may not be null
namespaceUri - the attribute value is set to this value, may not be null
Returns:
the Namespace with the specified values

XMLEventFactory.createProcessingInstruction(java.lang.String, java.lang.String) (New)

createProcessingInstruction

public abstract ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                  java.lang.String data)
Create a processing instruction

Parameters:
target - The target of the processing instruction
data - The text of the processing instruction
Returns:
a ProcessingInstruction event

XMLEventFactory.createSpace(java.lang.String) (New)

createSpace

public abstract Characters createSpace(java.lang.String content)
Create a Characters event with the isSpace flag set to true

Parameters:
content - the content of the space to create
Returns:
a Characters event

XMLEventFactory.createStartDocument() (New)

createStartDocument

public abstract StartDocument createStartDocument()
Creates a new instance of a StartDocument event

Returns:
a StartDocument event

XMLEventFactory.createStartDocument(java.lang.String) (New)

createStartDocument

public abstract StartDocument createStartDocument(java.lang.String encoding)
Creates a new instance of a StartDocument event

Parameters:
encoding - the encoding style
Returns:
a StartDocument event

XMLEventFactory.createStartDocument(java.lang.String, java.lang.String) (New)

createStartDocument

public abstract StartDocument createStartDocument(java.lang.String encoding,
                                                  java.lang.String version)
Creates a new instance of a StartDocument event

Parameters:
encoding - the encoding style
version - the XML version
Returns:
a StartDocument event

XMLEventFactory.createStartDocument(java.lang.String, java.lang.String, boolean) (New)

createStartDocument

public abstract StartDocument createStartDocument(java.lang.String encoding,
                                                  java.lang.String version,
                                                  boolean standalone)
Creates a new instance of a StartDocument event

Parameters:
encoding - the encoding style
version - the XML version
standalone - the status of standalone may be set to "true" or "false"
Returns:
a StartDocument event

XMLEventFactory.createStartElement(java.lang.String, java.lang.String, java.lang.String) (New)

createStartElement

public abstract StartElement createStartElement(java.lang.String prefix,
                                                java.lang.String namespaceUri,
                                                java.lang.String localName)
Create a new StartElement. This defaults the NamespaceContext to an empty NamespaceContext. Querying this event for its namespaces or attributes will result in an empty iterator being returned.

Parameters:
namespaceUri - the uri of the QName of the new StartElement
localName - the local name of the QName of the new StartElement
prefix - the prefix of the QName of the new StartElement
Returns:
an instance of the requested StartElement

XMLEventFactory.createStartElement(java.lang.String, java.lang.String, java.lang.String, java.util.Iterator, java.util.Iterator) (New)

createStartElement

public abstract StartElement createStartElement(java.lang.String prefix,
                                                java.lang.String namespaceUri,
                                                java.lang.String localName,
                                                java.util.Iterator attributes,
                                                java.util.Iterator namespaces)
Create a new StartElement. Namespaces can be added to this StartElement by passing in an Iterator that walks over a set of Namespace interfaces. Attributes can be added to this StartElement by passing an iterator that walks over a set of Attribute interfaces.

Parameters:
namespaceUri - the uri of the QName of the new StartElement
localName - the local name of the QName of the new StartElement
prefix - the prefix of the QName of the new StartElement
attributes - an unordered set of objects that implement Attribute to add to the new StartElement
namespaces - an unordered set of objects that implement Namespace to add to the new StartElement
Returns:
an instance of the requested StartElement

XMLEventFactory.createStartElement(java.lang.String, java.lang.String, java.lang.String, java.util.Iterator, java.util.Iterator, javax.xml.namespace.NamespaceContext) (New)

createStartElement

public abstract StartElement createStartElement(java.lang.String prefix,
                                                java.lang.String namespaceUri,
                                                java.lang.String localName,
                                                java.util.Iterator attributes,
                                                java.util.Iterator namespaces,
                                                NamespaceContext context)
Create a new StartElement. Namespaces can be added to this StartElement by passing in an Iterator that walks over a set of Namespace interfaces. Attributes can be added to this StartElement by passing an iterator that walks over a set of Attribute interfaces.

Parameters:
namespaceUri - the uri of the QName of the new StartElement
localName - the local name of the QName of the new StartElement
prefix - the prefix of the QName of the new StartElement
attributes - an unordered set of objects that implement Attribute to add to the new StartElement, may be null
namespaces - an unordered set of objects that implement Namespace to add to the new StartElement, may be null
context - the namespace context of this element
Returns:
an instance of the requested StartElement

XMLEventFactory.createStartElement(javax.xml.namespace.QName, java.util.Iterator, java.util.Iterator) (New)

createStartElement

public abstract StartElement createStartElement(QName name,
                                                java.util.Iterator attributes,
                                                java.util.Iterator namespaces)
Create a new StartElement. Namespaces can be added to this StartElement by passing in an Iterator that walks over a set of Namespace interfaces. Attributes can be added to this StartElement by passing an iterator that walks over a set of Attribute interfaces.

Parameters:
name - the qualified name of the attribute, may not be null
attributes - an optional unordered set of objects that implement Attribute to add to the new StartElement, may be null
namespaces - an optional unordered set of objects that implement Namespace to add to the new StartElement, may be null
Returns:
an instance of the requested StartElement

XMLEventFactory.newInstance() (New)

newInstance

public static XMLEventFactory newInstance()
                                   throws FactoryConfigurationError
Create a new instance of the factory

Throws:
FactoryConfigurationError - if an instance of this factory cannot be loaded

XMLEventFactory.newInstance(java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static XMLEventFactory newInstance(java.lang.String factoryId,
                                          java.lang.ClassLoader classLoader)
                                   throws FactoryConfigurationError
Create a new instance of the factory

Parameters:
factoryId - Name of the factory to find, same as a property name
classLoader - classLoader to use
Returns:
the factory implementation
Throws:
FactoryConfigurationError - if an instance of this factory cannot be loaded

XMLEventFactory.setLocation(javax.xml.stream.Location) (New)

setLocation

public abstract void setLocation(Location location)
This method allows setting of the Location on each event that is created by this factory. The values are copied by value into the events created by this factory. To reset the location information set the location to null.

Parameters:
location - the location to set on each event created

javax.xml.stream.XMLEventReader (New) (7 methods)

CLASS_COMMENT
close()
getElementText()
getProperty(java.lang.String)
hasNext()
nextEvent()
nextTag()
peek()

XMLEventReader.CLASS_COMMENT (New)

public interface XMLEventReader
extends java.util.Iterator

This is the top level interface for parsing XML Events. It provides the ability to peek at the next event and returns configuration information through the property interface.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLInputFactory, XMLEventWriter

XMLEventReader.close() (New)

close

void close()
           throws XMLStreamException
Frees any resources associated with this Reader. This method does not close the underlying input source.

Throws:
XMLStreamException - if there are errors freeing associated resources

XMLEventReader.getElementText() (New)

getElementText

java.lang.String getElementText()
                                throws XMLStreamException
Reads the content of a text-only element. Precondition: the current event is START_ELEMENT. Postcondition: The current event is the corresponding END_ELEMENT.

Throws:
XMLStreamException - if the current event is not a START_ELEMENT or if a non text element is encountered

XMLEventReader.getProperty(java.lang.String) (New)

getProperty

java.lang.Object getProperty(java.lang.String name)
                             throws java.lang.IllegalArgumentException
Get the value of a feature/property from the underlying implementation

Parameters:
name - The name of the property
Returns:
The value of the property
Throws:
java.lang.IllegalArgumentException - if the property is not supported

XMLEventReader.hasNext() (New)

hasNext

boolean hasNext()
Check if there are more events. Returns true if there are more events and false otherwise.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the event reader has more events, false otherwise

XMLEventReader.nextEvent() (New)

nextEvent

XMLEvent nextEvent()
                   throws XMLStreamException
Get the next XMLEvent

Throws:
XMLStreamException - if there is an error with the underlying XML.
NoSuchElementException - iteration has no more elements.
See Also:
XMLEvent

XMLEventReader.nextTag() (New)

nextTag

XMLEvent nextTag()
                 throws XMLStreamException
Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached. If anything other than space characters are encountered, an exception is thrown. This method should be used when processing element-only content because the parser is not able to recognize ignorable whitespace if the DTD is missing or not interpreted.

Throws:
XMLStreamException - if anything other than space characters are encountered

XMLEventReader.peek() (New)

peek

XMLEvent peek()
              throws XMLStreamException
Check the next XMLEvent without reading it from the stream. Returns null if the stream is at EOF or has no more XMLEvents. A call to peek() will be equal to the next return of next().

Throws:
XMLStreamException
See Also:
XMLEvent

javax.xml.stream.XMLEventWriter (New) (9 methods)

CLASS_COMMENT
add(javax.xml.stream.XMLEventReader)
add(javax.xml.stream.events.XMLEvent)
close()
flush()
getNamespaceContext()
getPrefix(java.lang.String)
setDefaultNamespace(java.lang.String)
setNamespaceContext(javax.xml.namespace.NamespaceContext)
setPrefix(java.lang.String, java.lang.String)

XMLEventWriter.CLASS_COMMENT (New)

public interface XMLEventWriter
extends XMLEventConsumer

This is the top level interface for writing XML documents. Instances of this interface are not required to validate the form of the XML.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLEventReader, XMLEvent, Characters, ProcessingInstruction, StartElement, EndElement

XMLEventWriter.add(javax.xml.stream.XMLEventReader) (New)

add

void add(XMLEventReader reader)
         throws XMLStreamException
Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.

Parameters:
reader - the event stream to add to the output
Throws:
XMLStreamException

XMLEventWriter.add(javax.xml.stream.events.XMLEvent) (New)

add

void add(XMLEvent event)
         throws XMLStreamException
Add an event to the output stream Adding a START_ELEMENT will open a new namespace scope that will be closed when the corresponding END_ELEMENT is written.
Required and optional fields for events added to the writer
Event Type Required Fields Optional Fields Required Behavior
START_ELEMENT QName name namespaces , attributes A START_ELEMENT will be written by writing the name, namespaces, and attributes of the event in XML 1.0 valid syntax for START_ELEMENTs. The name is written by looking up the prefix for the namespace uri. The writer can be configured to respect prefixes of QNames. If the writer is respecting prefixes it must use the prefix set on the QName. The default behavior is to lookup the value for the prefix on the EventWriter's internal namespace context. Each attribute (if any) is written using the behavior specified in the attribute section of this table. Each namespace (if any) is written using the behavior specified in the namespace section of this table.
END_ELEMENT Qname name None A well formed END_ELEMENT tag is written. The name is written by looking up the prefix for the namespace uri. The writer can be configured to respect prefixes of QNames. If the writer is respecting prefixes it must use the prefix set on the QName. The default behavior is to lookup the value for the prefix on the EventWriter's internal namespace context. If the END_ELEMENT name does not match the START_ELEMENT name an XMLStreamException is thrown.
ATTRIBUTE QName name , String value QName type An attribute is written using the same algorithm to find the lexical form as used in START_ELEMENT. The default is to use double quotes to wrap attribute values and to escape any double quotes found in the value. The type value is ignored.
NAMESPACE String prefix, String namespaceURI, boolean isDefaultNamespaceDeclaration None A namespace declaration is written. If the namespace is a default namespace declaration (isDefault is true) then xmlns="$namespaceURI" is written and the prefix is optional. If isDefault is false, the prefix must be declared and the writer must prepend xmlns to the prefix and write out a standard prefix declaration.
PROCESSING_INSTRUCTION None String target, String data The data does not need to be present and may be null. Target is required and many not be null. The writer will write data section directly after the target, enclosed in appropriate XML 1.0 syntax
COMMENT None String comment If the comment is present (not null) it is written, otherwise an an empty comment is written
START_DOCUMENT None String encoding , boolean standalone, String version A START_DOCUMENT event is not required to be written to the stream. If present the attributes are written inside the appropriate XML declaration syntax
END_DOCUMENT None None Nothing is written to the output
DTD String DocumentTypeDefinition None The DocumentTypeDefinition is written to the output

Specified by:
add in interface XMLEventConsumer
Parameters:
event - the event to be added
Throws:
XMLStreamException

XMLEventWriter.close() (New)

close

void close()
           throws XMLStreamException
Frees any resources associated with this stream

Throws:
XMLStreamException

XMLEventWriter.flush() (New)

flush

void flush()
           throws XMLStreamException
Writes any cached events to the underlying output mechanism

Throws:
XMLStreamException

XMLEventWriter.getNamespaceContext() (New)

getNamespaceContext

NamespaceContext getNamespaceContext()
Returns the current namespace context.

Returns:
the current namespace context

XMLEventWriter.getPrefix(java.lang.String) (New)

getPrefix

java.lang.String getPrefix(java.lang.String uri)
                           throws XMLStreamException
Gets the prefix the uri is bound to

Parameters:
uri - the uri to look up
Throws:
XMLStreamException

XMLEventWriter.setDefaultNamespace(java.lang.String) (New)

setDefaultNamespace

void setDefaultNamespace(java.lang.String uri)
                         throws XMLStreamException
Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.

Parameters:
uri - the uri to bind to the default namespace
Throws:
XMLStreamException

XMLEventWriter.setNamespaceContext(javax.xml.namespace.NamespaceContext) (New)

setNamespaceContext

void setNamespaceContext(NamespaceContext context)
                         throws XMLStreamException
Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces.

Parameters:
context - the namespace context to use for this writer
Throws:
XMLStreamException

XMLEventWriter.setPrefix(java.lang.String, java.lang.String) (New)

setPrefix

void setPrefix(java.lang.String prefix,
               java.lang.String uri)
               throws XMLStreamException
Sets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.

Parameters:
prefix - the prefix to bind to the uri
uri - the uri to bind to the prefix
Throws:
XMLStreamException

javax.xml.stream.XMLInputFactory (New) (27 methods) (9 fields)

CLASS_COMMENT
XMLInputFactory()
ALLOCATOR
IS_COALESCING
IS_NAMESPACE_AWARE
IS_REPLACING_ENTITY_REFERENCES
IS_SUPPORTING_EXTERNAL_ENTITIES
IS_VALIDATING
REPORTER
RESOLVER
SUPPORT_DTD
createFilteredReader(javax.xml.stream.XMLEventReader, javax.xml.stream.EventFilter)
createFilteredReader(javax.xml.stream.XMLStreamReader, javax.xml.stream.StreamFilter)
createXMLEventReader(java.io.InputStream)
createXMLEventReader(java.io.InputStream, java.lang.String)
createXMLEventReader(java.io.Reader)
createXMLEventReader(java.lang.String, java.io.InputStream)
createXMLEventReader(java.lang.String, java.io.Reader)
createXMLEventReader(javax.xml.stream.XMLStreamReader)
createXMLEventReader(javax.xml.transform.Source)
createXMLStreamReader(java.io.InputStream)
createXMLStreamReader(java.io.InputStream, java.lang.String)
createXMLStreamReader(java.io.Reader)
createXMLStreamReader(java.lang.String, java.io.InputStream)
createXMLStreamReader(java.lang.String, java.io.Reader)
createXMLStreamReader(javax.xml.transform.Source)
getEventAllocator()
getProperty(java.lang.String)
getXMLReporter()
getXMLResolver()
isPropertySupported(java.lang.String)
newInstance()
newInstance(java.lang.String, java.lang.ClassLoader)
setEventAllocator(javax.xml.stream.util.XMLEventAllocator)
setProperty(java.lang.String, java.lang.Object)
setXMLReporter(javax.xml.stream.XMLReporter)
setXMLResolver(javax.xml.stream.XMLResolver)

XMLInputFactory.CLASS_COMMENT (New)

public abstract class XMLInputFactory
extends java.lang.Object

Defines an abstract implementation of a factory for getting streams. The following table defines the standard properties of this specification. Each property varies in the level of support required by each implementation. The level of support required is described in the 'Required' column.

Configuration parameters
Property Name Behavior Return type Default Value Required
javax.xml.stream.isValidatingTurns on/off implementation specific DTD validationBooleanFalseNo
javax.xml.stream.isNamespaceAwareTurns on/off namespace processing for XML 1.0 supportBooleanTrueTrue (required) / False (optional)
javax.xml.stream.isCoalescingRequires the processor to coalesce adjacent character dataBooleanFalseYes
javax.xml.stream.isReplacingEntityReferencesreplace internal entity references with their replacement text and report them as charactersBooleanTrueYes
javax.xml.stream.isSupportingExternalEntitiesResolve external parsed entitiesBooleanUnspecifiedYes
javax.xml.stream.supportDTDUse this property to request processors that do not support DTDsBooleanTrueYes
javax.xml.stream.reportersets/gets the impl of the XMLReporter javax.xml.stream.XMLReporterNullYes
javax.xml.stream.resolversets/gets the impl of the XMLResolver interfacejavax.xml.stream.XMLResolverNullYes
javax.xml.stream.allocatorsets/gets the impl of the XMLEventAllocator interfacejavax.xml.stream.util.XMLEventAllocatorNullYes

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLOutputFactory, XMLEventReader, XMLStreamReader, EventFilter, XMLReporter, XMLResolver, XMLEventAllocator

XMLInputFactory.XMLInputFactory() (New)

XMLInputFactory

protected XMLInputFactory()

XMLInputFactory.ALLOCATOR (New)

ALLOCATOR

public static final java.lang.String ALLOCATOR
The property used to set/get the implementation of the allocator

See Also:
Constant Field Values

XMLInputFactory.IS_COALESCING (New)

IS_COALESCING

public static final java.lang.String IS_COALESCING
The property that requires the parser to coalesce adjacent character data sections

See Also:
Constant Field Values

XMLInputFactory.IS_NAMESPACE_AWARE (New)

IS_NAMESPACE_AWARE

public static final java.lang.String IS_NAMESPACE_AWARE
The property used to turn on/off namespace support, this is to support XML 1.0 documents, only the true setting must be supported

See Also:
Constant Field Values

XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES (New)

IS_REPLACING_ENTITY_REFERENCES

public static final java.lang.String IS_REPLACING_ENTITY_REFERENCES
Requires the parser to replace internal entity references with their replacement text and report them as characters

See Also:
Constant Field Values

XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES (New)

IS_SUPPORTING_EXTERNAL_ENTITIES

public static final java.lang.String IS_SUPPORTING_EXTERNAL_ENTITIES
The property that requires the parser to resolve external parsed entities

See Also:
Constant Field Values

XMLInputFactory.IS_VALIDATING (New)

IS_VALIDATING

public static final java.lang.String IS_VALIDATING
The property used to turn on/off implementation specific validation

See Also:
Constant Field Values

XMLInputFactory.REPORTER (New)

REPORTER

public static final java.lang.String REPORTER
The property used to set/get the implementation of the XMLReporter interface

See Also:
Constant Field Values

XMLInputFactory.RESOLVER (New)

RESOLVER

public static final java.lang.String RESOLVER
The property used to set/get the implementation of the XMLResolver

See Also:
Constant Field Values

XMLInputFactory.SUPPORT_DTD (New)

SUPPORT_DTD

public static final java.lang.String SUPPORT_DTD
The property that requires the parser to support DTDs

See Also:
Constant Field Values

XMLInputFactory.createFilteredReader(javax.xml.stream.XMLEventReader, javax.xml.stream.EventFilter) (New)

createFilteredReader

public abstract XMLEventReader createFilteredReader(XMLEventReader reader,
                                                    EventFilter filter)
                                             throws XMLStreamException
Create a filtered event reader that wraps the filter around the event reader

Parameters:
reader - the event reader to wrap
filter - the filter to apply to the event reader
Throws:
XMLStreamException

XMLInputFactory.createFilteredReader(javax.xml.stream.XMLStreamReader, javax.xml.stream.StreamFilter) (New)

createFilteredReader

public abstract XMLStreamReader createFilteredReader(XMLStreamReader reader,
                                                     StreamFilter filter)
                                              throws XMLStreamException
Create a filtered reader that wraps the filter around the reader

Parameters:
reader - the reader to filter
filter - the filter to apply to the reader
Throws:
XMLStreamException

XMLInputFactory.createXMLEventReader(java.io.InputStream) (New)

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream)
                                             throws XMLStreamException
Create a new XMLEventReader from a java.io.InputStream

Parameters:
stream - the InputStream to read from
Throws:
XMLStreamException

XMLInputFactory.createXMLEventReader(java.io.InputStream, java.lang.String) (New)

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream,
                                                    java.lang.String encoding)
                                             throws XMLStreamException
Create a new XMLEventReader from a java.io.InputStream

Parameters:
stream - the InputStream to read from
encoding - the character encoding of the stream
Throws:
XMLStreamException

XMLInputFactory.createXMLEventReader(java.io.Reader) (New)

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.io.Reader reader)
                                             throws XMLStreamException
Create a new XMLEventReader from a reader

Parameters:
reader - the XML data to read from
Throws:
XMLStreamException

XMLInputFactory.createXMLEventReader(java.lang.String, java.io.InputStream) (New)

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.lang.String systemId,
                                                    java.io.InputStream stream)
                                             throws XMLStreamException
Create a new XMLEventReader from a java.io.InputStream

Parameters:
systemId - the system ID of the stream
stream - the InputStream to read from
Throws:
XMLStreamException

XMLInputFactory.createXMLEventReader(java.lang.String, java.io.Reader) (New)

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(java.lang.String systemId,
                                                    java.io.Reader reader)
                                             throws XMLStreamException
Create a new XMLEventReader from a reader

Parameters:
systemId - the system ID of the input
reader - the XML data to read from
Throws:
XMLStreamException

XMLInputFactory.createXMLEventReader(javax.xml.stream.XMLStreamReader) (New)

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(XMLStreamReader reader)
                                             throws XMLStreamException
Create a new XMLEventReader from an XMLStreamReader. After being used to construct the XMLEventReader instance returned from this method the XMLStreamReader must not be used.

Parameters:
reader - the XMLStreamReader to read from (may not be modified)
Returns:
a new XMLEventReader
Throws:
XMLStreamException

XMLInputFactory.createXMLEventReader(javax.xml.transform.Source) (New)

createXMLEventReader

public abstract XMLEventReader createXMLEventReader(Source source)
                                             throws XMLStreamException
Create a new XMLEventReader from a JAXP source. Support of this method is optional.

Parameters:
source - the source to read from
Throws:
java.lang.UnsupportedOperationException - if this method is not supported by this XMLInputFactory
XMLStreamException

XMLInputFactory.createXMLStreamReader(java.io.InputStream) (New)

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream)
                                               throws XMLStreamException
Create a new XMLStreamReader from a java.io.InputStream

Parameters:
stream - the InputStream to read from
Throws:
XMLStreamException

XMLInputFactory.createXMLStreamReader(java.io.InputStream, java.lang.String) (New)

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream,
                                                      java.lang.String encoding)
                                               throws XMLStreamException
Create a new XMLStreamReader from a java.io.InputStream

Parameters:
stream - the InputStream to read from
encoding - the character encoding of the stream
Throws:
XMLStreamException

XMLInputFactory.createXMLStreamReader(java.io.Reader) (New)

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.io.Reader reader)
                                               throws XMLStreamException
Create a new XMLStreamReader from a reader

Parameters:
reader - the XML data to read from
Throws:
XMLStreamException

XMLInputFactory.createXMLStreamReader(java.lang.String, java.io.InputStream) (New)

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.lang.String systemId,
                                                      java.io.InputStream stream)
                                               throws XMLStreamException
Create a new XMLStreamReader from a java.io.InputStream

Parameters:
systemId - the system ID of the stream
stream - the InputStream to read from
Throws:
XMLStreamException

XMLInputFactory.createXMLStreamReader(java.lang.String, java.io.Reader) (New)

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(java.lang.String systemId,
                                                      java.io.Reader reader)
                                               throws XMLStreamException
Create a new XMLStreamReader from a java.io.InputStream

Parameters:
systemId - the system ID of the stream
reader - the InputStream to read from
Throws:
XMLStreamException

XMLInputFactory.createXMLStreamReader(javax.xml.transform.Source) (New)

createXMLStreamReader

public abstract XMLStreamReader createXMLStreamReader(Source source)
                                               throws XMLStreamException
Create a new XMLStreamReader from a JAXP source. This method is optional.

Parameters:
source - the source to read from
Throws:
java.lang.UnsupportedOperationException - if this method is not supported by this XMLInputFactory
XMLStreamException

XMLInputFactory.getEventAllocator() (New)

getEventAllocator

public abstract XMLEventAllocator getEventAllocator()
Gets the allocator used by streams created with this factory

XMLInputFactory.getProperty(java.lang.String) (New)

getProperty

public abstract java.lang.Object getProperty(java.lang.String name)
                                      throws java.lang.IllegalArgumentException
Get the value of a feature/property from the underlying implementation

Parameters:
name - The name of the property (may not be null)
Returns:
The value of the property
Throws:
java.lang.IllegalArgumentException - if the property is not supported

XMLInputFactory.getXMLReporter() (New)

getXMLReporter

public abstract XMLReporter getXMLReporter()
The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.

XMLInputFactory.getXMLResolver() (New)

getXMLResolver

public abstract XMLResolver getXMLResolver()
The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.

XMLInputFactory.isPropertySupported(java.lang.String) (New)

isPropertySupported

public abstract boolean isPropertySupported(java.lang.String name)
Query the set of properties that this factory supports.

Parameters:
name - The name of the property (may not be null)
Returns:
true if the property is supported and false otherwise

XMLInputFactory.newInstance() (New)

newInstance

public static XMLInputFactory newInstance()
                                   throws FactoryConfigurationError
Create a new instance of the factory. This static method creates a new factory instance. This method uses the following ordered lookup procedure to determine the XMLInputFactory implementation class to load: Use the javax.xml.stream.XMLInputFactory system property. Use the properties file "lib/stax.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.stream.XMLInputFactory in jars available to the runtime. Platform default XMLInputFactory instance. Once an application has obtained a reference to a XMLInputFactory it can use the factory to configure and obtain stream instances.

Throws:
FactoryConfigurationError - if an instance of this factory cannot be loaded

XMLInputFactory.newInstance(java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static XMLInputFactory newInstance(java.lang.String factoryId,
                                          java.lang.ClassLoader classLoader)
                                   throws FactoryConfigurationError
Create a new instance of the factory

Parameters:
factoryId - Name of the factory to find, same as a property name
classLoader - classLoader to use
Returns:
the factory implementation
Throws:
FactoryConfigurationError - if an instance of this factory cannot be loaded

XMLInputFactory.setEventAllocator(javax.xml.stream.util.XMLEventAllocator) (New)

setEventAllocator

public abstract void setEventAllocator(XMLEventAllocator allocator)
Set a user defined event allocator for events

Parameters:
allocator - the user defined allocator

XMLInputFactory.setProperty(java.lang.String, java.lang.Object) (New)

setProperty

public abstract void setProperty(java.lang.String name,
                                 java.lang.Object value)
                          throws java.lang.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:
name - The name of the property (may not be null)
value - The value of the property
Throws:
java.lang.IllegalArgumentException - if the property is not supported

XMLInputFactory.setXMLReporter(javax.xml.stream.XMLReporter) (New)

setXMLReporter

public abstract void setXMLReporter(XMLReporter reporter)
The reporter that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.

Parameters:
reporter - the resolver to use to report non fatal errors

XMLInputFactory.setXMLResolver(javax.xml.stream.XMLResolver) (New)

setXMLResolver

public abstract void setXMLResolver(XMLResolver resolver)
The resolver that will be set on any XMLStreamReader or XMLEventReader created by this factory instance.

Parameters:
resolver - the resolver to use to resolve references

javax.xml.stream.XMLOutputFactory (New) (14 methods) (1 field)

CLASS_COMMENT
XMLOutputFactory()
IS_REPAIRING_NAMESPACES
createXMLEventWriter(java.io.OutputStream)
createXMLEventWriter(java.io.OutputStream, java.lang.String)
createXMLEventWriter(java.io.Writer)
createXMLEventWriter(javax.xml.transform.Result)
createXMLStreamWriter(java.io.OutputStream)
createXMLStreamWriter(java.io.OutputStream, java.lang.String)
createXMLStreamWriter(java.io.Writer)
createXMLStreamWriter(javax.xml.transform.Result)
getProperty(java.lang.String)
isPropertySupported(java.lang.String)
newInstance()
newInstance(java.lang.String, java.lang.ClassLoader)
setProperty(java.lang.String, java.lang.Object)

XMLOutputFactory.CLASS_COMMENT (New)

public abstract class XMLOutputFactory
extends java.lang.Object

Defines an abstract implementation of a factory for getting XMLEventWriters and XMLStreamWriters. The following table defines the standard properties of this specification. Each property varies in the level of support required by each implementation. The level of support required is described in the 'Required' column.

Configuration parameters
Property Name Behavior Return type Default Value Required
javax.xml.stream.isRepairingNamespacesdefaults prefixes on the output sideBooleanFalseYes

The following paragraphs describe the namespace and prefix repair algorithm:

The property can be set with the following code line: setProperty("javax.xml.stream.isRepairingNamespaces",new Boolean(true|false));

This property specifies that the writer default namespace prefix declarations. The default value is false.

If a writer isRepairingNamespaces it will create a namespace declaration on the current StartElement for any attribute that does not currently have a namespace declaration in scope. If the StartElement has a uri but no prefix specified a prefix will be assigned, if the prefix has not been declared in a parent of the current StartElement it will be declared on the current StartElement. If the defaultNamespace is bound and in scope and the default namespace matches the URI of the attribute or StartElement QName no prefix will be assigned.

If an element or attribute name has a prefix, but is not bound to any namespace URI, then the prefix will be removed during serialization.

If element and/or attribute names in the same start or empty-element tag are bound to different namespace URIs and are using the same prefix then the element or the first occurring attribute retains the original prefix and the following attributes have their prefixes replaced with a new prefix that is bound to the namespace URIs of those attributes.

If an element or attribute name uses a prefix that is bound to a different URI than that inherited from the namespace context of the parent of that element and there is no namespace declaration in the context of the current element then such a namespace declaration is added.

If an element or attribute name is bound to a prefix and there is a namespace declaration that binds that prefix to a different URI then that namespace declaration is either removed if the correct mapping is inherited from the parent context of that element, or changed to the namespace URI of the element or attribute using that prefix.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLInputFactory, XMLEventWriter, XMLStreamWriter

XMLOutputFactory.XMLOutputFactory() (New)

XMLOutputFactory

protected XMLOutputFactory()

XMLOutputFactory.IS_REPAIRING_NAMESPACES (New)

IS_REPAIRING_NAMESPACES

public static final java.lang.String IS_REPAIRING_NAMESPACES
Property used to set prefix defaulting on the output side

See Also:
Constant Field Values

XMLOutputFactory.createXMLEventWriter(java.io.OutputStream) (New)

createXMLEventWriter

public abstract XMLEventWriter createXMLEventWriter(java.io.OutputStream stream)
                                             throws XMLStreamException
Create a new XMLEventWriter that writes to a stream

Parameters:
stream - the stream to write to
Throws:
XMLStreamException

XMLOutputFactory.createXMLEventWriter(java.io.OutputStream, java.lang.String) (New)

createXMLEventWriter

public abstract XMLEventWriter createXMLEventWriter(java.io.OutputStream stream,
                                                    java.lang.String encoding)
                                             throws XMLStreamException
Create a new XMLEventWriter that writes to a stream

Parameters:
stream - the stream to write to
encoding - the encoding to use
Throws:
XMLStreamException

XMLOutputFactory.createXMLEventWriter(java.io.Writer) (New)

createXMLEventWriter

public abstract XMLEventWriter createXMLEventWriter(java.io.Writer stream)
                                             throws XMLStreamException
Create a new XMLEventWriter that writes to a writer

Parameters:
stream - the stream to write to
Throws:
XMLStreamException

XMLOutputFactory.createXMLEventWriter(javax.xml.transform.Result) (New)

createXMLEventWriter

public abstract XMLEventWriter createXMLEventWriter(Result result)
                                             throws XMLStreamException
Create a new XMLEventWriter that writes to a JAXP result. This method is optional.

Parameters:
result - the result to write to
Throws:
java.lang.UnsupportedOperationException - if this method is not supported by this XMLOutputFactory
XMLStreamException

XMLOutputFactory.createXMLStreamWriter(java.io.OutputStream) (New)

createXMLStreamWriter

public abstract XMLStreamWriter createXMLStreamWriter(java.io.OutputStream stream)
                                               throws XMLStreamException
Create a new XMLStreamWriter that writes to a stream

Parameters:
stream - the stream to write to
Throws:
XMLStreamException

XMLOutputFactory.createXMLStreamWriter(java.io.OutputStream, java.lang.String) (New)

createXMLStreamWriter

public abstract XMLStreamWriter createXMLStreamWriter(java.io.OutputStream stream,
                                                      java.lang.String encoding)
                                               throws XMLStreamException
Create a new XMLStreamWriter that writes to a stream

Parameters:
stream - the stream to write to
encoding - the encoding to use
Throws:
XMLStreamException

XMLOutputFactory.createXMLStreamWriter(java.io.Writer) (New)

createXMLStreamWriter

public abstract XMLStreamWriter createXMLStreamWriter(java.io.Writer stream)
                                               throws XMLStreamException
Create a new XMLStreamWriter that writes to a writer

Parameters:
stream - the writer to write to
Throws:
XMLStreamException

XMLOutputFactory.createXMLStreamWriter(javax.xml.transform.Result) (New)

createXMLStreamWriter

public abstract XMLStreamWriter createXMLStreamWriter(Result result)
                                               throws XMLStreamException
Create a new XMLStreamWriter that writes to a JAXP result. This method is optional.

Parameters:
result - the result to write to
Throws:
java.lang.UnsupportedOperationException - if this method is not supported by this XMLOutputFactory
XMLStreamException

XMLOutputFactory.getProperty(java.lang.String) (New)

getProperty

public abstract java.lang.Object getProperty(java.lang.String name)
                                      throws java.lang.IllegalArgumentException
Get a feature/property on the underlying implementation

Parameters:
name - The name of the property
Returns:
The value of the property
Throws:
java.lang.IllegalArgumentException - if the property is not supported

XMLOutputFactory.isPropertySupported(java.lang.String) (New)

isPropertySupported

public abstract boolean isPropertySupported(java.lang.String name)
Query the set of properties that this factory supports.

Parameters:
name - The name of the property (may not be null)
Returns:
true if the property is supported and false otherwise

XMLOutputFactory.newInstance() (New)

newInstance

public static XMLOutputFactory newInstance()
                                    throws FactoryConfigurationError
Create a new instance of the factory.

Throws:
FactoryConfigurationError - if an instance of this factory cannot be loaded

XMLOutputFactory.newInstance(java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static XMLInputFactory newInstance(java.lang.String factoryId,
                                          java.lang.ClassLoader classLoader)
                                   throws FactoryConfigurationError
Create a new instance of the factory

Parameters:
factoryId - Name of the factory to find, same as a property name
classLoader - classLoader to use
Returns:
the factory implementation
Throws:
FactoryConfigurationError - if an instance of this factory cannot be loaded

XMLOutputFactory.setProperty(java.lang.String, java.lang.Object) (New)

setProperty

public abstract void setProperty(java.lang.String name,
                                 java.lang.Object value)
                          throws java.lang.IllegalArgumentException
Allows the user to set specific features/properties on the underlying implementation.

Parameters:
name - The name of the property
value - The value of the property
Throws:
java.lang.IllegalArgumentException - if the property is not supported

javax.xml.stream.XMLReporter (New) (1 method)

CLASS_COMMENT
report(java.lang.String, java.lang.String, java.lang.Object, javax.xml.stream.Location)

XMLReporter.CLASS_COMMENT (New)

public interface XMLReporter

This interface is used to report non-fatal errors. Only warnings should be echoed through this interface.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

XMLReporter.report(java.lang.String, java.lang.String, java.lang.Object, javax.xml.stream.Location) (New)

report

void report(java.lang.String message,
            java.lang.String errorType,
            java.lang.Object relatedInformation,
            Location location)
            throws XMLStreamException
Report the desired message in an application specific format. Only warnings and non-fatal errors should be reported through this interface. Fatal errors should be thrown as XMLStreamException.

Parameters:
message - the error message
errorType - an implementation defined error type
relatedInformation - information related to the error, if available
location - the location of the error, if available
Throws:
XMLStreamException

javax.xml.stream.XMLResolver (New) (1 method)

CLASS_COMMENT
resolveEntity(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

XMLResolver.CLASS_COMMENT (New)

public interface XMLResolver

This interface is used to resolve resources during an XML parse. If an application wishes to perform custom entity resolution it must register an instance of this interface with the XMLInputFactory using the setXMLResolver method.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

XMLResolver.resolveEntity(java.lang.String, java.lang.String, java.lang.String, java.lang.String) (New)

resolveEntity

java.lang.Object resolveEntity(java.lang.String publicID,
                               java.lang.String systemID,
                               java.lang.String baseURI,
                               java.lang.String namespace)
                               throws XMLStreamException
Retrieves a resource. This resource can be of the following three return types: (1) java.io.InputStream (2) javax.xml.stream.XMLStreamReader (3) java.xml.stream.XMLEventReader. If this method returns null the processor will attempt to resolve the entity using its default mechanism.

Parameters:
publicID - The public identifier of the external entity being referenced, or null if none was supplied.
systemID - The system identifier of the external entity being referenced.
baseURI - Absolute base URI associated with systemId.
namespace - The namespace of the entity to resolve.
Returns:
The resource requested or null.
Throws:
XMLStreamException - if there was a failure attempting to resolve the resource.

javax.xml.stream.XMLStreamConstants (New) (15 fields)

CLASS_COMMENT
ATTRIBUTE
CDATA
CHARACTERS
COMMENT
DTD
END_DOCUMENT
END_ELEMENT
ENTITY_DECLARATION
ENTITY_REFERENCE
NAMESPACE
NOTATION_DECLARATION
PROCESSING_INSTRUCTION
SPACE
START_DOCUMENT
START_ELEMENT

XMLStreamConstants.CLASS_COMMENT (New)

public interface XMLStreamConstants

This interface declares the constants used in this API. Numbers in the range 0 to 256 are reserved for the specification, user defined events must use event codes outside that range.

Since:
6.0

XMLStreamConstants.ATTRIBUTE (New)

ATTRIBUTE

static final int ATTRIBUTE
Indicates an event is an attribute

See Also:
Attribute, Constant Field Values

XMLStreamConstants.CDATA (New)

CDATA

static final int CDATA
Indicates an event is a CDATA section

See Also:
Characters, Constant Field Values

XMLStreamConstants.CHARACTERS (New)

CHARACTERS

static final int CHARACTERS
Indicates an event is characters

See Also:
Characters, Constant Field Values

XMLStreamConstants.COMMENT (New)

COMMENT

static final int COMMENT
Indicates an event is a comment

See Also:
Comment, Constant Field Values

XMLStreamConstants.DTD (New)

DTD

static final int DTD
Indicates an event is a DTD

See Also:
DTD, Constant Field Values

XMLStreamConstants.END_DOCUMENT (New)

END_DOCUMENT

static final int END_DOCUMENT
Indicates an event is an end document

See Also:
EndDocument, Constant Field Values

XMLStreamConstants.END_ELEMENT (New)

END_ELEMENT

static final int END_ELEMENT
Indicates an event is an end element

See Also:
EndElement, Constant Field Values

XMLStreamConstants.ENTITY_DECLARATION (New)

ENTITY_DECLARATION

static final int ENTITY_DECLARATION
Indicates a Entity Declaration

See Also:
NotationDeclaration, Constant Field Values

XMLStreamConstants.ENTITY_REFERENCE (New)

ENTITY_REFERENCE

static final int ENTITY_REFERENCE
Indicates an event is an entity reference

See Also:
EntityReference, Constant Field Values

XMLStreamConstants.NAMESPACE (New)

NAMESPACE

static final int NAMESPACE
Indicates the event is a namespace declaration

See Also:
Namespace, Constant Field Values

XMLStreamConstants.NOTATION_DECLARATION (New)

NOTATION_DECLARATION

static final int NOTATION_DECLARATION
Indicates a Notation

See Also:
NotationDeclaration, Constant Field Values

XMLStreamConstants.PROCESSING_INSTRUCTION (New)

PROCESSING_INSTRUCTION

static final int PROCESSING_INSTRUCTION
Indicates an event is a processing instruction

See Also:
ProcessingInstruction, Constant Field Values

XMLStreamConstants.SPACE (New)

SPACE

static final int SPACE
The characters are white space (see [XML], 2.10 "White Space Handling"). Events are only reported as SPACE if they are ignorable white space. Otherwise they are reported as CHARACTERS.

See Also:
Characters, Constant Field Values

XMLStreamConstants.START_DOCUMENT (New)

START_DOCUMENT

static final int START_DOCUMENT
Indicates an event is a start document

See Also:
StartDocument, Constant Field Values

XMLStreamConstants.START_ELEMENT (New)

START_ELEMENT

static final int START_ELEMENT
Indicates an event is a start element

See Also:
StartElement, Constant Field Values

javax.xml.stream.XMLStreamException (New) (8 methods) (2 fields)

CLASS_COMMENT
XMLStreamException()
XMLStreamException(java.lang.String)
XMLStreamException(java.lang.String, java.lang.Throwable)
XMLStreamException(java.lang.String, javax.xml.stream.Location)
XMLStreamException(java.lang.String, javax.xml.stream.Location, java.lang.Throwable)
XMLStreamException(java.lang.Throwable)
getLocation()
getNestedException()

XMLStreamException.CLASS_COMMENT (New)

public class XMLStreamException
extends java.lang.Exception

The base exception for unexpected processing errors. This Exception class is used to report well-formedness errors as well as unexpected processing conditions.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
Serialized Form

XMLStreamException.XMLStreamException() (New)

XMLStreamException

public XMLStreamException()
Default constructor

XMLStreamException.XMLStreamException(java.lang.String) (New)

XMLStreamException

public XMLStreamException(java.lang.String msg)
Construct an exception with the assocated message.

Parameters:
msg - the message to report

XMLStreamException.XMLStreamException(java.lang.String, java.lang.Throwable) (New)

XMLStreamException

public XMLStreamException(java.lang.String msg,
                          java.lang.Throwable th)
Construct an exception with the assocated message and exception

Parameters:
th - a nested exception
msg - the message to report

XMLStreamException.XMLStreamException(java.lang.String, javax.xml.stream.Location) (New)

XMLStreamException

public XMLStreamException(java.lang.String msg,
                          Location location)
Construct an exception with the assocated message, exception and location.

Parameters:
msg - the message to report
location - the location of the error

XMLStreamException.XMLStreamException(java.lang.String, javax.xml.stream.Location, java.lang.Throwable) (New)

XMLStreamException

public XMLStreamException(java.lang.String msg,
                          Location location,
                          java.lang.Throwable th)
Construct an exception with the assocated message, exception and location.

Parameters:
th - a nested exception
msg - the message to report
location - the location of the error

XMLStreamException.XMLStreamException(java.lang.Throwable) (New)

XMLStreamException

public XMLStreamException(java.lang.Throwable th)
Construct an exception with the assocated exception

Parameters:
th - a nested exception

XMLStreamException.location (New)

location

protected Location location

XMLStreamException.nested (New)

nested

protected java.lang.Throwable nested

XMLStreamException.getLocation() (New)

getLocation

public Location getLocation()
Gets the location of the exception

Returns:
the location of the exception, may be null if none is available

XMLStreamException.getNestedException() (New)

getNestedException

public java.lang.Throwable getNestedException()
Gets the nested exception.

Returns:
Nested exception

javax.xml.stream.XMLStreamReader (New) (45 methods)

CLASS_COMMENT
close()
getAttributeCount()
getAttributeLocalName(int)
getAttributeName(int)
getAttributeNamespace(int)
getAttributePrefix(int)
getAttributeType(int)
getAttributeValue(int)
getAttributeValue(java.lang.String, java.lang.String)
getCharacterEncodingScheme()
getElementText()
getEncoding()
getEventType()
getLocalName()
getLocation()
getName()
getNamespaceContext()
getNamespaceCount()
getNamespacePrefix(int)
getNamespaceURI()
getNamespaceURI(int)
getNamespaceURI(java.lang.String)
getPIData()
getPITarget()
getPrefix()
getProperty(java.lang.String)
getText()
getTextCharacters()
getTextCharacters(int, char[], int, int)
getTextLength()
getTextStart()
getVersion()
hasName()
hasNext()
hasText()
isAttributeSpecified(int)
isCharacters()
isEndElement()
isStandalone()
isStartElement()
isWhiteSpace()
next()
nextTag()
require(int, java.lang.String, java.lang.String)
standaloneSet()

XMLStreamReader.CLASS_COMMENT (New)

public interface XMLStreamReader
extends XMLStreamConstants

The XMLStreamReader interface allows forward, read-only access to XML. It is designed to be the lowest level and most efficient way to read XML data.

The XMLStreamReader is designed to iterate over XML using next() and hasNext(). The data can be accessed using methods such as getEventType(), getNamespaceURI(), getLocalName() and getText();

The next() method causes the reader to read the next parse event. The next() method returns an integer which identifies the type of event just read.

The event type can be determined using getEventType().

Parsing events are defined as the XML Declaration, a DTD, start tag, character data, white space, end tag, comment, or processing instruction. An attribute or namespace event may be encountered at the root level of a document as the result of a query operation.

For XML 1.0 compliance an XML processor must pass the identifiers of declared unparsed entities, notation declarations and their associated identifiers to the application. This information is provided through the property API on this interface. The following two properties allow access to this information: javax.xml.stream.notations and javax.xml.stream.entities. When the current event is a DTD the following call will return a list of Notations List l = (List) getProperty("javax.xml.stream.notations"); The following call will return a list of entity declarations: List l = (List) getProperty("javax.xml.stream.entities"); These properties can only be accessed during a DTD event and are defined to return null if the information is not available.

The following table describes which methods are valid in what state. If a method is called in an invalid state the method will throw a java.lang.IllegalStateException.

Valid methods for each state
Event Type Valid Methods
All States getProperty(), hasNext(), require(), close(), getNamespaceURI(), isStartElement(), isEndElement(), isCharacters(), isWhiteSpace(), getNamespaceContext(), getEventType(),getLocation(), hasText(), hasName()
START_ELEMENT next(), getName(), getLocalName(), hasName(), getPrefix(), getAttributeXXX(), isAttributeSpecified(), getNamespaceXXX(), getElementText(), nextTag()
ATTRIBUTE next(), nextTag() getAttributeXXX(), isAttributeSpecified(),
NAMESPACE next(), nextTag() getNamespaceXXX()
END_ELEMENT next(), getName(), getLocalName(), hasName(), getPrefix(), getNamespaceXXX(), nextTag()
CHARACTERS next(), getTextXXX(), nextTag()
CDATA next(), getTextXXX(), nextTag()
COMMENT next(), getTextXXX(), nextTag()
SPACE next(), getTextXXX(), nextTag()
START_DOCUMENT next(), getEncoding(), getVersion(), isStandalone(), standaloneSet(), getCharacterEncodingScheme(), nextTag()
END_DOCUMENT close()
PROCESSING_INSTRUCTION next(), getPITarget(), getPIData(), nextTag()
ENTITY_REFERENCE next(), getLocalName(), getText(), nextTag()
DTD next(), getText(), nextTag()

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLEvent, XMLInputFactory, XMLStreamWriter

XMLStreamReader.close() (New)

close

void close()
           throws XMLStreamException
Frees any resources associated with this Reader. This method does not close the underlying input source.

Throws:
XMLStreamException - if there are errors freeing associated resources

XMLStreamReader.getAttributeCount() (New)

getAttributeCount

int getAttributeCount()
Returns the count of attributes on this START_ELEMENT, this method is only valid on a START_ELEMENT or ATTRIBUTE. This count excludes namespace definitions. Attribute indices are zero-based.

Returns:
returns the number of attributes
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.getAttributeLocalName(int) (New)

getAttributeLocalName

java.lang.String getAttributeLocalName(int index)
Returns the localName of the attribute at the provided index

Parameters:
index - the position of the attribute
Returns:
the localName of the attribute
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.getAttributeName(int) (New)

getAttributeName

QName getAttributeName(int index)
Returns the qname of the attribute at the provided index

Parameters:
index - the position of the attribute
Returns:
the QName of the attribute
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.getAttributeNamespace(int) (New)

getAttributeNamespace

java.lang.String getAttributeNamespace(int index)
Returns the namespace of the attribute at the provided index

Parameters:
index - the position of the attribute
Returns:
the namespace URI (can be null)
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.getAttributePrefix(int) (New)

getAttributePrefix

java.lang.String getAttributePrefix(int index)
Returns the prefix of this attribute at the provided index

Parameters:
index - the position of the attribute
Returns:
the prefix of the attribute
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.getAttributeType(int) (New)

getAttributeType

java.lang.String getAttributeType(int index)
Returns the XML type of the attribute at the provided index

Parameters:
index - the position of the attribute
Returns:
the XML type of the attribute
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.getAttributeValue(int) (New)

getAttributeValue

java.lang.String getAttributeValue(int index)
Returns the value of the attribute at the index

Parameters:
index - the position of the attribute
Returns:
the attribute value
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.getAttributeValue(java.lang.String, java.lang.String) (New)

getAttributeValue

java.lang.String getAttributeValue(java.lang.String namespaceURI,
                                   java.lang.String localName)
Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality

Parameters:
namespaceURI - the namespace of the attribute
localName - the local name of the attribute, cannot be null
Returns:
returns the value of the attribute , returns null if not found
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.getCharacterEncodingScheme() (New)

getCharacterEncodingScheme

java.lang.String getCharacterEncodingScheme()
Returns the character encoding declared on the xml declaration Returns null if none was declared

Returns:
the encoding declared in the document or null

XMLStreamReader.getElementText() (New)

getElementText

java.lang.String getElementText()
                                throws XMLStreamException
Reads the content of a text-only element, an exception is thrown if this is not a text-only element. Regardless of value of javax.xml.stream.isCoalescing this method always returns coalesced content.
Precondition: the current event is START_ELEMENT.
Postcondition: the current event is the corresponding END_ELEMENT.
The method does the following (implementations are free to optimized but must do equivalent processing):
 if(getEventType() != XMLStreamConstants.START_ELEMENT) {
 throw new XMLStreamException(
 "parser must be on START_ELEMENT to read next text", getLocation());
 }
 int eventType = next();
 StringBuffer content = new StringBuffer();
 while(eventType != XMLStreamConstants.END_ELEMENT ) {
 if(eventType == XMLStreamConstants.CHARACTERS
 || eventType == XMLStreamConstants.CDATA
 || eventType == XMLStreamConstants.SPACE
 || eventType == XMLStreamConstants.ENTITY_REFERENCE) {
 buf.append(getText());
 } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
 || eventType == XMLStreamConstants.COMMENT) {
 // skipping
 } else if(eventType == XMLStreamConstants.END_DOCUMENT) {
 throw new XMLStreamException(
 "unexpected end of document when reading element text content", this);
 } else if(eventType == XMLStreamConstants.START_ELEMENT) {
 throw new XMLStreamException(
 "element text content may not contain START_ELEMENT", getLocation());
 } else {
 throw new XMLStreamException(
 "Unexpected event type "+eventType, getLocation());
 }
 eventType = next();
 }
 return buf.toString();
 

Throws:
XMLStreamException - if the current event is not a START_ELEMENT or if a non text element is encountered

XMLStreamReader.getEncoding() (New)

getEncoding

java.lang.String getEncoding()
Return input encoding if known or null if unknown.

Returns:
the encoding of this instance or null

XMLStreamReader.getEventType() (New)

getEventType

int getEventType()
Returns an integer code that indicates the type of the event the cursor is pointing to.

XMLStreamReader.getLocalName() (New)

getLocalName

java.lang.String getLocalName()
Returns the (local) name of the current event. For START_ELEMENT or END_ELEMENT returns the (local) name of the current element. For ENTITY_REFERENCE it returns entity name. The current event must be START_ELEMENT or END_ELEMENT, or ENTITY_REFERENCE

Returns:
the localName
Throws:
java.lang.IllegalStateException - if this not a START_ELEMENT, END_ELEMENT or ENTITY_REFERENCE

XMLStreamReader.getLocation() (New)

getLocation

Location getLocation()
Return the current location of the processor. If the Location is unknown the processor should return an implementation of Location that returns -1 for the location and null for the publicId and systemId. The location information is only valid until next() is called.

XMLStreamReader.getName() (New)

getName

QName getName()
Returns a QName for the current START_ELEMENT or END_ELEMENT event

Returns:
the QName for the current START_ELEMENT or END_ELEMENT event
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or END_ELEMENT

XMLStreamReader.getNamespaceContext() (New)

getNamespaceContext

NamespaceContext getNamespaceContext()
Returns a read only namespace context for the current position. The context is transient and only valid until a call to next() changes the state of the reader.

Returns:
return a namespace context

XMLStreamReader.getNamespaceCount() (New)

getNamespaceCount

int getNamespaceCount()
Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT, this method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE. On an END_ELEMENT the count is of the namespaces that are about to go out of scope. This is the equivalent of the information reported by SAX callback for an end element event.

Returns:
returns the number of namespace declarations on this specific element
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE

XMLStreamReader.getNamespacePrefix(int) (New)

getNamespacePrefix

java.lang.String getNamespacePrefix(int index)
Returns the prefix for the namespace declared at the index. Returns null if this is the default namespace declaration

Parameters:
index - the position of the namespace declaration
Returns:
returns the namespace prefix
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE

XMLStreamReader.getNamespaceURI() (New)

getNamespaceURI

java.lang.String getNamespaceURI()
If the current event is a START_ELEMENT or END_ELEMENT this method returns the URI of the prefix or the default namespace. Returns null if the event does not have a prefix.

Returns:
the URI bound to this elements prefix, the default namespace, or null

XMLStreamReader.getNamespaceURI(int) (New)

getNamespaceURI

java.lang.String getNamespaceURI(int index)
Returns the uri for the namespace declared at the index.

Parameters:
index - the position of the namespace declaration
Returns:
returns the namespace uri
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE

XMLStreamReader.getNamespaceURI(java.lang.String) (New)

getNamespaceURI

java.lang.String getNamespaceURI(java.lang.String prefix)
Return the uri for the given prefix. The uri returned depends on the current state of the processor.

NOTE:The 'xml' prefix is bound as defined in Namespaces in XML specification to "http://www.w3.org/XML/1998/namespace".

NOTE: The 'xmlns' prefix must be resolved to following namespace http://www.w3.org/2000/xmlns/

Parameters:
prefix - The prefix to lookup, may not be null
Returns:
the uri bound to the given prefix or null if it is not bound
Throws:
java.lang.IllegalArgumentException - if the prefix is null

XMLStreamReader.getPIData() (New)

getPIData

java.lang.String getPIData()
Get the data section of a processing instruction

Returns:
the data or null

XMLStreamReader.getPITarget() (New)

getPITarget

java.lang.String getPITarget()
Get the target of a processing instruction

Returns:
the target or null

XMLStreamReader.getPrefix() (New)

getPrefix

java.lang.String getPrefix()
Returns the prefix of the current event or null if the event does not have a prefix

Returns:
the prefix or null

XMLStreamReader.getProperty(java.lang.String) (New)

getProperty

java.lang.Object getProperty(java.lang.String name)
                             throws java.lang.IllegalArgumentException
Get the value of a feature/property from the underlying implementation

Parameters:
name - The name of the property, may not be null
Returns:
The value of the property
Throws:
java.lang.IllegalArgumentException - if name is null

XMLStreamReader.getText() (New)

getText

java.lang.String getText()
Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. If an ENTITY_REFERENCE has been resolved, any character data will be reported as CHARACTERS events.

Returns:
the current text or null
Throws:
java.lang.IllegalStateException - if this state is not a valid text state.

XMLStreamReader.getTextCharacters() (New)

getTextCharacters

char[] getTextCharacters()
Returns an array which contains the characters from this event. This array should be treated as read-only and transient. I.e. the array will contain the text characters until the XMLStreamReader moves on to the next event. Attempts to hold onto the character array beyond that time or modify the contents of the array are breaches of the contract for this interface.

Returns:
the current text or an empty array
Throws:
java.lang.IllegalStateException - if this state is not a valid text state.

XMLStreamReader.getTextCharacters(int, char[], int, int) (New)

getTextCharacters

int getTextCharacters(int sourceStart,
                      char[] target,
                      int targetStart,
                      int length)
                      throws XMLStreamException
Gets the the text associated with a CHARACTERS, SPACE or CDATA event. Text starting a "sourceStart" is copied into "target" starting at "targetStart". Up to "length" characters are copied. The number of characters actually copied is returned. The "sourceStart" argument must be greater or equal to 0 and less than or equal to the number of characters associated with the event. Usually, one requests text starting at a "sourceStart" of 0. If the number of characters actually copied is less than the "length", then there is no more text. Otherwise, subsequent calls need to be made until all text has been retrieved. For example: int length = 1024; char[] myBuffer = new char[ length ]; for ( int sourceStart = 0 ; ; sourceStart += length ) { int nCopied = stream.getTextCharacters( sourceStart, myBuffer, 0, length ); if (nCopied < length) break; } XMLStreamException may be thrown if there are any XML errors in the underlying source. The "targetStart" argument must be greater than or equal to 0 and less than the length of "target", Length must be greater than 0 and "targetStart + length" must be less than or equal to length of "target".

Parameters:
sourceStart - the index of the first character in the source array to copy
target - the destination array
targetStart - the start offset in the target array
length - the number of characters to copy
Returns:
the number of characters actually copied
Throws:
XMLStreamException - if the underlying XML source is not well-formed
java.lang.IndexOutOfBoundsException - if targetStart < 0 or > than the length of target
java.lang.IndexOutOfBoundsException - if length < 0 or targetStart + length > length of target
java.lang.UnsupportedOperationException - if this method is not supported
java.lang.NullPointerException - is if target is null

XMLStreamReader.getTextLength() (New)

getTextLength

int getTextLength()
Returns the length of the sequence of characters for this Text event within the text character array.

Throws:
java.lang.IllegalStateException - if this state is not a valid text state.

XMLStreamReader.getTextStart() (New)

getTextStart

int getTextStart()
Returns the offset into the text character array where the first character (of this text event) is stored.

Throws:
java.lang.IllegalStateException - if this state is not a valid text state.

XMLStreamReader.getVersion() (New)

getVersion

java.lang.String getVersion()
Get the xml version declared on the xml declaration Returns null if none was declared

Returns:
the XML version or null

XMLStreamReader.hasName() (New)

hasName

boolean hasName()
returns true if the current event has a name (is a START_ELEMENT or END_ELEMENT) returns false otherwise

XMLStreamReader.hasNext() (New)

hasNext

boolean hasNext()
                throws XMLStreamException
Returns true if there are more parsing events and false if there are no more events. This method will return false if the current state of the XMLStreamReader is END_DOCUMENT

Returns:
true if there are more events, false otherwise
Throws:
XMLStreamException - if there is a fatal error detecting the next state

XMLStreamReader.hasText() (New)

hasText

boolean hasText()
Return true if the current event has text, false otherwise The following events have text: CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT, SPACE

XMLStreamReader.isAttributeSpecified(int) (New)

isAttributeSpecified

boolean isAttributeSpecified(int index)
Returns a boolean which indicates if this attribute was created by default

Parameters:
index - the position of the attribute
Returns:
true if this is a default attribute
Throws:
java.lang.IllegalStateException - if this is not a START_ELEMENT or ATTRIBUTE

XMLStreamReader.isCharacters() (New)

isCharacters

boolean isCharacters()
Returns true if the cursor points to a character data event

Returns:
true if the cursor points to character data, false otherwise

XMLStreamReader.isEndElement() (New)

isEndElement

boolean isEndElement()
Returns true if the cursor points to an end tag (otherwise false)

Returns:
true if the cursor points to an end tag, false otherwise

XMLStreamReader.isStandalone() (New)

isStandalone

boolean isStandalone()
Get the standalone declaration from the xml declaration

Returns:
true if this is standalone, or false otherwise

XMLStreamReader.isStartElement() (New)

isStartElement

boolean isStartElement()
Returns true if the cursor points to a start tag (otherwise false)

Returns:
true if the cursor points to a start tag, false otherwise

XMLStreamReader.isWhiteSpace() (New)

isWhiteSpace

boolean isWhiteSpace()
Returns true if the cursor points to a character data event that consists of all whitespace

Returns:
true if the cursor points to all whitespace, false otherwise

XMLStreamReader.next() (New)

next

int next()
         throws XMLStreamException
Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks. If the property javax.xml.stream.isCoalescing is set to true element content must be coalesced and only one CHARACTERS event must be returned for contiguous element content or CDATA Sections. By default entity references must be expanded and reported transparently to the application. An exception will be thrown if an entity reference cannot be expanded. If element content is empty (i.e. content is "") then no CHARACTERS event will be reported.

Given the following XML:
<foo><!--description-->content text<![CDATA[<greeting>Hello</greeting>]]>other content</foo>
The behavior of calling next() when being on foo will be:
1- the comment (COMMENT)
2- then the characters section (CHARACTERS)
3- then the CDATA section (another CHARACTERS)
4- then the next characters section (another CHARACTERS)
5- then the END_ELEMENT

NOTE: empty element (such as <tag/>) will be reported with two separate events: START_ELEMENT, END_ELEMENT - This preserves parsing equivalency of empty element to <tag></tag>. This method will throw an IllegalStateException if it is called after hasNext() returns false.

Returns:
the integer code corresponding to the current parse event
Throws:
NoSuchElementException - if this is called when hasNext() returns false
XMLStreamException - if there is an error processing the underlying XML source
See Also:
XMLEvent

XMLStreamReader.nextTag() (New)

nextTag

int nextTag()
            throws XMLStreamException
Skips any white space (isWhiteSpace() returns true), COMMENT, or PROCESSING_INSTRUCTION, until a START_ELEMENT or END_ELEMENT is reached. If other than white space characters, COMMENT, PROCESSING_INSTRUCTION, START_ELEMENT, END_ELEMENT are encountered, an exception is thrown. This method should be used when processing element-only content seperated by white space.
Precondition: none
Postcondition: the current event is START_ELEMENT or END_ELEMENT and cursor may have moved over any whitespace event.
Essentially it does the following (implementations are free to optimized but must do equivalent processing):
 int eventType = next();
 while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
 || (eventType == XMLStreamConstants.CDATA && isWhiteSpace()) 
 // skip whitespace
 || eventType == XMLStreamConstants.SPACE
 || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
 || eventType == XMLStreamConstants.COMMENT
 ) {
 eventType = next();
 }
 if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
 throw new String XMLStreamException("expected start or end tag", getLocation());
 }
 return eventType;
 

Returns:
the event type of the element read (START_ELEMENT or END_ELEMENT)
Throws:
XMLStreamException - if the current event is not white space, PROCESSING_INSTRUCTION, START_ELEMENT or END_ELEMENT
NoSuchElementException - if this is called when hasNext() returns false

XMLStreamReader.require(int, java.lang.String, java.lang.String) (New)

require

void require(int type,
             java.lang.String namespaceURI,
             java.lang.String localName)
             throws XMLStreamException
Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event. If the namespaceURI is null it is not checked for equality, if the localName is null it is not checked for equality.

Parameters:
type - the event type
namespaceURI - the uri of the event, may be null
localName - the localName of the event, may be null
Throws:
XMLStreamException - if the required values are not matched.

XMLStreamReader.standaloneSet() (New)

standaloneSet

boolean standaloneSet()
Checks if standalone was set in the document

Returns:
true if standalone was set in the document, or false otherwise

javax.xml.stream.XMLStreamWriter (New) (32 methods)

CLASS_COMMENT
close()
flush()
getNamespaceContext()
getPrefix(java.lang.String)
getProperty(java.lang.String)
setDefaultNamespace(java.lang.String)
setNamespaceContext(javax.xml.namespace.NamespaceContext)
setPrefix(java.lang.String, java.lang.String)
writeAttribute(java.lang.String, java.lang.String)
writeAttribute(java.lang.String, java.lang.String, java.lang.String)
writeAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
writeCData(java.lang.String)
writeCharacters(char[], int, int)
writeCharacters(java.lang.String)
writeComment(java.lang.String)
writeDTD(java.lang.String)
writeDefaultNamespace(java.lang.String)
writeEmptyElement(java.lang.String)
writeEmptyElement(java.lang.String, java.lang.String)
writeEmptyElement(java.lang.String, java.lang.String, java.lang.String)
writeEndDocument()
writeEndElement()
writeEntityRef(java.lang.String)
writeNamespace(java.lang.String, java.lang.String)
writeProcessingInstruction(java.lang.String)
writeProcessingInstruction(java.lang.String, java.lang.String)
writeStartDocument()
writeStartDocument(java.lang.String)
writeStartDocument(java.lang.String, java.lang.String)
writeStartElement(java.lang.String)
writeStartElement(java.lang.String, java.lang.String)
writeStartElement(java.lang.String, java.lang.String, java.lang.String)

XMLStreamWriter.CLASS_COMMENT (New)

public interface XMLStreamWriter

The XMLStreamWriter interface specifies how to write XML. The XMLStreamWriter does not perform well formedness checking on its input. However the writeCharacters method is required to escape & , < and > For attribute values the writeAttribute method will escape the above characters plus " to ensure that all character content and attribute values are well formed. Each NAMESPACE and ATTRIBUTE must be individually written. If javax.xml.stream.isPrefixDefaulting is set to false it is a fatal error if an element is written with namespace URI that has not been bound to a prefix. If javax.xml.stream.isPrefixDefaulting is set to true the XMLStreamWriter implementation must write a prefix for each unbound URI that it encounters in the current scope.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLOutputFactory, XMLStreamReader

XMLStreamWriter.close() (New)

close

void close()
           throws XMLStreamException
Close this writer and free any resources associated with the writer. This must not close the underlying output stream.

Throws:
XMLStreamException

XMLStreamWriter.flush() (New)

flush

void flush()
           throws XMLStreamException
Write any cached data to the underlying output mechanism.

Throws:
XMLStreamException

XMLStreamWriter.getNamespaceContext() (New)

getNamespaceContext

NamespaceContext getNamespaceContext()
Returns the current namespace context.

Returns:
the current NamespaceContext

XMLStreamWriter.getPrefix(java.lang.String) (New)

getPrefix

java.lang.String getPrefix(java.lang.String uri)
                           throws XMLStreamException
Gets the prefix the uri is bound to

Returns:
the prefix or null
Throws:
XMLStreamException

XMLStreamWriter.getProperty(java.lang.String) (New)

getProperty

java.lang.Object getProperty(java.lang.String name)
                             throws java.lang.IllegalArgumentException
Get the value of a feature/property from the underlying implementation

Parameters:
name - The name of the property, may not be null
Returns:
The value of the property
Throws:
java.lang.IllegalArgumentException - if the property is not supported
java.lang.NullPointerException - if the name is null

XMLStreamWriter.setDefaultNamespace(java.lang.String) (New)

setDefaultNamespace

void setDefaultNamespace(java.lang.String uri)
                         throws XMLStreamException
Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.

Parameters:
uri - the uri to bind to the default namespace, may be null
Throws:
XMLStreamException

XMLStreamWriter.setNamespaceContext(javax.xml.namespace.NamespaceContext) (New)

setNamespaceContext

void setNamespaceContext(NamespaceContext context)
                         throws XMLStreamException
Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces. This method may only be called once at the start of the document. It does not cause the namespaces to be declared. If a namespace URI to prefix mapping is found in the namespace context it is treated as declared and the prefix may be used by the StreamWriter.

Parameters:
context - the namespace context to use for this writer, may not be null
Throws:
XMLStreamException

XMLStreamWriter.setPrefix(java.lang.String, java.lang.String) (New)

setPrefix

void setPrefix(java.lang.String prefix,
               java.lang.String uri)
               throws XMLStreamException
Sets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.

Parameters:
prefix - the prefix to bind to the uri, may not be null
uri - the uri to bind to the prefix, may be null
Throws:
XMLStreamException

XMLStreamWriter.writeAttribute(java.lang.String, java.lang.String) (New)

writeAttribute

void writeAttribute(java.lang.String localName,
                    java.lang.String value)
                    throws XMLStreamException
Writes an attribute to the output stream without a prefix.

Parameters:
localName - the local name of the attribute
value - the value of the attribute
Throws:
java.lang.IllegalStateException - if the current state does not allow Attribute writing
XMLStreamException

XMLStreamWriter.writeAttribute(java.lang.String, java.lang.String, java.lang.String) (New)

writeAttribute

void writeAttribute(java.lang.String namespaceURI,
                    java.lang.String localName,
                    java.lang.String value)
                    throws XMLStreamException
Writes an attribute to the output stream

Parameters:
namespaceURI - the uri of the prefix for this attribute
localName - the local name of the attribute
value - the value of the attribute
Throws:
java.lang.IllegalStateException - if the current state does not allow Attribute writing
XMLStreamException - if the namespace URI has not been bound to a prefix and javax.xml.stream.isPrefixDefaulting has not been set to true

XMLStreamWriter.writeAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String) (New)

writeAttribute

void writeAttribute(java.lang.String prefix,
                    java.lang.String namespaceURI,
                    java.lang.String localName,
                    java.lang.String value)
                    throws XMLStreamException
Writes an attribute to the output stream

Parameters:
prefix - the prefix for this attribute
namespaceURI - the uri of the prefix for this attribute
localName - the local name of the attribute
value - the value of the attribute
Throws:
java.lang.IllegalStateException - if the current state does not allow Attribute writing
XMLStreamException - if the namespace URI has not been bound to a prefix and javax.xml.stream.isPrefixDefaulting has not been set to true

XMLStreamWriter.writeCData(java.lang.String) (New)

writeCData

void writeCData(java.lang.String data)
                throws XMLStreamException
Writes a CData section

Parameters:
data - the data contained in the CData Section, may not be null
Throws:
XMLStreamException

XMLStreamWriter.writeCharacters(char[], int, int) (New)

writeCharacters

void writeCharacters(char[] text,
                     int start,
                     int len)
                     throws XMLStreamException
Write text to the output

Parameters:
text - the value to write
start - the starting position in the array
len - the number of characters to write
Throws:
XMLStreamException

XMLStreamWriter.writeCharacters(java.lang.String) (New)

writeCharacters

void writeCharacters(java.lang.String text)
                     throws XMLStreamException
Write text to the output

Parameters:
text - the value to write
Throws:
XMLStreamException

XMLStreamWriter.writeComment(java.lang.String) (New)

writeComment

void writeComment(java.lang.String data)
                  throws XMLStreamException
Writes an xml comment with the data enclosed

Parameters:
data - the data contained in the comment, may be null
Throws:
XMLStreamException

XMLStreamWriter.writeDTD(java.lang.String) (New)

writeDTD

void writeDTD(java.lang.String dtd)
              throws XMLStreamException
Write a DTD section. This string represents the entire doctypedecl production from the XML 1.0 specification.

Parameters:
dtd - the DTD to be written
Throws:
XMLStreamException

XMLStreamWriter.writeDefaultNamespace(java.lang.String) (New)

writeDefaultNamespace

void writeDefaultNamespace(java.lang.String namespaceURI)
                           throws XMLStreamException
Writes the default namespace to the stream

Parameters:
namespaceURI - the uri to bind the default namespace to
Throws:
java.lang.IllegalStateException - if the current state does not allow Namespace writing
XMLStreamException

XMLStreamWriter.writeEmptyElement(java.lang.String) (New)

writeEmptyElement

void writeEmptyElement(java.lang.String localName)
                       throws XMLStreamException
Writes an empty element tag to the output

Parameters:
localName - local name of the tag, may not be null
Throws:
XMLStreamException

XMLStreamWriter.writeEmptyElement(java.lang.String, java.lang.String) (New)

writeEmptyElement

void writeEmptyElement(java.lang.String namespaceURI,
                       java.lang.String localName)
                       throws XMLStreamException
Writes an empty element tag to the output

Parameters:
namespaceURI - the uri to bind the tag to, may not be null
localName - local name of the tag, may not be null
Throws:
XMLStreamException - if the namespace URI has not been bound to a prefix and javax.xml.stream.isPrefixDefaulting has not been set to true

XMLStreamWriter.writeEmptyElement(java.lang.String, java.lang.String, java.lang.String) (New)

writeEmptyElement

void writeEmptyElement(java.lang.String prefix,
                       java.lang.String localName,
                       java.lang.String namespaceURI)
                       throws XMLStreamException
Writes an empty element tag to the output

Parameters:
prefix - the prefix of the tag, may not be null
localName - local name of the tag, may not be null
namespaceURI - the uri to bind the tag to, may not be null
Throws:
XMLStreamException

XMLStreamWriter.writeEndDocument() (New)

writeEndDocument

void writeEndDocument()
                      throws XMLStreamException
Closes any start tags and writes corresponding end tags.

Throws:
XMLStreamException

XMLStreamWriter.writeEndElement() (New)

writeEndElement

void writeEndElement()
                     throws XMLStreamException
Writes an end tag to the output relying on the internal state of the writer to determine the prefix and local name of the event.

Throws:
XMLStreamException

XMLStreamWriter.writeEntityRef(java.lang.String) (New)

writeEntityRef

void writeEntityRef(java.lang.String name)
                    throws XMLStreamException
Writes an entity reference

Parameters:
name - the name of the entity
Throws:
XMLStreamException

XMLStreamWriter.writeNamespace(java.lang.String, java.lang.String) (New)

writeNamespace

void writeNamespace(java.lang.String prefix,
                    java.lang.String namespaceURI)
                    throws XMLStreamException
Writes a namespace to the output stream If the prefix argument to this method is the empty string, "xmlns", or null this method will delegate to writeDefaultNamespace

Parameters:
prefix - the prefix to bind this namespace to
namespaceURI - the uri to bind the prefix to
Throws:
java.lang.IllegalStateException - if the current state does not allow Namespace writing
XMLStreamException

XMLStreamWriter.writeProcessingInstruction(java.lang.String) (New)

writeProcessingInstruction

void writeProcessingInstruction(java.lang.String target)
                                throws XMLStreamException
Writes a processing instruction

Parameters:
target - the target of the processing instruction, may not be null
Throws:
XMLStreamException

XMLStreamWriter.writeProcessingInstruction(java.lang.String, java.lang.String) (New)

writeProcessingInstruction

void writeProcessingInstruction(java.lang.String target,
                                java.lang.String data)
                                throws XMLStreamException
Writes a processing instruction

Parameters:
target - the target of the processing instruction, may not be null
data - the data contained in the processing instruction, may not be null
Throws:
XMLStreamException

XMLStreamWriter.writeStartDocument() (New)

writeStartDocument

void writeStartDocument()
                        throws XMLStreamException
Write the XML Declaration. Defaults the XML version to 1.0, and the encoding to utf-8

Throws:
XMLStreamException

XMLStreamWriter.writeStartDocument(java.lang.String) (New)

writeStartDocument

void writeStartDocument(java.lang.String version)
                        throws XMLStreamException
Write the XML Declaration. Defaults the XML version to 1.0

Parameters:
version - version of the xml document
Throws:
XMLStreamException

XMLStreamWriter.writeStartDocument(java.lang.String, java.lang.String) (New)

writeStartDocument

void writeStartDocument(java.lang.String encoding,
                        java.lang.String version)
                        throws XMLStreamException
Write the XML Declaration. Note that the encoding parameter does not set the actual encoding of the underlying output. That must be set when the instance of the XMLStreamWriter is created using the XMLOutputFactory

Parameters:
encoding - encoding of the xml declaration
version - version of the xml document
Throws:
XMLStreamException

XMLStreamWriter.writeStartElement(java.lang.String) (New)

writeStartElement

void writeStartElement(java.lang.String localName)
                       throws XMLStreamException
Writes a start tag to the output. All writeStartElement methods open a new scope in the internal namespace context. Writing the corresponding EndElement causes the scope to be closed.

Parameters:
localName - local name of the tag, may not be null
Throws:
XMLStreamException

XMLStreamWriter.writeStartElement(java.lang.String, java.lang.String) (New)

writeStartElement

void writeStartElement(java.lang.String namespaceURI,
                       java.lang.String localName)
                       throws XMLStreamException
Writes a start tag to the output

Parameters:
namespaceURI - the namespaceURI of the prefix to use, may not be null
localName - local name of the tag, may not be null
Throws:
XMLStreamException - if the namespace URI has not been bound to a prefix and javax.xml.stream.isPrefixDefaulting has not been set to true

XMLStreamWriter.writeStartElement(java.lang.String, java.lang.String, java.lang.String) (New)

writeStartElement

void writeStartElement(java.lang.String prefix,
                       java.lang.String localName,
                       java.lang.String namespaceURI)
                       throws XMLStreamException
Writes a start tag to the output

Parameters:
localName - local name of the tag, may not be null
prefix - the prefix of the tag, may not be null
namespaceURI - the uri to bind the prefix to, may not be null
Throws:
XMLStreamException

javax.xml.stream.events.Attribute (New) (4 methods)

CLASS_COMMENT
getDTDType()
getName()
getValue()
isSpecified()

Attribute.CLASS_COMMENT (New)

public interface Attribute
extends XMLEvent

An interface that contains information about an attribute. Attributes are reported as a set of events accessible from a StartElement. Other applications may report Attributes as first-order events, for example as the results of an XPath expression.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
StartElement

Attribute.getDTDType() (New)

getDTDType

java.lang.String getDTDType()
Gets the type of this attribute, default is the String "CDATA"

Returns:
the type as a String, default is "CDATA"

Attribute.getName() (New)

getName

QName getName()
Returns the QName for this attribute

Attribute.getValue() (New)

getValue

java.lang.String getValue()
Gets the normalized value of this attribute

Attribute.isSpecified() (New)

isSpecified

boolean isSpecified()
A flag indicating whether this attribute was actually specified in the start-tag of its element, or was defaulted from the schema.

Returns:
returns true if this was specified in the start element

javax.xml.stream.events.Characters (New) (4 methods)

CLASS_COMMENT
getData()
isCData()
isIgnorableWhiteSpace()
isWhiteSpace()

Characters.CLASS_COMMENT (New)

public interface Characters
extends XMLEvent

This describes the interface to Characters events. All text events get reported as Characters events. Content, CData and whitespace are all reported as Characters events. IgnorableWhitespace, in most cases, will be set to false unless an element declaration of element content is present for the current element.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

Characters.getData() (New)

getData

java.lang.String getData()
Get the character data of this event

Characters.isCData() (New)

isCData

boolean isCData()
Returns true if this is a CData section. If this event is CData its event type will be CDATA If javax.xml.stream.isCoalescing is set to true CDATA Sections that are surrounded by non CDATA characters will be reported as a single Characters event. This method will return false in this case.

Characters.isIgnorableWhiteSpace() (New)

isIgnorableWhiteSpace

boolean isIgnorableWhiteSpace()
Return true if this is ignorableWhiteSpace. If this event is ignorableWhiteSpace its event type will be SPACE.

Characters.isWhiteSpace() (New)

isWhiteSpace

boolean isWhiteSpace()
Returns true if this set of Characters is all whitespace. Whitespace inside a document is reported as CHARACTERS. This method allows checking of CHARACTERS events to see if they are composed of only whitespace characters

javax.xml.stream.events.Comment (New) (1 method)

CLASS_COMMENT
getText()

Comment.CLASS_COMMENT (New)

public interface Comment
extends XMLEvent

An interface for comment events

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

Comment.getText() (New)

getText

java.lang.String getText()
Return the string data of the comment, returns empty string if it does not exist

javax.xml.stream.events.DTD (New) (4 methods)

CLASS_COMMENT
getDocumentTypeDeclaration()
getEntities()
getNotations()
getProcessedDTD()

DTD.CLASS_COMMENT (New)

public interface DTD
extends XMLEvent

This is the top level interface for events dealing with DTDs

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

DTD.getDocumentTypeDeclaration() (New)

getDocumentTypeDeclaration

java.lang.String getDocumentTypeDeclaration()
Returns the entire Document Type Declaration as a string, including the internal DTD subset. This may be null if there is not an internal subset. If it is not null it must return the entire Document Type Declaration which matches the doctypedecl production in the XML 1.0 specification

DTD.getEntities() (New)

getEntities

java.util.List getEntities()
Return a List containing the general entities, both external and internal, declared in the DTD. This list must contain EntityDeclaration events.

Returns:
an unordered list of EntityDeclaration events
See Also:
EntityDeclaration

DTD.getNotations() (New)

getNotations

java.util.List getNotations()
Return a List containing the notations declared in the DTD. This list must contain NotationDeclaration events.

Returns:
an unordered list of NotationDeclaration events
See Also:
NotationDeclaration

DTD.getProcessedDTD() (New)

getProcessedDTD

java.lang.Object getProcessedDTD()
Returns an implementation defined representation of the DTD. This method may return null if no representation is available.

javax.xml.stream.events.EndDocument (New)

EndDocument.CLASS_COMMENT (New)

public interface EndDocument
extends XMLEvent

A marker interface for the end of the document

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

javax.xml.stream.events.EndElement (New) (2 methods)

CLASS_COMMENT
getName()
getNamespaces()

EndElement.CLASS_COMMENT (New)

public interface EndElement
extends XMLEvent

An interface for the end element event. An EndElement is reported for each End Tag in the document.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLEvent

EndElement.getName() (New)

getName

QName getName()
Get the name of this event

Returns:
the qualified name of this event

EndElement.getNamespaces() (New)

getNamespaces

java.util.Iterator getNamespaces()
Returns an Iterator of namespaces that have gone out of scope. Returns an empty iterator if no namespaces have gone out of scope.

Returns:
an Iterator over Namespace interfaces, or an empty iterator

javax.xml.stream.events.EntityDeclaration (New) (6 methods)

CLASS_COMMENT
getBaseURI()
getName()
getNotationName()
getPublicId()
getReplacementText()
getSystemId()

EntityDeclaration.CLASS_COMMENT (New)

public interface EntityDeclaration
extends XMLEvent

An interface for handling Entity Declarations This interface is used to record and report unparsed entity declarations.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

EntityDeclaration.getBaseURI() (New)

getBaseURI

java.lang.String getBaseURI()
Get the base URI for this reference or null if this information is not available

Returns:
the base URI or null

EntityDeclaration.getName() (New)

getName

java.lang.String getName()
The entity's name

Returns:
the name, may not be null

EntityDeclaration.getNotationName() (New)

getNotationName

java.lang.String getNotationName()
The name of the associated notation.

Returns:
the notation name

EntityDeclaration.getPublicId() (New)

getPublicId

java.lang.String getPublicId()
The entity's public identifier, or null if none was given

Returns:
the public ID for this declaration or null

EntityDeclaration.getReplacementText() (New)

getReplacementText

java.lang.String getReplacementText()
The replacement text of the entity. This method will only return non-null if this is an internal entity.

Returns:
null or the replacment text

EntityDeclaration.getSystemId() (New)

getSystemId

java.lang.String getSystemId()
The entity's system identifier.

Returns:
the system ID for this declaration or null

javax.xml.stream.events.EntityReference (New) (2 methods)

CLASS_COMMENT
getDeclaration()
getName()

EntityReference.CLASS_COMMENT (New)

public interface EntityReference
extends XMLEvent

An interface for handling Entity events. This event reports entities that have not been resolved and reports their replacement text unprocessed (if available). This event will be reported if javax.xml.stream.isReplacingEntityReferences is set to false. If javax.xml.stream.isReplacingEntityReferences is set to true entity references will be resolved transparently. Entities are handled in two possible ways: (1) If javax.xml.stream.isReplacingEntityReferences is set to true all entity references are resolved and reported as markup transparently. (2) If javax.xml.stream.isReplacingEntityReferences is set to false Entity references are reported as an EntityReference Event.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

EntityReference.getDeclaration() (New)

getDeclaration

EntityDeclaration getDeclaration()
Return the declaration of this entity.

EntityReference.getName() (New)

getName

java.lang.String getName()
The name of the entity

Returns:
the entity's name, may not be null

javax.xml.stream.events.Namespace (New) (3 methods)

CLASS_COMMENT
getNamespaceURI()
getPrefix()
isDefaultNamespaceDeclaration()

Namespace.CLASS_COMMENT (New)

public interface Namespace
extends Attribute

An interface that contains information about a namespace. Namespaces are accessed from a StartElement.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
StartElement

Namespace.getNamespaceURI() (New)

getNamespaceURI

java.lang.String getNamespaceURI()
Gets the uri bound to the prefix of this namespace

Namespace.getPrefix() (New)

getPrefix

java.lang.String getPrefix()
Gets the prefix, returns "" if this is a default namespace declaration.

Namespace.isDefaultNamespaceDeclaration() (New)

isDefaultNamespaceDeclaration

boolean isDefaultNamespaceDeclaration()
returns true if this attribute declares the default namespace

javax.xml.stream.events.NotationDeclaration (New) (3 methods)

CLASS_COMMENT
getName()
getPublicId()
getSystemId()

NotationDeclaration.CLASS_COMMENT (New)

public interface NotationDeclaration
extends XMLEvent

An interface for handling Notation Declarations Receive notification of a notation declaration event. It is up to the application to record the notation for later reference, At least one of publicId and systemId must be non-null. There is no guarantee that the notation declaration will be reported before any unparsed entities that use it.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

NotationDeclaration.getName() (New)

getName

java.lang.String getName()
The notation name.

NotationDeclaration.getPublicId() (New)

getPublicId

java.lang.String getPublicId()
The notation's public identifier, or null if none was given.

NotationDeclaration.getSystemId() (New)

getSystemId

java.lang.String getSystemId()
The notation's system identifier, or null if none was given.

javax.xml.stream.events.ProcessingInstruction (New) (2 methods)

CLASS_COMMENT
getData()
getTarget()

ProcessingInstruction.CLASS_COMMENT (New)

public interface ProcessingInstruction
extends XMLEvent

An interface that describes the data found in processing instructions

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

ProcessingInstruction.getData() (New)

getData

java.lang.String getData()
The data section of the processing instruction

Returns:
the String value of the PI's data or null

ProcessingInstruction.getTarget() (New)

getTarget

java.lang.String getTarget()
The target section of the processing instruction

Returns:
the String value of the PI or null

javax.xml.stream.events.StartDocument (New) (6 methods)

CLASS_COMMENT
encodingSet()
getCharacterEncodingScheme()
getSystemId()
getVersion()
isStandalone()
standaloneSet()

StartDocument.CLASS_COMMENT (New)

public interface StartDocument
extends XMLEvent

An interface for the start document event

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

StartDocument.encodingSet() (New)

encodingSet

boolean encodingSet()
Returns true if CharacterEncodingScheme was set in the encoding declaration of the document

StartDocument.getCharacterEncodingScheme() (New)

getCharacterEncodingScheme

java.lang.String getCharacterEncodingScheme()
Returns the encoding style of the XML data

Returns:
the character encoding, defaults to "UTF-8"

StartDocument.getSystemId() (New)

getSystemId

java.lang.String getSystemId()
Returns the system ID of the XML data

Returns:
the system ID, defaults to ""

StartDocument.getVersion() (New)

getVersion

java.lang.String getVersion()
Returns the version of XML of this XML stream

Returns:
the version of XML, defaults to "1.0"

StartDocument.isStandalone() (New)

isStandalone

boolean isStandalone()
Returns if this XML is standalone

Returns:
the standalone state of XML, defaults to "no"

StartDocument.standaloneSet() (New)

standaloneSet

boolean standaloneSet()
Returns true if the standalone attribute was set in the encoding declaration of the document.

javax.xml.stream.events.StartElement (New) (6 methods)

CLASS_COMMENT
getAttributeByName(javax.xml.namespace.QName)
getAttributes()
getName()
getNamespaceContext()
getNamespaceURI(java.lang.String)
getNamespaces()

StartElement.CLASS_COMMENT (New)

public interface StartElement
extends XMLEvent

The StartElement interface provides access to information about start elements. A StartElement is reported for each Start Tag in the document.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

StartElement.getAttributeByName(javax.xml.namespace.QName) (New)

getAttributeByName

Attribute getAttributeByName(QName name)
Returns the attribute referred to by this name

Parameters:
name - the qname of the desired name
Returns:
the attribute corresponding to the name value or null

StartElement.getAttributes() (New)

getAttributes

java.util.Iterator getAttributes()
Returns an Iterator of non-namespace declared attributes declared on this START_ELEMENT, returns an empty iterator if there are no attributes. The iterator must contain only implementations of the javax.xml.stream.Attribute interface. Attributes are fundamentally unordered and may not be reported in any order.

Returns:
a readonly Iterator over Attribute interfaces, or an empty iterator

StartElement.getName() (New)

getName

QName getName()
Get the name of this event

Returns:
the qualified name of this event

StartElement.getNamespaceContext() (New)

getNamespaceContext

NamespaceContext getNamespaceContext()
Gets a read-only namespace context. If no context is available this method will return an empty namespace context. The NamespaceContext contains information about all namespaces in scope for this StartElement.

Returns:
the current namespace context

StartElement.getNamespaceURI(java.lang.String) (New)

getNamespaceURI

java.lang.String getNamespaceURI(java.lang.String prefix)
Gets the value that the prefix is bound to in the context of this element. Returns null if the prefix is not bound in this context

Parameters:
prefix - the prefix to lookup
Returns:
the uri bound to the prefix or null

StartElement.getNamespaces() (New)

getNamespaces

java.util.Iterator getNamespaces()
Returns an Iterator of namespaces declared on this element. This Iterator does not contain previously declared namespaces unless they appear on the current START_ELEMENT. Therefore this list may contain redeclared namespaces and duplicate namespace declarations. Use the getNamespaceContext() method to get the current context of namespace declarations.

The iterator must contain only implementations of the javax.xml.stream.Namespace interface.

A Namespace isA Attribute. One can iterate over a list of namespaces as a list of attributes. However this method returns only the list of namespaces declared on this START_ELEMENT and does not include the attributes declared on this START_ELEMENT. Returns an empty iterator if there are no namespaces.

Returns:
a readonly Iterator over Namespace interfaces, or an empty iterator

javax.xml.stream.events.XMLEvent (New) (16 methods)

CLASS_COMMENT
asCharacters()
asEndElement()
asStartElement()
getEventType()
getLocation()
getSchemaType()
isAttribute()
isCharacters()
isEndDocument()
isEndElement()
isEntityReference()
isNamespace()
isProcessingInstruction()
isStartDocument()
isStartElement()
writeAsEncodedUnicode(java.io.Writer)

XMLEvent.CLASS_COMMENT (New)

public interface XMLEvent
extends XMLStreamConstants

This is the base event interface for handling markup events. Events are value objects that are used to communicate the XML 1.0 InfoSet to the Application. Events may be cached and referenced after the parse has completed.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLEventReader, Characters, ProcessingInstruction, StartElement, EndElement, StartDocument, EndDocument, EntityReference, EntityDeclaration, NotationDeclaration

XMLEvent.asCharacters() (New)

asCharacters

Characters asCharacters()
Returns this event as Characters, may result in a class cast exception if this event is not Characters.

XMLEvent.asEndElement() (New)

asEndElement

EndElement asEndElement()
Returns this event as an end element event, may result in a class cast exception if this event is not a end element.

XMLEvent.asStartElement() (New)

asStartElement

StartElement asStartElement()
Returns this event as a start element event, may result in a class cast exception if this event is not a start element.

XMLEvent.getEventType() (New)

getEventType

int getEventType()
Returns an integer code for this event.

See Also:
XMLStreamConstants.START_ELEMENT, XMLStreamConstants.END_ELEMENT, XMLStreamConstants.CHARACTERS, XMLStreamConstants.ATTRIBUTE, XMLStreamConstants.NAMESPACE, XMLStreamConstants.PROCESSING_INSTRUCTION, XMLStreamConstants.COMMENT, XMLStreamConstants.START_DOCUMENT, XMLStreamConstants.END_DOCUMENT, XMLStreamConstants.DTD

XMLEvent.getLocation() (New)

getLocation

Location getLocation()
Return the location of this event. The Location returned from this method is non-volatile and will retain its information.

See Also:
Location

XMLEvent.getSchemaType() (New)

getSchemaType

QName getSchemaType()
This method is provided for implementations to provide optional type information about the associated event. It is optional and will return null if no information is available.

XMLEvent.isAttribute() (New)

isAttribute

boolean isAttribute()
A utility function to check if this event is an Attribute.

See Also:
Attribute

XMLEvent.isCharacters() (New)

isCharacters

boolean isCharacters()
A utility function to check if this event is Characters.

See Also:
Characters

XMLEvent.isEndDocument() (New)

isEndDocument

boolean isEndDocument()
A utility function to check if this event is an EndDocument.

See Also:
EndDocument

XMLEvent.isEndElement() (New)

isEndElement

boolean isEndElement()
A utility function to check if this event is a EndElement.

See Also:
EndElement

XMLEvent.isEntityReference() (New)

isEntityReference

boolean isEntityReference()
A utility function to check if this event is an EntityReference.

See Also:
EntityReference

XMLEvent.isNamespace() (New)

isNamespace

boolean isNamespace()
A utility function to check if this event is a Namespace.

See Also:
Namespace

XMLEvent.isProcessingInstruction() (New)

isProcessingInstruction

boolean isProcessingInstruction()
A utility function to check if this event is a ProcessingInstruction.

See Also:
ProcessingInstruction

XMLEvent.isStartDocument() (New)

isStartDocument

boolean isStartDocument()
A utility function to check if this event is a StartDocument.

See Also:
StartDocument

XMLEvent.isStartElement() (New)

isStartElement

boolean isStartElement()
A utility function to check if this event is a StartElement.

See Also:
StartElement

XMLEvent.writeAsEncodedUnicode(java.io.Writer) (New)

writeAsEncodedUnicode

void writeAsEncodedUnicode(java.io.Writer writer)
                           throws XMLStreamException
This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters. No indentation or whitespace should be outputted. Any user defined event type SHALL have this method called when being written to on an output stream. Built in Event types MUST implement this method, but implementations MAY choose not call these methods for optimizations reasons when writing out built in Events to an output stream. The output generated MUST be equivalent in terms of the infoset expressed.

Parameters:
writer - The writer that will output the data
Throws:
XMLStreamException - if there is a fatal error writing the event

javax.xml.stream.util.EventReaderDelegate (New) (13 methods)

CLASS_COMMENT
EventReaderDelegate()
EventReaderDelegate(javax.xml.stream.XMLEventReader)
close()
getElementText()
getParent()
getProperty(java.lang.String)
hasNext()
next()
nextEvent()
nextTag()
peek()
remove()
setParent(javax.xml.stream.XMLEventReader)

EventReaderDelegate.CLASS_COMMENT (New)

public class EventReaderDelegate
extends java.lang.Object
implements XMLEventReader

This is the base class for deriving an XMLEventReader filter. This class is designed to sit between an XMLEventReader and an application's XMLEventReader. By default each method does nothing but call the corresponding method on the parent interface.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLEventReader, StreamReaderDelegate

EventReaderDelegate.EventReaderDelegate() (New)

EventReaderDelegate

public EventReaderDelegate()
Construct an empty filter with no parent.

EventReaderDelegate.EventReaderDelegate(javax.xml.stream.XMLEventReader) (New)

EventReaderDelegate

public EventReaderDelegate(XMLEventReader reader)
Construct an filter with the specified parent.

Parameters:
reader - the parent

EventReaderDelegate.close() (New)

close

public void close()
           throws XMLStreamException
Description copied from interface: XMLEventReader
Frees any resources associated with this Reader. This method does not close the underlying input source.

Specified by:
close in interface XMLEventReader
Throws:
XMLStreamException - if there are errors freeing associated resources

EventReaderDelegate.getElementText() (New)

getElementText

public java.lang.String getElementText()
                                throws XMLStreamException
Description copied from interface: XMLEventReader
Reads the content of a text-only element. Precondition: the current event is START_ELEMENT. Postcondition: The current event is the corresponding END_ELEMENT.

Specified by:
getElementText in interface XMLEventReader
Throws:
XMLStreamException - if the current event is not a START_ELEMENT or if a non text element is encountered

EventReaderDelegate.getParent() (New)

getParent

public XMLEventReader getParent()
Get the parent of this instance.

Returns:
the parent or null if none is set

EventReaderDelegate.getProperty(java.lang.String) (New)

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws java.lang.IllegalArgumentException
Description copied from interface: XMLEventReader
Get the value of a feature/property from the underlying implementation

Specified by:
getProperty in interface XMLEventReader
Parameters:
name - The name of the property
Returns:
The value of the property
Throws:
java.lang.IllegalArgumentException - if the property is not supported

EventReaderDelegate.hasNext() (New)

hasNext

public boolean hasNext()
Description copied from interface: XMLEventReader
Check if there are more events. Returns true if there are more events and false otherwise.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in interface XMLEventReader
Returns:
true if the event reader has more events, false otherwise

EventReaderDelegate.next() (New)

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

EventReaderDelegate.nextEvent() (New)

nextEvent

public XMLEvent nextEvent()
                   throws XMLStreamException
Description copied from interface: XMLEventReader
Get the next XMLEvent

Specified by:
nextEvent in interface XMLEventReader
Throws:
XMLStreamException - if there is an error with the underlying XML.
See Also:
XMLEvent

EventReaderDelegate.nextTag() (New)

nextTag

public XMLEvent nextTag()
                 throws XMLStreamException
Description copied from interface: XMLEventReader
Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached. If anything other than space characters are encountered, an exception is thrown. This method should be used when processing element-only content because the parser is not able to recognize ignorable whitespace if the DTD is missing or not interpreted.

Specified by:
nextTag in interface XMLEventReader
Throws:
XMLStreamException - if anything other than space characters are encountered

EventReaderDelegate.peek() (New)

peek

public XMLEvent peek()
              throws XMLStreamException
Description copied from interface: XMLEventReader
Check the next XMLEvent without reading it from the stream. Returns null if the stream is at EOF or has no more XMLEvents. A call to peek() will be equal to the next return of next().

Specified by:
peek in interface XMLEventReader
Throws:
XMLStreamException
See Also:
XMLEvent

EventReaderDelegate.remove() (New)

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

EventReaderDelegate.setParent(javax.xml.stream.XMLEventReader) (New)

setParent

public void setParent(XMLEventReader reader)
Set the parent of this instance.

Parameters:
reader - the new parent

javax.xml.stream.util.StreamReaderDelegate (New) (49 methods)

CLASS_COMMENT
StreamReaderDelegate()
StreamReaderDelegate(javax.xml.stream.XMLStreamReader)
close()
getAttributeCount()
getAttributeLocalName(int)
getAttributeName(int)
getAttributeNamespace(int)
getAttributePrefix(int)
getAttributeType(int)
getAttributeValue(int)
getAttributeValue(java.lang.String, java.lang.String)
getCharacterEncodingScheme()
getElementText()
getEncoding()
getEventType()
getLocalName()
getLocation()
getName()
getNamespaceContext()
getNamespaceCount()
getNamespacePrefix(int)
getNamespaceURI()
getNamespaceURI(int)
getNamespaceURI(java.lang.String)
getPIData()
getPITarget()
getParent()
getPrefix()
getProperty(java.lang.String)
getText()
getTextCharacters()
getTextCharacters(int, char[], int, int)
getTextLength()
getTextStart()
getVersion()
hasName()
hasNext()
hasText()
isAttributeSpecified(int)
isCharacters()
isEndElement()
isStandalone()
isStartElement()
isWhiteSpace()
next()
nextTag()
require(int, java.lang.String, java.lang.String)
setParent(javax.xml.stream.XMLStreamReader)
standaloneSet()

StreamReaderDelegate.CLASS_COMMENT (New)

public class StreamReaderDelegate
extends java.lang.Object
implements XMLStreamReader

This is the base class for deriving an XMLStreamReader filter This class is designed to sit between an XMLStreamReader and an application's XMLStreamReader. By default each method does nothing but call the corresponding method on the parent interface.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLStreamReader, EventReaderDelegate

StreamReaderDelegate.StreamReaderDelegate() (New)

StreamReaderDelegate

public StreamReaderDelegate()
Construct an empty filter with no parent.

StreamReaderDelegate.StreamReaderDelegate(javax.xml.stream.XMLStreamReader) (New)

StreamReaderDelegate

public StreamReaderDelegate(XMLStreamReader reader)
Construct an filter with the specified parent.

Parameters:
reader - the parent

StreamReaderDelegate.close() (New)

close

public void close()
           throws XMLStreamException
Description copied from interface: XMLStreamReader
Frees any resources associated with this Reader. This method does not close the underlying input source.

Specified by:
close in interface XMLStreamReader
Throws:
XMLStreamException - if there are errors freeing associated resources

StreamReaderDelegate.getAttributeCount() (New)

getAttributeCount

public int getAttributeCount()
Description copied from interface: XMLStreamReader
Returns the count of attributes on this START_ELEMENT, this method is only valid on a START_ELEMENT or ATTRIBUTE. This count excludes namespace definitions. Attribute indices are zero-based.

Specified by:
getAttributeCount in interface XMLStreamReader
Returns:
returns the number of attributes

StreamReaderDelegate.getAttributeLocalName(int) (New)

getAttributeLocalName

public java.lang.String getAttributeLocalName(int index)
Description copied from interface: XMLStreamReader
Returns the localName of the attribute at the provided index

Specified by:
getAttributeLocalName in interface XMLStreamReader
Parameters:
index - the position of the attribute
Returns:
the localName of the attribute

StreamReaderDelegate.getAttributeName(int) (New)

getAttributeName

public QName getAttributeName(int index)
Description copied from interface: XMLStreamReader
Returns the qname of the attribute at the provided index

Specified by:
getAttributeName in interface XMLStreamReader
Parameters:
index - the position of the attribute
Returns:
the QName of the attribute

StreamReaderDelegate.getAttributeNamespace(int) (New)

getAttributeNamespace

public java.lang.String getAttributeNamespace(int index)
Description copied from interface: XMLStreamReader
Returns the namespace of the attribute at the provided index

Specified by:
getAttributeNamespace in interface XMLStreamReader
Parameters:
index - the position of the attribute
Returns:
the namespace URI (can be null)

StreamReaderDelegate.getAttributePrefix(int) (New)

getAttributePrefix

public java.lang.String getAttributePrefix(int index)
Description copied from interface: XMLStreamReader
Returns the prefix of this attribute at the provided index

Specified by:
getAttributePrefix in interface XMLStreamReader
Parameters:
index - the position of the attribute
Returns:
the prefix of the attribute

StreamReaderDelegate.getAttributeType(int) (New)

getAttributeType

public java.lang.String getAttributeType(int index)
Description copied from interface: XMLStreamReader
Returns the XML type of the attribute at the provided index

Specified by:
getAttributeType in interface XMLStreamReader
Parameters:
index - the position of the attribute
Returns:
the XML type of the attribute

StreamReaderDelegate.getAttributeValue(int) (New)

getAttributeValue

public java.lang.String getAttributeValue(int index)
Description copied from interface: XMLStreamReader
Returns the value of the attribute at the index

Specified by:
getAttributeValue in interface XMLStreamReader
Parameters:
index - the position of the attribute
Returns:
the attribute value

StreamReaderDelegate.getAttributeValue(java.lang.String, java.lang.String) (New)

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String namespaceUri,
                                          java.lang.String localName)
Description copied from interface: XMLStreamReader
Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality

Specified by:
getAttributeValue in interface XMLStreamReader
Parameters:
namespaceUri - the namespace of the attribute
localName - the local name of the attribute, cannot be null
Returns:
returns the value of the attribute , returns null if not found

StreamReaderDelegate.getCharacterEncodingScheme() (New)

getCharacterEncodingScheme

public java.lang.String getCharacterEncodingScheme()
Description copied from interface: XMLStreamReader
Returns the character encoding declared on the xml declaration Returns null if none was declared

Specified by:
getCharacterEncodingScheme in interface XMLStreamReader
Returns:
the encoding declared in the document or null

StreamReaderDelegate.getElementText() (New)

getElementText

public java.lang.String getElementText()
                                throws XMLStreamException
Description copied from interface: XMLStreamReader
Reads the content of a text-only element, an exception is thrown if this is not a text-only element. Regardless of value of javax.xml.stream.isCoalescing this method always returns coalesced content.
Precondition: the current event is START_ELEMENT.
Postcondition: the current event is the corresponding END_ELEMENT.
The method does the following (implementations are free to optimized but must do equivalent processing):
 if(getEventType() != XMLStreamConstants.START_ELEMENT) {
 throw new XMLStreamException(
 "parser must be on START_ELEMENT to read next text", getLocation());
 }
 int eventType = next();
 StringBuffer content = new StringBuffer();
 while(eventType != XMLStreamConstants.END_ELEMENT ) {
 if(eventType == XMLStreamConstants.CHARACTERS
 || eventType == XMLStreamConstants.CDATA
 || eventType == XMLStreamConstants.SPACE
 || eventType == XMLStreamConstants.ENTITY_REFERENCE) {
 buf.append(getText());
 } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
 || eventType == XMLStreamConstants.COMMENT) {
 // skipping
 } else if(eventType == XMLStreamConstants.END_DOCUMENT) {
 throw new XMLStreamException(
 "unexpected end of document when reading element text content", this);
 } else if(eventType == XMLStreamConstants.START_ELEMENT) {
 throw new XMLStreamException(
 "element text content may not contain START_ELEMENT", getLocation());
 } else {
 throw new XMLStreamException(
 "Unexpected event type "+eventType, getLocation());
 }
 eventType = next();
 }
 return buf.toString();
 

Specified by:
getElementText in interface XMLStreamReader
Throws:
XMLStreamException - if the current event is not a START_ELEMENT or if a non text element is encountered

StreamReaderDelegate.getEncoding() (New)

getEncoding

public java.lang.String getEncoding()
Description copied from interface: XMLStreamReader
Return input encoding if known or null if unknown.

Specified by:
getEncoding in interface XMLStreamReader
Returns:
the encoding of this instance or null

StreamReaderDelegate.getEventType() (New)

getEventType

public int getEventType()
Description copied from interface: XMLStreamReader
Returns an integer code that indicates the type of the event the cursor is pointing to.

Specified by:
getEventType in interface XMLStreamReader

StreamReaderDelegate.getLocalName() (New)

getLocalName

public java.lang.String getLocalName()
Description copied from interface: XMLStreamReader
Returns the (local) name of the current event. For START_ELEMENT or END_ELEMENT returns the (local) name of the current element. For ENTITY_REFERENCE it returns entity name. The current event must be START_ELEMENT or END_ELEMENT, or ENTITY_REFERENCE

Specified by:
getLocalName in interface XMLStreamReader
Returns:
the localName

StreamReaderDelegate.getLocation() (New)

getLocation

public Location getLocation()
Description copied from interface: XMLStreamReader
Return the current location of the processor. If the Location is unknown the processor should return an implementation of Location that returns -1 for the location and null for the publicId and systemId. The location information is only valid until next() is called.

Specified by:
getLocation in interface XMLStreamReader

StreamReaderDelegate.getName() (New)

getName

public QName getName()
Description copied from interface: XMLStreamReader
Returns a QName for the current START_ELEMENT or END_ELEMENT event

Specified by:
getName in interface XMLStreamReader
Returns:
the QName for the current START_ELEMENT or END_ELEMENT event

StreamReaderDelegate.getNamespaceContext() (New)

getNamespaceContext

public NamespaceContext getNamespaceContext()
Description copied from interface: XMLStreamReader
Returns a read only namespace context for the current position. The context is transient and only valid until a call to next() changes the state of the reader.

Specified by:
getNamespaceContext in interface XMLStreamReader
Returns:
return a namespace context

StreamReaderDelegate.getNamespaceCount() (New)

getNamespaceCount

public int getNamespaceCount()
Description copied from interface: XMLStreamReader
Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT, this method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE. On an END_ELEMENT the count is of the namespaces that are about to go out of scope. This is the equivalent of the information reported by SAX callback for an end element event.

Specified by:
getNamespaceCount in interface XMLStreamReader
Returns:
returns the number of namespace declarations on this specific element

StreamReaderDelegate.getNamespacePrefix(int) (New)

getNamespacePrefix

public java.lang.String getNamespacePrefix(int index)
Description copied from interface: XMLStreamReader
Returns the prefix for the namespace declared at the index. Returns null if this is the default namespace declaration

Specified by:
getNamespacePrefix in interface XMLStreamReader
Parameters:
index - the position of the namespace declaration
Returns:
returns the namespace prefix

StreamReaderDelegate.getNamespaceURI() (New)

getNamespaceURI

public java.lang.String getNamespaceURI()
Description copied from interface: XMLStreamReader
If the current event is a START_ELEMENT or END_ELEMENT this method returns the URI of the prefix or the default namespace. Returns null if the event does not have a prefix.

Specified by:
getNamespaceURI in interface XMLStreamReader
Returns:
the URI bound to this elements prefix, the default namespace, or null

StreamReaderDelegate.getNamespaceURI(int) (New)

getNamespaceURI

public java.lang.String getNamespaceURI(int index)
Description copied from interface: XMLStreamReader
Returns the uri for the namespace declared at the index.

Specified by:
getNamespaceURI in interface XMLStreamReader
Parameters:
index - the position of the namespace declaration
Returns:
returns the namespace uri

StreamReaderDelegate.getNamespaceURI(java.lang.String) (New)

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Description copied from interface: XMLStreamReader
Return the uri for the given prefix. The uri returned depends on the current state of the processor.

NOTE:The 'xml' prefix is bound as defined in Namespaces in XML specification to "http://www.w3.org/XML/1998/namespace".

NOTE: The 'xmlns' prefix must be resolved to following namespace http://www.w3.org/2000/xmlns/

Specified by:
getNamespaceURI in interface XMLStreamReader
Parameters:
prefix - The prefix to lookup, may not be null
Returns:
the uri bound to the given prefix or null if it is not bound

StreamReaderDelegate.getPIData() (New)

getPIData

public java.lang.String getPIData()
Description copied from interface: XMLStreamReader
Get the data section of a processing instruction

Specified by:
getPIData in interface XMLStreamReader
Returns:
the data or null

StreamReaderDelegate.getPITarget() (New)

getPITarget

public java.lang.String getPITarget()
Description copied from interface: XMLStreamReader
Get the target of a processing instruction

Specified by:
getPITarget in interface XMLStreamReader
Returns:
the target or null

StreamReaderDelegate.getParent() (New)

getParent

public XMLStreamReader getParent()
Get the parent of this instance.

Returns:
the parent or null if none is set

StreamReaderDelegate.getPrefix() (New)

getPrefix

public java.lang.String getPrefix()
Description copied from interface: XMLStreamReader
Returns the prefix of the current event or null if the event does not have a prefix

Specified by:
getPrefix in interface XMLStreamReader
Returns:
the prefix or null

StreamReaderDelegate.getProperty(java.lang.String) (New)

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from interface: XMLStreamReader
Get the value of a feature/property from the underlying implementation

Specified by:
getProperty in interface XMLStreamReader
Parameters:
name - The name of the property, may not be null
Returns:
The value of the property

StreamReaderDelegate.getText() (New)

getText

public java.lang.String getText()
Description copied from interface: XMLStreamReader
Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. If an ENTITY_REFERENCE has been resolved, any character data will be reported as CHARACTERS events.

Specified by:
getText in interface XMLStreamReader
Returns:
the current text or null

StreamReaderDelegate.getTextCharacters() (New)

getTextCharacters

public char[] getTextCharacters()
Description copied from interface: XMLStreamReader
Returns an array which contains the characters from this event. This array should be treated as read-only and transient. I.e. the array will contain the text characters until the XMLStreamReader moves on to the next event. Attempts to hold onto the character array beyond that time or modify the contents of the array are breaches of the contract for this interface.

Specified by:
getTextCharacters in interface XMLStreamReader
Returns:
the current text or an empty array

StreamReaderDelegate.getTextCharacters(int, char[], int, int) (New)

getTextCharacters

public int getTextCharacters(int sourceStart,
                             char[] target,
                             int targetStart,
                             int length)
                      throws XMLStreamException
Description copied from interface: XMLStreamReader
Gets the the text associated with a CHARACTERS, SPACE or CDATA event. Text starting a "sourceStart" is copied into "target" starting at "targetStart". Up to "length" characters are copied. The number of characters actually copied is returned. The "sourceStart" argument must be greater or equal to 0 and less than or equal to the number of characters associated with the event. Usually, one requests text starting at a "sourceStart" of 0. If the number of characters actually copied is less than the "length", then there is no more text. Otherwise, subsequent calls need to be made until all text has been retrieved. For example: int length = 1024; char[] myBuffer = new char[ length ]; for ( int sourceStart = 0 ; ; sourceStart += length ) { int nCopied = stream.getTextCharacters( sourceStart, myBuffer, 0, length ); if (nCopied < length) break; } XMLStreamException may be thrown if there are any XML errors in the underlying source. The "targetStart" argument must be greater than or equal to 0 and less than the length of "target", Length must be greater than 0 and "targetStart + length" must be less than or equal to length of "target".

Specified by:
getTextCharacters in interface XMLStreamReader
Parameters:
sourceStart - the index of the first character in the source array to copy
target - the destination array
targetStart - the start offset in the target array
length - the number of characters to copy
Returns:
the number of characters actually copied
Throws:
XMLStreamException - if the underlying XML source is not well-formed

StreamReaderDelegate.getTextLength() (New)

getTextLength

public int getTextLength()
Description copied from interface: XMLStreamReader
Returns the length of the sequence of characters for this Text event within the text character array.

Specified by:
getTextLength in interface XMLStreamReader

StreamReaderDelegate.getTextStart() (New)

getTextStart

public int getTextStart()
Description copied from interface: XMLStreamReader
Returns the offset into the text character array where the first character (of this text event) is stored.

Specified by:
getTextStart in interface XMLStreamReader

StreamReaderDelegate.getVersion() (New)

getVersion

public java.lang.String getVersion()
Description copied from interface: XMLStreamReader
Get the xml version declared on the xml declaration Returns null if none was declared

Specified by:
getVersion in interface XMLStreamReader
Returns:
the XML version or null

StreamReaderDelegate.hasName() (New)

hasName

public boolean hasName()
Description copied from interface: XMLStreamReader
returns true if the current event has a name (is a START_ELEMENT or END_ELEMENT) returns false otherwise

Specified by:
hasName in interface XMLStreamReader

StreamReaderDelegate.hasNext() (New)

hasNext

public boolean hasNext()
                throws XMLStreamException
Description copied from interface: XMLStreamReader
Returns true if there are more parsing events and false if there are no more events. This method will return false if the current state of the XMLStreamReader is END_DOCUMENT

Specified by:
hasNext in interface XMLStreamReader
Returns:
true if there are more events, false otherwise
Throws:
XMLStreamException - if there is a fatal error detecting the next state

StreamReaderDelegate.hasText() (New)

hasText

public boolean hasText()
Description copied from interface: XMLStreamReader
Return true if the current event has text, false otherwise The following events have text: CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT, SPACE

Specified by:
hasText in interface XMLStreamReader

StreamReaderDelegate.isAttributeSpecified(int) (New)

isAttributeSpecified

public boolean isAttributeSpecified(int index)
Description copied from interface: XMLStreamReader
Returns a boolean which indicates if this attribute was created by default

Specified by:
isAttributeSpecified in interface XMLStreamReader
Parameters:
index - the position of the attribute
Returns:
true if this is a default attribute

StreamReaderDelegate.isCharacters() (New)

isCharacters

public boolean isCharacters()
Description copied from interface: XMLStreamReader
Returns true if the cursor points to a character data event

Specified by:
isCharacters in interface XMLStreamReader
Returns:
true if the cursor points to character data, false otherwise

StreamReaderDelegate.isEndElement() (New)

isEndElement

public boolean isEndElement()
Description copied from interface: XMLStreamReader
Returns true if the cursor points to an end tag (otherwise false)

Specified by:
isEndElement in interface XMLStreamReader
Returns:
true if the cursor points to an end tag, false otherwise

StreamReaderDelegate.isStandalone() (New)

isStandalone

public boolean isStandalone()
Description copied from interface: XMLStreamReader
Get the standalone declaration from the xml declaration

Specified by:
isStandalone in interface XMLStreamReader
Returns:
true if this is standalone, or false otherwise

StreamReaderDelegate.isStartElement() (New)

isStartElement

public boolean isStartElement()
Description copied from interface: XMLStreamReader
Returns true if the cursor points to a start tag (otherwise false)

Specified by:
isStartElement in interface XMLStreamReader
Returns:
true if the cursor points to a start tag, false otherwise

StreamReaderDelegate.isWhiteSpace() (New)

isWhiteSpace

public boolean isWhiteSpace()
Description copied from interface: XMLStreamReader
Returns true if the cursor points to a character data event that consists of all whitespace

Specified by:
isWhiteSpace in interface XMLStreamReader
Returns:
true if the cursor points to all whitespace, false otherwise

StreamReaderDelegate.next() (New)

next

public int next()
         throws XMLStreamException
Description copied from interface: XMLStreamReader
Get next parsing event - a processor may return all contiguous character data in a single chunk, or it may split it into several chunks. If the property javax.xml.stream.isCoalescing is set to true element content must be coalesced and only one CHARACTERS event must be returned for contiguous element content or CDATA Sections. By default entity references must be expanded and reported transparently to the application. An exception will be thrown if an entity reference cannot be expanded. If element content is empty (i.e. content is "") then no CHARACTERS event will be reported.

Given the following XML:
<foo><!--description-->content text<![CDATA[<greeting>Hello</greeting>]]>other content</foo>
The behavior of calling next() when being on foo will be:
1- the comment (COMMENT)
2- then the characters section (CHARACTERS)
3- then the CDATA section (another CHARACTERS)
4- then the next characters section (another CHARACTERS)
5- then the END_ELEMENT

NOTE: empty element (such as <tag/>) will be reported with two separate events: START_ELEMENT, END_ELEMENT - This preserves parsing equivalency of empty element to <tag></tag>. This method will throw an IllegalStateException if it is called after hasNext() returns false.

Specified by:
next in interface XMLStreamReader
Returns:
the integer code corresponding to the current parse event
Throws:
XMLStreamException - if there is an error processing the underlying XML source
See Also:
XMLEvent

StreamReaderDelegate.nextTag() (New)

nextTag

public int nextTag()
            throws XMLStreamException
Description copied from interface: XMLStreamReader
Skips any white space (isWhiteSpace() returns true), COMMENT, or PROCESSING_INSTRUCTION, until a START_ELEMENT or END_ELEMENT is reached. If other than white space characters, COMMENT, PROCESSING_INSTRUCTION, START_ELEMENT, END_ELEMENT are encountered, an exception is thrown. This method should be used when processing element-only content seperated by white space.
Precondition: none
Postcondition: the current event is START_ELEMENT or END_ELEMENT and cursor may have moved over any whitespace event.
Essentially it does the following (implementations are free to optimized but must do equivalent processing):
 int eventType = next();
 while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
 || (eventType == XMLStreamConstants.CDATA && isWhiteSpace()) 
 // skip whitespace
 || eventType == XMLStreamConstants.SPACE
 || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
 || eventType == XMLStreamConstants.COMMENT
 ) {
 eventType = next();
 }
 if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
 throw new String XMLStreamException("expected start or end tag", getLocation());
 }
 return eventType;
 

Specified by:
nextTag in interface XMLStreamReader
Returns:
the event type of the element read (START_ELEMENT or END_ELEMENT)
Throws:
XMLStreamException - if the current event is not white space, PROCESSING_INSTRUCTION, START_ELEMENT or END_ELEMENT

StreamReaderDelegate.require(int, java.lang.String, java.lang.String) (New)

require

public void require(int type,
                    java.lang.String namespaceURI,
                    java.lang.String localName)
             throws XMLStreamException
Description copied from interface: XMLStreamReader
Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event. If the namespaceURI is null it is not checked for equality, if the localName is null it is not checked for equality.

Specified by:
require in interface XMLStreamReader
Parameters:
type - the event type
namespaceURI - the uri of the event, may be null
localName - the localName of the event, may be null
Throws:
XMLStreamException - if the required values are not matched.

StreamReaderDelegate.setParent(javax.xml.stream.XMLStreamReader) (New)

setParent

public void setParent(XMLStreamReader reader)
Set the parent of this instance.

Parameters:
reader - the new parent

StreamReaderDelegate.standaloneSet() (New)

standaloneSet

public boolean standaloneSet()
Description copied from interface: XMLStreamReader
Checks if standalone was set in the document

Specified by:
standaloneSet in interface XMLStreamReader
Returns:
true if standalone was set in the document, or false otherwise

javax.xml.stream.util.XMLEventAllocator (New) (3 methods)

CLASS_COMMENT
allocate(javax.xml.stream.XMLStreamReader)
allocate(javax.xml.stream.XMLStreamReader, javax.xml.stream.util.XMLEventConsumer)
newInstance()

XMLEventAllocator.CLASS_COMMENT (New)

public interface XMLEventAllocator

This interface defines a class that allows a user to register a way to allocate events given an XMLStreamReader. An implementation is not required to use the XMLEventFactory implementation but this is recommended. The XMLEventAllocator can be set on an XMLInputFactory using the property "javax.xml.stream.allocator"

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLInputFactory, XMLEventFactory

XMLEventAllocator.allocate(javax.xml.stream.XMLStreamReader) (New)

allocate

XMLEvent allocate(XMLStreamReader reader)
                  throws XMLStreamException
This method allocates an event given the current state of the XMLStreamReader. If this XMLEventAllocator does not have a one-to-one mapping between reader states and events this method will return null. This method must not modify the state of the XMLStreamReader.

Parameters:
reader - The XMLStreamReader to allocate from
Returns:
the event corresponding to the current reader state
Throws:
XMLStreamException

XMLEventAllocator.allocate(javax.xml.stream.XMLStreamReader, javax.xml.stream.util.XMLEventConsumer) (New)

allocate

void allocate(XMLStreamReader reader,
              XMLEventConsumer consumer)
              throws XMLStreamException
This method allocates an event or set of events given the current state of the XMLStreamReader and adds the event or set of events to the consumer that was passed in. This method can be used to expand or contract reader states into event states. This method may modify the state of the XMLStreamReader.

Parameters:
reader - The XMLStreamReader to allocate from
consumer - The XMLEventConsumer to add to.
Throws:
XMLStreamException

XMLEventAllocator.newInstance() (New)

newInstance

XMLEventAllocator newInstance()
This method creates an instance of the XMLEventAllocator. This allows the XMLInputFactory to allocate a new instance per reader.

javax.xml.stream.util.XMLEventConsumer (New) (1 method)

CLASS_COMMENT
add(javax.xml.stream.events.XMLEvent)

XMLEventConsumer.CLASS_COMMENT (New)

public interface XMLEventConsumer

This interface defines an event consumer interface. The contract of the of a consumer is to accept the event. This interface can be used to mark an object as able to receive events. Add may be called several times in immediate succession so a consumer must be able to cache events it hasn't processed yet.

Since:
6.0
Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.

XMLEventConsumer.add(javax.xml.stream.events.XMLEvent) (New)

add

void add(XMLEvent event)
         throws XMLStreamException
This method adds an event to the consumer. Calling this method invalidates the event parameter. The client application should discard all references to this event upon calling add. The behavior of an application that continues to use such references is undefined.

Parameters:
event - the event to add, may not be null
Throws:
XMLStreamException

javax.xml.transform.ErrorListener (1 method)

ErrorListener.fatalError(javax.xml.transform.TransformerException)

fatalError


void fatalError(TransformerException exception)
                throws TransformerException

Receive notification of a non-recoverable error.

The processor may choose to continue, but will not normally proceed to a successful completion. The Transformer must continue to try and provide normal transformation after invoking this method. It should still be possible for the application to process the document through to the end if no other errors are encountered, but there is no guarantee that the output will be useable.

The method should throw an exception if it is unable to process the error, or if it wishes execution to terminate immediately. The processor will not necessarily honor this request.

Parameters:
exception - The error information encapsulated in a TransformerException.
Throws:
TransformerException - if the application chooses to discontinue the transformation.
See Also:
TransformerException

fatalError

void fatalError(TransformerException exception)
                throws TransformerException

Receive notification of a non-recoverable error.

The Transformer must continue to try and provide normal transformation after invoking this method. It should still be possible for the application to process the document through to the end if no other errors are encountered, but there is no guarantee that the output will be useable.

Parameters:
exception - The error information encapsulated in a TransformerException.
Throws:
TransformerException - if the application chooses to discontinue the transformation.
See Also:
TransformerException

fatalError

void fatalError(TransformerException exception)
                throws TransformerException

Receive notification of a non-recoverable error.

The processor may choose to continue, but will not normally proceed to a successful completion.

The method should throw an exception if it is unable to process the error, or if it wishes execution to terminate immediately. The processor will not necessarily honor this request.

Parameters:
exception - The error information encapsulated in a TransformerException.
Throws:
TransformerException - if the application chooses to discontinue the transformation.
See Also:
TransformerException

javax.xml.transform.Transformer (1 method)

Transformer.getOutputProperty(java.lang.String)

getOutputProperty


public abstract java.lang.String getOutputProperty(java.lang.String name)
                                            throws java.lang.IllegalArgumentException

Get an output property that is in effect for the transformer.

The property specified may be a property that was set with setOutputProperty, or it may be a property specified in the stylesheet.

If a property has been set using setOutputProperty(java.lang.String, java.lang.String) , that value will be returned. Otherwise, if a property is explicitly specified in the stylesheet, that value will be returned. If the value of the property has been defaulted, that is, if no value has been set explicitly either with setOutputProperty(java.lang.String, java.lang.String) or in the stylesheet, the result may vary depending on implementation and input stylesheet.

Parameters:
name - A non-null String that specifies an output property name, which may be namespace qualified.
Returns:
The string value of the output property, or null if no property was found.
Throws:
java.lang.IllegalArgumentException - If the property is not supported.
See Also:
OutputKeys

getOutputProperty

public abstract java.lang.String getOutputProperty(java.lang.String name)
                                            throws java.lang.IllegalArgumentException
Get an output property that is in effect for the transformer. The property specified may be a property that was set with setOutputProperty, or it may be a property specified in the stylesheet.

Parameters:
name - A non-null String that specifies an output property name, which may be namespace qualified.
Returns:
The string value of the output property, or null if no property was found.
Throws:
java.lang.IllegalArgumentException - If the property is not supported.
See Also:
OutputKeys

getOutputProperty

public abstract java.lang.String getOutputProperty(java.lang.String name)
                                            throws java.lang.IllegalArgumentException

Get an output property that is in effect for the transformer.

If a property has been set using setOutputProperty(java.lang.String, java.lang.String), that value will be returned. Otherwise, if a property is explicitly specified in the stylesheet, that value will be returned. If the value of the property has been defaulted, that is, if no value has been set explicitly either with setOutputProperty(java.lang.String, java.lang.String) or in the stylesheet, the result may vary depending on implementation and input stylesheet.

Parameters:
name - A non-null String that specifies an output property name, which may be namespace qualified.
Returns:
The string value of the output property, or null if no property was found.
Throws:
java.lang.IllegalArgumentException - If the property is not supported.
See Also:
OutputKeys

javax.xml.transform.TransformerFactory (2 methods)

CLASS_COMMENT
newInstance()
newInstance(java.lang.String, java.lang.ClassLoader)

TransformerFactory.CLASS_COMMENT

public abstract class TransformerFactory
extends java.lang.Object

A TransformerFactory instance can be used to create Transformer and Templates objects.

The system property that determines which Factory implementation to create is named "javax.xml.transform.TransformerFactory". This property names a concrete subclass of the TransformerFactory abstract class. If the property is not defined, a platform default is be used.

Author:
Jeff Suttor , Neeraj Bajaj
public abstract class TransformerFactory
extends java.lang.Object

A TransformerFactory instance can be used to create Transformer and Templates objects.

The system property that determines which Factory implementation to create is named "javax.xml.transform.TransformerFactory". This property names a concrete subclass of the TransformerFactory abstract class. If the property is not defined, a platform default is be used.

Author:
Jeff Suttor
public abstract class TransformerFactory
extends java.lang.Object

A TransformerFactory instance can be used to create Transformer and Templates objects.

The system property that determines which Factory implementation to create is named "javax.xml.transform.TransformerFactory". This property names a concrete subclass of the TransformerFactory abstract class. If the property is not defined, a platform default is be used.

Author:
Jeff Suttor, Neeraj Bajaj

TransformerFactory.newInstance()

newInstance


public static TransformerFactory newInstance()
                                      throws TransformerFactoryConfigurationError

Obtain a new instance of a TransformerFactory. This static method creates a new factory instance This method uses the following ordered lookup procedure to determine the TransformerFactory implementation class to load:

  • Use the javax.xml.transform.TransformerFactory system property.
  • Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in jaxp.properties after it has been read for the first time.
  • Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.transform.TransformerFactory in jars available to the runtime.
  • Platform default TransformerFactory instance.

Once an application has obtained a reference to a TransformerFactory it can use the factory to configure and obtain transformer parser instances.

Returns:
new TransformerFactory instance, never null.
Throws:
TransformerFactoryConfigurationError - Thrown if the implementation is not available or cannot be instantiated.

newInstance

public static TransformerFactory newInstance()
                                      throws TransformerFactoryConfigurationError
Obtain a new instance of a TransformerFactory. This static method creates a new factory instance This method uses the following ordered lookup procedure to determine the TransformerFactory implementation class to load:
  • Use the javax.xml.transform.TransformerFactory system property.
  • Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in jaxp.properties after it has been read for the first time.
  • Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.transform.TransformerFactory in jars available to the runtime.
  • Platform default TransformerFactory instance.
Once an application has obtained a reference to a TransformerFactory it can use the factory to configure and obtain parser instances.

Returns:
new TransformerFactory instance, never null.
Throws:
TransformerFactoryConfigurationError - Thrown if the implementation is not available or cannot be instantiated.

newInstance

public static TransformerFactory newInstance()
                                      throws TransformerFactoryConfigurationError

Obtain a new instance of a TransformerFactory. This static method creates a new factory instance This method uses the following ordered lookup procedure to determine the TransformerFactory implementation class to load:

  • Use the javax.xml.transform.TransformerFactory system property.
  • Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in jaxp.properties after it has been read for the first time.
  • Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.transform.TransformerFactory in jars available to the runtime.
  • Platform default TransformerFactory instance.

Once an application has obtained a reference to a TransformerFactory it can use the factory to configure and obtain transformer instances.

Returns:
new TransformerFactory instance, never null.
Throws:
TransformerFactoryConfigurationError - Thrown if the implementation is not available or cannot be instantiated.

TransformerFactory.newInstance(java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static TransformerFactory newInstance(java.lang.String factoryClassName,
                                             java.lang.ClassLoader classLoader)
                                      throws TransformerFactoryConfigurationError

Obtain a new instance of a TransformerFactory from factory class name. This function is useful when there are multiple providers in the classpath. It gives more control to the application as it can specify which provider should be loaded.

Once an application has obtained a reference to a TransformerFactory it can use the factory to configure and obtain transformer instances.

Tip for Trouble-shooting

Setting the jaxp.debug system property will cause this method to print a lot of debug messages to System.err about what it is doing and where it is looking at.

If you have problems try:

 java -Djaxp.debug=1 YourProgram ....
 

Parameters:
factoryClassName - fully qualified factory class name that provides implementation of javax.xml.transform.TransformerFactory.
classLoader - ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.
Returns:
new TransformerFactory instance, never null.
Throws:
TransformerFactoryConfigurationError - if factoryClassName is null, or the factory class cannot be loaded, instantiated.
See Also:
newInstance()

javax.xml.transform.stax.StAXResult (New) (6 methods)

CLASS_COMMENT
StAXResult(javax.xml.stream.XMLEventWriter)
StAXResult(javax.xml.stream.XMLStreamWriter)
getSystemId()
getXMLEventWriter()
getXMLStreamWriter()
setSystemId(java.lang.String)

StAXResult.CLASS_COMMENT (New)

public class StAXResult
extends java.lang.Object
implements Result

Acts as a holder for an XML Result in the form of a StAX writer,i.e. XMLStreamWriter or XMLEventWriter. StAXResult can be used in all cases that accept a Result, e.g. Transformer, Validator which accept Result as input.

Since:
6.0
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Neeraj Bajaj, Jeff Suttor
See Also:
JSR 173: Streaming API for XML, XMLStreamWriter, XMLEventWriter

StAXResult.StAXResult(javax.xml.stream.XMLEventWriter) (New)

StAXResult

public StAXResult(XMLEventWriter xmlEventWriter)

Creates a new instance of a StAXResult by supplying an XMLEventWriter.

XMLEventWriter must be a non-null reference.

Parameters:
xmlEventWriter - XMLEventWriter used to create this StAXResult.
Throws:
java.lang.IllegalArgumentException - If xmlEventWriter == null.

StAXResult.StAXResult(javax.xml.stream.XMLStreamWriter) (New)

StAXResult

public StAXResult(XMLStreamWriter xmlStreamWriter)

Creates a new instance of a StAXResult by supplying an XMLStreamWriter.

XMLStreamWriter must be a non-null reference.

Parameters:
xmlStreamWriter - XMLStreamWriter used to create this StAXResult.
Throws:
java.lang.IllegalArgumentException - If xmlStreamWriter == null.

StAXResult.getSystemId() (New)

getSystemId

public java.lang.String getSystemId()

The returned system identifier is always null.

Specified by:
getSystemId in interface Result
Returns:
The returned system identifier is always null.

StAXResult.getXMLEventWriter() (New)

getXMLEventWriter

public XMLEventWriter getXMLEventWriter()

Get the XMLEventWriter used by this StAXResult.

XMLEventWriter will be null if this StAXResult was created with a XMLStreamWriter.

Returns:
XMLEventWriter used by this StAXResult.

StAXResult.getXMLStreamWriter() (New)

getXMLStreamWriter

public XMLStreamWriter getXMLStreamWriter()

Get the XMLStreamWriter used by this StAXResult.

XMLStreamWriter will be null if this StAXResult was created with a XMLEventWriter.

Returns:
XMLStreamWriter used by this StAXResult.

StAXResult.setSystemId(java.lang.String) (New)

setSystemId

public void setSystemId(java.lang.String systemId)

In the context of a StAXResult, it is not appropriate to explicitly set the system identifier. The XMLEventWriter or XMLStreamWriter use to construct this StAXResult determines the system identifier of the XML result.

An UnsupportedOperationException is always thrown by this method.

Specified by:
setSystemId in interface Result
Parameters:
systemId - Ignored.
Throws:
java.lang.UnsupportedOperationException - Is always thrown by this method.

javax.xml.transform.stax.StAXSource (New) (6 methods)

CLASS_COMMENT
StAXSource(javax.xml.stream.XMLEventReader)
StAXSource(javax.xml.stream.XMLStreamReader)
getSystemId()
getXMLEventReader()
getXMLStreamReader()
setSystemId(java.lang.String)

StAXSource.CLASS_COMMENT (New)

public class StAXSource
extends java.lang.Object
implements Source

Acts as a holder for an XML Source in the form of a StAX reader,i.e. XMLStreamReader or XMLEventReader. StAXSource can be used in all cases that accept a Source, e.g. Transformer, Validator which accept Source as input.

StAXSources are consumed during processing and are not reusable.

Since:
6.0
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Neeraj Bajaj, Jeff Suttor
See Also:
JSR 173: Streaming API for XML, XMLStreamReader, XMLEventReader

StAXSource.StAXSource(javax.xml.stream.XMLEventReader) (New)

StAXSource

public StAXSource(XMLEventReader xmlEventReader)
           throws XMLStreamException

Creates a new instance of a StAXSource by supplying an XMLEventReader.

XMLEventReader must be a non-null reference.

XMLEventReader must be in XMLStreamConstants.START_DOCUMENT or XMLStreamConstants.START_ELEMENT state.

Parameters:
xmlEventReader - XMLEventReader used to create this StAXSource.
Throws:
XMLStreamException - If xmlEventReader access throws an Exception.
java.lang.IllegalArgumentException - If xmlEventReader == null.
java.lang.IllegalStateException - If xmlEventReader is not in XMLStreamConstants.START_DOCUMENT or XMLStreamConstants.START_ELEMENT state.

StAXSource.StAXSource(javax.xml.stream.XMLStreamReader) (New)

StAXSource

public StAXSource(XMLStreamReader xmlStreamReader)

Creates a new instance of a StAXSource by supplying an XMLStreamReader.

XMLStreamReader must be a non-null reference.

XMLStreamReader must be in XMLStreamConstants.START_DOCUMENT or XMLStreamConstants.START_ELEMENT state.

Parameters:
xmlStreamReader - XMLStreamReader used to create this StAXSource.
Throws:
java.lang.IllegalArgumentException - If xmlStreamReader == null.
java.lang.IllegalStateException - If xmlStreamReader is not in XMLStreamConstants.START_DOCUMENT or XMLStreamConstants.START_ELEMENT state.

StAXSource.getSystemId() (New)

getSystemId

public java.lang.String getSystemId()

Get the system identifier used by this StAXSource.

The XMLStreamReader or XMLEventReader used to construct this StAXSource is queried to determine the system identifier of the XML source.

The system identifier may be null or an empty "" String.

Specified by:
getSystemId in interface Source
Returns:
System identifier used by this StAXSource.

StAXSource.getXMLEventReader() (New)

getXMLEventReader

public XMLEventReader getXMLEventReader()

Get the XMLEventReader used by this StAXSource.

XMLEventReader will be null. if this StAXSource was created with a XMLStreamReader.

Returns:
XMLEventReader used by this StAXSource.

StAXSource.getXMLStreamReader() (New)

getXMLStreamReader

public XMLStreamReader getXMLStreamReader()

Get the XMLStreamReader used by this StAXSource.

XMLStreamReader will be null if this StAXSource was created with a XMLEventReader.

Returns:
XMLStreamReader used by this StAXSource.

StAXSource.setSystemId(java.lang.String) (New)

setSystemId

public void setSystemId(java.lang.String systemId)

In the context of a StAXSource, it is not appropriate to explicitly set the system identifier. The XMLStreamReader or XMLEventReader use to construct this StAXSource determines the system identifier of the XML source.

An UnsupportedOperationException is always thrown by this method.

Specified by:
setSystemId in interface Source
Parameters:
systemId - Ignored.
Throws:
java.lang.UnsupportedOperationException - Is always thrown by this method.

javax.xml.validation.Schema (2 methods)

newValidator()
newValidatorHandler()

Schema.newValidator()

newValidator


public abstract Validator newValidator()
Creates a new Validator for this Schema .

A validator enforces/checks the set of constraints this object represents.

Implementors should assure that the properties set on the SchemaFactory that created this Schema are also set on the Validator constructed.

Returns:
Always return a non-null valid object.

newValidator

public abstract Validator newValidator()
Creates a new Validator for this Schema.

A validator enforces/checks the set of constraints this object represents.

Returns:
Always return a non-null valid object.

newValidator

public abstract Validator newValidator()
Creates a new Validator for this Schema.

A validator enforces/checks the set of constraints this object represents.

Implementors should assure that the properties set on the SchemaFactory that created this Schema are also set on the Validator constructed.

Returns:
Always return a non-null valid object.

Schema.newValidatorHandler()

newValidatorHandler


public abstract ValidatorHandler newValidatorHandler()
Creates a new ValidatorHandler for this Schema .

Implementors should assure that the properties set on the SchemaFactory that created this Schema are also set on the ValidatorHandler constructed.

Returns:
Always return a non-null valid object.

newValidatorHandler

public abstract ValidatorHandler newValidatorHandler()
Creates a new ValidatorHandler for this Schema.

Returns:
Always return a non-null valid object.

newValidatorHandler

public abstract ValidatorHandler newValidatorHandler()
Creates a new ValidatorHandler for this Schema.

Implementors should assure that the properties set on the SchemaFactory that created this Schema are also set on the ValidatorHandler constructed.

Returns:
Always return a non-null valid object.

javax.xml.validation.SchemaFactory (5 methods)

CLASS_COMMENT
newInstance(java.lang.String)
newInstance(java.lang.String, java.lang.String, java.lang.ClassLoader)
newSchema()
newSchema(javax.xml.transform.Source[])
setFeature(java.lang.String, boolean)

SchemaFactory.CLASS_COMMENT

public abstract class SchemaFactory
extends java.lang.Object

Factory that creates Schema objects. Entry-point to the validation API.

SchemaFactory is a schema compiler. It reads external representations of schemas and prepares them for validation.

The SchemaFactory class is not thread-safe. In other words, it is the application's responsibility to ensure that at most one thread is using a SchemaFactory object at any given moment. Implementations are encouraged to mark methods as synchronized to protect themselves from broken clients.

SchemaFactory is not re-entrant. While one of the newSchema methods is being invoked, applications may not attempt to recursively invoke the newSchema method, even from the same thread.

Schema Language

This spec uses a namespace URI to designate a schema language. The following table shows the values defined by this specification.

To be compliant with the spec, the implementation is only required to support W3C XML Schema 1.0. However, if it chooses to support other schema languages listed here, it must conform to the relevant behaviors described in this spec.

Schema languages not listed here are expected to introduce their own URIs to represent themselves. The SchemaFactory class is capable of locating other implementations for other schema languages at run-time.

Note that because the XML DTD is strongly tied to the parsing process and has a significant effect on the parsing process, it is impossible to define the DTD validation as a process independent from parsing. For this reason, this specification does not define the semantics for the XML DTD. This doesn't prohibit implentors from implementing it in a way they see fit, but users are warned that any DTD validation implemented on this interface necessarily deviate from the XML DTD semantics as defined in the XML 1.0 .

value language
XMLConstants.W3C_XML_SCHEMA_NS_URI ("http://www.w3.org/2001/XMLSchema ") W3C XML Schema 1.0
XMLConstants.RELAXNG_NS_URI ("http://relaxng.org/ns/structure/1.0 ") RELAX NG 1.0

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi , Neeraj Bajaj
public abstract class SchemaFactory
extends java.lang.Object

Factory that creates Schema objects. Entry-point to the validation API.

SchemaFactory is a schema compiler. It reads external representations of schemas and prepares them for validation.

The SchemaFactory class is not thread-safe. In other words, it is the application's responsibility to ensure that at most one thread is using a SchemaFactory object at any given moment. Implementations are encouraged to mark methods as synchronized to protect themselves from broken clients.

SchemaFactory is not re-entrant. While one of the newSchema methods is being invoked, applications may not attempt to recursively invoke the newSchema method, even from the same thread.

Schema Language

This spec uses a namespace URI to designate a schema language. The following table shows the values defined by this specification.

To be compliant with the spec, the implementation is only required to support W3C XML Schema 1.0. However, if it chooses to support other schema languages listed here, it must conform to the relevant behaviors described in this spec.

Schema languages not listed here are expected to introduce their own URIs to represent themselves. The SchemaFactory class is capable of locating other implementations for other schema languages at run-time.

Note that because the XML DTD is strongly tied to the parsing process and has a significant effect on the parsing process, it is impossible to define the DTD validation as a process independent from parsing. For this reason, this specification does not define the semantics for the XML DTD. This doesn't prohibit implentors from implementing it in a way they see fit, but users are warned that any DTD validation implemented on this interface necessarily deviate from the XML DTD semantics as defined in the XML 1.0.

value language
XMLConstants.W3C_XML_SCHEMA_NS_URI ("http://www.w3.org/2001/XMLSchema") W3C XML Schema 1.0
XMLConstants.RELAXNG_NS_URI ("http://relaxng.org/ns/structure/1.0") RELAX NG 1.0

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi
public abstract class SchemaFactory
extends java.lang.Object

Factory that creates Schema objects. Entry-point to the validation API.

SchemaFactory is a schema compiler. It reads external representations of schemas and prepares them for validation.

The SchemaFactory class is not thread-safe. In other words, it is the application's responsibility to ensure that at most one thread is using a SchemaFactory object at any given moment. Implementations are encouraged to mark methods as synchronized to protect themselves from broken clients.

SchemaFactory is not re-entrant. While one of the newSchema methods is being invoked, applications may not attempt to recursively invoke the newSchema method, even from the same thread.

Schema Language

This spec uses a namespace URI to designate a schema language. The following table shows the values defined by this specification.

To be compliant with the spec, the implementation is only required to support W3C XML Schema 1.0. However, if it chooses to support other schema languages listed here, it must conform to the relevant behaviors described in this spec.

Schema languages not listed here are expected to introduce their own URIs to represent themselves. The SchemaFactory class is capable of locating other implementations for other schema languages at run-time.

Note that because the XML DTD is strongly tied to the parsing process and has a significant effect on the parsing process, it is impossible to define the DTD validation as a process independent from parsing. For this reason, this specification does not define the semantics for the XML DTD. This doesn't prohibit implentors from implementing it in a way they see fit, but users are warned that any DTD validation implemented on this interface necessarily deviate from the XML DTD semantics as defined in the XML 1.0.

value language
XMLConstants.W3C_XML_SCHEMA_NS_URI ("http://www.w3.org/2001/XMLSchema") W3C XML Schema 1.0
XMLConstants.RELAXNG_NS_URI ("http://relaxng.org/ns/structure/1.0") RELAX NG 1.0

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi, Neeraj Bajaj

SchemaFactory.newInstance(java.lang.String)

newInstance


public static final SchemaFactory newInstance(java.lang.String schemaLanguage)

Lookup an implementation of the SchemaFactory that supports the specified schema language and return it.

To find a SchemaFactory object for a given schema language, this method looks the following places in the following order where "the class loader" refers to the context class loader:

  1. If the system property "javax.xml.validation.SchemaFactory: schemaLanguage " is present (where schemaLanguage is the parameter to this method), then its value is read as a class name. The method will try to create a new instance of this class by using the class loader, and returns it if it is successfully created.
  2. $java.home/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for. If present, the value is processed just like above.
  3. The class loader is asked for service provider provider-configuration files matching javax.xml.validation.SchemaFactory in the resource directory META-INF/services. See the JAR File Specification for file format and parsing rules. Each potential service provider is required to implement the method:

            isSchemaLanguageSupported(String schemaLanguage)
         
    The first service provider found in class loader order that supports the specified schema language is returned.
  4. Platform default SchemaFactory is located in a implementation specific way. There must be a platform default SchemaFactory for W3C XML Schema.

If everything fails, IllegalArgumentException will be thrown.

Tip for Trouble-shooting:

See Properties.load(java.io.InputStream) for exactly how a property file is parsed. In particular, colons ':' need to be escaped in a property file, so make sure schema language URIs are properly escaped in it. For example:

 http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory
 

Parameters:
schemaLanguage - Specifies the schema language which the returned SchemaFactory will understand. See the list of available schema languages for the possible values.
Returns:
New instance of a SchemaFactory
Throws:
java.lang.IllegalArgumentException - If no implementation of the schema language is available.
java.lang.NullPointerException - If the schemaLanguage schemLanguage parameter is null.
See Also:
newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader)

newInstance

public static final SchemaFactory newInstance(java.lang.String schemaLanguage)

Lookup an implementation of the SchemaFactory that supports the specified schema language and return it.

To find a SchemaFactory object for a given schema language, this method looks the following places in the following order where "the class loader" refers to the context class loader:

  1. If the system property "javax.xml.validation.SchemaFactory:schemaLanguage" is present (where schemaLanguage is the parameter to this method), then its value is read as a class name. The method will try to create a new instance of this class by using the class loader, and returns it if it is successfully created.
  2. $java.home/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for. If present, the value is processed just like above.
  3. The class loader is asked for service provider provider-configuration files matching javax.xml.validation.SchemaFactory in the resource directory META-INF/services. See the JAR File Specification for file format and parsing rules. Each potential service provider is required to implement the method:

            isSchemaLanguageSupported(String schemaLanguage)
         
    The first service provider found in class loader order that supports the specified schema language is returned.
  4. Platform default SchemaFactory is located in a implementation specific way. There must be a platform default SchemaFactory for W3C XML Schema.

If everything fails, IllegalArgumentException will be thrown.

Tip for Trouble-shooting:

See Properties.load(java.io.InputStream) for exactly how a property file is parsed. In particular, colons ':' need to be escaped in a property file, so make sure schema language URIs are properly escaped in it. For example:

 http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory
 

Parameters:
schemaLanguage - Specifies the schema language which the returned SchemaFactory will understand. See the list of available schema languages for the possible values.
Returns:
New instance of a SchemaFactory
Throws:
java.lang.IllegalArgumentException - If no implementation of the schema language is available.
java.lang.NullPointerException - If the schemLanguage parameter is null.

newInstance

public static final SchemaFactory newInstance(java.lang.String schemaLanguage)

Lookup an implementation of the SchemaFactory that supports the specified schema language and return it.

To find a SchemaFactory object for a given schema language, this method looks the following places in the following order where "the class loader" refers to the context class loader:

  1. If the system property "javax.xml.validation.SchemaFactory:schemaLanguage" is present (where schemaLanguage is the parameter to this method), then its value is read as a class name. The method will try to create a new instance of this class by using the class loader, and returns it if it is successfully created.
  2. $java.home/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for. If present, the value is processed just like above.
  3. The class loader is asked for service provider provider-configuration files matching javax.xml.validation.SchemaFactory in the resource directory META-INF/services. See the JAR File Specification for file format and parsing rules. Each potential service provider is required to implement the method:

            isSchemaLanguageSupported(String schemaLanguage)
         
    The first service provider found in class loader order that supports the specified schema language is returned.
  4. Platform default SchemaFactory is located in a implementation specific way. There must be a platform default SchemaFactory for W3C XML Schema.

If everything fails, IllegalArgumentException will be thrown.

Tip for Trouble-shooting:

See Properties.load(java.io.InputStream) for exactly how a property file is parsed. In particular, colons ':' need to be escaped in a property file, so make sure schema language URIs are properly escaped in it. For example:

 http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory
 

Parameters:
schemaLanguage - Specifies the schema language which the returned SchemaFactory will understand. See the list of available schema languages for the possible values.
Returns:
New instance of a SchemaFactory
Throws:
java.lang.IllegalArgumentException - If no implementation of the schema language is available.
java.lang.NullPointerException - If the schemaLanguage parameter is null.
See Also:
newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader)

SchemaFactory.newInstance(java.lang.String, java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static SchemaFactory newInstance(java.lang.String schemaLanguage,
                                        java.lang.String factoryClassName,
                                        java.lang.ClassLoader classLoader)

Obtain a new instance of a SchemaFactory from class name. SchemaFactory is returned if specified factory class name supports the specified schema language. This function is useful when there are multiple providers in the classpath. It gives more control to the application as it can specify which provider should be loaded.

Tip for Trouble-shooting

Setting the jaxp.debug system property will cause this method to print a lot of debug messages to System.err about what it is doing and where it is looking at.

If you have problems try:

 java -Djaxp.debug=1 YourProgram ....
 

Parameters:
schemaLanguage - Specifies the schema language which the returned SchemaFactory will understand. See the list of available schema languages for the possible values.
factoryClassName - fully qualified factory class name that provides implementation of javax.xml.validation.SchemaFactory.
classLoader - ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.
Returns:
New instance of a SchemaFactory
Throws:
java.lang.IllegalArgumentException - if factoryClassName is null, or the factory class cannot be loaded, instantiated or doesn't support the schema language specified in schemLanguage parameter.
java.lang.NullPointerException - If the schemaLanguage parameter is null.
See Also:
newInstance(String schemaLanguage)

SchemaFactory.newSchema()

newSchema


public abstract Schema newSchema()
                          throws SAXException
Creates a special Schema object.

The exact semantics of the returned Schema object depend depends on the schema language for which that this SchemaFactory is created. is created for.

Also, implementations are allowed to use implementation-specific property/feature to alter the semantics of this method.

Implementors and developers should pay particular attention to how the features set on this SchemaFactory are processed by this special Schema . In some cases, for example, when the SchemaFactory and the class actually loading the schema come from different implementations, it may not be possible for SchemaFactory features to be inherited automatically. Developers should make sure that features, such as secure processing, are explicitly set in both places.

W3C XML Schema 1.0

For XML Schema, this method creates a Schema object that performs validation by using location hints specified in documents.

The returned Schema object assumes that if documents refer to the same URL in the schema location hints, they will always resolve to the same schema document. This asusmption allows implementations to reuse parsed results of schema documents so that multiple validations against the same schema will run faster.

Note that the use of schema location hints introduces a vulnerability to denial-of-service attacks.

RELAX NG

RELAX NG does not support this operation.

Returns:
Always return non-null valid Schema object.
Throws:
java.lang.UnsupportedOperationException - If this operation is not supported by the callee.
SAXException - If this operation is supported but failed for some reason.

newSchema

public abstract Schema newSchema()
                          throws SAXException
Creates a special Schema object.

The exact semantics of the returned Schema object depends on the schema language that this SchemaFactory is created for.

Also, implementations are allowed to use implementation-specific property/feature to alter the semantics of this method.

W3C XML Schema 1.0

For XML Schema, this method creates a Schema object that performs validation by using location hints specified in documents.

The returned Schema object assumes that if documents refer to the same URL in the schema location hints, they will always resolve to the same schema document. This asusmption allows implementations to reuse parsed results of schema documents so that multiple validations against the same schema will run faster.

Note that the use of schema location hints introduces a vulnerability to denial-of-service attacks.

RELAX NG

RELAX NG does not support this operation.

Returns:
Always return non-null valid Schema object.
Throws:
java.lang.UnsupportedOperationException - If this operation is not supported by the callee.
SAXException - If this operation is supported but failed for some reason.

newSchema

public abstract Schema newSchema()
                          throws SAXException
Creates a special Schema object.

The exact semantics of the returned Schema object depend on the schema language for which this SchemaFactory is created.

Also, implementations are allowed to use implementation-specific property/feature to alter the semantics of this method.

Implementors and developers should pay particular attention to how the features set on this SchemaFactory are processed by this special Schema. In some cases, for example, when the SchemaFactory and the class actually loading the schema come from different implementations, it may not be possible for SchemaFactory features to be inherited automatically. Developers should make sure that features, such as secure processing, are explicitly set in both places.

W3C XML Schema 1.0

For XML Schema, this method creates a Schema object that performs validation by using location hints specified in documents.

The returned Schema object assumes that if documents refer to the same URL in the schema location hints, they will always resolve to the same schema document. This asusmption allows implementations to reuse parsed results of schema documents so that multiple validations against the same schema will run faster.

Note that the use of schema location hints introduces a vulnerability to denial-of-service attacks.

RELAX NG

RELAX NG does not support this operation.

Returns:
Always return non-null valid Schema object.
Throws:
java.lang.UnsupportedOperationException - If this operation is not supported by the callee.
SAXException - If this operation is supported but failed for some reason.

SchemaFactory.newSchema(javax.xml.transform.Source[])

newSchema


public abstract Schema newSchema(Source[] schemas)
                          throws SAXException
Parses the specified source(s) as a schema and returns it as a schema.

The callee will read all the Source s and combine them into a single schema. The exact semantics of the combination depends on the schema language that this SchemaFactory object is created for.

When an ErrorHandler is set, the callee will report all the errors found in sources to the handler. If the handler throws an exception, it will abort the schema compilation and the same exception will be thrown from this method. Also, after an error is reported to a handler, the callee is allowed to abort the further processing by throwing it. If an error handler is not set, the callee will throw the first error it finds in the sources.

W3C XML Schema 1.0

The resulting schema contains components from the specified sources. The same result would be achieved if all these sources were imported, using appropriate values for schemaLocation and namespace, into a single schema document with a different targetNamespace and no components of its own, if the import elements were given in the same order as the sources. Section 4.2.3 of the XML Schema recommendation describes the options processors have in this regard. While a processor should be consistent in its treatment of JAXP schema sources and XML Schema imports, the behaviour between JAXP-compliant parsers may vary; in particular, parsers may choose to ignore all but the first <import> for a given namespace, regardless of information provided in schemaLocation.

If the parsed set of schemas includes error(s) as specified in the section 5.1 of the XML Schema spec, then the error must be reported to the ErrorHandler .

RELAX NG

For RELAX NG, this method must throw UnsupportedOperationException if schemas.length!=1.

Parameters:
schemas - inputs to be parsed. SchemaFactory is required to recognize SAXSource , StreamSource , StAXSource , and DOMSource , and DOMSource . Input schemas must be XML documents or XML elements and must not be null. For backwards compatibility, the results of passing anything other than a document or element are implementation-dependent. Implementations must either recognize and process the input or thrown an IllegalArgumentException.
Returns:
Always return a non-null valid Schema object. Note that when an error has been reported, there is no guarantee that the returned Schema object is meaningful.
Throws:
SAXException - If an error is found during processing the specified inputs. When an ErrorHandler is set, errors are reported to there first. See setErrorHandler(ErrorHandler) .
java.lang.NullPointerException - If the schemas parameter itself is null or any item in the array is null.
java.lang.IllegalArgumentException - If any item in the array is not recognized by this method.
java.lang.UnsupportedOperationException - If the schema language doesn't support this operation.

newSchema

public abstract Schema newSchema(Source[] schemas)
                          throws SAXException
Parses the specified source(s) as a schema and returns it as a schema.

The callee will read all the Sources and combine them into a single schema. The exact semantics of the combination depends on the schema language that this SchemaFactory object is created for.

When an ErrorHandler is set, the callee will report all the errors found in sources to the handler. If the handler throws an exception, it will abort the schema compilation and the same exception will be thrown from this method. Also, after an error is reported to a handler, the callee is allowed to abort the further processing by throwing it. If an error handler is not set, the callee will throw the first error it finds in the sources.

W3C XML Schema 1.0

The resulting schema contains components from the specified sources. The same result would be achieved if all these sources were imported, using appropriate values for schemaLocation and namespace, into a single schema document with a different targetNamespace and no components of its own, if the import elements were given in the same order as the sources. Section 4.2.3 of the XML Schema recommendation describes the options processors have in this regard. While a processor should be consistent in its treatment of JAXP schema sources and XML Schema imports, the behaviour between JAXP-compliant parsers may vary; in particular, parsers may choose to ignore all but the first <import> for a given namespace, regardless of information provided in schemaLocation.

If the parsed set of schemas includes error(s) as specified in the section 5.1 of the XML Schema spec, then the error must be reported to the ErrorHandler.

RELAX NG

For RELAX NG, this method must throw UnsupportedOperationException if schemas.length!=1.

Parameters:
schemas - inputs to be parsed. SchemaFactory is required to recognize SAXSource, StreamSource, and DOMSource.
Returns:
Always return a non-null valid Schema object. Note that when an error has been reported, there is no guarantee that the returned Schema object is meaningful.
Throws:
SAXException - If an error is found during processing the specified inputs. When an ErrorHandler is set, errors are reported to there first. See setErrorHandler(ErrorHandler).
java.lang.NullPointerException - If the schemas parameter itself is null or any item in the array is null.
java.lang.IllegalArgumentException - If any item in the array is not recognized by this method.
java.lang.UnsupportedOperationException - If the schema language doesn't support this operation.

newSchema

public abstract Schema newSchema(Source[] schemas)
                          throws SAXException
Parses the specified source(s) as a schema and returns it as a schema.

The callee will read all the Sources and combine them into a single schema. The exact semantics of the combination depends on the schema language that this SchemaFactory object is created for.

When an ErrorHandler is set, the callee will report all the errors found in sources to the handler. If the handler throws an exception, it will abort the schema compilation and the same exception will be thrown from this method. Also, after an error is reported to a handler, the callee is allowed to abort the further processing by throwing it. If an error handler is not set, the callee will throw the first error it finds in the sources.

W3C XML Schema 1.0

The resulting schema contains components from the specified sources. The same result would be achieved if all these sources were imported, using appropriate values for schemaLocation and namespace, into a single schema document with a different targetNamespace and no components of its own, if the import elements were given in the same order as the sources. Section 4.2.3 of the XML Schema recommendation describes the options processors have in this regard. While a processor should be consistent in its treatment of JAXP schema sources and XML Schema imports, the behaviour between JAXP-compliant parsers may vary; in particular, parsers may choose to ignore all but the first <import> for a given namespace, regardless of information provided in schemaLocation.

If the parsed set of schemas includes error(s) as specified in the section 5.1 of the XML Schema spec, then the error must be reported to the ErrorHandler.

RELAX NG

For RELAX NG, this method must throw UnsupportedOperationException if schemas.length!=1.

Parameters:
schemas - inputs to be parsed. SchemaFactory is required to recognize SAXSource, StreamSource, StAXSource, and DOMSource. Input schemas must be XML documents or XML elements and must not be null. For backwards compatibility, the results of passing anything other than a document or element are implementation-dependent. Implementations must either recognize and process the input or thrown an IllegalArgumentException.
Returns:
Always return a non-null valid Schema object. Note that when an error has been reported, there is no guarantee that the returned Schema object is meaningful.
Throws:
SAXException - If an error is found during processing the specified inputs. When an ErrorHandler is set, errors are reported to there first. See setErrorHandler(ErrorHandler).
java.lang.NullPointerException - If the schemas parameter itself is null or any item in the array is null.
java.lang.IllegalArgumentException - If any item in the array is not recognized by this method.
java.lang.UnsupportedOperationException - If the schema language doesn't support this operation.

SchemaFactory.setFeature(java.lang.String, boolean)

setFeature


public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the value of a feature flag.

Set a feature for this SchemaFactory , Schema Feature can be used to control the way a SchemaFactory s created by this factory, and by extension, Validator parses schemas, although SchemaFactory s and ValidatorHandler s created by those Schema s. s are not required to recognize any specific feature names.

Implementors and developers should pay particular attention to how the special Schema object returned by newSchema() is processed. In some cases, for example, when the SchemaFactory and the class actually loading the schema come from different implementations, it may not be possible for SchemaFactory features to be inherited automatically. Developers should make sure that features, such as secure processing, are explicitly set in both places.

The feature name is any fully-qualified URI. It is possible for a SchemaFactory to expose a feature value but to be unable to change the current value.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING feature. When the feature is:

  • true : the implementation will limit XML processing to conform to implementation limits. Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources. If XML processing is limited for security reasons, it will be reported via a call to the registered ErrorHandler.fatalError(SAXParseException exception) . See setErrorHandler(ErrorHandler errorHandler)
  • false : the implementation will processing XML according to the XML specifications without regard to possible implementation limits.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the SchemaFactory recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - If name is null.
See Also:
getFeature(String)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the value of a feature flag.

Feature can be used to control the way a SchemaFactory parses schemas, although SchemaFactorys are not required to recognize any specific feature names.

The feature name is any fully-qualified URI. It is possible for a SchemaFactory to expose a feature value but to be unable to change the current value.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING feature. When the feature is:

  • true: the implementation will limit XML processing to conform to implementation limits. Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources. If XML processing is limited for security reasons, it will be reported via a call to the registered ErrorHandler.fatalError(SAXParseException exception). See setErrorHandler(ErrorHandler errorHandler).
  • false: the implementation will processing XML according to the XML specifications without regard to possible implementation limits.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the SchemaFactory recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - If name is null.
See Also:
getFeature(String)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException

Set a feature for this SchemaFactory, Schemas created by this factory, and by extension, Validators and ValidatorHandlers created by those Schemas.

Implementors and developers should pay particular attention to how the special Schema object returned by newSchema() is processed. In some cases, for example, when the SchemaFactory and the class actually loading the schema come from different implementations, it may not be possible for SchemaFactory features to be inherited automatically. Developers should make sure that features, such as secure processing, are explicitly set in both places.

The feature name is any fully-qualified URI. It is possible for a SchemaFactory to expose a feature value but to be unable to change the current value.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING feature. When the feature is:

  • true: the implementation will limit XML processing to conform to implementation limits. Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources. If XML processing is limited for security reasons, it will be reported via a call to the registered ErrorHandler.fatalError(SAXParseException exception). See setErrorHandler(ErrorHandler errorHandler).
  • false: the implementation will processing XML according to the XML specifications without regard to possible implementation limits.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the SchemaFactory recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - If name is null.
See Also:
getFeature(String)

javax.xml.validation.SchemaFactoryLoader (New) (2 methods)

CLASS_COMMENT
SchemaFactoryLoader()
newFactory(java.lang.String)

SchemaFactoryLoader.CLASS_COMMENT (New)

public abstract class SchemaFactoryLoader
extends java.lang.Object

Factory that creates SchemaFactory.

DO NOT USE THIS CLASS

This class was introduced as a part of an early proposal during the JSR-206 standardization process. The proposal was eventually abandoned but this class accidentally remained in the source tree, and made its way into the final version.

This class does not participate in any JAXP 1.3 or JAXP 1.4 processing. It must not be used by users or JAXP implementations.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi

SchemaFactoryLoader.SchemaFactoryLoader() (New)

SchemaFactoryLoader

protected SchemaFactoryLoader()
A do-nothing constructor.

SchemaFactoryLoader.newFactory(java.lang.String) (New)

newFactory

public abstract SchemaFactory newFactory(java.lang.String schemaLanguage)
Creates a new SchemaFactory object for the specified schema language.

Parameters:
schemaLanguage - See the list of available schema languages.
Returns:
null if the callee fails to create one.
Throws:
java.lang.NullPointerException - If the schemaLanguage parameter is null.

javax.xml.validation.TypeInfoProvider (1 method)

TypeInfoProvider.getElementTypeInfo()

getElementTypeInfo


public abstract TypeInfo getElementTypeInfo()

Returns the immutable TypeInfo object for the current element.

The method may only be called by the startElement event or the endElement event of the ContentHandler that the application sets to the ValidatorHandler .

When W3C XML Schema validation is being performed, in the case where an element has a union type, the TypeInfo returned by a call to getElementTypeInfo() from the startElement event will be the union type. The TypeInfo returned by a call from the endElement event will be the actual member type used to validate the element.

Returns:
An immutable TypeInfo object that represents the type of the current element. Note that the caller can keep references to the obtained TypeInfo longer than the callback scope. Otherwise, this method returns null if the validator is unable to determine the type of the current element for some reason (for example, if the validator is recovering from an earlier error.)
Throws:
java.lang.IllegalStateException - If this method is called from other ContentHandler methods.

getElementTypeInfo

public abstract TypeInfo getElementTypeInfo()

Returns the immutable TypeInfo object for the current element.

The method may only be called by the startElement event of the ContentHandler that the application sets to the ValidatorHandler.

Returns:
An immutable TypeInfo object that represents the type of the current element. Note that the caller can keep references to the obtained TypeInfo longer than the callback scope. Otherwise, this method returns null if the validator is unable to determine the type of the current element for some reason (for example, if the validator is recovering from an earlier error.)
Throws:
java.lang.IllegalStateException - If this method is called from other ContentHandler methods.

getElementTypeInfo

public abstract TypeInfo getElementTypeInfo()

Returns the immutable TypeInfo object for the current element.

The method may only be called by the startElement event or the endElement event of the ContentHandler that the application sets to the ValidatorHandler.

When W3C XML Schema validation is being performed, in the case where an element has a union type, the TypeInfo returned by a call to getElementTypeInfo() from the startElement event will be the union type. The TypeInfo returned by a call from the endElement event will be the actual member type used to validate the element.

Returns:
An immutable TypeInfo object that represents the type of the current element. Note that the caller can keep references to the obtained TypeInfo longer than the callback scope. Otherwise, this method returns null if the validator is unable to determine the type of the current element for some reason (for example, if the validator is recovering from an earlier error.)
Throws:
java.lang.IllegalStateException - If this method is called from other ContentHandler methods.

javax.xml.validation.Validator (3 methods)

CLASS_COMMENT
setFeature(java.lang.String, boolean)
validate(javax.xml.transform.Source)
validate(javax.xml.transform.Source, javax.xml.transform.Result)

Validator.CLASS_COMMENT

public abstract class Validator
extends java.lang.Object

A processor that checks an XML document against Schema .

A validator object is not thread-safe a thread-unsafe and not reentrant. non-reentrant object. In other words, it is the application's responsibility to make sure that one Validator object is not used from more than one thread at any given time, and while the validate method is invoked, applications may not recursively call the validate method.

Note that while the validate(javax.xml.transform.Source) and validate(javax.xml.transform.Source, javax.xml.transform.Result) methods take a Source instance, the Source instance must be a SAXSource or DOMSource.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi
public abstract class Validator
extends java.lang.Object

A processor that checks an XML document against Schema.

A validator is a thread-unsafe and non-reentrant object. In other words, it is the application's responsibility to make sure that one Validator object is not used from more than one thread at any given time, and while the validate method is invoked, applications may not recursively call the validate method.

Note that while the validate(javax.xml.transform.Source) and validate(javax.xml.transform.Source, javax.xml.transform.Result) methods take a Source instance, the Source instance must be a SAXSource or DOMSource.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi
public abstract class Validator
extends java.lang.Object

A processor that checks an XML document against Schema.

A validator object is not thread-safe and not reentrant. In other words, it is the application's responsibility to make sure that one Validator object is not used from more than one thread at any given time, and while the validate method is invoked, applications may not recursively call the validate method.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi

Validator.setFeature(java.lang.String, boolean)

setFeature


public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the value of a feature flag.

Feature can be used to control the way a Validator parses schemas, although Validator s are not required to recognize any specific feature property names.

The feature name is any fully-qualified URI. It is possible for a Validator 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 validation.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the Validator recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - When the name parameter is null.
See Also:
getFeature(String)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the value of a feature flag.

Feature can be used to control the way a Validator parses schemas, although Validators are not required to recognize any specific property names.

The feature name is any fully-qualified URI. It is possible for a Validator 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 validation.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the Validator recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - When the name parameter is null.
See Also:
getFeature(String)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the value of a feature flag.

Feature can be used to control the way a Validator parses schemas, although Validators are not required to recognize any specific feature names.

The feature name is any fully-qualified URI. It is possible for a Validator 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 validation.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the Validator recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - When the name parameter is null.
See Also:
getFeature(String)

Validator.validate(javax.xml.transform.Source)

validate


public void validate(Source source)
              throws SAXException,
                     java.io.IOException
Validates the specified input.

This is just a convenience method for validate(Source source, Result result) with result of null.

Parameters:
source - XML to be validated. Must be an XML document or XML element and must not be null. For backwards compatibility, the results of attempting to validate anything other than a document or element are implementation-dependent. Implementations must either recognize and process the input or throw an IllegalArgumentException. Must not be null.
Throws:
java.lang.IllegalArgumentException - If the Source is an XML artifact that the implementation cannot validate (for example, a processing instruction).
SAXException - If the ErrorHandler throws a SAXException or if a fatal error is found and the ErrorHandler returns normally.
java.io.IOException - If the validator is processing a SAXSource and the underlying XMLReader throws an IOException.
java.lang.IllegalArgumentException - When the specified source is neither SAXSource nor DOMSource .
java.lang.NullPointerException - If source is null.
See Also:
validate(Source source, Result result)

validate

public void validate(Source source)
              throws SAXException,
                     java.io.IOException
Validates the specified input.

This is just a convenience method for validate(Source source, Result result) with result of null.

Parameters:
source - XML to be validated. Must not be null.
Throws:
SAXException - If the ErrorHandler throws a SAXException or if a fatal error is found and the ErrorHandler returns normally.
java.io.IOException - If the validator is processing a SAXSource and the underlying XMLReader throws an IOException.
java.lang.IllegalArgumentException - When the specified source is neither SAXSource nor DOMSource.
java.lang.NullPointerException - If source is null.
See Also:
validate(Source source, Result result)

validate

public void validate(Source source)
              throws SAXException,
                     java.io.IOException
Validates the specified input.

This is just a convenience method for validate(Source source, Result result) with result of null.

Parameters:
source - XML to be validated. Must be an XML document or XML element and must not be null. For backwards compatibility, the results of attempting to validate anything other than a document or element are implementation-dependent. Implementations must either recognize and process the input or throw an IllegalArgumentException.
Throws:
java.lang.IllegalArgumentException - If the Source is an XML artifact that the implementation cannot validate (for example, a processing instruction).
SAXException - If the ErrorHandler throws a SAXException or if a fatal error is found and the ErrorHandler returns normally.
java.io.IOException - If the validator is processing a SAXSource and the underlying XMLReader throws an IOException.
java.lang.NullPointerException - If source is null.
See Also:
validate(Source source, Result result)

Validator.validate(javax.xml.transform.Source, javax.xml.transform.Result)

validate


public abstract void validate(Source source,
                              Result result)
                       throws SAXException,
                              java.io.IOException

Validates the specified input and send the augmented validation result to the specified output.

This method places the following restrictions on the types of the Source / Result accepted.

Source / Result accepted:

Source / Result Accepted
SAXSource DOMSource
StreamSource SAXSource DOMSource StAXSource
null OK OK OK OK
StreamResult OK IllegalArgumentException IllegalArgumentException IllegalArgumentException
SAXResult OK Err
SAXResult IllegalArgumentException OK IllegalArgumentException IllegalArgumentException
DOMResult Err OK
DOMResult IllegalArgumentException IllegalArgumentException OK IllegalArgumentException
StAXResult IllegalArgumentException IllegalArgumentException IllegalArgumentException OK

To validate one Note that StreamSource instances are not allowed. To process a Source StreamSource into another kind of Result , or to validate one Source into another kind of Result , use the identity transformer (see TransformerFactory.newTransformer() ).

Errors found during the validation is sent to the specified ErrorHandler .

If a document is valid, or if a document contains some errors but none of them were fatal and the ErrorHandler ErrorHandler didn't throw any exception, then the method returns normally.

Parameters:
source - XML to be validated. Must be an XML document or XML element and must not be null. For backwards compatibility, the results of attempting to validate anything other than a document or element are implementation-dependent. Implementations must either recognize and process the input or throw an IllegalArgumentException. Must not be null.
result - The Result - The Result object that receives (possibly augmented) XML. This parameter can be null if the caller is not interested in it. Note that when a DOMResult DOMResult is used, a validator might just pass the same DOM node from DOMSource DOMSource to DOMResult DOMResult (in which case source.getNode()==result.getNode() ), it might copy the entire DOM tree, or it might alter the node given by the source.
Throws:
java.lang.IllegalArgumentException - If the Result type doesn't match the Source type of if the Source is an XML artifact that the implementation cannot validate (for example, a processing instruction). - If the Result type doesn't match the Source type, or if the specified source is neither SAXSource nor DOMSource .
SAXException - If the ErrorHandler ErrorHandler throws a SAXException SAXException or if a fatal error is found and the ErrorHandler ErrorHandler returns normally.
java.io.IOException - If the validator is processing a SAXSource SAXSource and the underlying XMLReader throws an IOException.
java.lang.NullPointerException - If the source parameter is null. parameter is null.
See Also:
validate(Source source)

validate

public abstract void validate(Source source,
                              Result result)
                       throws SAXException,
                              java.io.IOException
Validates the specified input and send the augmented validation result to the specified output.

This method places the following restrictions on the types of the Source/Result accepted.

Source/Result accepted:

SAXSource DOMSource
null OK OK
SAXResult OK Err
DOMResult Err OK

Note that StreamSource instances are not allowed. To process a StreamSource, or to validate one Source into another kind of Result, use the identity transformer (see TransformerFactory.newTransformer()).

Errors found during the validation is sent to the specified ErrorHandler.

If a document is valid, or if a document contains some errors but none of them were fatal and the ErrorHandler didn't throw any exception, then the method returns normally.

Parameters:
source - XML to be validated. Must not be null.
result - The Result object that receives (possibly augmented) XML. This parameter can be null if the caller is not interested in it. Note that when a DOMResult is used, a validator might just pass the same DOM node from DOMSource to DOMResult (in which case source.getNode()==result.getNode()), it might copy the entire DOM tree, or it might alter the node given by the source.
Throws:
java.lang.IllegalArgumentException - If the Result type doesn't match the Source type, or if the specified source is neither SAXSource nor DOMSource.
SAXException - If the ErrorHandler throws a SAXException or if a fatal error is found and the ErrorHandler returns normally.
java.io.IOException - If the validator is processing a SAXSource and the underlying XMLReader throws an IOException.
java.lang.NullPointerException - If the source parameter is null.
See Also:
validate(Source source)

validate

public abstract void validate(Source source,
                              Result result)
                       throws SAXException,
                              java.io.IOException

Validates the specified input and send the augmented validation result to the specified output.

This method places the following restrictions on the types of the Source/Result accepted.

Source / Result Accepted
StreamSource SAXSource DOMSource StAXSource
null OK OK OK OK
StreamResult OK IllegalArgumentException IllegalArgumentException IllegalArgumentException
SAXResult IllegalArgumentException OK IllegalArgumentException IllegalArgumentException
DOMResult IllegalArgumentException IllegalArgumentException OK IllegalArgumentException
StAXResult IllegalArgumentException IllegalArgumentException IllegalArgumentException OK

To validate one Source into another kind of Result, use the identity transformer (see TransformerFactory.newTransformer()).

Errors found during the validation is sent to the specified ErrorHandler.

If a document is valid, or if a document contains some errors but none of them were fatal and the ErrorHandler didn't throw any exception, then the method returns normally.

Parameters:
source - XML to be validated. Must be an XML document or XML element and must not be null. For backwards compatibility, the results of attempting to validate anything other than a document or element are implementation-dependent. Implementations must either recognize and process the input or throw an IllegalArgumentException.
result - The Result object that receives (possibly augmented) XML. This parameter can be null if the caller is not interested in it. Note that when a DOMResult is used, a validator might just pass the same DOM node from DOMSource to DOMResult (in which case source.getNode()==result.getNode()), it might copy the entire DOM tree, or it might alter the node given by the source.
Throws:
java.lang.IllegalArgumentException - If the Result type doesn't match the Source type of if the Source is an XML artifact that the implementation cannot validate (for example, a processing instruction).
SAXException - If the ErrorHandler throws a SAXException or if a fatal error is found and the ErrorHandler returns normally.
java.io.IOException - If the validator is processing a SAXSource and the underlying XMLReader throws an IOException.
java.lang.NullPointerException - If the source parameter is null.
See Also:
validate(Source source)

javax.xml.validation.ValidatorHandler (1 method)

CLASS_COMMENT
setFeature(java.lang.String, boolean)

ValidatorHandler.CLASS_COMMENT

public abstract class ValidatorHandler
extends java.lang.Object
implements ContentHandler

Streaming validator that works on SAX stream.

A ValidatorHandler object is not thread-safe and not reentrant. object is a thread-unsafe, non-reentrant object. In other words, it is the application's responsibility to make sure that one ValidatorHandler object is not used from more than one thread at any given time.

ValidatorHandler checks if the SAX events follow the set of constraints described in the associated Schema , and additionally it may modify the SAX events (for example by adding default values, etc.)

ValidatorHandler extends from ContentHandler , but it refines the underlying ContentHandler in the following way:

  1. startElement/endElement events must receive non-null String for uri , localName , and qname , even though SAX allows some of them to be null. Similarly, the user-specified ContentHandler will receive non-null Strings for all three parameters.
  2. Applications must ensure that ValidatorHandler 's ContentHandler.startPrefixMapping(String,String) and ContentHandler.endPrefixMapping(String) are invoked properly. Similarly, the user-specified ContentHandler will receive startPrefixMapping/endPrefixMapping events. If the ValidatorHandler introduces additional namespace bindings, the user-specified ContentHandler will receive additional startPrefixMapping/endPrefixMapping events.
  3. Attributes for the ContentHandler.startElement(String,String,String,Attributes) method may or may not include xmlns* attributes.

A ValidatorHandler is automatically reset every time the startDocument method is invoked.

Recognized Properties and Features

This spec defines the following feature that must be recognized by all ValidatorHandler implementations.

http://xml.org/sax/features/namespace-prefixes

This feature controls how a ValidatorHandler introduces namespace bindings that were not present in the original SAX event stream. When this feature is set to true, it must make sure that the user's ContentHandler will see the corresponding xmlns* attribute in the Attributes object of the ContentHandler.startElement(String,String,String,Attributes) callback. Otherwise, xmlns* attributes must not be added to Attributes that's passed to the user-specified ContentHandler .

(Note that regardless of this switch, namespace bindings are always notified to applications through ContentHandler.startPrefixMapping(String,String) and ContentHandler.endPrefixMapping(String) methods of the ContentHandler specified by the user.)

Note that this feature does NOT affect the way a ValidatorHandler receives SAX events. It merely changes the way it augments SAX events.

This feature is set to false by default.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi
public abstract class ValidatorHandler
extends java.lang.Object
implements ContentHandler

Streaming validator that works on SAX stream.

A ValidatorHandler object is a thread-unsafe, non-reentrant object. In other words, it is the application's responsibility to make sure that one ValidatorHandler object is not used from more than one thread at any given time.

ValidatorHandler checks if the SAX events follow the set of constraints described in the associated Schema, and additionally it may modify the SAX events (for example by adding default values, etc.)

ValidatorHandler extends from ContentHandler, but it refines the underlying ContentHandler in the following way:

  1. startElement/endElement events must receive non-null String for uri, localName, and qname, even though SAX allows some of them to be null. Similarly, the user-specified ContentHandler will receive non-null Strings for all three parameters.
  2. Applications must ensure that ValidatorHandler's ContentHandler.startPrefixMapping(String,String) and ContentHandler.endPrefixMapping(String) are invoked properly. Similarly, the user-specified ContentHandler will receive startPrefixMapping/endPrefixMapping events. If the ValidatorHandler introduces additional namespace bindings, the user-specified ContentHandler will receive additional startPrefixMapping/endPrefixMapping events.
  3. Attributes for the ContentHandler.startElement(String,String,String,Attributes) method may or may not include xmlns* attributes.

A ValidatorHandler is automatically reset every time the startDocument method is invoked.

Recognized Properties and Features

This spec defines the following feature that must be recognized by all ValidatorHandler implementations.

http://xml.org/sax/features/namespace-prefixes

This feature controls how a ValidatorHandler introduces namespace bindings that were not present in the original SAX event stream. When this feature is set to true, it must make sure that the user's ContentHandler will see the corresponding xmlns* attribute in the Attributes object of the ContentHandler.startElement(String,String,String,Attributes) callback. Otherwise, xmlns* attributes must not be added to Attributes that's passed to the user-specified ContentHandler.

(Note that regardless of this switch, namespace bindings are always notified to applications through ContentHandler.startPrefixMapping(String,String) and ContentHandler.endPrefixMapping(String) methods of the ContentHandler specified by the user.)

Note that this feature does NOT affect the way a ValidatorHandler receives SAX events. It merely changes the way it augments SAX events.

This feature is set to false by default.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi
public abstract class ValidatorHandler
extends java.lang.Object
implements ContentHandler

Streaming validator that works on SAX stream.

A ValidatorHandler object is not thread-safe and not reentrant. In other words, it is the application's responsibility to make sure that one ValidatorHandler object is not used from more than one thread at any given time.

ValidatorHandler checks if the SAX events follow the set of constraints described in the associated Schema, and additionally it may modify the SAX events (for example by adding default values, etc.)

ValidatorHandler extends from ContentHandler, but it refines the underlying ContentHandler in the following way:

  1. startElement/endElement events must receive non-null String for uri, localName, and qname, even though SAX allows some of them to be null. Similarly, the user-specified ContentHandler will receive non-null Strings for all three parameters.
  2. Applications must ensure that ValidatorHandler's ContentHandler.startPrefixMapping(String,String) and ContentHandler.endPrefixMapping(String) are invoked properly. Similarly, the user-specified ContentHandler will receive startPrefixMapping/endPrefixMapping events. If the ValidatorHandler introduces additional namespace bindings, the user-specified ContentHandler will receive additional startPrefixMapping/endPrefixMapping events.
  3. Attributes for the ContentHandler.startElement(String,String,String,Attributes) method may or may not include xmlns* attributes.

A ValidatorHandler is automatically reset every time the startDocument method is invoked.

Recognized Properties and Features

This spec defines the following feature that must be recognized by all ValidatorHandler implementations.

http://xml.org/sax/features/namespace-prefixes

This feature controls how a ValidatorHandler introduces namespace bindings that were not present in the original SAX event stream. When this feature is set to true, it must make sure that the user's ContentHandler will see the corresponding xmlns* attribute in the Attributes object of the ContentHandler.startElement(String,String,String,Attributes) callback. Otherwise, xmlns* attributes must not be added to Attributes that's passed to the user-specified ContentHandler.

(Note that regardless of this switch, namespace bindings are always notified to applications through ContentHandler.startPrefixMapping(String,String) and ContentHandler.endPrefixMapping(String) methods of the ContentHandler specified by the user.)

Note that this feature does NOT affect the way a ValidatorHandler receives SAX events. It merely changes the way it augments SAX events.

This feature is set to false by default.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Kohsuke Kawaguchi

ValidatorHandler.setFeature(java.lang.String, boolean)

setFeature


public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the value of a feature flag.

Set a feature for this ValidatorHandler.

Feature can be used to control the way a ValidatorHandler parses schemas. The feature name is any fully-qualified URI. It is possible for a SchemaFactory parses schemas, although ValidatorHandler 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 validation. s are not required to recognize any specific property names.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING The feature name is any fully-qualified URI. It is possible for a ValidatorHandler feature. When the feature is: 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 validation.

  • true : the implementation will limit XML processing to conform to implementation limits. Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources. If XML processing is limited for security reasons, it will be reported via a call to the registered ErrorHandler.fatalError(SAXParseException exception) . See setErrorHandler(ErrorHandler errorHandler)
  • false : the implementation will processing XML according to the XML specifications without regard to possible implementation limits.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the ValidatorHandler recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - When name is null.
See Also:
getFeature(String)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the value of a feature flag.

Feature can be used to control the way a ValidatorHandler parses schemas, although ValidatorHandlers are not required to recognize any specific property names.

The feature name is any fully-qualified URI. It is possible for a ValidatorHandler 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 validation.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the ValidatorHandler recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - When name is null.
See Also:
getFeature(String)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException

Set a feature for this ValidatorHandler.

Feature can be used to control the way a ValidatorHandler parses schemas. The feature name is any fully-qualified URI. It is possible for a SchemaFactory 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 validation.

All implementations are required to support the XMLConstants.FEATURE_SECURE_PROCESSING feature. When the feature is:

  • true: the implementation will limit XML processing to conform to implementation limits. Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources. If XML processing is limited for security reasons, it will be reported via a call to the registered ErrorHandler.fatalError(SAXParseException exception). See setErrorHandler(ErrorHandler errorHandler).
  • false: the implementation will processing XML according to the XML specifications without regard to possible implementation limits.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature value can't be assigned or retrieved.
SAXNotSupportedException - When the ValidatorHandler recognizes the feature name but cannot set the requested value.
java.lang.NullPointerException - When name is null.
See Also:
getFeature(String)

javax.xml.xpath.XPath (3 methods)

CLASS_COMMENT
compile(java.lang.String)
evaluate(java.lang.String, java.lang.Object)
evaluate(java.lang.String, java.lang.Object, javax.xml.namespace.QName)

XPath.CLASS_COMMENT

public interface XPath

XPath provides access to the XPath evaluation environment and expressions.

Evaluation of XPath Expressions.
context If a request is made to evaluate the expression in the absence of a context item, an empty document node will be used for the context. For the purposes of evaluating XPath expressions, a DocumentFragment is treated like a Document node.
variables If the expression contains a variable reference, its value will be found through the XPathVariableResolver set with setXPathVariableResolver(XPathVariableResolver resolver) . An XPathExpressionException is raised if the variable resolver is undefined or the resolver returns null for the variable. The value of a variable must be immutable through the course of any single evaluation.

functions If the expression contains a function reference, the function will be found through the XPathFunctionResolver set with setXPathFunctionResolver(XPathFunctionResolver resolver) . An XPathExpressionException is raised if the function resolver is undefined or the function resolver returns null for the function.

QNames QNames in the expression are resolved against the XPath namespace context set with setNamespaceContext(NamespaceContext nsContext) .
result This result of evaluating an expression is converted to an instance of the desired return type. Valid return types are defined in XPathConstants . Conversion to the return type follows XPath conversion rules.

An XPath object is not thread-safe and not reentrant. In other words, it is the application's responsibility to make sure that one XPath object is not used from more than one thread at any given time, and while the evaluate method is invoked, applications may not recursively call the evaluate method.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh , Jeff Suttor
See Also:
XML Path Language (XPath) Version 1.0
public interface XPath

XPath provides access to the XPath evaluation environment and expressions.

Evaluation of XPath Expressions.
context If a request is made to evaluate the expression in the absence of a context item, an empty document node will be used for the context. For the purposes of evaluating XPath expressions, a DocumentFragment is treated like a Document node.
variables If the expression contains a variable reference, its value will be found through the XPathVariableResolver set with setXPathVariableResolver(XPathVariableResolver resolver). An XPathExpressionException is raised if the variable resolver is undefined or the resolver returns null for the variable. The value of a variable must be immutable through the course of any single evaluation.

functions If the expression contains a function reference, the function will be found through the XPathFunctionResolver set with setXPathFunctionResolver(XPathFunctionResolver resolver). An XPathExpressionException is raised if the function resolver is undefined or the function resolver returns null for the function.

QNames QNames in the expression are resolved against the XPath namespace context set with setNamespaceContext(NamespaceContext nsContext).
result This result of evaluating an expression is converted to an instance of the desired return type. Valid return types are defined in XPathConstants. Conversion to the return type follows XPath conversion rules.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh, Jeff Suttor
See Also:
XML Path Language (XPath) Version 1.0
public interface XPath

XPath provides access to the XPath evaluation environment and expressions.

Evaluation of XPath Expressions.
context If a request is made to evaluate the expression in the absence of a context item, an empty document node will be used for the context. For the purposes of evaluating XPath expressions, a DocumentFragment is treated like a Document node.
variables If the expression contains a variable reference, its value will be found through the XPathVariableResolver set with setXPathVariableResolver(XPathVariableResolver resolver). An XPathExpressionException is raised if the variable resolver is undefined or the resolver returns null for the variable. The value of a variable must be immutable through the course of any single evaluation.

functions If the expression contains a function reference, the function will be found through the XPathFunctionResolver set with setXPathFunctionResolver(XPathFunctionResolver resolver). An XPathExpressionException is raised if the function resolver is undefined or the function resolver returns null for the function.

QNames QNames in the expression are resolved against the XPath namespace context set with setNamespaceContext(NamespaceContext nsContext).
result This result of evaluating an expression is converted to an instance of the desired return type. Valid return types are defined in XPathConstants. Conversion to the return type follows XPath conversion rules.

An XPath object is not thread-safe and not reentrant. In other words, it is the application's responsibility to make sure that one XPath object is not used from more than one thread at any given time, and while the evaluate method is invoked, applications may not recursively call the evaluate method.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh, Jeff Suttor
See Also:
XML Path Language (XPath) Version 1.0

XPath.compile(java.lang.String)

compile


XPathExpression compile(java.lang.String expression)
                        throws XPathExpressionException

Compile an XPath expression for later evaluation.

If expression contains any XPathFunction s, they must be available via the XPathFunctionResolver . An XPathExpressionException will be thrown if the XPathFunction cannot be resovled with the XPathFunctionResolver.

If expression contains any variables, the XPathVariableResolver in effect at compile time will be used to resolve them.

If expression is null , a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
Returns:
Compiled XPath expression.
Throws:
XPathExpressionException - If expression cannot be compiled.
java.lang.NullPointerException - If expression is null.

compile

XPathExpression compile(java.lang.String expression)
                        throws XPathExpressionException

Compile an XPath expression for later evaluation.

If expression contains any XPathFunctions, they must be available via the XPathFunctionResolver. An XPathExpressionException will be thrown if the XPathFunction cannot be resovled with the XPathFunctionResolver.

If expression is null, a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
Returns:
Compiled XPath expression.
Throws:
XPathExpressionException - If expression cannot be compiled.
java.lang.NullPointerException - If expression is null.

compile

XPathExpression compile(java.lang.String expression)
                        throws XPathExpressionException

Compile an XPath expression for later evaluation.

If expression contains any XPathFunctions, they must be available via the XPathFunctionResolver. An XPathExpressionException will be thrown if the XPathFunction cannot be resovled with the XPathFunctionResolver.

If expression contains any variables, the XPathVariableResolver in effect at compile time will be used to resolve them.

If expression is null, a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
Returns:
Compiled XPath expression.
Throws:
XPathExpressionException - If expression cannot be compiled.
java.lang.NullPointerException - If expression is null.

XPath.evaluate(java.lang.String, java.lang.Object)

evaluate


java.lang.String evaluate(java.lang.String expression,
                          java.lang.Object item)
                          throws XPathExpressionException

Evaluate an XPath expression in the specified context and return the result as a String.

This method calls evaluate(String expression, Object item, QName returnType) with a returnType of XPathConstants.STRING .

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If a null value is provided for item , an empty document will be used for the context. If expression is null , then a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
item - The starting context (a node, (node or node list, for example).
Returns:
The String that is the result of evaluating the expression and converting the result to a String.
Throws:
XPathExpressionException - If expression cannot be evaluated.
java.lang.NullPointerException - If expression is null.

evaluate

java.lang.String evaluate(java.lang.String expression,
                          java.lang.Object item)
                          throws XPathExpressionException

Evaluate an XPath expression in the specified context and return the result as a String.

This method calls evaluate(String expression, Object item, QName returnType) with a returnType of XPathConstants.STRING.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If a null value is provided for item, an empty document will be used for the context. If expression is null, then a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
item - The starting context (node or node list, for example).
Returns:
The String that is the result of evaluating the expression and converting the result to a String.
Throws:
XPathExpressionException - If expression cannot be evaluated.
java.lang.NullPointerException - If expression is null.

evaluate

java.lang.String evaluate(java.lang.String expression,
                          java.lang.Object item)
                          throws XPathExpressionException

Evaluate an XPath expression in the specified context and return the result as a String.

This method calls evaluate(String expression, Object item, QName returnType) with a returnType of XPathConstants.STRING.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If a null value is provided for item, an empty document will be used for the context. If expression is null, then a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
item - The starting context (a node, for example).
Returns:
The String that is the result of evaluating the expression and converting the result to a String.
Throws:
XPathExpressionException - If expression cannot be evaluated.
java.lang.NullPointerException - If expression is null.

XPath.evaluate(java.lang.String, java.lang.Object, javax.xml.namespace.QName)

evaluate


java.lang.Object evaluate(java.lang.String expression,
                          java.lang.Object item,
                          QName returnType)
                          throws XPathExpressionException

Evaluate an XPath expression in the specified context and return the result as the specified type.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If returnType is not one of the types defined in XPathConstants ( NUMBER , STRING , BOOLEAN , NODE or NODESET ) then an IllegalArgumentException is thrown.

If a null value is provided for item , an empty document will be used for the context. If expression or returnType is null , then a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
item - The starting context (a node, (node or node list, for example).
returnType - The desired return type.
Returns:
Result of evaluating an XPath expression as an Object of returnType.
Throws:
XPathExpressionException - If expression cannot be evaluated.
java.lang.IllegalArgumentException - If returnType is not one of the types defined in XPathConstants .
java.lang.NullPointerException - If expression or returnType is null.

evaluate

java.lang.Object evaluate(java.lang.String expression,
                          java.lang.Object item,
                          QName returnType)
                          throws XPathExpressionException

Evaluate an XPath expression in the specified context and return the result as the specified type.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If returnType is not one of the types defined in XPathConstants ( NUMBER, STRING, BOOLEAN, NODE or NODESET) then an IllegalArgumentException is thrown.

If a null value is provided for item, an empty document will be used for the context. If expression or returnType is null, then a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
item - The starting context (node or node list, for example).
returnType - The desired return type.
Returns:
Result of evaluating an XPath expression as an Object of returnType.
Throws:
XPathExpressionException - If expression cannot be evaluated.
java.lang.IllegalArgumentException - If returnType is not one of the types defined in XPathConstants.
java.lang.NullPointerException - If expression or returnType is null.

evaluate

java.lang.Object evaluate(java.lang.String expression,
                          java.lang.Object item,
                          QName returnType)
                          throws XPathExpressionException

Evaluate an XPath expression in the specified context and return the result as the specified type.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If returnType is not one of the types defined in XPathConstants ( NUMBER, STRING, BOOLEAN, NODE or NODESET) then an IllegalArgumentException is thrown.

If a null value is provided for item, an empty document will be used for the context. If expression or returnType is null, then a NullPointerException is thrown.

Parameters:
expression - The XPath expression.
item - The starting context (a node, for example).
returnType - The desired return type.
Returns:
Result of evaluating an XPath expression as an Object of returnType.
Throws:
XPathExpressionException - If expression cannot be evaluated.
java.lang.IllegalArgumentException - If returnType is not one of the types defined in XPathConstants.
java.lang.NullPointerException - If expression or returnType is null.

javax.xml.xpath.XPathExpression (2 methods)

CLASS_COMMENT
evaluate(java.lang.Object)
evaluate(java.lang.Object, javax.xml.namespace.QName)

XPathExpression.CLASS_COMMENT

public interface XPathExpression

XPathExpression provides access to compiled XPath expressions.

Evaluation of XPath Expressions.
context If a request is made to evaluate the expression in the absence of a context item, an empty document node will be used for the context. For the purposes of evaluating XPath expressions, a DocumentFragment is treated like a Document node.
variables If the expression contains a variable reference, its value will be found through the XPathVariableResolver . An XPathExpressionException is raised if the variable resolver is undefined or the resolver returns null for the variable. The value of a variable must be immutable through the course of any single evaluation.

functions If the expression contains a function reference, the function will be found through the XPathFunctionResolver . An XPathExpressionException is raised if the function resolver is undefined or the function resolver returns null for the function.

QNames QNames in the expression are resolved against the XPath namespace context.
result This result of evaluating an expression is converted to an instance of the desired return type. Valid return types are defined in XPathConstants . Conversion to the return type follows XPath conversion rules.

An XPath expression is not thread-safe and not reentrant. In other words, it is the application's responsibility to make sure that one XPathExpression object is not used from more than one thread at any given time, and while the evaluate method is invoked, applications may not recursively call the evaluate method.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh , Jeff Suttor
See Also:
XML Path Language (XPath) Version 1.0, Expressions
public interface XPathExpression

XPathExpression provides access to compiled XPath expressions.

Evaluation of XPath Expressions.
context If a request is made to evaluate the expression in the absence of a context item, an empty document node will be used for the context. For the purposes of evaluating XPath expressions, a DocumentFragment is treated like a Document node.
variables If the expression contains a variable reference, its value will be found through the XPathVariableResolver. An XPathExpressionException is raised if the variable resolver is undefined or the resolver returns null for the variable. The value of a variable must be immutable through the course of any single evaluation.

functions If the expression contains a function reference, the function will be found through the XPathFunctionResolver. An XPathExpressionException is raised if the function resolver is undefined or the function resolver returns null for the function.

QNames QNames in the expression are resolved against the XPath namespace context.
result This result of evaluating an expression is converted to an instance of the desired return type. Valid return types are defined in XPathConstants. Conversion to the return type follows XPath conversion rules.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh, Jeff Suttor
See Also:
XML Path Language (XPath) Version 1.0, Expressions
public interface XPathExpression

XPathExpression provides access to compiled XPath expressions.

Evaluation of XPath Expressions.
context If a request is made to evaluate the expression in the absence of a context item, an empty document node will be used for the context. For the purposes of evaluating XPath expressions, a DocumentFragment is treated like a Document node.
variables If the expression contains a variable reference, its value will be found through the XPathVariableResolver. An XPathExpressionException is raised if the variable resolver is undefined or the resolver returns null for the variable. The value of a variable must be immutable through the course of any single evaluation.

functions If the expression contains a function reference, the function will be found through the XPathFunctionResolver. An XPathExpressionException is raised if the function resolver is undefined or the function resolver returns null for the function.

QNames QNames in the expression are resolved against the XPath namespace context.
result This result of evaluating an expression is converted to an instance of the desired return type. Valid return types are defined in XPathConstants. Conversion to the return type follows XPath conversion rules.

An XPath expression is not thread-safe and not reentrant. In other words, it is the application's responsibility to make sure that one XPathExpression object is not used from more than one thread at any given time, and while the evaluate method is invoked, applications may not recursively call the evaluate method.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh, Jeff Suttor
See Also:
XML Path Language (XPath) Version 1.0, Expressions

XPathExpression.evaluate(java.lang.Object)

evaluate


java.lang.String evaluate(java.lang.Object item)
                          throws XPathExpressionException

Evaluate the compiled XPath expression in the specified context and return the result as a String.

This method calls evaluate(Object item, QName returnType) with a returnType of XPathConstants.STRING .

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If a null value is provided for item , an empty document will be used for the context.

Parameters:
item - The starting context (a node, (node or node list, for example).
Returns:
The String that is the result of evaluating the expression and converting the result to a String.
Throws:
XPathExpressionException - If the expression cannot be evaluated.

evaluate

java.lang.String evaluate(java.lang.Object item)
                          throws XPathExpressionException

Evaluate the compiled XPath expression in the specified context and return the result as a String.

This method calls evaluate(Object item, QName returnType) with a returnType of XPathConstants.STRING.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If a null value is provided for item, an empty document will be used for the context.

Parameters:
item - The starting context (node or node list, for example).
Returns:
The String that is the result of evaluating the expression and converting the result to a String.
Throws:
XPathExpressionException - If the expression cannot be evaluated.

evaluate

java.lang.String evaluate(java.lang.Object item)
                          throws XPathExpressionException

Evaluate the compiled XPath expression in the specified context and return the result as a String.

This method calls evaluate(Object item, QName returnType) with a returnType of XPathConstants.STRING.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If a null value is provided for item, an empty document will be used for the context.

Parameters:
item - The starting context (a node, for example).
Returns:
The String that is the result of evaluating the expression and converting the result to a String.
Throws:
XPathExpressionException - If the expression cannot be evaluated.

XPathExpression.evaluate(java.lang.Object, javax.xml.namespace.QName)

evaluate


java.lang.Object evaluate(java.lang.Object item,
                          QName returnType)
                          throws XPathExpressionException

Evaluate the compiled XPath expression in the specified context and return the result as the specified type.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If returnType is not one of the types defined in XPathConstants , then an IllegalArgumentException is thrown.

If a null value is provided for item , an empty document will be used for the context. If returnType is null , then a NullPointerException is thrown.

Parameters:
item - The starting context (a node, (node or node list, for example).
returnType - The desired return type.
Returns:
The Object that is the result of evaluating the expression and converting the result to returnType.
Throws:
XPathExpressionException - If the expression cannot be evaluated.
java.lang.IllegalArgumentException - If returnType is not one of the types defined in XPathConstants .
java.lang.NullPointerException - If returnType is null.

evaluate

java.lang.Object evaluate(java.lang.Object item,
                          QName returnType)
                          throws XPathExpressionException

Evaluate the compiled XPath expression in the specified context and return the result as the specified type.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If returnType is not one of the types defined in XPathConstants, then an IllegalArgumentException is thrown.

If a null value is provided for item, an empty document will be used for the context. If returnType is null, then a NullPointerException is thrown.

Parameters:
item - The starting context (node or node list, for example).
returnType - The desired return type.
Returns:
The Object that is the result of evaluating the expression and converting the result to returnType.
Throws:
XPathExpressionException - If the expression cannot be evaluated.
java.lang.IllegalArgumentException - If returnType is not one of the types defined in XPathConstants.
java.lang.NullPointerException - If returnType is null.

evaluate

java.lang.Object evaluate(java.lang.Object item,
                          QName returnType)
                          throws XPathExpressionException

Evaluate the compiled XPath expression in the specified context and return the result as the specified type.

See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

If returnType is not one of the types defined in XPathConstants, then an IllegalArgumentException is thrown.

If a null value is provided for item, an empty document will be used for the context. If returnType is null, then a NullPointerException is thrown.

Parameters:
item - The starting context (a node, for example).
returnType - The desired return type.
Returns:
The Object that is the result of evaluating the expression and converting the result to returnType.
Throws:
XPathExpressionException - If the expression cannot be evaluated.
java.lang.IllegalArgumentException - If returnType is not one of the types defined in XPathConstants.
java.lang.NullPointerException - If returnType is null.

javax.xml.xpath.XPathFactory (2 methods)

CLASS_COMMENT
XPathFactory()
newInstance(java.lang.String, java.lang.String, java.lang.ClassLoader)

XPathFactory.CLASS_COMMENT

public abstract class XPathFactory
extends java.lang.Object

An XPathFactory instance can be used to create XPath objects.

See newInstance(String uri) for lookup mechanism.

The XPathFactory class is not thread-safe. In other words, it is the application's responsibility to ensure that at most one thread is using a XPathFactory object at any given moment. Implementations are encouraged to mark methods as synchronized to protect themselves from broken clients.

XPathFactory is not re-entrant. While one of the newInstance methods is being invoked, applications may not attempt to recursively invoke a newInstance method, even from the same thread.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh , Jeff Suttor
public abstract class XPathFactory
extends java.lang.Object

An XPathFactory instance can be used to create XPath objects.

See newInstance(String uri) for lookup mechanism.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh, Jeff Suttor
public abstract class XPathFactory
extends java.lang.Object

An XPathFactory instance can be used to create XPath objects.

See newInstance(String uri) for lookup mechanism.

The XPathFactory class is not thread-safe. In other words, it is the application's responsibility to ensure that at most one thread is using a XPathFactory object at any given moment. Implementations are encouraged to mark methods as synchronized to protect themselves from broken clients.

XPathFactory is not re-entrant. While one of the newInstance methods is being invoked, applications may not attempt to recursively invoke a newInstance method, even from the same thread.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh, Jeff Suttor

XPathFactory.XPathFactory()

XPathFactory


protected XPathFactory()

Protected constructor as newInstance() or newInstance(String uri) or newInstance(String uri, String factoryClassName, ClassLoader classLoader) should be used to create a new instance of an XPathFactory.

XPathFactory

protected XPathFactory()

Protected constructor as newInstance() or newInstance(String uri) should be used to create a new instance of an XPathFactory.

XPathFactory

protected XPathFactory()

Protected constructor as newInstance() or newInstance(String uri) or newInstance(String uri, String factoryClassName, ClassLoader classLoader) should be used to create a new instance of an XPathFactory.

XPathFactory.newInstance(java.lang.String, java.lang.String, java.lang.ClassLoader) (New)

newInstance

public static XPathFactory newInstance(java.lang.String uri,
                                       java.lang.String factoryClassName,
                                       java.lang.ClassLoader classLoader)
                                throws XPathFactoryConfigurationException

Obtain a new instance of a XPathFactory from a factory class name. XPathFactory is returned if specified factory class supports the specified object model. This function is useful when there are multiple providers in the classpath. It gives more control to the application as it can specify which provider should be loaded.

Tip for Trouble-shooting

Setting the jaxp.debug system property will cause this method to print a lot of debug messages to System.err about what it is doing and where it is looking at.

If you have problems try:

 java -Djaxp.debug=1 YourProgram ....
 

Parameters:
uri - Identifies the underlying object model. The specification only defines the URI DEFAULT_OBJECT_MODEL_URI,http://java.sun.com/jaxp/xpath/dom for the W3C DOM, the org.w3c.dom package, and implementations are free to introduce other URIs for other object models.
factoryClassName - fully qualified factory class name that provides implementation of javax.xml.xpath.XPathFactory.
classLoader - ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.
Returns:
New instance of a XPathFactory
Throws:
XPathFactoryConfigurationException - if factoryClassName is null, or the factory class cannot be loaded, instantiated or the factory class does not support the object model specified in the uri parameter.
java.lang.NullPointerException - If uri is null.
java.lang.IllegalArgumentException - If uri is null or uri.length() == 0.
See Also:
newInstance(), newInstance(String uri)

javax.xml.xpath.XPathVariableResolver

XPathVariableResolver.CLASS_COMMENT

public interface XPathVariableResolver

XPathVariableResolver provides access to the set of user defined XPath variables.

The XPathVariableResolver and the XPath evaluator must adhere to a contract that cannot be directly enforced by the API. Although variables may be mutable, that is, an application may wish to evaluate the same XPath expression more than once with different variable values, in the course of evaluating any single XPath expression, a variable's value must not change. be immutable.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh , Jeff Suttor
public interface XPathVariableResolver

XPathVariableResolver provides access to the set of user defined XPath variables.

The XPathVariableResolver and the XPath evaluator must adhere to a contract that cannot be directly enforced by the API. Although variables may be mutable, that is, an application may wish to evaluate the same XPath expression more than once with different variable values, in the course of evaluating any single XPath expression, a variable's value must be immutable.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh, Jeff Suttor
public interface XPathVariableResolver

XPathVariableResolver provides access to the set of user defined XPath variables.

The XPathVariableResolver and the XPath evaluator must adhere to a contract that cannot be directly enforced by the API. Although variables may be mutable, that is, an application may wish to evaluate the same XPath expression more than once with different variable values, in the course of evaluating any single XPath expression, a variable's value must not change.

Since:
1.5
Version:
$Revision: [scrubbed] $, $Revision: [scrubbed] $
Author:
Norman Walsh, Jeff Suttor

org.w3c.dom.Document (1 method)

Document.getDoctype()

getDoctype


DocumentType getDoctype()
The Document Type Declaration (see DocumentType ) associated with this document. For XML documents without a document type declaration this returns null. For HTML documents, a DocumentType object may be returned, independently of the presence or absence of document type declaration in the HTML document.
This provides direct access to the DocumentType node, child node of this Document. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as Node.insertBefore , or Node.replaceChild. Note, however, that while some implementations may instantiate different types of Document objects supporting additional features than the "Core", such as "HTML" [ DOM Level 2 HTML ] , based on the DocumentType specified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.

Since:
DOM Level 3

getDoctype

DocumentType getDoctype()
The Document Type Declaration (see DocumentType) associated with this document. For XML documents without a document type declaration this returns null. For HTML documents, a DocumentType object may be returned, independently of the presence or absence of document type declaration in the HTML document.
This provides direct access to the DocumentType node, child node of this Document. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as Node.insertBefore, or Node.replaceChild. Note, however, that while some implementations may instantiate different types of Document objects supporting additional features than the "Core", such as "HTML" [DOM Level 2 HTML] , based on the DocumentType specified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.

getDoctype

DocumentType getDoctype()
The Document Type Declaration (see DocumentType) associated with this document. For XML documents without a document type declaration this returns null. For HTML documents, a DocumentType object may be returned, independently of the presence or absence of document type declaration in the HTML document.
This provides direct access to the DocumentType node, child node of this Document. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as Node.insertBefore, or Node.replaceChild. Note, however, that while some implementations may instantiate different types of Document objects supporting additional features than the "Core", such as "HTML" [DOM Level 2 HTML] , based on the DocumentType specified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.

Since:
DOM Level 3

org.w3c.dom.DOMImplementation (2 methods)

getFeature(java.lang.String, java.lang.String)
hasFeature(java.lang.String, java.lang.String)

DOMImplementation.getFeature(java.lang.String, java.lang.String)

getFeature


java.lang.Object getFeature(java.lang.String feature,
                            java.lang.String version)
This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in DOM Features. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in . This method also allow the implementation to provide specialized objects which do not support the DOMImplementation interface.

Parameters:
feature - The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.
version - This is the version number of the feature to test.
Returns:
Returns an object which implements the specialized APIs of the specified feature and version, if any, or null if there is no object which implements interfaces associated with that feature. If the DOMObject returned by this method implements the DOMImplementation interface, it must delegate to the primary core DOMImplementation and not return results inconsistent with the primary core DOMImplementation such as hasFeature , getFeature , etc.
Since:
DOM Level 3

getFeature

java.lang.Object getFeature(java.lang.String feature,
                            java.lang.String version)
This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in . The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in . This method also allow the implementation to provide specialized objects which do not support the DOMImplementation interface.

Parameters:
feature - The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.
version - This is the version number of the feature to test.
Returns:
Returns an object which implements the specialized APIs of the specified feature and version, if any, or null if there is no object which implements interfaces associated with that feature. If the DOMObject returned by this method implements the DOMImplementation interface, it must delegate to the primary core DOMImplementation and not return results inconsistent with the primary core DOMImplementation such as hasFeature, getFeature, etc.
Since:
DOM Level 3

getFeature

java.lang.Object getFeature(java.lang.String feature,
                            java.lang.String version)
This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in DOM Features. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in . This method also allow the implementation to provide specialized objects which do not support the DOMImplementation interface.

Parameters:
feature - The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.
version - This is the version number of the feature to test.
Returns:
Returns an object which implements the specialized APIs of the specified feature and version, if any, or null if there is no object which implements interfaces associated with that feature. If the DOMObject returned by this method implements the DOMImplementation interface, it must delegate to the primary core DOMImplementation and not return results inconsistent with the primary core DOMImplementation such as hasFeature, getFeature, etc.
Since:
DOM Level 3

DOMImplementation.hasFeature(java.lang.String, java.lang.String)

hasFeature


boolean hasFeature(java.lang.String feature,
                   java.lang.String version)
Test if the DOM implementation implements a specific feature and version, as specified in DOM Features.

Parameters:
feature - The name of the feature to test.
version - This is the version number of the feature to test.
Returns:
true if the feature is implemented in the specified version, false otherwise.

hasFeature

boolean hasFeature(java.lang.String feature,
                   java.lang.String version)
Test if the DOM implementation implements a specific feature and version, as specified in .

Parameters:
feature - The name of the feature to test.
version - This is the version number of the feature to test.
Returns:
true if the feature is implemented in the specified version, false otherwise.

hasFeature

boolean hasFeature(java.lang.String feature,
                   java.lang.String version)
Test if the DOM implementation implements a specific feature and version, as specified in DOM Features.

Parameters:
feature - The name of the feature to test.
version - This is the version number of the feature to test.
Returns:
true if the feature is implemented in the specified version, false otherwise.

org.w3c.dom.Node (6 methods)

appendChild(org.w3c.dom.Node)
getOwnerDocument()
insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
normalize()
removeChild(org.w3c.dom.Node)
replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)

Node.appendChild(org.w3c.dom.Node)

appendChild


Node appendChild(Node newChild)
                 throws DOMException
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

Parameters:
newChild - The node to add.If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
Returns:
The node added.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to append a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the previous parent of the node being inserted is readonly.
NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node, this exception might be raised if the DOM implementation doesn't support the removal of the DocumentType child or Element child.
Since:
DOM Level 3

appendChild

Node appendChild(Node newChild)
                 throws DOMException
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

Parameters:
newChild - The node to add.If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
Returns:
The node added.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to append a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the previous parent of the node being inserted is readonly.
NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node, this exception might be raised if the DOM implementation doesn't support the removal of the DocumentType child or Element child.

appendChild

Node appendChild(Node newChild)
                 throws DOMException
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

Parameters:
newChild - The node to add.If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
Returns:
The node added.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to append a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the previous parent of the node being inserted is readonly.
NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node, this exception might be raised if the DOM implementation doesn't support the removal of the DocumentType child or Element child.
Since:
DOM Level 3

Node.getOwnerDocument()

getOwnerDocument


Document getOwnerDocument()
The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.

Since:
DOM Level 2

getOwnerDocument

Document getOwnerDocument()
The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.

getOwnerDocument

Document getOwnerDocument()
The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.

Since:
DOM Level 2

Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)

insertBefore


Node insertBefore(Node newChild,
                  Node refChild)
                  throws DOMException
Inserts the node newChild before the existing child node refChild. If refChild is null , insert newChild at the end of the list of children.
If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.

Note: Inserting a node before itself is implementation dependent.

Parameters:
newChild - The node to insert.
refChild - The reference node, i.e., the node before which the new node must be inserted.
Returns:
The node being inserted.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to insert a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document , this exception might be raised if the DOM implementation doesn't support the insertion of a DocumentType or Element node.
Since:
DOM Level 3

insertBefore

Node insertBefore(Node newChild,
                  Node refChild)
                  throws DOMException
Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children.
If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.

Note: Inserting a node before itself is implementation dependent.

Parameters:
newChild - The node to insert.
refChild - The reference node, i.e., the node before which the new node must be inserted.
Returns:
The node being inserted.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to insert a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the insertion of a DocumentType or Element node.

insertBefore

Node insertBefore(Node newChild,
                  Node refChild)
                  throws DOMException
Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children.
If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.

Note: Inserting a node before itself is implementation dependent.

Parameters:
newChild - The node to insert.
refChild - The reference node, i.e., the node before which the new node must be inserted.
Returns:
The node being inserted.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to insert a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the insertion of a DocumentType or Element node.
Since:
DOM Level 3

Node.normalize()

normalize


void normalize()
Puts all Text nodes in the full depth of the sub-tree underneath this Node , including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [ XPointer ] lookups) that depend on a particular document tree structure are to be used. If the parameter "normalize-characters" of the DOMConfiguration object attached to the Node.ownerDocument is true , this method will also fully normalize the characters of the Text nodes.

Note: In cases where the document contains CDATASections , the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.

Since:
DOM Level 3

normalize

void normalize()
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [XPointer] lookups) that depend on a particular document tree structure are to be used. If the parameter "normalize-characters" of the DOMConfiguration object attached to the Node.ownerDocument is true, this method will also fully normalize the characters of the Text nodes.

Note: In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.

normalize

void normalize()
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [XPointer] lookups) that depend on a particular document tree structure are to be used. If the parameter "normalize-characters" of the DOMConfiguration object attached to the Node.ownerDocument is true, this method will also fully normalize the characters of the Text nodes.

Note: In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.

Since:
DOM Level 3

Node.removeChild(org.w3c.dom.Node)

removeChild


Node removeChild(Node oldChild)
                 throws DOMException
Removes the child node indicated by oldChild from the list of children, and returns it.

Parameters:
oldChild - The node being removed.
Returns:
The node removed.
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document , this exception might be raised if the DOM implementation doesn't support the removal of the DocumentType child or the Element child.
Since:
DOM Level 3

removeChild

Node removeChild(Node oldChild)
                 throws DOMException
Removes the child node indicated by oldChild from the list of children, and returns it.

Parameters:
oldChild - The node being removed.
Returns:
The node removed.
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the removal of the DocumentType child or the Element child.

removeChild

Node removeChild(Node oldChild)
                 throws DOMException
Removes the child node indicated by oldChild from the list of children, and returns it.

Parameters:
oldChild - The node being removed.
Returns:
The node removed.
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the removal of the DocumentType child or the Element child.
Since:
DOM Level 3

Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)

replaceChild


Node replaceChild(Node newChild,
                  Node oldChild)
                  throws DOMException
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed.

Note: Replacing a node with itself is implementation dependent.

Parameters:
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
Returns:
The node replaced.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to put in is one of this node's ancestors or this node itself, or if this node is of type Document and the result of the replacement operation would add a second DocumentType or Element on the Document node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document , this exception might be raised if the DOM implementation doesn't support the replacement of the DocumentType child or Element child.
Since:
DOM Level 3

replaceChild

Node replaceChild(Node newChild,
                  Node oldChild)
                  throws DOMException
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed.

Note: Replacing a node with itself is implementation dependent.

Parameters:
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
Returns:
The node replaced.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to put in is one of this node's ancestors or this node itself, or if this node is of type Document and the result of the replacement operation would add a second DocumentType or Element on the Document node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the replacement of the DocumentType child or Element child.

replaceChild

Node replaceChild(Node newChild,
                  Node oldChild)
                  throws DOMException
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed.

Note: Replacing a node with itself is implementation dependent.

Parameters:
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
Returns:
The node replaced.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to put in is one of this node's ancestors or this node itself, or if this node is of type Document and the result of the replacement operation would add a second DocumentType or Element on the Document node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the replacement of the DocumentType child or Element child.
Since:
DOM Level 3