JAXP 1.4 Change Log

This document details all of the changes between the JAXP 1.3 and JAXP 1.4 APIs. For each modified class, interface, method, and field, the changes are shown using revision markup followed by the old and new API definitions. (In the interest of suppressing entirely irrelevant differences, the JAXP 1.3 and JAXP 1.4 API documention has been formatted with the same version of the JavaDoc tool and the CVS revision information has been scrubbed.)

Change Summary

The following items stand out as particularly significant in this release. Many other smaller changes and JavaDoc improvements are detailed below.

Detailed Change Log


javax.xml.datatype.DatatypeConfigurationException

DatatypeConfigurationException.CLASS_COMMENT

javax.xml.datatype
Class DatatypeConfigurationException


 java.lang.Object
  java.lang.Throwable
      java.lang.Exception
          javax.xml.datatype.DatatypeConfigurationException
 

public class DatatypeConfigurationException
extends java.lang.Exception

Indicates a serious configuration error.

TODO: support all constructors

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
Serialized Form

javax.xml.datatype
Class DatatypeConfigurationException

java.lang.Object
  java.lang.Throwable
      java.lang.Exception
          javax.xml.datatype.DatatypeConfigurationException

public class DatatypeConfigurationException
extends java.lang.Exception

Indicates a serious configuration error.

TODO: support all constructors

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
Serialized Form

javax.xml.datatype
Class DatatypeConfigurationException

java.lang.Object
  java.lang.Throwable
      java.lang.Exception
          javax.xml.datatype.DatatypeConfigurationException

public class DatatypeConfigurationException
extends java.lang.Exception

Indicates a serious configuration error.

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
Serialized Form

javax.xml.datatype.DatatypeConstants.Field

DatatypeConstants.Field.CLASS_COMMENT

javax.xml.datatype
Class DatatypeConstants.Field


 java.lang.Object
  javax.xml.datatype.DatatypeConstants.Field
 

public static final class DatatypeConstants.Field
extends java.lang.Object

Type-safe enum class that represents six fields of the Duration class.

Since:
1.5

javax.xml.datatype
Class DatatypeConstants.Field

java.lang.Object
  javax.xml.datatype.DatatypeConstants.Field

public static final class DatatypeConstants.Field
extends java.lang.Object

Type-safe enum class that represents six fields of the Duration class.

javax.xml.datatype
Class DatatypeConstants.Field

java.lang.Object
  javax.xml.datatype.DatatypeConstants.Field

public static final class DatatypeConstants.Field
extends java.lang.Object

Type-safe enum class that represents six fields of the Duration class.

Since:
1.5

javax.xml.datatype.DatatypeFactory (16 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)
newXMLGregorianCalendar(int, int, int, int, int, int, int, int)
newXMLGregorianCalendar(java.math.BigInteger, int, int, int, int, int, java.math.BigDecimal, int)
newXMLGregorianCalendarDate(int, int, int, int)
newXMLGregorianCalendarTime(int, int, int, int)
newXMLGregorianCalendarTime(int, int, int, int, int)
newXMLGregorianCalendarTime(int, int, int, java.math.BigDecimal, int)

DatatypeFactory.CLASS_COMMENT

javax.xml.datatype
Class DatatypeFactory


 java.lang.Object
  javax.xml.datatype.DatatypeFactory
 

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() 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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Joseph Fialli , Jeff Suttor , Neeraj Bajaj

javax.xml.datatype
Class DatatypeFactory

java.lang.Object
  javax.xml.datatype.DatatypeFactory

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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Joseph Fialli, Jeff Suttor

javax.xml.datatype
Class DatatypeFactory

java.lang.Object
  javax.xml.datatype.DatatypeFactory

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: 1.2 $, $Date: 2008/01/24 18:12:22 $
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 com.sun.org.apache.xerces.internal.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 com.sun.org.apache.xerces.internal.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 is not 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 is not 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 is not 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 is not 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 is not 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 is not 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 is not 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 is not 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 is not 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 is not 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 is not 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 is not 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.
Since:
1.6
See Also:
newInstance()

DatatypeFactory.newXMLGregorianCalendar(int, int, int, int, int, int, int, int)

newXMLGregorianCalendar


 public XMLGregorianCalendar newXMLGregorianCalendar(int year,
                                                    int month,
                                                    int day,
                                                    int hour,
                                                    int minute,
                                                    int second,
                                                    int millisecond,
                                                    int timezone)

Constructor of value spaces that a java.util.GregorianCalendar instance would need to convert to an XMLGregorianCalendar instance.

XMLGregorianCalendar eon and fractionalSecond are set to null

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not isnot set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
hour - of XMLGregorianCalendar to be created.
minute - of XMLGregorianCalendar to be created.
second - of XMLGregorianCalendar to be created.
millisecond - of XMLGregorianCalendar to be created.
timezone - of XMLGregorianCalendar to be created.
Returns:
XMLGregorianCalendar created from specified values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().

newXMLGregorianCalendar

public XMLGregorianCalendar newXMLGregorianCalendar(int year,
                                                    int month,
                                                    int day,
                                                    int hour,
                                                    int minute,
                                                    int second,
                                                    int millisecond,
                                                    int timezone)

Constructor of value spaces that a java.util.GregorianCalendar instance would need to convert to an XMLGregorianCalendar instance.

XMLGregorianCalendar eon and fractionalSecond are set to null

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
hour - of XMLGregorianCalendar to be created.
minute - of XMLGregorianCalendar to be created.
second - of XMLGregorianCalendar to be created.
millisecond - of XMLGregorianCalendar to be created.
timezone - of XMLGregorianCalendar to be created.
Returns:
XMLGregorianCalendar created from specified values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().

newXMLGregorianCalendar

public XMLGregorianCalendar newXMLGregorianCalendar(int year,
                                                    int month,
                                                    int day,
                                                    int hour,
                                                    int minute,
                                                    int second,
                                                    int millisecond,
                                                    int timezone)

Constructor of value spaces that a java.util.GregorianCalendar instance would need to convert to an XMLGregorianCalendar instance.

XMLGregorianCalendar eon and fractionalSecond are set to null

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
hour - of XMLGregorianCalendar to be created.
minute - of XMLGregorianCalendar to be created.
second - of XMLGregorianCalendar to be created.
millisecond - of XMLGregorianCalendar to be created.
timezone - of XMLGregorianCalendar to be created.
Returns:
XMLGregorianCalendar created from specified values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().

DatatypeFactory.newXMLGregorianCalendar(java.math.BigInteger, int, int, int, int, int, java.math.BigDecimal, int)

newXMLGregorianCalendar


 public abstract XMLGregorianCalendar newXMLGregorianCalendar(java.math.BigInteger year,
                                                             int month,
                                                             int day,
                                                             int hour,
                                                             int minute,
                                                             int second,
                                                             java.math.BigDecimal fractionalSecond,
                                                             int timezone)

Constructor allowing for complete value spaces allowed by W3C XML Schema 1.0 recommendation for xsd:dateTime and related builtin datatypes. Note that year parameter supports arbitrarily large numbers and fractionalSecond has infinite precision.

A null value indicates that field is not isnot set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
hour - of XMLGregorianCalendar to be created.
minute - of XMLGregorianCalendar to be created.
second - of XMLGregorianCalendar to be created.
fractionalSecond - of XMLGregorianCalendar to be created.
timezone - of XMLGregorianCalendar to be created.
Returns:
XMLGregorianCalendar created from specified values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().

newXMLGregorianCalendar

public abstract XMLGregorianCalendar newXMLGregorianCalendar(java.math.BigInteger year,
                                                             int month,
                                                             int day,
                                                             int hour,
                                                             int minute,
                                                             int second,
                                                             java.math.BigDecimal fractionalSecond,
                                                             int timezone)

Constructor allowing for complete value spaces allowed by W3C XML Schema 1.0 recommendation for xsd:dateTime and related builtin datatypes. Note that year parameter supports arbitrarily large numbers and fractionalSecond has infinite precision.

A null value indicates that field isnot set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
hour - of XMLGregorianCalendar to be created.
minute - of XMLGregorianCalendar to be created.
second - of XMLGregorianCalendar to be created.
fractionalSecond - of XMLGregorianCalendar to be created.
timezone - of XMLGregorianCalendar to be created.
Returns:
XMLGregorianCalendar created from specified values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().

newXMLGregorianCalendar

public abstract XMLGregorianCalendar newXMLGregorianCalendar(java.math.BigInteger year,
                                                             int month,
                                                             int day,
                                                             int hour,
                                                             int minute,
                                                             int second,
                                                             java.math.BigDecimal fractionalSecond,
                                                             int timezone)

Constructor allowing for complete value spaces allowed by W3C XML Schema 1.0 recommendation for xsd:dateTime and related builtin datatypes. Note that year parameter supports arbitrarily large numbers and fractionalSecond has infinite precision.

A null value indicates that field is not set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
hour - of XMLGregorianCalendar to be created.
minute - of XMLGregorianCalendar to be created.
second - of XMLGregorianCalendar to be created.
fractionalSecond - of XMLGregorianCalendar to be created.
timezone - of XMLGregorianCalendar to be created.
Returns:
XMLGregorianCalendar created from specified values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().

DatatypeFactory.newXMLGregorianCalendarDate(int, int, int, int)

newXMLGregorianCalendarDate


 public XMLGregorianCalendar newXMLGregorianCalendarDate(int year,
                                                        int month,
                                                        int day,
                                                        int timezone)

Create a Java representation of XML Schema builtin datatype date or g*.

For example, an instance of gYear can be created invoking this factory with month and day parameters set to DatatypeConstants.FIELD_UNDEFINED.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not isnot set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

newXMLGregorianCalendarDate

public XMLGregorianCalendar newXMLGregorianCalendarDate(int year,
                                                        int month,
                                                        int day,
                                                        int timezone)

Create a Java representation of XML Schema builtin datatype date or g*.

For example, an instance of gYear can be created invoking this factory with month and day parameters set to DatatypeConstants.FIELD_UNDEFINED.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

newXMLGregorianCalendarDate

public XMLGregorianCalendar newXMLGregorianCalendarDate(int year,
                                                        int month,
                                                        int day,
                                                        int timezone)

Create a Java representation of XML Schema builtin datatype date or g*.

For example, an instance of gYear can be created invoking this factory with month and day parameters set to DatatypeConstants.FIELD_UNDEFINED.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not set.

Parameters:
year - of XMLGregorianCalendar to be created.
month - of XMLGregorianCalendar to be created.
day - of XMLGregorianCalendar to be created.
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

DatatypeFactory.newXMLGregorianCalendarTime(int, int, int, int)

newXMLGregorianCalendarTime


 public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not isnot set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

newXMLGregorianCalendarTime

public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

newXMLGregorianCalendarTime

public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

DatatypeFactory.newXMLGregorianCalendarTime(int, int, int, int, int)

newXMLGregorianCalendarTime


 public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        int milliseconds,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not isnot set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
milliseconds - number of milliseconds
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

newXMLGregorianCalendarTime

public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        int milliseconds,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
milliseconds - number of milliseconds
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

newXMLGregorianCalendarTime

public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        int milliseconds,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
milliseconds - number of milliseconds
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

DatatypeFactory.newXMLGregorianCalendarTime(int, int, int, java.math.BigDecimal, int)

newXMLGregorianCalendarTime


 public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        java.math.BigDecimal fractionalSecond,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A null value indicates that field is not isnot set.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not isnot set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
fractionalSecond - value of null indicates that this optional field is not set.
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

newXMLGregorianCalendarTime

public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        java.math.BigDecimal fractionalSecond,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A null value indicates that field isnot set.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field isnot set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
fractionalSecond - value of null indicates that this optional field is not set.
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

newXMLGregorianCalendarTime

public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours,
                                                        int minutes,
                                                        int seconds,
                                                        java.math.BigDecimal fractionalSecond,
                                                        int timezone)

Create a Java instance of XML Schema builtin datatype time.

A null value indicates that field is not set.

A DatatypeConstants.FIELD_UNDEFINED value indicates that field is not set.

Parameters:
hours - number of hours
minutes - number of minutes
seconds - number of seconds
fractionalSecond - value of null indicates that this optional field is not set.
timezone - offset in minutes. DatatypeConstants.FIELD_UNDEFINED indicates optional field is not set.
Returns:
XMLGregorianCalendar created from parameter values.
Throws:
java.lang.IllegalArgumentException - If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in XMLGregorianCalendar or if the composite values constitute an invalid XMLGregorianCalendar instance as determined by XMLGregorianCalendar.isValid().
See Also:
DatatypeConstants.FIELD_UNDEFINED

javax.xml.datatype.Duration (2 methods)

CLASS_COMMENT
Duration()
equals(java.lang.Object)

Duration.CLASS_COMMENT

javax.xml.datatype
Class Duration


 java.lang.Object
  javax.xml.datatype.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 Duration s. The impacted methods document their dependency on Calendar .

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Joseph Fialli , Kohsuke Kawaguchi , Jeff Suttor , Sunitha Reddy
See Also:
XMLGregorianCalendar.add(Duration)

javax.xml.datatype
Class Duration

java.lang.Object
  javax.xml.datatype.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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Joseph Fialli, Kohsuke Kawaguchi, Jeff Suttor
See Also:
XMLGregorianCalendar.add(Duration)

javax.xml.datatype
Class Duration

java.lang.Object
  javax.xml.datatype.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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Joseph Fialli, Kohsuke Kawaguchi, Jeff Suttor, Sunitha Reddy
See Also:
XMLGregorianCalendar.add(Duration)

Duration.Duration()

Duration


 public Duration()
Default no-arg constructor.

Note: Always use the DatatypeFactory to construct an instance of Duration. The constructor on this class cannot be guaranteed to produce an object with a consistent state and may be removed in the future.

Duration

public Duration()

Duration

public Duration()
Default no-arg constructor.

Note: Always use the DatatypeFactory to construct an instance of Duration. The constructor on this class cannot be guaranteed to produce an object with a consistent state and may be removed in the future.

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 (6 methods)

CLASS_COMMENT
XMLGregorianCalendar()
add(javax.xml.datatype.Duration)
equals(java.lang.Object)
setFractionalSecond(java.math.BigDecimal)
setMillisecond(int)
toGregorianCalendar()

XMLGregorianCalendar.CLASS_COMMENT

javax.xml.datatype
Class XMLGregorianCalendar


 java.lang.Object
  javax.xml.datatype.XMLGregorianCalendar
 

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 dateTime , DatatypeConstants.TIME time , DatatypeConstants.DATE date , DatatypeConstants.GYEARMONTH gYearMonth , DatatypeConstants.GMONTHDAY gMonthDay , DatatypeConstants.GYEAR gYear , DatatypeConstants.GMONTH gMonth , and DatatypeConstants.GDAYand 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()
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()
month getMonth() 1 to 12 or DatatypeConstants.FIELD_UNDEFINED
day getDay()
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()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()
minute getMinute() 0 to 59 or DatatypeConstants.FIELD_UNDEFINED
second getSecond()
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()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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Joseph Fialli , Kohsuke Kawaguchi , Jeff Suttor , Sunitha Reddy
See Also:
Duration , DatatypeFactory

javax.xml.datatype
Class XMLGregorianCalendar

java.lang.Object
  javax.xml.datatype.XMLGregorianCalendar

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 dateTime, time, date, gYearMonth, gMonthDay, gYear gMonth and 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.
hourgetHour() 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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Joseph Fialli, Kohsuke Kawaguchi, Jeff Suttor
See Also:
Duration, DatatypeFactory

javax.xml.datatype
Class XMLGregorianCalendar

java.lang.Object
  javax.xml.datatype.XMLGregorianCalendar

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.
hourgetHour() 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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Joseph Fialli, Kohsuke Kawaguchi, Jeff Suttor, Sunitha Reddy
See Also:
Duration, DatatypeFactory

XMLGregorianCalendar.XMLGregorianCalendar()

XMLGregorianCalendar


 public XMLGregorianCalendar()
Default no-arg constructor.

Note: Always use the DatatypeFactory to construct an instance of XMLGregorianCalendar. The constructor on this class cannot be guaranteed to produce an object with a consistent state and may be removed in the future.

XMLGregorianCalendar

public XMLGregorianCalendar()

XMLGregorianCalendar

public XMLGregorianCalendar()
Default no-arg constructor.

Note: Always use the DatatypeFactory to construct an instance of XMLGregorianCalendar. The constructor on this class cannot be guaranteed to produce an object with a consistent state and may be removed in the future.

XMLGregorianCalendar.add(javax.xml.datatype.Duration)

add


 public abstract void add(Duration duration)

Add duration to this instance.

The computation is specified in XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes >. date/time field mapping table date/time field mapping table defines the mapping from XML Schema 1.0 dateTime fields to this class' representation of those fields.

Parameters:
duration - Duration to add to this XMLGregorianCalendar.
Throws:
java.lang.NullPointerException - when duration parameter is null.

add

public abstract void add(Duration duration)

Add duration to this instance.

The computation is specified in XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes>. date/time field mapping table defines the mapping from XML Schema 1.0 dateTime fields to this class' representation of those fields.

Parameters:
duration - Duration to add to this XMLGregorianCalendar.
Throws:
java.lang.NullPointerException - when duration parameter is null.

add

public abstract void add(Duration duration)

Add duration to this instance.

The computation is specified in XML Schema 1.0 Part 2, Appendix E, Adding durations to dateTimes>. date/time field mapping table defines the mapping from XML Schema 1.0 dateTime fields to this class' representation of those fields.

Parameters:
duration - Duration to add to this XMLGregorianCalendar.
Throws:
java.lang.NullPointerException - when duration parameter is null.

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.

XMLGregorianCalendar.setFractionalSecond(java.math.BigDecimal)

setFractionalSecond


 public abstract void setFractionalSecond(java.math.BigDecimal fractional)

Set fractional seconds.

Unset this field by invoking the setter with a parameter value of null.

Parameters:
fractional - value constraints summarized in second field of date/time field mapping table fractional field of date/time field mapping table.
Throws:
java.lang.IllegalArgumentException - if fractional parameter is outside value constraints for the field as specified in date/time field mapping table.

setFractionalSecond

public abstract void setFractionalSecond(java.math.BigDecimal fractional)

Set fractional seconds.

Unset this field by invoking the setter with a parameter value of null.

Parameters:
fractional - value constraints summarized in fractional field of date/time field mapping table.
Throws:
java.lang.IllegalArgumentException - if fractional parameter is outside value constraints for the field as specified in date/time field mapping table.

setFractionalSecond

public abstract void setFractionalSecond(java.math.BigDecimal fractional)

Set fractional seconds.

Unset this field by invoking the setter with a parameter value of null.

Parameters:
fractional - value constraints summarized in second field of date/time field mapping table.
Throws:
java.lang.IllegalArgumentException - if fractional parameter is outside value constraints for the field as specified in date/time field mapping table.

XMLGregorianCalendar.setMillisecond(int)

setMillisecond


 public abstract void setMillisecond(int millisecond)

Set milliseconds.

Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.

Parameters:
millisecond - value constraints summarized in second field of date/time field mapping table millisecond field of date/time field mapping table.
Throws:
java.lang.IllegalArgumentException - if millisecond parameter is outside value constraints for the field as specified in date/time field mapping table.

setMillisecond

public abstract void setMillisecond(int millisecond)

Set milliseconds.

Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.

Parameters:
millisecond - value constraints summarized in millisecond field of date/time field mapping table.
Throws:
java.lang.IllegalArgumentException - if millisecond parameter is outside value constraints for the field as specified in date/time field mapping table.

setMillisecond

public abstract void setMillisecond(int millisecond)

Set milliseconds.

Unset this field by invoking the setter with a parameter value of DatatypeConstants.FIELD_UNDEFINED.

Parameters:
millisecond - value constraints summarized in second field of date/time field mapping table.
Throws:
java.lang.IllegalArgumentException - if millisecond parameter is outside value constraints for the field as specified in date/time field mapping table.

XMLGregorianCalendar.toGregorianCalendar()

toGregorianCalendar


 public abstract java.util.GregorianCalendar toGregorianCalendar()

Convert this XMLGregorianCalendar to a GregorianCalendar.

When this instance has an undefined field, this conversion relies on the java.util.GregorianCalendar default for its corresponding field. A notable difference between XML Schema 1.0 date/time datatypes and java.util.GregorianCalendar is that Timezone value is optional for date/time datatypes and it is a required field for java.util.GregorianCalendar. See javadoc for java.util.TimeZone.getDefault() on how the default is determined. To explicitly specify the TimeZone instance, see toGregorianCalendar(TimeZone, Locale, XMLGregorianCalendar).

Field by Field Conversion from this class to java.util.GregorianCalendar
java.util.GregorianCalendar field javax.xml.datatype.XMLGregorianCalendar field
ERA getEonAndYear() .signum() <0 ? GregorianCalendar.BC : GregorianCalendar.AD
YEAR getEonAndYear() .abs().intValue() *
MONTH getMonth() - DatatypeConstants.JANUARY + Calendar.JANUARY
DAY_OF_MONTH getDay()
HOUR_OF_DAY getHour()
MINUTE getMinute()
SECOND getSecond()
MILLISECOND get millisecond order from getFractionalSecond() *
GregorianCalendar.setTimeZone(TimeZone) getTimezone() formatted into Custom timezone id
* designates possible loss of precision during the conversion due to source datatype having higher precision than target datatype.

To ensure consistency in conversion implementations, the new GregorianCalendar should be instantiated in following manner.

  • Using timeZone value as defined above, create a new java.util.GregorianCalendar(timeZone,Locale.getDefault()).
  • Initialize all GregorianCalendar fields by calling Calendar.clear(). {(@link GegorianCalendar#clear()}.
  • Obtain a pure Gregorian Calendar by invoking GregorianCalendar.setGregorianChange( new Date(Long.MIN_VALUE)).
  • Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND are set using the method Calendar.set(int,int)

See Also:
toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar)

toGregorianCalendar

public abstract java.util.GregorianCalendar toGregorianCalendar()

Convert this XMLGregorianCalendar to a GregorianCalendar.

When this instance has an undefined field, this conversion relies on the java.util.GregorianCalendar default for its corresponding field. A notable difference between XML Schema 1.0 date/time datatypes and java.util.GregorianCalendar is that Timezone value is optional for date/time datatypes and it is a required field for java.util.GregorianCalendar. See javadoc for java.util.TimeZone.getDefault() on how the default is determined. To explicitly specify the TimeZone instance, see toGregorianCalendar(TimeZone, Locale, XMLGregorianCalendar).

Field by Field Conversion from this class to java.util.GregorianCalendar
java.util.GregorianCalendar fieldjavax.xml.datatype.XMLGregorianCalendar field
ERAgetEonAndYear().signum() <0 ? GregorianCalendar.BC : GregorianCalendar.AD
YEARgetEonAndYear().abs().intValue()*
MONTHgetMonth() - DatatypeConstants.JANUARY + Calendar.JANUARY
DAY_OF_MONTHgetDay()
HOUR_OF_DAYgetHour()
MINUTEgetMinute()
SECONDgetSecond()
MILLISECONDget millisecond order from getFractionalSecond()*
GregorianCalendar.setTimeZone(TimeZone)getTimezone() formatted into Custom timezone id
* designates possible loss of precision during the conversion due to source datatype having higher precision than target datatype.

To ensure consistency in conversion implementations, the new GregorianCalendar should be instantiated in following manner.

  • Using timeZone value as defined above, create a new java.util.GregorianCalendar(timeZone,Locale.getDefault()).
  • Initialize all GregorianCalendar fields by calling {(@link GegorianCalendar#clear()}.
  • Obtain a pure Gregorian Calendar by invoking GregorianCalendar.setGregorianChange( new Date(Long.MIN_VALUE)).
  • Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND are set using the method Calendar.set(int,int)

See Also:
toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar)

toGregorianCalendar

public abstract java.util.GregorianCalendar toGregorianCalendar()

Convert this XMLGregorianCalendar to a GregorianCalendar.

When this instance has an undefined field, this conversion relies on the java.util.GregorianCalendar default for its corresponding field. A notable difference between XML Schema 1.0 date/time datatypes and java.util.GregorianCalendar is that Timezone value is optional for date/time datatypes and it is a required field for java.util.GregorianCalendar. See javadoc for java.util.TimeZone.getDefault() on how the default is determined. To explicitly specify the TimeZone instance, see toGregorianCalendar(TimeZone, Locale, XMLGregorianCalendar).

Field by Field Conversion from this class to java.util.GregorianCalendar
java.util.GregorianCalendar fieldjavax.xml.datatype.XMLGregorianCalendar field
ERAgetEonAndYear().signum() <0 ? GregorianCalendar.BC : GregorianCalendar.AD
YEARgetEonAndYear().abs().intValue()*
MONTHgetMonth() - DatatypeConstants.JANUARY + Calendar.JANUARY
DAY_OF_MONTHgetDay()
HOUR_OF_DAYgetHour()
MINUTEgetMinute()
SECONDgetSecond()
MILLISECONDget millisecond order from getFractionalSecond()*
GregorianCalendar.setTimeZone(TimeZone)getTimezone() formatted into Custom timezone id
* designates possible loss of precision during the conversion due to source datatype having higher precision than target datatype.

To ensure consistency in conversion implementations, the new GregorianCalendar should be instantiated in following manner.

  • Using timeZone value as defined above, create a new java.util.GregorianCalendar(timeZone,Locale.getDefault()).
  • Initialize all GregorianCalendar fields by calling Calendar.clear().
  • Obtain a pure Gregorian Calendar by invoking GregorianCalendar.setGregorianChange( new Date(Long.MIN_VALUE)).
  • Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND are set using the method Calendar.set(int,int)

See Also:
toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar)

javax.xml.namespace.NamespaceContext (3 methods)

CLASS_COMMENT
getNamespaceURI(java.lang.String)
getPrefix(java.lang.String)
getPrefixes(java.lang.String)

NamespaceContext.CLASS_COMMENT

javax.xml.namespace
Interface NamespaceContext


public interface NamespaceContext

Interface for read only XML Namespace context processing.

An XML Namespace has the properties:

  • Namespace URI: Namespace name expressed as a URI to which the prefix is bound
  • prefix: syntactically, this is the part of the attribute name following the XMLConstants.XMLNS_ATTRIBUTE ("xmlns") in the Namespace declaration

example: <element xmlns:prefix="http://Namespace-name-URI">

All get*(*) methods operate in the current scope for Namespace URI and prefix resolution.

Note that a Namespace URI can be bound to multiple prefixes in the current scope. This can occur when multiple XMLConstants.XMLNS_ATTRIBUTE ("xmlns") Namespace declarations occur in the same Start-Tag and refer to the same Namespace URI. e.g.


 <element xmlns:prefix1="http://Namespace-name-URI"
          xmlns:prefix2="http://Namespace-name-URI">
 
This can also occur when the same Namespace URI is used in multiple XMLConstants.XMLNS_ATTRIBUTE ("xmlns") Namespace declarations in the logical parent element hierarchy. e.g.

 <parent xmlns:prefix1="http://Namespace-name-URI">
   <child xmlns:prefix2="http://Namespace-name-URI">
     ...
   </child>
 </parent>
 

A prefix can only be bound to a single Namespace URI in the current scope.

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
javax.xml.XMLConstants for declarations of common XML values javax.XMLConstants for declarations of common XML values , XML Schema Part2: Datatypes XML Schema Part2: Datatypes , Namespaces in XML Namespaces in XML , Namespaces in XML Errata Namespaces in XML Errata

javax.xml.namespace
Interface NamespaceContext


public interface NamespaceContext

Interface for read only XML Namespace context processing.

An XML Namespace has the properties:

  • Namespace URI: Namespace name expressed as a URI to which the prefix is bound
  • prefix: syntactically, this is the part of the attribute name following the XMLConstants.XMLNS_ATTRIBUTE ("xmlns") in the Namespace declaration

example: <element xmlns:prefix="http://Namespace-name-URI">

All get*(*) methods operate in the current scope for Namespace URI and prefix resolution.

Note that a Namespace URI can be bound to multiple prefixes in the current scope. This can occur when multiple XMLConstants.XMLNS_ATTRIBUTE ("xmlns") Namespace declarations occur in the same Start-Tag and refer to the same Namespace URI. e.g.

 <element xmlns:prefix1="http://Namespace-name-URI"
          xmlns:prefix2="http://Namespace-name-URI">
 
This can also occur when the same Namespace URI is used in multiple XMLConstants.XMLNS_ATTRIBUTE ("xmlns") Namespace declarations in the logical parent element hierarchy. e.g.
 <parent xmlns:prefix1="http://Namespace-name-URI">
   <child xmlns:prefix2="http://Namespace-name-URI">
     ...
   </child>
 </parent>
 

A prefix can only be bound to a single Namespace URI in the current scope.

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
javax.XMLConstants for declarations of common XML values, XML Schema Part2: Datatypes, Namespaces in XML, Namespaces in XML Errata

javax.xml.namespace
Interface NamespaceContext


public interface NamespaceContext

Interface for read only XML Namespace context processing.

An XML Namespace has the properties:

  • Namespace URI: Namespace name expressed as a URI to which the prefix is bound
  • prefix: syntactically, this is the part of the attribute name following the XMLConstants.XMLNS_ATTRIBUTE ("xmlns") in the Namespace declaration

example: <element xmlns:prefix="http://Namespace-name-URI">

All get*(*) methods operate in the current scope for Namespace URI and prefix resolution.

Note that a Namespace URI can be bound to multiple prefixes in the current scope. This can occur when multiple XMLConstants.XMLNS_ATTRIBUTE ("xmlns") Namespace declarations occur in the same Start-Tag and refer to the same Namespace URI. e.g.

 <element xmlns:prefix1="http://Namespace-name-URI"
          xmlns:prefix2="http://Namespace-name-URI">
 
This can also occur when the same Namespace URI is used in multiple XMLConstants.XMLNS_ATTRIBUTE ("xmlns") Namespace declarations in the logical parent element hierarchy. e.g.
 <parent xmlns:prefix1="http://Namespace-name-URI">
   <child xmlns:prefix2="http://Namespace-name-URI">
     ...
   </child>
 </parent>
 

A prefix can only be bound to a single Namespace URI in the current scope.

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
javax.xml.XMLConstants for declarations of common XML values, XML Schema Part2: Datatypes, Namespaces in XML, Namespaces in XML Errata

NamespaceContext.getNamespaceURI(java.lang.String)

getNamespaceURI


 java.lang.String getNamespaceURI(java.lang.String prefix)

Get Namespace URI bound to a prefix in the current scope.

When requesting a Namespace URI by prefix, the following table describes the returned Namespace URI value for all possible prefix values:

getNamespaceURI(prefix) return value for specified prefixes
prefix parameter Namespace URI return value
DEFAULT_NS_PREFIX ("") default Namespace URI in the current scope or XMLConstants.NULL_NS_URI("") when there is no default Namespace URI in the current scope
bound prefix Namespace URI bound to prefix in current scope
unbound prefix XMLConstants.NULL_NS_URI("")
XMLConstants.XML_NS_PREFIX ("xml") XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")
XMLConstants.XMLNS_ATTRIBUTE ("xmlns") XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")
null IllegalArgumentException is thrown

Parameters:
prefix - prefix to look up
Returns:
Namespace URI bound to prefix in the current scope
Throws:
java.lang.IllegalArgumentException - When prefix is null

getNamespaceURI

java.lang.String getNamespaceURI(java.lang.String prefix)

Get Namespace URI bound to a prefix in the current scope.

When requesting a Namespace URI by prefix, the following table describes the returned Namespace URI value for all possible prefix values:

getNamespaceURI(prefix) return value for specified prefixes
prefix parameterNamespace URI return value
DEFAULT_NS_PREFIX ("")default Namespace URI in the current scope or XMLConstants.NULL_NS_URI("") when there is no default Namespace URI in the current scope
bound prefixNamespace URI bound to prefix in current scope
unbound prefixXMLConstants.NULL_NS_URI("")
XMLConstants.XML_NS_PREFIX ("xml")XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")
XMLConstants.XMLNS_ATTRIBUTE ("xmlns")XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")
nullIllegalArgumentException is thrown

Parameters:
prefix - prefix to look up
Returns:
Namespace URI bound to prefix in the current scope

getNamespaceURI

java.lang.String getNamespaceURI(java.lang.String prefix)

Get Namespace URI bound to a prefix in the current scope.

When requesting a Namespace URI by prefix, the following table describes the returned Namespace URI value for all possible prefix values:

getNamespaceURI(prefix) return value for specified prefixes
prefix parameterNamespace URI return value
DEFAULT_NS_PREFIX ("")default Namespace URI in the current scope or XMLConstants.NULL_NS_URI("") when there is no default Namespace URI in the current scope
bound prefixNamespace URI bound to prefix in current scope
unbound prefix XMLConstants.NULL_NS_URI("")
XMLConstants.XML_NS_PREFIX ("xml")XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")
XMLConstants.XMLNS_ATTRIBUTE ("xmlns")XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")
nullIllegalArgumentException is thrown

Parameters:
prefix - prefix to look up
Returns:
Namespace URI bound to prefix in the current scope
Throws:
java.lang.IllegalArgumentException - When prefix is null

NamespaceContext.getPrefix(java.lang.String)

getPrefix


 java.lang.String getPrefix(java.lang.String namespaceURI)

Get prefix bound to Namespace URI in the current scope.

To get all prefixes bound to a Namespace URI in the current scope, use getPrefixes(String namespaceURI).

When requesting a prefix by Namespace URI, the following table describes the returned prefix value for all Namespace URI values:

getPrefix(namespaceURI) return value for specified Namespace URIs
Namespace URI parameter prefix value returned
<default Namespace URI> XMLConstants.DEFAULT_NS_PREFIX ("")
bound Namespace URI prefix bound to Namespace URI in the current scope, if multiple prefixes are bound to the Namespace URI in the current scope, a single arbitrary prefix, whose choice is implementation dependent, is returned
unbound Namespace URI null
XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace") XMLConstants.XML_NS_PREFIX ("xml")
XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/") XMLConstants.XMLNS_ATTRIBUTE ("xmlns")
null IllegalArgumentException is thrown

Parameters:
namespaceURI - URI of Namespace to lookup
Returns:
prefix bound to Namespace URI in current context
Throws:
java.lang.IllegalArgumentException - When namespaceURI is null

getPrefix

java.lang.String getPrefix(java.lang.String namespaceURI)

Get prefix bound to Namespace URI in the current scope.

To get all prefixes bound to a Namespace URI in the current scope, use getPrefixes(String namespaceURI).

When requesting a prefix by Namespace URI, the following table describes the returned prefix value for all Namespace URI values:

getPrefix(namespaceURI) return value for specified Namespace URIs
Namespace URI parameterprefix value returned
<default Namespace URI>XMLConstants.DEFAULT_NS_PREFIX ("")
bound Namespace URIprefix bound to Namespace URI in the current scope, if multiple prefixes are bound to the Namespace URI in the current scope, a single arbitrary prefix, whose choice is implementation dependent, is returned
unbound Namespace URInull
XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")XMLConstants.XML_NS_PREFIX ("xml")
XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")XMLConstants.XMLNS_ATTRIBUTE ("xmlns")
nullIllegalArgumentException is thrown

Parameters:
namespaceURI - URI of Namespace to lookup
Returns:
prefix bound to Namespace URI in current context

getPrefix

java.lang.String getPrefix(java.lang.String namespaceURI)

Get prefix bound to Namespace URI in the current scope.

To get all prefixes bound to a Namespace URI in the current scope, use getPrefixes(String namespaceURI).

When requesting a prefix by Namespace URI, the following table describes the returned prefix value for all Namespace URI values:

getPrefix(namespaceURI) return value for specified Namespace URIs
Namespace URI parameterprefix value returned
<default Namespace URI>XMLConstants.DEFAULT_NS_PREFIX ("")
bound Namespace URIprefix bound to Namespace URI in the current scope, if multiple prefixes are bound to the Namespace URI in the current scope, a single arbitrary prefix, whose choice is implementation dependent, is returned
unbound Namespace URInull
XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")XMLConstants.XML_NS_PREFIX ("xml")
XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")XMLConstants.XMLNS_ATTRIBUTE ("xmlns")
nullIllegalArgumentException is thrown

Parameters:
namespaceURI - URI of Namespace to lookup
Returns:
prefix bound to Namespace URI in current context
Throws:
java.lang.IllegalArgumentException - When namespaceURI is null

NamespaceContext.getPrefixes(java.lang.String)

getPrefixes


 java.util.Iterator getPrefixes(java.lang.String namespaceURI)

Get all prefixes bound to a Namespace URI in the current scope.

An Iterator over String elements is returned in an arbitrary, implementation dependent , order.

The Iterator is not modifiable. e.g. the remove() method will throw UnsupportedOperationException.

When requesting prefixes by Namespace URI, the following table describes the returned prefixes value for all Namespace URI values:

getPrefixes(namespaceURI) return value for specified Namespace URIs
Namespace URI parameter prefixes value returned
bound Namespace URI, including the <default Namespace URI> Iterator over prefixes bound to Namespace URI in the current scope in an arbitrary, implementation dependent , order
unbound Namespace URI empty Iterator
XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace") Iterator with one element set to XMLConstants.XML_NS_PREFIX ("xml")
XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/") Iterator with one element set to XMLConstants.XMLNS_ATTRIBUTE ("xmlns")
null IllegalArgumentException is thrown

Parameters:
namespaceURI - URI of Namespace to lookup
Returns:
Iterator for all prefixes bound to the Namespace URI in the current scope
Throws:
java.lang.IllegalArgumentException - When namespaceURI is null

getPrefixes

java.util.Iterator getPrefixes(java.lang.String namespaceURI)

Get all prefixes bound to a Namespace URI in the current scope.

An Iterator over String elements is returned in an arbitrary, implementation dependent, order.

The Iterator is not modifiable. e.g. the remove() method will throw UnsupportedOperationException.

When requesting prefixes by Namespace URI, the following table describes the returned prefixes value for all Namespace URI values:

getPrefixes(namespaceURI) return value for specified Namespace URIs
Namespace URI parameterprefixes value returned
bound Namespace URI, including the <default Namespace URI>Iterator over prefixes bound to Namespace URI in the current scope in an arbitrary, implementation dependent, order
unbound Namespace URIempty Iterator
XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")Iterator with one element set to XMLConstants.XML_NS_PREFIX ("xml")
XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")Iterator with one element set to XMLConstants.XMLNS_ATTRIBUTE ("xmlns")
nullIllegalArgumentException is thrown

Parameters:
namespaceURI - URI of Namespace to lookup
Returns:
Iterator for all prefixes bound to the Namespace URI in the current scope

getPrefixes

java.util.Iterator getPrefixes(java.lang.String namespaceURI)

Get all prefixes bound to a Namespace URI in the current scope.

An Iterator over String elements is returned in an arbitrary, implementation dependent, order.

The Iterator is not modifiable. e.g. the remove() method will throw UnsupportedOperationException.

When requesting prefixes by Namespace URI, the following table describes the returned prefixes value for all Namespace URI values:

getPrefixes(namespaceURI) return value for specified Namespace URIs
Namespace URI parameterprefixes value returned
bound Namespace URI, including the <default Namespace URI> Iterator over prefixes bound to Namespace URI in the current scope in an arbitrary, implementation dependent, order
unbound Namespace URIempty Iterator
XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")Iterator with one element set to XMLConstants.XML_NS_PREFIX ("xml")
XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")Iterator with one element set to XMLConstants.XMLNS_ATTRIBUTE ("xmlns")
nullIllegalArgumentException is thrown

Parameters:
namespaceURI - URI of Namespace to lookup
Returns:
Iterator for all prefixes bound to the Namespace URI in the current scope
Throws:
java.lang.IllegalArgumentException - When namespaceURI is null

javax.xml.namespace.QName (4 methods)

CLASS_COMMENT
QName(java.lang.String)
QName(java.lang.String, java.lang.String)
QName(java.lang.String, java.lang.String, java.lang.String)
valueOf(java.lang.String)

QName.CLASS_COMMENT

javax.xml.namespace
Class QName


 java.lang.Object
  javax.xml.namespace.QName
 

public class QName
extends java.lang.Object
implements java.io.Serializable

QName represents a qualified name as defined in the XML specifications: XML Schema Part2: Datatypes specification , Namespaces in XML , Namespaces in XML Errata.

The value of a QName contains a Namespace URI , local part and prefix .

The prefix is included in QName to retain lexical information when present in an XML input source. The prefix is NOT used in QName.equals(Object) or to compute the QName.hashCode(). Equality and the hash code are defined using only the Namespace URI and local part.

If not specified, the Namespace URI is set to XMLConstants.NULL_NS_URI. If not specified, the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

QName is immutable.

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
XML Schema Part2: Datatypes specification XML Schema Part2: Datatypes specification , Namespaces in XML Namespaces in XML , Namespaces in XML Errata Namespaces in XML Errata , Serialized Form

javax.xml.namespace
Class QName

java.lang.Object
  javax.xml.namespace.QName

public class QName
extends java.lang.Object
implements java.io.Serializable

QName represents a qualified name as defined in the XML specifications: XML Schema Part2: Datatypes specification, Namespaces in XML, Namespaces in XML Errata.

The value of a QName contains a Namespace URI, local part and prefix.

The prefix is included in QName to retain lexical information when present in an XML input source. The prefix is NOT used in QName.equals(Object) or to compute the QName.hashCode(). Equality and the hash code are defined using only the Namespace URI and local part.

If not specified, the Namespace URI is set to XMLConstants.NULL_NS_URI. If not specified, the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

QName is immutable.

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
XML Schema Part2: Datatypes specification, Namespaces in XML, Namespaces in XML Errata, Serialized Form

javax.xml.namespace
Class QName

java.lang.Object
  javax.xml.namespace.QName

public class QName
extends java.lang.Object
implements java.io.Serializable

QName represents a qualified name as defined in the XML specifications: XML Schema Part2: Datatypes specification, Namespaces in XML, Namespaces in XML Errata.

The value of a QName contains a Namespace URI, local part and prefix.

The prefix is included in QName to retain lexical information when present in an XML input source. The prefix is NOT used in QName.equals(Object) or to compute the QName.hashCode(). Equality and the hash code are defined using only the Namespace URI and local part.

If not specified, the Namespace URI is set to XMLConstants.NULL_NS_URI. If not specified, the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

QName is immutable.

Since:
1.5
Version:
$Revision: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor
See Also:
XML Schema Part2: Datatypes specification, Namespaces in XML, Namespaces in XML Errata, Serialized Form

QName.QName(java.lang.String)

QName


 public QName(java.lang.String localPart)

QName constructor specifying the local part.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

When using this constructor, the Namespace URI is set to XMLConstants.NULL_NS_URI and the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

In an XML context, all Element and Attribute names exist in the context of a Namespace. Making this explicit during the construction of a QName helps prevent hard to diagnosis XML validity errors. The constructors QName(String namespaceURI, String localPart) and QName(String namespaceURI, String localPart, String prefix) are preferred.

The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
localPart - local part of the QName
Throws:
java.lang.IllegalArgumentException - When localPart is null
See Also:
QName(String namespaceURI, String localPart) , QName(String namespaceURI, String localPart, String prefix)

QName

public QName(java.lang.String localPart)

QName constructor specifying the local part.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

When using this constructor, the Namespace URI is set to XMLConstants.NULL_NS_URI and the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

In an XML context, all Element and Attribute names exist in the context of a Namespace. Making this explicit during the construction of a QName helps prevent hard to diagnosis XML validity errors. The constructors QName(String namespaceURI, String localPart) and QName(String namespaceURI, String localPart, String prefix) are preferred.

The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
localPart - local part of the QName
See Also:
QName(String namespaceURI, String localPart), QName(String namespaceURI, String localPart, String prefix)

QName

public QName(java.lang.String localPart)

QName constructor specifying the local part.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

When using this constructor, the Namespace URI is set to XMLConstants.NULL_NS_URI and the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

In an XML context, all Element and Attribute names exist in the context of a Namespace. Making this explicit during the construction of a QName helps prevent hard to diagnosis XML validity errors. The constructors QName(String namespaceURI, String localPart) and QName(String namespaceURI, String localPart, String prefix) are preferred.

The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
localPart - local part of the QName
Throws:
java.lang.IllegalArgumentException - When localPart is null
See Also:
QName(String namespaceURI, String localPart), QName(String namespaceURI, String localPart, String prefix)

QName.QName(java.lang.String, java.lang.String)

QName


 public QName(java.lang.String namespaceURI,
             java.lang.String localPart)

QName constructor specifying the Namespace URI and local part.

If the Namespace URI is null , it is set to XMLConstants.NULL_NS_URI. This value represents no explicitly defined Namespace as defined by the Namespaces in XML specification. This action preserves compatible behavior with QName 1.0. Explicitly providing the XMLConstants.NULL_NS_URI value is the preferred coding style.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

When using this constructor, the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

The Namespace URI is not validated as a URI reference. The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
namespaceURI - Namespace URI of the QName
localPart - local part of the QName
Throws:
java.lang.IllegalArgumentException - When localPart is null
See Also:
QName(String namespaceURI, String localPart, String prefix)

QName

public QName(java.lang.String namespaceURI,
             java.lang.String localPart)

QName constructor specifying the Namespace URI and local part.

If the Namespace URI is null, it is set to XMLConstants.NULL_NS_URI. This value represents no explicitly defined Namespace as defined by the Namespaces in XML specification. This action preserves compatible behavior with QName 1.0. Explicitly providing the XMLConstants.NULL_NS_URI value is the preferred coding style.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

When using this constructor, the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

The Namespace URI is not validated as a URI reference. The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
namespaceURI - Namespace URI of the QName
localPart - local part of the QName
See Also:
QName(String namespaceURI, String localPart, String prefix)

QName

public QName(java.lang.String namespaceURI,
             java.lang.String localPart)

QName constructor specifying the Namespace URI and local part.

If the Namespace URI is null, it is set to XMLConstants.NULL_NS_URI. This value represents no explicitly defined Namespace as defined by the Namespaces in XML specification. This action preserves compatible behavior with QName 1.0. Explicitly providing the XMLConstants.NULL_NS_URI value is the preferred coding style.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

When using this constructor, the prefix is set to XMLConstants.DEFAULT_NS_PREFIX.

The Namespace URI is not validated as a URI reference. The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
namespaceURI - Namespace URI of the QName
localPart - local part of the QName
Throws:
java.lang.IllegalArgumentException - When localPart is null
See Also:
QName(String namespaceURI, String localPart, String prefix)

QName.QName(java.lang.String, java.lang.String, java.lang.String)

QName


 public QName(java.lang.String namespaceURI,
             java.lang.String localPart,
             java.lang.String prefix)

QName constructor specifying the Namespace URI, local part and prefix.

If the Namespace URI is null , it is set to XMLConstants.NULL_NS_URI. This value represents no explicitly defined Namespace as defined by the Namespaces in XML specification. This action preserves compatible behavior with QName 1.0. Explicitly providing the XMLConstants.NULL_NS_URI value is the preferred coding style.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

If the prefix is null , an IllegalArgumentException is thrown. Use XMLConstants.DEFAULT_NS_PREFIX to explicitly indicate that no prefix is present or the prefix is not relevant.

The Namespace URI is not validated as a URI reference. The local part and prefix are not validated as a NCName as specified in Namespaces in XML.

Parameters:
namespaceURI - Namespace URI of the QName
localPart - local part of the QName
prefix - prefix of the QName
Throws:
java.lang.IllegalArgumentException - When localPart or prefix is null

QName


public QName(java.lang.String namespaceURI,
             java.lang.String localPart,
             java.lang.String prefix)

QName constructor specifying the Namespace URI, local part and prefix.

If the Namespace URI is null, it is set to XMLConstants.NULL_NS_URI. This value represents no explicitly defined Namespace as defined by the Namespaces in XML specification. This action preserves compatible behavior with QName 1.0. Explicitly providing the XMLConstants.NULL_NS_URI value is the preferred coding style.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

If the prefix is null, an IllegalArgumentException is thrown. Use XMLConstants.DEFAULT_NS_PREFIX to explicitly indicate that no prefix is present or the prefix is not relevant.

The Namespace URI is not validated as a URI reference. The local part and prefix are not validated as a NCName as specified in Namespaces in XML.

Parameters:
namespaceURI - Namespace URI of the QName
localPart - local part of the QName
prefix - prefix of the QName

QName


public QName(java.lang.String namespaceURI,
             java.lang.String localPart,
             java.lang.String prefix)

QName constructor specifying the Namespace URI, local part and prefix.

If the Namespace URI is null, it is set to XMLConstants.NULL_NS_URI. This value represents no explicitly defined Namespace as defined by the Namespaces in XML specification. This action preserves compatible behavior with QName 1.0. Explicitly providing the XMLConstants.NULL_NS_URI value is the preferred coding style.

If the local part is null an IllegalArgumentException is thrown. A local part of "" is allowed to preserve compatible behavior with QName 1.0.

If the prefix is null, an IllegalArgumentException is thrown. Use XMLConstants.DEFAULT_NS_PREFIX to explicitly indicate that no prefix is present or the prefix is not relevant.

The Namespace URI is not validated as a URI reference. The local part and prefix are not validated as a NCName as specified in Namespaces in XML.

Parameters:
namespaceURI - Namespace URI of the QName
localPart - local part of the QName
prefix - prefix of the QName
Throws:
java.lang.IllegalArgumentException - When localPart or prefix is null

QName.valueOf(java.lang.String)

valueOf



 public static QName valueOf(java.lang.String qNameAsString)

QName derived from parsing the formatted String.

If the String is null or does not conform to QName.toString() formatting, an IllegalArgumentException is thrown.

The String MUST be in the form returned by QName.toString().

The commonly accepted way of representing a QName as a String was defined by James Clark. Although this is not a standard specification, it is in common use, e.g. Transformer.setParameter(String name, Object value). This implementation parses a String formatted as: "{" + Namespace URI + "}" + local part. If the Namespace URI .equals(XMLConstants.NULL_NS_URI) , only the local part should be provided.

The prefix value CANNOT be represented in the String and will be set to XMLConstants.DEFAULT_NS_PREFIX.

This method does not do full validation of the resulting QName.

The Namespace URI is not validated as a URI reference. The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
qNameAsString - String representation of the QName
Returns:
QName corresponding to the given String
Throws:
java.lang.IllegalArgumentException - When qNameAsString is null or malformed
See Also:
QName.toString()

valueOf


public static QName valueOf(java.lang.String qNameAsString)

QName derived from parsing the formatted String.

If the String is null or does not conform to QName.toString() formatting, an IllegalArgumentException is thrown.

The String MUST be in the form returned by QName.toString().

The commonly accepted way of representing a QName as a String was defined by James Clark. Although this is not a standard specification, it is in common use, e.g. Transformer.setParameter(String name, Object value). This implementation parses a String formatted as: "{" + Namespace URI + "}" + local part. If the Namespace URI .equals(XMLConstants.NULL_NS_URI), only the local part should be provided.

The prefix value CANNOT be represented in the String and will be set to XMLConstants.DEFAULT_NS_PREFIX.

This method does not do full validation of the resulting QName.

The Namespace URI is not validated as a URI reference. The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
qNameAsString - String representation of the QName
Returns:
QName corresponding to the given String
See Also:
QName.toString()

valueOf


public static QName valueOf(java.lang.String qNameAsString)

QName derived from parsing the formatted String.

If the String is null or does not conform to QName.toString() formatting, an IllegalArgumentException is thrown.

The String MUST be in the form returned by QName.toString().

The commonly accepted way of representing a QName as a String was defined by James Clark. Although this is not a standard specification, it is in common use, e.g. Transformer.setParameter(String name, Object value). This implementation parses a String formatted as: "{" + Namespace URI + "}" + local part. If the Namespace URI .equals(XMLConstants.NULL_NS_URI), only the local part should be provided.

The prefix value CANNOT be represented in the String and will be set to XMLConstants.DEFAULT_NS_PREFIX.

This method does not do full validation of the resulting QName.

The Namespace URI is not validated as a URI reference. The local part is not validated as a NCName as specified in Namespaces in XML.

Parameters:
qNameAsString - String representation of the QName
Returns:
QName corresponding to the given String
Throws:
java.lang.IllegalArgumentException - When qNameAsString is null or malformed
See Also:
QName.toString()

javax.xml.parsers.DocumentBuilder (8 methods)

getSchema()
isXIncludeAware()
parse(java.io.File)
parse(java.io.InputStream)
parse(java.io.InputStream, java.lang.String)
parse(java.lang.String)
parse(org.xml.sax.InputSource)
reset()

DocumentBuilder.getSchema()

getSchema



 public Schema getSchema()

Get a reference to the the Schema being used by the XML processor.

If no schema is being used, null is returned.

Returns:
Schema being used or null if none in use
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

getSchema


public Schema getSchema()

Get a reference to the the Schema being used by the XML processor.

If no schema is being used, null is returned.

Returns:
Schema being used or null if none in use
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

getSchema


public Schema getSchema()

Get a reference to the the Schema being used by the XML processor.

If no schema is being used, null is returned.

Returns:
Schema being used or null if none in use
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method
Since:
1.5

DocumentBuilder.isXIncludeAware()

isXIncludeAware



 public boolean isXIncludeAware()

Get the XInclude processing mode for this parser.

Returns:
the return value of the DocumentBuilderFactory.isXIncludeAware() when this parser was created from factory.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5
See Also:
DocumentBuilderFactory.setXIncludeAware(boolean)

isXIncludeAware


public boolean isXIncludeAware()

Get the XInclude processing mode for this parser.

Returns:
the return value of the DocumentBuilderFactory.isXIncludeAware() when this parser was created from factory.
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5
See Also:
DocumentBuilderFactory.setXIncludeAware(boolean)

isXIncludeAware


public boolean isXIncludeAware()

Get the XInclude processing mode for this parser.

Returns:
the return value of the DocumentBuilderFactory.isXIncludeAware() when this parser was created from factory.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method
Since:
1.5
See Also:
DocumentBuilderFactory.setXIncludeAware(boolean)

DocumentBuilder.parse(java.io.File)

parse



 public Document parse(java.io.File f)
               throws SAXException,
                      java.io.IOException
Parse the content of the given file as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the File is null null.

Parameters:
f - The file containing the XML to parse.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When f is null
See Also:
DocumentHandler

parse


public Document parse(java.io.File f)
               throws SAXException,
                      java.io.IOException
Parse the content of the given file as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the File is null null.

Parameters:
f - The file containing the XML to parse.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
See Also:
DocumentHandler

parse


public Document parse(java.io.File f)
               throws SAXException,
                      java.io.IOException
Parse the content of the given file as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the File is null null.

Parameters:
f - The file containing the XML to parse.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When f is null
See Also:
DocumentHandler

DocumentBuilder.parse(java.io.InputStream)

parse



 public Document parse(java.io.InputStream is)
               throws SAXException,
                      java.io.IOException
Parse the content of the given InputStream as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputStream is null.

Parameters:
is - InputStream containing the content to be parsed.
Returns:
Document result of parsing the InputStream
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When is is null
See Also:
DocumentHandler

parse


public Document parse(java.io.InputStream is)
               throws SAXException,
                      java.io.IOException
Parse the content of the given InputStream as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputStream is null.

Parameters:
is - InputStream containing the content to be parsed.
Returns:
Document result of parsing the InputStream
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
See Also:
DocumentHandler

parse


public Document parse(java.io.InputStream is)
               throws SAXException,
                      java.io.IOException
Parse the content of the given InputStream as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputStream is null.

Parameters:
is - InputStream containing the content to be parsed.
Returns:
Document result of parsing the InputStream
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When is is null
See Also:
DocumentHandler

DocumentBuilder.parse(java.io.InputStream, java.lang.String)

parse



 public Document parse(java.io.InputStream is,
                      java.lang.String systemId)
               throws SAXException,
                      java.io.IOException
Parse the content of the given InputStream as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputStream is null.

Parameters:
is - InputStream containing the content to be parsed.
systemId - Provide a base for resolving relative URIs.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When is is null
See Also:
DocumentHandler

parse


public Document parse(java.io.InputStream is,
                      java.lang.String systemId)
               throws SAXException,
                      java.io.IOException
Parse the content of the given InputStream as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputStream is null.

Parameters:
is - InputStream containing the content to be parsed.
systemId - Provide a base for resolving relative URIs.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
See Also:
DocumentHandler

parse


public Document parse(java.io.InputStream is,
                      java.lang.String systemId)
               throws SAXException,
                      java.io.IOException
Parse the content of the given InputStream as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputStream is null.

Parameters:
is - InputStream containing the content to be parsed.
systemId - Provide a base for resolving relative URIs.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When is is null
See Also:
DocumentHandler

DocumentBuilder.parse(java.lang.String)

parse



 public Document parse(java.lang.String uri)
               throws SAXException,
                      java.io.IOException
Parse the content of the given URI as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the URI is null null.

Parameters:
uri - The location of the content to be parsed.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When uri is null
See Also:
DocumentHandler

parse


public Document parse(java.lang.String uri)
               throws SAXException,
                      java.io.IOException
Parse the content of the given URI as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the URI is null null.

Parameters:
uri - The location of the content to be parsed.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
See Also:
DocumentHandler

parse


public Document parse(java.lang.String uri)
               throws SAXException,
                      java.io.IOException
Parse the content of the given URI as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the URI is null null.

Parameters:
uri - The location of the content to be parsed.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When uri is null
See Also:
DocumentHandler

DocumentBuilder.parse(org.xml.sax.InputSource)

parse



 public abstract Document parse(InputSource is)
                        throws SAXException,
                               java.io.IOException
Parse the content of the given input source as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputSource is null null.

Parameters:
is - InputSource containing the content to be parsed.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When is is null
See Also:
DocumentHandler

parse


public abstract Document parse(InputSource is)
                        throws SAXException,
                               java.io.IOException
Parse the content of the given input source as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputSource is null null.

Parameters:
is - InputSource containing the content to be parsed.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
See Also:
DocumentHandler

parse


public abstract Document parse(InputSource is)
                        throws SAXException,
                               java.io.IOException
Parse the content of the given input source as an XML document and return a new DOM Document object. An IllegalArgumentException is thrown if the InputSource is null null.

Parameters:
is - InputSource containing the content to be parsed.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - When is is null
See Also:
DocumentHandler

DocumentBuilder.reset()

reset



 public void reset()

Reset this DocumentBuilder to its original configuration.

DocumentBuilder is reset to the same state as when it was created with DocumentBuilderFactory.newDocumentBuilder(). reset() is designed to allow the reuse of existing DocumentBuilder s thus saving resources associated with the creation of new DocumentBuilder s.

The reset DocumentBuilder is not guaranteed to have the same EntityResolver or ErrorHandler Object s, e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal EntityResolver and ErrorHandler.

Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

reset


public void reset()

Reset this DocumentBuilder to its original configuration.

DocumentBuilder is reset to the same state as when it was created with DocumentBuilderFactory.newDocumentBuilder(). reset() is designed to allow the reuse of existing DocumentBuilders thus saving resources associated with the creation of new DocumentBuilders.

The reset DocumentBuilder is not guaranteed to have the same EntityResolver or ErrorHandler Objects, e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal EntityResolver and ErrorHandler.

Since:
1.5

reset


public void reset()

Reset this DocumentBuilder to its original configuration.

DocumentBuilder is reset to the same state as when it was created with DocumentBuilderFactory.newDocumentBuilder(). reset() is designed to allow the reuse of existing DocumentBuilders thus saving resources associated with the creation of new DocumentBuilders.

The reset DocumentBuilder is not guaranteed to have the same EntityResolver or ErrorHandler Objects, e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal EntityResolver and ErrorHandler.

Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

javax.xml.parsers.DocumentBuilderFactory (8 methods)

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

DocumentBuilderFactory.CLASS_COMMENT

javax.xml.parsers
Class DocumentBuilderFactory



 java.lang.Object
  javax.xml.parsers.DocumentBuilderFactory
 

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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor Jeff Suttor , Neeraj Bajaj

javax.xml.parsers
Class DocumentBuilderFactory


java.lang.Object
  javax.xml.parsers.DocumentBuilderFactory

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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor

javax.xml.parsers
Class DocumentBuilderFactory


java.lang.Object
  javax.xml.parsers.DocumentBuilderFactory

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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor, Neeraj Bajaj

DocumentBuilderFactory.DocumentBuilderFactory()

DocumentBuilderFactory



 protected DocumentBuilderFactory()

Protected constructor to prevent instantiation. Use newInstance() .

DocumentBuilderFactory


protected DocumentBuilderFactory()

DocumentBuilderFactory


protected DocumentBuilderFactory()

Protected constructor to prevent instantiation. Use newInstance().

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. - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
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 - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
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.isXIncludeAware()

isXIncludeAware



 public boolean isXIncludeAware()

Get state of XInclude processing.

Returns:
current state of XInclude processing
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method. - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

isXIncludeAware


public boolean isXIncludeAware()

Get state of XInclude processing.

Returns:
current state of XInclude processing
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

isXIncludeAware


public boolean isXIncludeAware()

Get state of XInclude processing.

Returns:
current state of XInclude processing
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.
Since:
1.6
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. - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
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 - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
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

DocumentBuilderFactory.setValidating(boolean)

setValidating



 public void setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, it essentially just controls the DTD validation. (except the legacy two properties defined in JAXP 1.2.) 1.2. See here for more details.)

To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser to be a non-validating parser by leaving the setValidating(boolean) method false , then use the setSchema(Schema) method to associate a schema to a parser.

Parameters:
validating - true if the parser produced will validate documents as they are parsed; false otherwise.

setValidating


public void setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, it essentially just controls the DTD validation. (except the legacy two properties defined in JAXP 1.2. See here for more details.)

To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser to be a non-validating parser by leaving the setValidating(boolean) method false, then use the setSchema(Schema) method to associate a schema to a parser.

Parameters:
validating - true if the parser produced will validate documents as they are parsed; false otherwise.

setValidating


public void setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, it essentially just controls the DTD validation. (except the legacy two properties defined in JAXP 1.2.)

To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser to be a non-validating parser by leaving the setValidating(boolean) method false, then use the setSchema(Schema) method to associate a schema to a parser.

Parameters:
validating - true if the parser produced will validate documents as they are parsed; false otherwise.

DocumentBuilderFactory.setXIncludeAware(boolean)

setXIncludeAware



 public void setXIncludeAware(boolean state)

Set state of XInclude processing.

If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.

XInclude processing defaults to false.

Parameters:
state - Set XInclude processing to true or false
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method. - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

setXIncludeAware


public void setXIncludeAware(boolean state)

Set state of XInclude processing.

If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.

XInclude processing defaults to false.

Parameters:
state - Set XInclude processing to true or false
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

setXIncludeAware


public void setXIncludeAware(boolean state)

Set state of XInclude processing.

If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.

XInclude processing defaults to false.

Parameters:
state - Set XInclude processing to true or false
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method.
Since:
1.5

javax.xml.parsers.SAXParser (3 methods)

getSchema()
isXIncludeAware()
reset()

SAXParser.getSchema()

getSchema



 public Schema getSchema()

Get a reference to the the Schema being used by the XML processor.

If no schema is being used, null is returned.

Returns:
Schema being used or null if none in use
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

getSchema


public Schema getSchema()

Get a reference to the the Schema being used by the XML processor.

If no schema is being used, null is returned.

Returns:
Schema being used or null if none in use
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

getSchema


public Schema getSchema()

Get a reference to the the Schema being used by the XML processor.

If no schema is being used, null is returned.

Returns:
Schema being used or null if none in use
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method
Since:
1.5

SAXParser.isXIncludeAware()

isXIncludeAware



 public boolean isXIncludeAware()

Get the XInclude processing mode for this parser.

Returns:
the return value of the SAXParserFactory.isXIncludeAware() when this parser was created from factory.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5
See Also:
SAXParserFactory.setXIncludeAware(boolean)

isXIncludeAware


public boolean isXIncludeAware()

Get the XInclude processing mode for this parser.

Returns:
the return value of the SAXParserFactory.isXIncludeAware() when this parser was created from factory.
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5
See Also:
SAXParserFactory.setXIncludeAware(boolean)

isXIncludeAware


public boolean isXIncludeAware()

Get the XInclude processing mode for this parser.

Returns:
the return value of the SAXParserFactory.isXIncludeAware() when this parser was created from factory.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method
Since:
1.5
See Also:
SAXParserFactory.setXIncludeAware(boolean)

SAXParser.reset()

reset



 public void reset()

Reset this SAXParser to its original configuration.

SAXParser is reset to the same state as when it was created with SAXParserFactory.newSAXParser(). reset() is designed to allow the reuse of existing SAXParser s thus saving resources associated with the creation of new SAXParser s.

The reset SAXParser is not guaranteed to have the same Schema Object , e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal Schema.

Throws:
java.lang.UnsupportedOperationException - When Implementations do not override this method
Since:
1.5

reset


public void reset()

Reset this SAXParser to its original configuration.

SAXParser is reset to the same state as when it was created with SAXParserFactory.newSAXParser(). reset() is designed to allow the reuse of existing SAXParsers thus saving resources associated with the creation of new SAXParsers.

The reset SAXParser is not guaranteed to have the same Schema Object, e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal Schema.

Since:
1.5

reset


public void reset()

Reset this SAXParser to its original configuration.

SAXParser is reset to the same state as when it was created with SAXParserFactory.newSAXParser(). reset() is designed to allow the reuse of existing SAXParsers thus saving resources associated with the creation of new SAXParsers.

The reset SAXParser is not guaranteed to have the same Schema Object, e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal Schema.

Throws:
java.lang.UnsupportedOperationException - When Implementations do not override this method
Since:
1.5

javax.xml.parsers.SAXParserFactory (6 methods)

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

SAXParserFactory.CLASS_COMMENT

javax.xml.parsers
Class SAXParserFactory



 java.lang.Object
  javax.xml.parsers.SAXParserFactory
 

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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor Jeff Suttor , Neeraj Bajaj

javax.xml.parsers
Class SAXParserFactory


java.lang.Object
  javax.xml.parsers.SAXParserFactory

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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor

javax.xml.parsers
Class SAXParserFactory


java.lang.Object
  javax.xml.parsers.SAXParserFactory

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: 1.2 $, $Date: 2008/01/24 18:12:22 $
Author:
Jeff Suttor, Neeraj Bajaj

SAXParserFactory.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 SAXParserFactory is created.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
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 - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
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

SAXParserFactory.isXIncludeAware()

isXIncludeAware



 public boolean isXIncludeAware()

Get state of XInclude processing.

Returns:
current state of XInclude processing
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

isXIncludeAware


public boolean isXIncludeAware()

Get state of XInclude processing.

Returns:
current state of XInclude processing
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

isXIncludeAware


public boolean isXIncludeAware()

Get state of XInclude processing.

Returns:
current state of XInclude processing
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method
Since:
1.5

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.SAXParserFactory.
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.
Since:
1.6
See Also:
newInstance()

SAXParserFactory.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 warnings/errors/fatal errors are found by the validator, the parser must handle them as if those errors were 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 SAX event stream (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive those modified event stream.

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 non-null Schema object. Such configuration will cause a SAXException exception when those properties are set on a SAXParser.

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, null to remove a schema.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
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 warnings/errors/fatal errors are found by the validator, the parser must handle them as if those errors were 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 SAX event stream (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive those modified event stream.

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 non-null Schema object. Such configuration will cause a SAXException exception when those properties are set on a SAXParser.

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, null to remove a schema.
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
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 warnings/errors/fatal errors are found by the validator, the parser must handle them as if those errors were 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 SAX event stream (for example by adding default values that were missing in documents), and a parser is responsible to make sure that the application will receive those modified event stream.

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 non-null Schema object. Such configuration will cause a SAXException exception when those properties are set on a SAXParser.

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, null to remove a schema.
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method
Since:
1.5

SAXParserFactory.setValidating(boolean)

setValidating



 public void setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, it essentially just controls the DTD validation. (except the legacy two properties defined in JAXP 1.2.) 1.2. See here for more details.)

To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser to be a non-validating parser by leaving the setValidating(boolean) method false , then use the setSchema(Schema) method to associate a schema to a parser.

Parameters:
validating - true if the parser produced by this code will validate documents as they are parsed; false otherwise.

setValidating


public void setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, it essentially just controls the DTD validation. (except the legacy two properties defined in JAXP 1.2. See here for more details.)

To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser to be a non-validating parser by leaving the setValidating(boolean) method false, then use the setSchema(Schema) method to associate a schema to a parser.

Parameters:
validating - true if the parser produced by this code will validate documents as they are parsed; false otherwise.

setValidating


public void setValidating(boolean validating)
Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to false.

Note that "the validation" here means a validating parser as defined in the XML recommendation. In other words, it essentially just controls the DTD validation. (except the legacy two properties defined in JAXP 1.2.)

To use modern schema languages such as W3C XML Schema or RELAX NG instead of DTD, you can configure your parser to be a non-validating parser by leaving the setValidating(boolean) method false, then use the setSchema(Schema) method to associate a schema to a parser.

Parameters:
validating - true if the parser produced by this code will validate documents as they are parsed; false otherwise.

SAXParserFactory.setXIncludeAware(boolean)

setXIncludeAware



 public void setXIncludeAware(boolean state)

Set state of XInclude processing.

If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.

XInclude processing defaults to false.

Parameters:
state - Set XInclude processing to true or false
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

setXIncludeAware


public void setXIncludeAware(boolean state)

Set state of XInclude processing.

If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.

XInclude processing defaults to false.

Parameters:
state - Set XInclude processing to true or false
Throws:
java.lang.UnsupportedOperationException - For backward compatibility, when implementations for earlier versions of JAXP is used, this exception will be thrown.
Since:
1.5

setXIncludeAware


public void setXIncludeAware(boolean state)

Set state of XInclude processing.

If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.

XInclude processing defaults to false.

Parameters:
state - Set XInclude processing to true or false
Throws:
java.lang.UnsupportedOperationException - When implementation does not override this method
Since:
1.5

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

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

EventFilter.CLASS_COMMENT (New)

javax.xml.stream
Interface EventFilter


public interface EventFilter

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

Since:
1.6
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)

javax.xml.stream
Class FactoryConfigurationError


java.lang.Object
  java.lang.Throwable
      java.lang.Error
          javax.xml.stream.FactoryConfigurationError

public class FactoryConfigurationError
extends java.lang.Error

An error class for reporting factory configuration errors.

Since:
1.6
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)

javax.xml.stream
Interface Location


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:
1.6
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)

javax.xml.stream
Interface StreamFilter


public interface StreamFilter

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

Since:
1.6
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)

javax.xml.stream
Class XMLEventFactory


java.lang.Object
  javax.xml.stream.XMLEventFactory

public abstract class XMLEventFactory
extends java.lang.Object

This interface defines a utility class for creating instances of XMLEvents

Since:
1.6
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)

javax.xml.stream
Interface XMLEventReader


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:
1.6
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)

javax.xml.stream
Interface XMLEventWriter


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:
1.6
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 TypeRequired FieldsOptional FieldsRequired 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)

javax.xml.stream
Class XMLInputFactory


java.lang.Object
  javax.xml.stream.XMLInputFactory

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 NameBehaviorReturn typeDefault ValueRequired
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:
1.6
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)

javax.xml.stream
Class XMLOutputFactory


java.lang.Object
  javax.xml.stream.XMLOutputFactory

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 NameBehaviorReturn typeDefault ValueRequired
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:
1.6
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)

javax.xml.stream
Interface XMLReporter


public interface XMLReporter

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

Since:
1.6
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)

javax.xml.stream
Interface XMLResolver


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:
1.6
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)

javax.xml.stream
Interface XMLStreamConstants


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:
1.6

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)

javax.xml.stream
Class XMLStreamException


java.lang.Object
  java.lang.Throwable
      java.lang.Exception
          javax.xml.stream.XMLStreamException

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:
1.6
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)

javax.xml.stream
Interface XMLStreamReader


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 TypeValid 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:
1.6
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)

javax.xml.stream
Interface XMLStreamWriter


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.

XML Namespaces, javax.xml.stream.isRepairingNamespaces and write method behaviour
MethodisRepairingNamespaces == trueisRepairingNamespaces == false
namespaceURI boundnamespaceURI unboundnamespaceURI boundnamespaceURI unbound
writeAttribute(namespaceURI, localName, value) prefix:localName="value" [1] xmlns:{generated}="namespaceURI" {generated}:localName="value" prefix:localName="value" [1] XMLStreamException
writeAttribute(prefix, namespaceURI, localName, value) bound to same prefix:
prefix:localName="value" [1]

bound to different prefix:
xmlns:{generated}="namespaceURI" {generated}:localName="value"
xmlns:prefix="namespaceURI" prefix:localName="value" [3] bound to same prefix:
prefix:localName="value" [1][2]

bound to different prefix:
XMLStreamException[2]
xmlns:prefix="namespaceURI" prefix:localName="value" [2][5]
writeStartElement(namespaceURI, localName)

writeEmptyElement(namespaceURI, localName)
<prefix:localName> [1] <{generated}:localName xmlns:{generated}="namespaceURI"> <prefix:localName> [1] XMLStreamException
writeStartElement(prefix, localName, namespaceURI)

writeEmptyElement(prefix, localName, namespaceURI)
bound to same prefix:
<prefix:localName> [1]

bound to different prefix:
<{generated}:localName xmlns:{generated}="namespaceURI">
<prefix:localName xmlns:prefix="namespaceURI"> [4] bound to same prefix:
<prefix:localName> [1]

bound to different prefix:
XMLStreamException
<prefix:localName> 
Notes:
  • [1] if namespaceURI == default Namespace URI, then no prefix is written
  • [2] if prefix == "" || null && namespaceURI == "", then no prefix or Namespace declaration is generated or written
  • [3] if prefix == "" || null, then a prefix is randomly generated
  • [4] if prefix == "" || null, then it is treated as the default Namespace and no prefix is generated or written, an xmlns declaration is generated and written if the namespaceURI is unbound
  • [5] if prefix == "" || null, then it is treated as an invalid attempt to define the default Namespace and an XMLStreamException is thrown

Since:
1.6
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.isRepairingNamespaces 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.isRepairingNamespaces 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.isRepairingNamespaces 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 - If given encoding does not match encoding of the underlying stream

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

javax.xml.stream.events
Interface Attribute


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:
1.6
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)

javax.xml.stream.events
Interface Characters


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:
1.6
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)

javax.xml.stream.events
Interface Comment


public interface Comment
extends XMLEvent

An interface for comment events

Since:
1.6
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)

javax.xml.stream.events
Interface DTD


public interface DTD
extends XMLEvent

This is the top level interface for events dealing with DTDs

Since:
1.6
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)

javax.xml.stream.events
Interface EndDocument


public interface EndDocument
extends XMLEvent

A marker interface for the end of the document

Since:
1.6
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)

javax.xml.stream.events
Interface EndElement


public interface EndElement
extends XMLEvent

An interface for the end element event. An EndElement is reported for each End Tag in the document.

Since:
1.6
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)

javax.xml.stream.events
Interface EntityDeclaration


public interface EntityDeclaration
extends XMLEvent

An interface for handling Entity Declarations This interface is used to record and report unparsed entity declarations.

Since:
1.6
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)

javax.xml.stream.events
Interface EntityReference


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:
1.6
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)

javax.xml.stream.events
Interface Namespace


public interface Namespace
extends Attribute

An interface that contains information about a namespace. Namespaces are accessed from a StartElement.

Since:
1.6
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)

javax.xml.stream.events
Interface NotationDeclaration


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:
1.6
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)

javax.xml.stream.events
Interface ProcessingInstruction


public interface ProcessingInstruction
extends XMLEvent

An interface that describes the data found in processing instructions

Since:
1.6
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)

javax.xml.stream.events
Interface StartDocument


public interface StartDocument
extends XMLEvent

An interface for the start document event

Since:
1.6
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)

javax.xml.stream.events
Interface StartElement


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:
1.6
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)

javax.xml.stream.events
Interface XMLEvent


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:
1.6
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)

javax.xml.stream.util
Class EventReaderDelegate


java.lang.Object
  javax.xml.stream.util.EventReaderDelegate

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:
1.6
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)

javax.xml.stream.util
Class StreamReaderDelegate


java.lang.Object
  javax.xml.stream.util.StreamReaderDelegate

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:
1.6
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)

javax.xml.stream.util
Interface XMLEventAllocator


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:
1.6
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)

javax.xml.stream.util
Interface XMLEventConsumer


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:
1.6
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.