diff --git a/fine-third-default/fine-org-w3c/README.md b/fine-third-default/fine-org-w3c/README.md
deleted file mode 100644
index 7d70af71c..000000000
--- a/fine-third-default/fine-org-w3c/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-1.css的源码地址:https://www.w3.org/Style/CSS/SAC
-版本:1.3
-2.svg的源码地址:https://www.mvnjar.com/org.axsl.org.w3c.dom.svg/svg-dom-java/1.1/detail.html
-版本:1.1
\ No newline at end of file
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/smil/ElementTimeControl.java b/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/smil/ElementTimeControl.java
deleted file mode 100644
index 9474fc331..000000000
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/smil/ElementTimeControl.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.w3c.dom.smil;
-
-import org.w3c.dom.DOMException;
-
-/**
- * @author zhouping
- * @version 10.0
- * Created by zhouping on 2019/12/20
- */
-
-public interface ElementTimeControl {
- boolean beginElement() throws DOMException;
-
- boolean beginElementAt(float var1) throws DOMException;
-
- boolean endElement() throws DOMException;
-
- boolean endElementAt(float var1) throws DOMException;
-}
\ No newline at end of file
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/smil/TimeEvent.java b/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/smil/TimeEvent.java
deleted file mode 100644
index 117b7eed8..000000000
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/smil/TimeEvent.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.w3c.dom.smil;
-
-import org.w3c.dom.events.Event;
-import org.w3c.dom.views.AbstractView;
-
-/**
- * @author zhouping
- * @version 10.0
- * Created by zhouping on 2019/12/20
- */
-public interface TimeEvent extends Event {
- AbstractView getView();
-
- int getDetail();
-
- void initTimeEvent(String var1, AbstractView var2, int var3);
-}
diff --git a/fine-third-jdk11/README.md b/fine-third-jdk11/README.md
new file mode 100644
index 000000000..51e307236
--- /dev/null
+++ b/fine-third-jdk11/README.md
@@ -0,0 +1 @@
+只有在jdk11编译时需要依赖
\ No newline at end of file
diff --git a/fine-third-jdk8/README.md b/fine-third-jdk8/README.md
new file mode 100644
index 000000000..82337a4ae
--- /dev/null
+++ b/fine-third-jdk8/README.md
@@ -0,0 +1 @@
+只有在jdk7或者jdk8编译时需要依赖
\ No newline at end of file
diff --git a/fine-third-jdk8/xml-apis/README.md b/fine-third-jdk8/xml-apis/README.md
new file mode 100644
index 000000000..6e1102448
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/README.md
@@ -0,0 +1,2 @@
+源码地址:https://www.mvnjar.com/xml-apis/xml-apis/1.4.01/detail.html
+版本:1.4.01
\ No newline at end of file
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/XMLConstants.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/XMLConstants.java
new file mode 100644
index 000000000..9ede70d52
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/XMLConstants.java
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: XMLConstants.java 584477 2007-10-14 02:44:03Z mrglavas $
+
+package javax.xml;
+
+/**
+ *
Utility class to contain basic XML values as constants.
+ * + * @author Jeff Suttor + * @version $Revision: 584477 $, $Date: 2007-10-13 22:44:03 -0400 (Sat, 13 Oct 2007) $ + * @see Extensible Markup Language (XML) 1.1 + * @see Extensible Markup Language (XML) 1.0 (Second Edition) + * @see XML 1.0 Second Edition Specification Errata + * @see Namespaces in XML 1.1 + * @see Namespaces in XML + * @see Namespaces in XML Errata + * @see XML Schema Part 1: Structures + * @since 1.5 + **/ +public final class XMLConstants { + + /** + *Private constructor to prevent instantiation.
+ */ + private XMLConstants() { + } + + /** + *Namespace URI to use to represent that there is no Namespace.
+ * + *Defined by the Namespace specification to be "".
+ * + * @see + * Namespaces in XML, 5.2 Namespace Defaulting + */ + public static final String NULL_NS_URI = ""; + + /** + *Prefix to use to represent the default XML Namespace.
+ * + *Defined by the XML specification to be "".
+ * + * @see + * Namespaces in XML, 3. Qualified Names + */ + public static final String DEFAULT_NS_PREFIX = ""; + + /** + *The official XML Namespace name URI.
+ * + *Defined by the XML specification to be
+ * "http://www.w3.org/XML/1998/namespace
".
The official XML Namespace prefix.
+ * + *Defined by the XML specification to be "xml
".
The official XML attribute used for specifying XML Namespace + * declarations, {@link #XMLNS_ATTRIBUTE + * XMLConstants.XMLNS_ATTRIBUTE}, Namespace name URI.
+ * + *Defined by the XML specification to be
+ * "http://www.w3.org/2000/xmlns/
".
The official XML attribute used for specifying XML Namespace + * declarations.
+ * + *It is NOT valid to use as a
+ * prefix. Defined by the XML specification to be
+ * "xmlns
".
W3C XML Schema Namespace URI.
+ * + *Defined to be "http://www.w3.org/2001/XMLSchema
".
+ *
+ * @see
+ * XML Schema Part 1:
+ * Structures, 2.6 Schema-Related Markup in Documents Being Validated
+ */
+ public static final String W3C_XML_SCHEMA_NS_URI =
+ "http://www.w3.org/2001/XMLSchema";
+
+ /**
+ *
W3C XML Schema Instance Namespace URI.
+ * + *Defined to be "http://www.w3.org/2001/XMLSchema-instance
".
W3C XPath Datatype Namespace URI.
+ * + *Defined to be "http://www.w3.org/2003/11/xpath-datatypes
".
XML Document Type Declaration Namespace URI as an arbitrary value.
+ * + *Since not formally defined by any existing standard, arbitrarily define to be "http://www.w3.org/TR/REC-xml
".
+ */
+ public static final String XML_DTD_NS_URI = "http://www.w3.org/TR/REC-xml";
+
+ /**
+ *
RELAX NG Namespace URI.
+ * + *Defined to be "http://relaxng.org/ns/structure/1.0
".
Feature for secure processing.
+ * + *true
instructs the implementation to process XML securely.
+ * This may set limits on XML constructs to avoid conditions such as denial of service attacks.
+ * false
instructs the implementation to process XML according to the letter of the XML specifications
+ * ignoring security issues such as limits on XML constructs to avoid conditions such as denial of service attacks.
+ * Indicates a serious configuration error.
+ * + * @author Jeff Suttor + * @version $Revision: 569987 $, $Date: 2007-08-27 00:08:46 -0400 (Mon, 27 Aug 2007) $ + * @since 1.5 + */ + +public class DatatypeConfigurationException extends Exception { + + /** Stream Unique Identifier. */ + private static final long serialVersionUID = -1699373159027047238L; + + /** This field is required to store the cause on JDK 1.3 and below. */ + private Throwable causeOnJDK13OrBelow; + + /** Indicates whether this class is being used in a JDK 1.4 context. */ + private transient boolean isJDK14OrAbove = false; + + /** + *Create a new DatatypeConfigurationException
with
+ * no specified detail message and cause.
Create a new DatatypeConfigurationException
with
+ * the specified detail message.
Create a new DatatypeConfigurationException
with
+ * the specified detail message and cause.
null
value is permitted, and indicates that the cause is nonexistent or unknown.
+ */
+
+ public DatatypeConfigurationException(String message, Throwable cause) {
+ super(message);
+ initCauseByReflection(cause);
+ }
+
+ /**
+ * Create a new DatatypeConfigurationException
with
+ * the specified cause.
null
value is permitted, and indicates that the cause is nonexistent or unknown.
+ */
+
+ public DatatypeConfigurationException(Throwable cause) {
+ super(cause == null ? null : cause.toString());
+ initCauseByReflection(cause);
+ }
+
+ /**
+ * Print the the trace of methods from where the error
+ * originated. This will trace all nested exception
+ * objects, as well as this object.
+ */
+ public void printStackTrace() {
+ if (!isJDK14OrAbove && causeOnJDK13OrBelow != null) {
+ printStackTrace0(new PrintWriter(System.err, true));
+ }
+ else {
+ super.printStackTrace();
+ }
+ }
+
+ /**
+ * Print the the trace of methods from where the error
+ * originated. This will trace all nested exception
+ * objects, as well as this object.
+ * @param s The stream where the dump will be sent to.
+ */
+ public void printStackTrace(PrintStream s) {
+ if (!isJDK14OrAbove && causeOnJDK13OrBelow != null) {
+ printStackTrace0(new PrintWriter(s));
+ }
+ else {
+ super.printStackTrace(s);
+ }
+ }
+
+ /**
+ * Print the the trace of methods from where the error
+ * originated. This will trace all nested exception
+ * objects, as well as this object.
+ * @param s The writer where the dump will be sent to.
+ */
+ public void printStackTrace(PrintWriter s) {
+ if (!isJDK14OrAbove && causeOnJDK13OrBelow != null) {
+ printStackTrace0(s);
+ }
+ else {
+ super.printStackTrace(s);
+ }
+ }
+
+ private void printStackTrace0(PrintWriter s) {
+ causeOnJDK13OrBelow.printStackTrace(s);
+ s.println("------------------------------------------");
+ super.printStackTrace(s);
+ }
+
+ private void initCauseByReflection(Throwable cause) {
+ causeOnJDK13OrBelow = cause;
+ try {
+ Method m = this.getClass().getMethod("initCause", new Class[] {Throwable.class});
+ m.invoke(this, new Object[] {cause});
+ isJDK14OrAbove = true;
+ }
+ // Ignore exception
+ catch (Exception e) {}
+ }
+
+ private void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ try {
+ Method m1 = this.getClass().getMethod("getCause", new Class[] {});
+ Throwable cause = (Throwable) m1.invoke(this, new Object[] {});
+ if (causeOnJDK13OrBelow == null) {
+ causeOnJDK13OrBelow = cause;
+ }
+ else if (cause == null) {
+ Method m2 = this.getClass().getMethod("initCause", new Class[] {Throwable.class});
+ m2.invoke(this, new Object[] {causeOnJDK13OrBelow});
+ }
+ isJDK14OrAbove = true;
+ }
+ // Ignore exception
+ catch (Exception e) {}
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/DatatypeConstants.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/DatatypeConstants.java
new file mode 100644
index 000000000..bcb086dbf
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/DatatypeConstants.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: DatatypeConstants.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.datatype;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+
+/**
+ * Utility class to contain basic Datatype values as constants.
+ * + * @author Jeff Suttor + * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $ + * @since 1.5 + */ + +public final class DatatypeConstants { + + /** + *Private constructor to prevent instantiation.
+ */ + private DatatypeConstants() { + } + + /** + * Value for first month of year. + */ + public static final int JANUARY = 1; + + /** + * Value for second month of year. + */ + public static final int FEBRUARY = 2; + + /** + * Value for third month of year. + */ + public static final int MARCH = 3; + + /** + * Value for fourth month of year. + */ + public static final int APRIL = 4; + + /** + * Value for fifth month of year. + */ + public static final int MAY = 5; + + /** + * Value for sixth month of year. + */ + public static final int JUNE = 6; + + /** + * Value for seventh month of year. + */ + public static final int JULY = 7; + + /** + * Value for eighth month of year. + */ + public static final int AUGUST = 8; + + /** + * Value for ninth month of year. + */ + public static final int SEPTEMBER = 9; + + /** + * Value for tenth month of year. + */ + public static final int OCTOBER = 10; + + /** + * Value for eleven month of year. + */ + public static final int NOVEMBER = 11; + + /** + * Value for twelve month of year. + */ + public static final int DECEMBER = 12; + + /** + *Comparison result.
+ */ + public static final int LESSER = -1; + + /** + *Comparison result.
+ */ + public static final int EQUAL = 0; + + /** + *Comparison result.
+ */ + public static final int GREATER = 1; + + /** + *Comparison result.
+ */ + public static final int INDETERMINATE = 2; + + /** + * Designation that an "int" field is not set. + */ + public static final int FIELD_UNDEFINED = Integer.MIN_VALUE; + + /** + *A constant that represents the years field.
+ */ + public static final Field YEARS = new Field("YEARS", 0); + + /** + *A constant that represents the months field.
+ */ + public static final Field MONTHS = new Field("MONTHS", 1); + + /** + *A constant that represents the days field.
+ */ + public static final Field DAYS = new Field("DAYS", 2); + + /** + *A constant that represents the hours field.
+ */ + public static final Field HOURS = new Field("HOURS", 3); + + /** + *A constant that represents the minutes field.
+ */ + public static final Field MINUTES = new Field("MINUTES", 4); + + /** + *A constant that represents the seconds field.
+ */ + public static final Field SECONDS = new Field("SECONDS", 5); + + /** + * Type-safe enum class that represents six fields + * of the {@link Duration} class. + */ + public static final class Field { + + /** + *String
representation of
Unique id of the field.
+ * + *This value allows the {@link Duration} class to use switch + * statements to process fields.
+ */ + private final int id; + + /** + *Construct a Field
with specified values.
String
representation of Field
+ * @param id int
representation of Field
+ */
+ private Field(final String str, final int id) {
+ this.str = str;
+ this.id = id;
+ }
+ /**
+ * Returns a field name in English. This method
+ * is intended to be used for debugging/diagnosis
+ * and not for display to end-users.
+ *
+ * @return
+ * a non-null valid String constant.
+ */
+ public String toString() { return str; }
+
+ /**
+ * Get id of this Field.
+ * + * @return Id of field. + */ + public int getId() { + return id; + } + } + + /** + *Fully qualified name for W3C XML Schema 1.0 datatype dateTime
.
Fully qualified name for W3C XML Schema 1.0 datatype time
.
Fully qualified name for W3C XML Schema 1.0 datatype date
.
Fully qualified name for W3C XML Schema 1.0 datatype gYearMonth
.
Fully qualified name for W3C XML Schema 1.0 datatype gMonthDay
.
Fully qualified name for W3C XML Schema 1.0 datatype gYear
.
Fully qualified name for W3C XML Schema 1.0 datatype gMonth
.
Fully qualified name for W3C XML Schema 1.0 datatype gDay
.
Fully qualified name for W3C XML Schema datatype duration
.
Fully qualified name for XQuery 1.0 and XPath 2.0 datatype dayTimeDuration
.
Fully qualified name for XQuery 1.0 and XPath 2.0 datatype yearMonthDuration
.
Factory that creates new javax.xml.datatype
Object
s that map XML to/from Java Object
s.
{@link #newInstance()} is used to create a new DatatypeFactory
.
+ * The following implementation resolution mechanisms are used in the following order:
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 {@link DatatypeConfigurationException}.
+ * Object
.
+ * The Properties
Object
is then queried for the property as documented in the prior step
+ * and processed as documented in the prior step.
+ * META-INF/services/java.xml.datatype.DatatypeFactory
.
+ * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
+ * Class
specified by
+ * {@link #DATATYPEFACTORY_IMPLEMENTATION_CLASS}, "javax.xml.datatype.DatatypeFactoryImpl
".
+ * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
+ * Default property name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3.
+ * + *Default value is javax.xml.datatype.DatatypeFactory
.
Default implementation class name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3.
+ * + *Default value is org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl
.
Protected constructor to prevent instantiation outside of package.
+ * + *Use {@link #newInstance()} to create a DatatypeFactory
.
Obtain a new instance of a DatatypeFactory
.
The implementation resolution mechanisms are defined in this
+ * Class
's documentation.
DocumentBuilderFactory
+ *
+ * @throws DatatypeConfigurationException If the implementation is not
+ * available or cannot be instantiated.
+ */
+ public static DatatypeFactory newInstance()
+ throws DatatypeConfigurationException {
+ try {
+ return (DatatypeFactory) FactoryFinder.find(
+ /* The default property name according to the JAXP spec */
+ DATATYPEFACTORY_PROPERTY,
+ /* The fallback implementation class name */
+ DATATYPEFACTORY_IMPLEMENTATION_CLASS);
+ }
+ catch (FactoryFinder.ConfigurationError e) {
+ throw new DatatypeConfigurationException(e.getMessage(), e.getException());
+ }
+ }
+
+ /**
+ * @return New instance of a DocumentBuilderFactory
+ *
+ * @throws DatatypeConfigurationException If the implementation is not
+ * available or cannot be instantiated.
+ */
+ public static DatatypeFactory newInstance(String factoryClassName,
+ ClassLoader classLoader) throws DatatypeConfigurationException {
+ if (factoryClassName == null) {
+ throw new DatatypeConfigurationException("factoryClassName cannot be null.");
+ }
+ if (classLoader == null) {
+ classLoader = SecuritySupport.getContextClassLoader();
+ }
+ try {
+ return (DatatypeFactory) FactoryFinder.newInstance(factoryClassName, classLoader);
+ }
+ catch (FactoryFinder.ConfigurationError e) {
+ throw new DatatypeConfigurationException(e.getMessage(), e.getException());
+ }
+ }
+
+ /**
+ * Obtain a new instance of a Duration
+ * specifying the Duration
as its string representation, "PnYnMnDTnHnMnS",
+ * as defined in XML Schema 1.0 section 3.2.6.1.
XML Schema Part 2: Datatypes, 3.2.6 duration, defines duration
as:
+ * duration represents a duration of time. + * The value space of duration is a six-dimensional space where the coordinates designate the + * Gregorian year, month, day, hour, minute, and second components defined in Section 5.5.3.2 of [ISO 8601], respectively. + * These components are ordered in their significance by their order of appearance i.e. as + * year, month, day, hour, minute, and second. + *+ *
All six values are set and available from the created {@link 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 {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits + * if implementation capacities are exceeded.
+ * + * @param lexicalRepresentationString
representation of a Duration
.
+ *
+ * @return New Duration
created from parsing the lexicalRepresentation
.
+ *
+ * @throws IllegalArgumentException If lexicalRepresentation
is not a valid representation of a Duration
.
+ * @throws UnsupportedOperationException If implementation cannot support requested values.
+ * @throws NullPointerException if lexicalRepresentation
is null
.
+ */
+ public abstract Duration newDuration(final String lexicalRepresentation);
+
+ /**
+ * Obtain a new instance of a Duration
+ * specifying the Duration
as milliseconds.
XML Schema Part 2: Datatypes, 3.2.6 duration, defines duration
as:
+ * duration represents a duration of time. + * The value space of duration is a six-dimensional space where the coordinates designate the + * Gregorian year, month, day, hour, minute, and second components defined in Section 5.5.3.2 of [ISO 8601], respectively. + * These components are ordered in their significance by their order of appearance i.e. as + * year, month, day, hour, minute, and second. + *+ *
All six values are set by computing their values from the specified milliseconds
+ * and are available using the get
methods of the created {@link Duration}.
+ * The values conform to and are defined by:
The default start instance is defined by {@link GregorianCalendar}'s use of the start of the epoch: i.e., + * {@link java.util.Calendar#YEAR} = 1970, + * {@link java.util.Calendar#MONTH} = {@link java.util.Calendar#JANUARY}, + * {@link java.util.Calendar#DATE} = 1, etc. + * This is important as there are variations in the Gregorian Calendar, + * e.g. leap years have different days in the month = {@link java.util.Calendar#FEBRUARY} + * so the result of {@link Duration#getMonths()} and {@link Duration#getDays()} can be influenced.
+ * + * @param durationInMilliSeconds Duration in milliseconds to create. + * + * @return NewDuration
representing durationInMilliSeconds
.
+ */
+ public abstract Duration newDuration(final long durationInMilliSeconds);
+
+ /**
+ * 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 {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits + * if implementation capacities are exceeded.
+ * + *A null
value indicates that field is not set.
false
to create a negative duration. When the length
+ * of the duration is zero, this parameter will be ignored.
+ * @param years of this Duration
+ * @param months of this Duration
+ * @param days of this Duration
+ * @param hours of this Duration
+ * @param minutes of this Duration
+ * @param seconds of this Duration
+ *
+ * @return New Duration
created from the specified values.
+ *
+ * @throws IllegalArgumentException If values are not a valid representation of a Duration
.
+ * @throws UnsupportedOperationException If implementation cannot support requested values.
+ */
+ public abstract Duration newDuration(
+ final boolean isPositive,
+ final BigInteger years,
+ final BigInteger months,
+ final BigInteger days,
+ final BigInteger hours,
+ final BigInteger minutes,
+ final BigDecimal seconds);
+
+ /**
+ * Obtain a new instance of a Duration
+ * specifying the Duration
as isPositive, years, months, days, hours, minutes, seconds.
A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.
+ * + * @param isPositive Set tofalse
to create a negative duration. When the length
+ * of the duration is zero, this parameter will be ignored.
+ * @param years of this Duration
+ * @param months of this Duration
+ * @param days of this Duration
+ * @param hours of this Duration
+ * @param minutes of this Duration
+ * @param seconds of this Duration
+ *
+ * @return New Duration
created from the specified values.
+ *
+ * @throws IllegalArgumentException If values are not a valid representation of a Duration
.
+ *
+ * @see #newDuration(
+ * boolean isPositive,
+ * BigInteger years,
+ * BigInteger months,
+ * BigInteger days,
+ * BigInteger hours,
+ * BigInteger minutes,
+ * BigDecimal seconds)
+ */
+ public Duration newDuration(
+ final boolean isPositive,
+ final int years,
+ final int months,
+ final int days,
+ final int hours,
+ final int minutes,
+ final int seconds) {
+
+ // years may not be set
+ BigInteger realYears = (years != DatatypeConstants.FIELD_UNDEFINED) ? BigInteger.valueOf((long) years) : null;
+
+ // months may not be set
+ BigInteger realMonths = (months != DatatypeConstants.FIELD_UNDEFINED) ? BigInteger.valueOf((long) months) : null;
+
+ // days may not be set
+ BigInteger realDays = (days != DatatypeConstants.FIELD_UNDEFINED) ? BigInteger.valueOf((long) days) : null;
+
+ // hours may not be set
+ BigInteger realHours = (hours != DatatypeConstants.FIELD_UNDEFINED) ? BigInteger.valueOf((long) hours) : null;
+
+ // minutes may not be set
+ BigInteger realMinutes = (minutes != DatatypeConstants.FIELD_UNDEFINED) ? BigInteger.valueOf((long) minutes) : null;
+
+ // seconds may not be set
+ BigDecimal realSeconds = (seconds != DatatypeConstants.FIELD_UNDEFINED) ? BigDecimal.valueOf((long) seconds) : null;
+
+ return newDuration(
+ isPositive,
+ realYears,
+ realMonths,
+ realDays,
+ realHours,
+ realMinutes,
+ realSeconds
+ );
+ }
+
+ /**
+ * 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 available from the created {@link 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 {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits + * if implementation capacities are exceeded.
+ * + * @param lexicalRepresentation Lexical representation of a duration. + * + * @return NewDuration
created using the specified lexicalRepresentation
.
+ *
+ * @throws IllegalArgumentException If the given string does not conform to the aforementioned specification.
+ * @throws UnsupportedOperationException If implementation cannot support requested values.
+ * @throws NullPointerException If lexicalRepresentation
is null
.
+ */
+ public Duration newDurationDayTime(final String lexicalRepresentation) {
+ if (lexicalRepresentation == null) {
+ throw new NullPointerException("The lexical representation cannot be null.");
+ }
+ // The lexical representation must match the pattern [^YM]*(T.*)?
+ int pos = lexicalRepresentation.indexOf('T');
+ int length = (pos >= 0) ? pos : lexicalRepresentation.length();
+ for (int i = 0; i < length; ++i) {
+ char c = lexicalRepresentation.charAt(i);
+ if (c == 'Y' || c == 'M') {
+ throw new IllegalArgumentException("Invalid dayTimeDuration value: " + lexicalRepresentation);
+ }
+ }
+ return newDuration(lexicalRepresentation);
+ }
+
+ /**
+ * Create a Duration
of type xdt:dayTimeDuration
using the specified milliseconds 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
.
All four values are set by computing their values from the specified milliseconds
+ * and are available using the get
methods of the created {@link Duration}.
+ * The values conform to and are defined by:
The default start instance is defined by {@link GregorianCalendar}'s use of the start of the epoch: i.e., + * {@link java.util.Calendar#YEAR} = 1970, + * {@link java.util.Calendar#MONTH} = {@link java.util.Calendar#JANUARY}, + * {@link java.util.Calendar#DATE} = 1, etc. + * This is important as there are variations in the Gregorian Calendar, + * e.g. leap years have different days in the month = {@link java.util.Calendar#FEBRUARY} + * so the result of {@link Duration#getDays()} can be influenced.
+ * + *Any remaining milliseconds after determining the day, hour, minute and second are discarded.
+ * + * @param durationInMilliseconds Milliseconds ofDuration
to create.
+ *
+ * @return New Duration
created with the specified durationInMilliseconds
.
+ *
+ * @see
+ * XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration
+ */
+ public Duration newDurationDayTime(final long durationInMilliseconds) {
+ long _durationInMilliseconds = durationInMilliseconds;
+ if (_durationInMilliseconds == 0) {
+ return newDuration(true, DatatypeConstants.FIELD_UNDEFINED,
+ DatatypeConstants.FIELD_UNDEFINED, 0, 0, 0, 0);
+ }
+ boolean tooLong = false;
+ final boolean isPositive;
+ if (_durationInMilliseconds < 0) {
+ isPositive = false;
+ if (_durationInMilliseconds == Long.MIN_VALUE) {
+ _durationInMilliseconds++;
+ tooLong = true;
+ }
+ _durationInMilliseconds *= -1;
+ }
+ else {
+ isPositive = true;
+ }
+
+ long val = _durationInMilliseconds;
+ int milliseconds = (int) (val % 60000L); // 60000 milliseconds per minute
+ if (tooLong) {
+ ++milliseconds;
+ }
+ if (milliseconds % 1000 == 0) {
+ int seconds = milliseconds / 1000;
+ val = val / 60000L;
+ int minutes = (int) (val % 60L); // 60 minutes per hour
+ val = val / 60L;
+ int hours = (int) (val % 24L); // 24 hours per day
+ long days = val / 24L;
+ if (days <= ((long) Integer.MAX_VALUE)) {
+ return newDuration(isPositive, DatatypeConstants.FIELD_UNDEFINED,
+ DatatypeConstants.FIELD_UNDEFINED, (int) days, hours, minutes, seconds);
+ }
+ else {
+ return newDuration(isPositive, null, null,
+ BigInteger.valueOf(days), BigInteger.valueOf(hours),
+ BigInteger.valueOf(minutes), BigDecimal.valueOf(milliseconds, 3));
+ }
+ }
+
+ BigDecimal seconds = BigDecimal.valueOf(milliseconds, 3);
+ val = val / 60000L;
+ BigInteger minutes = BigInteger.valueOf(val % 60L); // 60 minutes per hour
+ val = val / 60L;
+ BigInteger hours = BigInteger.valueOf(val % 24L); // 24 hours per day
+ val = val / 24L;
+ BigInteger days = BigInteger.valueOf(val);
+ return newDuration(isPositive, null, null, days, hours, minutes, seconds);
+ }
+
+ /**
+ * 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 {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits + * if implementation capacities are exceeded.
+ * + *A null
value indicates that field is not set.
false
to create a negative duration. When the length
+ * of the duration is zero, this parameter will be ignored.
+ * @param day Day of Duration
.
+ * @param hour Hour of Duration
.
+ * @param minute Minute of Duration
.
+ * @param second Second of Duration
.
+ *
+ * @return New Duration
created with the specified day
, hour
, minute
+ * and second
.
+ *
+ * @throws IllegalArgumentException If any values would create an invalid Duration
.
+ * @throws UnsupportedOperationException If implementation cannot support requested values.
+ */
+ public Duration newDurationDayTime(
+ final boolean isPositive,
+ final BigInteger day,
+ final BigInteger hour,
+ final BigInteger minute,
+ final BigInteger second) {
+
+ return newDuration(
+ isPositive,
+ null, // years
+ null, // months
+ day,
+ hour,
+ minute,
+ (second != null)? new BigDecimal(second):null
+ );
+ }
+
+ /**
+ * 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 {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.
+ * + * @param isPositive Set tofalse
to create a negative duration. When the length
+ * of the duration is zero, this parameter will be ignored.
+ * @param day Day of Duration
.
+ * @param hour Hour of Duration
.
+ * @param minute Minute of Duration
.
+ * @param second Second of Duration
.
+ *
+ * @return New Duration
created with the specified day
, hour
, minute
+ * and second
.
+ *
+ * @throws IllegalArgumentException If any values would create an invalid Duration
.
+ */
+ public Duration newDurationDayTime(
+ final boolean isPositive,
+ final int day,
+ final int hour,
+ final int minute,
+ final int second) {
+ return newDuration(isPositive,
+ DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED,
+ day, hour, minute, second);
+ }
+
+ /**
+ * 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 {@link javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI}.
Both values are set and available from the created {@link 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 {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits + * if implementation capacities are exceeded.
+ * + * @param lexicalRepresentation Lexical representation of a duration. + * + * @return NewDuration
created using the specified lexicalRepresentation
.
+ *
+ * @throws IllegalArgumentException If the lexicalRepresentation
does not conform to the specification.
+ * @throws UnsupportedOperationException If implementation cannot support requested values.
+ * @throws NullPointerException If lexicalRepresentation
is null
.
+ */
+ public Duration newDurationYearMonth(final String lexicalRepresentation) {
+ if (lexicalRepresentation == null) {
+ throw new NullPointerException("The lexical representation cannot be null.");
+ }
+ // The lexical representation must match the pattern [^DT]*.
+ int length = lexicalRepresentation.length();
+ for (int i = 0; i < length; ++i) {
+ char c = lexicalRepresentation.charAt(i);
+ if (c == 'D' || c == 'T') {
+ throw new IllegalArgumentException("Invalid yearMonthDuration value: " + lexicalRepresentation);
+ }
+ }
+ return newDuration(lexicalRepresentation);
+ }
+
+ /**
+ * Create a Duration
of type xdt:yearMonthDuration
using the specified milliseconds as defined in
+ *
+ * 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 {@link javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI}.
Both values are set by computing their values from the specified milliseconds
+ * and are available using the get
methods of the created {@link Duration}.
+ * The values conform to and are defined by:
The default start instance is defined by {@link GregorianCalendar}'s use of the start of the epoch: i.e., + * {@link java.util.Calendar#YEAR} = 1970, + * {@link java.util.Calendar#MONTH} = {@link java.util.Calendar#JANUARY}, + * {@link java.util.Calendar#DATE} = 1, etc. + * This is important as there are variations in the Gregorian Calendar, + * e.g. leap years have different days in the month = {@link java.util.Calendar#FEBRUARY} + * so the result of {@link Duration#getMonths()} can be influenced.
+ * + *Any remaining milliseconds after determining the year and month are discarded.
+ * + * @param durationInMilliseconds Milliseconds ofDuration
to create.
+ *
+ * @return New Duration
created using the specified durationInMilliseconds
.
+ */
+ public Duration newDurationYearMonth(final long durationInMilliseconds) {
+
+ return newDuration(durationInMilliseconds);
+ }
+
+ /**
+ * 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 {@link UnsupportedOperationException} will be thrown with a message indicating implementation limits + * if implementation capacities are exceeded.
+ * + *A null
value indicates that field is not set.
false
to create a negative duration. When the length
+ * of the duration is zero, this parameter will be ignored.
+ * @param year Year of Duration
.
+ * @param month Month of Duration
.
+ *
+ * @return New Duration
created using the specified year
and month
.
+ *
+ * @throws IllegalArgumentException If any values would create an invalid Duration
.
+ * @throws UnsupportedOperationException If implementation cannot support requested values.
+ */
+ public Duration newDurationYearMonth(
+ final boolean isPositive,
+ final BigInteger year,
+ final BigInteger month) {
+
+ return newDuration(
+ isPositive,
+ year,
+ month,
+ null, // days
+ null, // hours
+ null, // minutes
+ null // seconds
+ );
+ }
+
+ /**
+ * 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 {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.
+ * + * @param isPositive Set tofalse
to create a negative duration. When the length
+ * of the duration is zero, this parameter will be ignored.
+ * @param year Year of Duration
.
+ * @param month Month of Duration
.
+ *
+ * @return New Duration
created using the specified year
and month
.
+ *
+ * @throws IllegalArgumentException If any values would create an invalid Duration
.
+ */
+ public Duration newDurationYearMonth(
+ final boolean isPositive,
+ final int year,
+ final int month) {
+ return newDuration(isPositive, year, month,
+ DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED,
+ DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED);
+ }
+
+ /**
+ * Create a new instance of an XMLGregorianCalendar
.
All date/time datatype fields set to {@link DatatypeConstants#FIELD_UNDEFINED} or null.
+ * + * @return NewXMLGregorianCalendar
with all date/time datatype fields set to
+ * {@link DatatypeConstants#FIELD_UNDEFINED} or null.
+ */
+ public abstract XMLGregorianCalendar newXMLGregorianCalendar();
+
+ /**
+ * Create a new XMLGregorianCalendar by parsing the String as a lexical representation.
+ * + *Parsing the lexical string representation is defined in + * XML Schema 1.0 Part 2, Section 3.2.[7-14].1, + * Lexical Representation.
+ * + *The string representation may not have any leading and trailing whitespaces.
+ * + *The parsing is done field by field so that + * the following holds for any lexically correct String x:
+ *+ * newXMLGregorianCalendar(x).toXMLFormat().equals(x) + *+ *
Except for the noted lexical/canonical representation mismatches + * listed in + * XML Schema 1.0 errata, Section 3.2.7.2.
+ * + * @param lexicalRepresentation Lexical representation of one the eight XML Schema date/time datatypes. + * + * @returnXMLGregorianCalendar
created from the lexicalRepresentation
.
+ *
+ * @throws IllegalArgumentException If the lexicalRepresentation
is not a valid XMLGregorianCalendar
.
+ * @throws NullPointerException If lexicalRepresentation
is null
.
+ */
+ public abstract XMLGregorianCalendar newXMLGregorianCalendar(final String lexicalRepresentation);
+
+ /**
+ * Create an XMLGregorianCalendar
from a {@link GregorianCalendar}.
+ * Field by Field Conversion from + * {@link GregorianCalendar} to an {@link XMLGregorianCalendar} + * | + *|
---|---|
java.util.GregorianCalendar field |
+ * javax.xml.datatype.XMLGregorianCalendar field |
+ *
ERA == GregorianCalendar.BC ? -YEAR : YEAR |
+ * {@link XMLGregorianCalendar#setYear(int year)} | + *
MONTH + 1 |
+ * {@link XMLGregorianCalendar#setMonth(int month)} | + *
DAY_OF_MONTH |
+ * {@link XMLGregorianCalendar#setDay(int day)} | + *
HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND |
+ * {@link XMLGregorianCalendar#setTime(int hour, int minute, int second, BigDecimal fractional)} | + *
+ * (ZONE_OFFSET + DST_OFFSET) / (60*1000) + * (in minutes) + * |
+ * {@link XMLGregorianCalendar#setTimezone(int offset)}* + * | + *
*conversion loss of information. It is not possible to represent
+ * a java.util.GregorianCalendar
daylight savings timezone id in the
+ * XML Schema 1.0 date/time datatype representation.
To compute the return value's TimeZone
field,
+ *
this.getTimezone() != FIELD_UNDEFINED
,
+ * create a java.util.TimeZone
with a custom timezone id
+ * using the this.getTimezone()
.GregorianCalendar
default timezone value
+ * for the host is defined as specified by
+ * java.util.TimeZone.getDefault()
.java.util.GregorianCalendar
used to create XMLGregorianCalendar
+ *
+ * @return XMLGregorianCalendar
created from java.util.GregorianCalendar
+ *
+ * @throws NullPointerException If cal
is null
.
+ */
+ public abstract XMLGregorianCalendar newXMLGregorianCalendar(final GregorianCalendar cal);
+
+ /**
+ * 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.
XMLGregorianCalendar
to be created.
+ * @param month of XMLGregorianCalendar
to be created.
+ * @param day of XMLGregorianCalendar
to be created.
+ * @param hour of XMLGregorianCalendar
to be created.
+ * @param minute of XMLGregorianCalendar
to be created.
+ * @param second of XMLGregorianCalendar
to be created.
+ * @param fractionalSecond of XMLGregorianCalendar
to be created.
+ * @param timezone of XMLGregorianCalendar
to be created.
+ *
+ * @return XMLGregorianCalendar
created from specified values.
+ *
+ * @throws 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 {@link XMLGregorianCalendar}
+ * or if the composite values constitute an invalid XMLGregorianCalendar
instance
+ * as determined by {@link XMLGregorianCalendar#isValid()}.
+ */
+ public abstract XMLGregorianCalendar newXMLGregorianCalendar(
+ final BigInteger year,
+ final int month,
+ final int day,
+ final int hour,
+ final int minute,
+ final int second,
+ final BigDecimal fractionalSecond,
+ final 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 {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.
+ * + * @param year ofXMLGregorianCalendar
to be created.
+ * @param month of XMLGregorianCalendar
to be created.
+ * @param day of XMLGregorianCalendar
to be created.
+ * @param hour of XMLGregorianCalendar
to be created.
+ * @param minute of XMLGregorianCalendar
to be created.
+ * @param second of XMLGregorianCalendar
to be created.
+ * @param millisecond of XMLGregorianCalendar
to be created.
+ * @param timezone of XMLGregorianCalendar
to be created.
+ *
+ * @return XMLGregorianCalendar
created from specified values.
+ *
+ * @throws 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 {@link XMLGregorianCalendar}
+ * or if the composite values constitute an invalid XMLGregorianCalendar
instance
+ * as determined by {@link XMLGregorianCalendar#isValid()}.
+ */
+ public XMLGregorianCalendar newXMLGregorianCalendar(
+ final int year,
+ final int month,
+ final int day,
+ final int hour,
+ final int minute,
+ final int second,
+ final int millisecond,
+ final int timezone) {
+
+ // year may be undefined
+ BigInteger realYear = (year != DatatypeConstants.FIELD_UNDEFINED) ? BigInteger.valueOf((long) year) : null;
+
+ // millisecond may be undefined
+ // millisecond must be >= 0 millisecond <= 1000
+ BigDecimal realMillisecond = null; // undefined value
+ if (millisecond != DatatypeConstants.FIELD_UNDEFINED) {
+ if (millisecond < 0 || millisecond > 1000) {
+ throw new IllegalArgumentException(
+ "javax.xml.datatype.DatatypeFactory#newXMLGregorianCalendar("
+ + "int year, int month, int day, int hour, int minute, int second, int millisecond, int timezone)"
+ + "with invalid millisecond: " + millisecond
+ );
+ }
+ realMillisecond = BigDecimal.valueOf((long) millisecond, 3);
+ }
+
+ return newXMLGregorianCalendar(
+ realYear,
+ month,
+ day,
+ hour,
+ minute,
+ second,
+ realMillisecond,
+ 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
+ * {@link DatatypeConstants#FIELD_UNDEFINED}.
A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.
+ * + * @param year ofXMLGregorianCalendar
to be created.
+ * @param month of XMLGregorianCalendar
to be created.
+ * @param day of XMLGregorianCalendar
to be created.
+ * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set.
+ *
+ * @return XMLGregorianCalendar
created from parameter values.
+ *
+ * @see DatatypeConstants#FIELD_UNDEFINED
+ *
+ * @throws 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 {@link XMLGregorianCalendar}
+ * or if the composite values constitute an invalid XMLGregorianCalendar
instance
+ * as determined by {@link XMLGregorianCalendar#isValid()}.
+ */
+ public XMLGregorianCalendar newXMLGregorianCalendarDate(
+ final int year,
+ final int month,
+ final int day,
+ final int timezone) {
+
+ return newXMLGregorianCalendar(
+ year,
+ month,
+ day,
+ DatatypeConstants.FIELD_UNDEFINED, // hour
+ DatatypeConstants.FIELD_UNDEFINED, // minute
+ DatatypeConstants.FIELD_UNDEFINED, // second
+ DatatypeConstants.FIELD_UNDEFINED, // millisecond
+ timezone);
+ }
+
+ /**
+ * Create a Java instance of XML Schema builtin datatype time
.
A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.
+ * + * @param hours number of hours + * @param minutes number of minutes + * @param seconds number of seconds + * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set. + * + * @returnXMLGregorianCalendar
created from parameter values.
+ *
+ * @throws 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 {@link XMLGregorianCalendar}
+ * or if the composite values constitute an invalid XMLGregorianCalendar
instance
+ * as determined by {@link XMLGregorianCalendar#isValid()}.
+ *
+ * @see DatatypeConstants#FIELD_UNDEFINED
+ */
+ public XMLGregorianCalendar newXMLGregorianCalendarTime(
+ final int hours,
+ final int minutes,
+ final int seconds,
+ final int timezone) {
+
+ return newXMLGregorianCalendar(
+ DatatypeConstants.FIELD_UNDEFINED, // Year
+ DatatypeConstants.FIELD_UNDEFINED, // Month
+ DatatypeConstants.FIELD_UNDEFINED, // Day
+ hours,
+ minutes,
+ seconds,
+ DatatypeConstants.FIELD_UNDEFINED, //Millisecond
+ timezone);
+ }
+
+ /**
+ * Create a Java instance of XML Schema builtin datatype time.
+ * + *A null
value indicates that field is not set.
A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.
+ * + * @param hours number of hours + * @param minutes number of minutes + * @param seconds number of seconds + * @param fractionalSecond value ofnull
indicates that this optional field is not set.
+ * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set.
+ *
+ * @return XMLGregorianCalendar
created from parameter values.
+ *
+ * @see DatatypeConstants#FIELD_UNDEFINED
+ *
+ * @throws 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 {@link XMLGregorianCalendar}
+ * or if the composite values constitute an invalid XMLGregorianCalendar
instance
+ * as determined by {@link XMLGregorianCalendar#isValid()}.
+ */
+ public XMLGregorianCalendar newXMLGregorianCalendarTime(
+ final int hours,
+ final int minutes,
+ final int seconds,
+ final BigDecimal fractionalSecond,
+ final int timezone) {
+
+ return newXMLGregorianCalendar(
+ null, // year
+ DatatypeConstants.FIELD_UNDEFINED, // month
+ DatatypeConstants.FIELD_UNDEFINED, // day
+ hours,
+ minutes,
+ seconds,
+ fractionalSecond,
+ timezone);
+ }
+
+ /**
+ * Create a Java instance of XML Schema builtin datatype time.
+ * + *A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.
+ * + * @param hours number of hours + * @param minutes number of minutes + * @param seconds number of seconds + * @param milliseconds number of milliseconds + * @param timezone offset in minutes. {@link DatatypeConstants#FIELD_UNDEFINED} indicates optional field is not set. + * + * @returnXMLGregorianCalendar
created from parameter values.
+ *
+ * @see DatatypeConstants#FIELD_UNDEFINED
+ *
+ * @throws 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 {@link XMLGregorianCalendar}
+ * or if the composite values constitute an invalid XMLGregorianCalendar
instance
+ * as determined by {@link XMLGregorianCalendar#isValid()}.
+ */
+ public XMLGregorianCalendar newXMLGregorianCalendarTime(
+ final int hours,
+ final int minutes,
+ final int seconds,
+ final int milliseconds,
+ final int timezone) {
+
+ // millisecond may be undefined
+ // millisecond must be >= 0 millisecond <= 1000
+ BigDecimal realMilliseconds = null; // undefined value
+ if (milliseconds != DatatypeConstants.FIELD_UNDEFINED) {
+ if (milliseconds < 0 || milliseconds > 1000) {
+ throw new IllegalArgumentException(
+ "javax.xml.datatype.DatatypeFactory#newXMLGregorianCalendarTime("
+ + "int hours, int minutes, int seconds, int milliseconds, int timezone)"
+ + "with invalid milliseconds: " + milliseconds
+ );
+ }
+ realMilliseconds = BigDecimal.valueOf((long) milliseconds, 3);
+ }
+
+ return newXMLGregorianCalendarTime(
+ hours,
+ minutes,
+ seconds,
+ realMilliseconds,
+ timezone
+ );
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/Duration.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/Duration.java
new file mode 100644
index 000000000..0f0e1a23d
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/Duration.java
@@ -0,0 +1,987 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//$Id: Duration.java 759828 2009-03-30 01:26:29Z mrglavas $
+
+package javax.xml.datatype;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.xml.namespace.QName;
+
+/**
+ * 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.
+ * + *Duration objects only have partial order, where two values A and B + * maybe either:
+ *For example, 30 days cannot be meaningfully compared to one month. + * The {@link #compare(Duration duration)} method implements this + * relationship.
+ * + *See the {@link #isLongerThan(Duration)} method for details about
+ * the order relationship among Duration
objects.
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.
+ * + *
+ * Because some operations of Duration
rely on {@link Calendar}
+ * even though {@link 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 {@link Calendar}.
+ *
+ *
+ * @author Joseph Fialli
+ * @author Kohsuke Kawaguchi
+ * @author Jeff Suttor
+ * @version $Revision: 759828 $, $Date: 2009-03-29 21:26:29 -0400 (Sun, 29 Mar 2009) $
+ * @see XMLGregorianCalendar#add(Duration)
+ * @since 1.5
+ */
+public abstract class Duration {
+
+ /**
+ *
Return the name of the XML Schema date/time type that this instance
+ * maps to. Type is computed based on fields that are set,
+ * i.e. {@link #isSet(DatatypeConstants.Field field)} == true
.
+ * Required fields for XML Schema 1.0 Date/Time Datatypes. + * (timezone is optional for all date/time datatypes) + * |
+ * ||||||
---|---|---|---|---|---|---|
Datatype | + *year | + *month | + *day | + *hour | + *minute | + *second | + *
{@link DatatypeConstants#DURATION} | + *X | + *X | + *X | + *X | + *X | + *X | + *
{@link DatatypeConstants#DURATION_DAYTIME} | + *+ * | + * | X | + *X | + *X | + *X | + *
{@link DatatypeConstants#DURATION_YEARMONTH} | + *X | + *X | + *+ * | + * | + * | + * |
Get the years value of this Duration
as an int
or 0
if not present.
getYears()
is a convenience method for
+ * {@link #getField(DatatypeConstants.Field field) getField(DatatypeConstants.YEARS)}.
As the return value is an int
, an incorrect value will be returned for Duration
s
+ * with years that go beyond the range of an int
.
+ * Use {@link #getField(DatatypeConstants.Field field) getField(DatatypeConstants.YEARS)} to avoid possible loss of precision.
int
, else return 0
.
+ */
+ public int getYears() {
+ return getFieldValueAsInt(DatatypeConstants.YEARS);
+ }
+
+ /**
+ * Obtains the value of the MONTHS field as an integer value,
+ * or 0 if not present.
+ *
+ * This method works just like {@link #getYears()} except
+ * that this method works on the MONTHS field.
+ *
+ * @return Months of this Duration
.
+ */
+ public int getMonths() {
+ return getFieldValueAsInt(DatatypeConstants.MONTHS);
+ }
+
+ /**
+ * Obtains the value of the DAYS field as an integer value,
+ * or 0 if not present.
+ *
+ * This method works just like {@link #getYears()} except
+ * that this method works on the DAYS field.
+ *
+ * @return Days of this Duration
.
+ */
+ public int getDays() {
+ return getFieldValueAsInt(DatatypeConstants.DAYS);
+ }
+
+ /**
+ * Obtains the value of the HOURS field as an integer value,
+ * or 0 if not present.
+ *
+ * This method works just like {@link #getYears()} except
+ * that this method works on the HOURS field.
+ *
+ * @return Hours of this Duration
.
+ *
+ */
+ public int getHours() {
+ return getFieldValueAsInt(DatatypeConstants.HOURS);
+ }
+
+ /**
+ * Obtains the value of the MINUTES field as an integer value,
+ * or 0 if not present.
+ *
+ * This method works just like {@link #getYears()} except
+ * that this method works on the MINUTES field.
+ *
+ * @return Minutes of this Duration
.
+ *
+ */
+ public int getMinutes() {
+ return getFieldValueAsInt(DatatypeConstants.MINUTES);
+ }
+
+ /**
+ * Obtains the value of the SECONDS field as an integer value,
+ * or 0 if not present.
+ *
+ * This method works just like {@link #getYears()} except
+ * that this method works on the SECONDS field.
+ *
+ * @return seconds in the integer value. The fraction of seconds
+ * will be discarded (for example, if the actual value is 2.5,
+ * this method returns 2)
+ */
+ public int getSeconds() {
+ return getFieldValueAsInt(DatatypeConstants.SECONDS);
+ }
+
+ /**
+ * Returns the length of the duration in milliseconds.
+ * + *If the seconds field carries more digits than millisecond order,
+ * those will be simply discarded (or in other words, rounded to zero.)
+ * For example, for any Calendar value x
,
+ *+ * + *new Duration("PT10.00099S").getTimeInMills(x) == 10000
. + *new Duration("-PT10.00099S").getTimeInMills(x) == -10000
. + *
+ * Note that this method uses the {@link #addTo(Calendar)} method,
+ * which may work incorrectly with Duration
objects with
+ * very large values in its fields. See the {@link #addTo(Calendar)}
+ * method for details.
+ *
+ * @param startInstant
+ * The length of a month/year varies. The startInstant
is
+ * used to disambiguate this variance. Specifically, this method
+ * returns the difference between startInstant
and
+ * startInstant+duration
+ *
+ * @return milliseconds between startInstant
and
+ * startInstant
plus this Duration
+ *
+ * @throws NullPointerException if startInstant
parameter
+ * is null.
+ *
+ */
+ public long getTimeInMillis(final Calendar startInstant) {
+ Calendar cal = (Calendar) startInstant.clone();
+ addTo(cal);
+ return getCalendarTimeInMillis(cal)
+ - getCalendarTimeInMillis(startInstant);
+ }
+
+ /**
+ *
Returns the length of the duration in milliseconds.
+ * + *If the seconds field carries more digits than millisecond order,
+ * those will be simply discarded (or in other words, rounded to zero.)
+ * For example, for any Date
value x
,
+ *+ * + *new Duration("PT10.00099S").getTimeInMills(x) == 10000
. + *new Duration("-PT10.00099S").getTimeInMills(x) == -10000
. + *
+ * Note that this method uses the {@link #addTo(Date)} method,
+ * which may work incorrectly with Duration
objects with
+ * very large values in its fields. See the {@link #addTo(Date)}
+ * method for details.
+ *
+ * @param startInstant
+ * The length of a month/year varies. The startInstant
is
+ * used to disambiguate this variance. Specifically, this method
+ * returns the difference between startInstant
and
+ * startInstant+duration
.
+ *
+ * @throws NullPointerException
+ * If the startInstant parameter is null.
+ *
+ * @return milliseconds between startInstant
and
+ * startInstant
plus this Duration
+ *
+ * @see #getTimeInMillis(Calendar)
+ */
+ public long getTimeInMillis(final Date startInstant) {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(startInstant);
+ this.addTo(cal);
+ return getCalendarTimeInMillis(cal) - startInstant.getTime();
+ }
+
+ /**
+ * Gets the value of a field.
+ *
+ * Fields of a duration object may contain arbitrary large value.
+ * Therefore this method is designed to return a {@link Number} object.
+ *
+ * In case of YEARS, MONTHS, DAYS, HOURS, and MINUTES, the returned
+ * number will be a non-negative integer. In case of seconds,
+ * the returned number may be a non-negative decimal value.
+ *
+ * @param field
+ * one of the six Field constants (YEARS,MONTHS,DAYS,HOURS,
+ * MINUTES, or SECONDS.)
+ * @return
+ * If the specified field is present, this method returns
+ * a non-null non-negative {@link Number} object that
+ * represents its value. If it is not present, return null.
+ * For YEARS, MONTHS, DAYS, HOURS, and MINUTES, this method
+ * returns a {@link java.math.BigInteger} object. For SECONDS, this
+ * method returns a {@link java.math.BigDecimal}.
+ *
+ * @throws NullPointerException If the field
is null
.
+ */
+ public abstract Number getField(final DatatypeConstants.Field field);
+
+ /**
+ * Gets the value of a field as an int
.
+ *
+ * @param field
+ * one of the six Field constants (YEARS,MONTHS,DAYS,HOURS,
+ * MINUTES, or SECONDS.)
+ * @return
+ * If the field is present, return its value as an int
,
+ * else return 0
.
+ */
+ private int getFieldValueAsInt(final DatatypeConstants.Field field) {
+ Number n = getField(field);
+ if (n != null) {
+ return n.intValue();
+ }
+ return 0;
+ }
+
+ /**
+ * Checks if a field is set.
+ *
+ * A field of a duration object may or may not be present.
+ * This method can be used to test if a field is present.
+ *
+ * @param field
+ * one of the six Field constants (YEARS,MONTHS,DAYS,HOURS,
+ * MINUTES, or SECONDS.)
+ * @return
+ * true if the field is present. false if not.
+ *
+ * @throws NullPointerException
+ * If the field parameter is null.
+ */
+ public abstract boolean isSet(final DatatypeConstants.Field field);
+
+ /**
+ *
Computes a new duration whose value is this+rhs
.
For example,
+ *+ * "1 day" + "-3 days" = "-2 days" + * "1 year" + "1 day" = "1 year and 1 day" + * "-(1 hour,50 minutes)" + "-20 minutes" = "-(1 hours,70 minutes)" + * "15 hours" + "-3 days" = "-(2 days,9 hours)" + * "1 year" + "-1 day" = IllegalStateException + *+ * + *
Since there's no way to meaningfully subtract 1 day from 1 month, + * there are cases where the operation fails in + * {@link IllegalStateException}.
+ * + *+ * Formally, the computation is defined as follows.
+ *
+ * Firstly, we can assume that two Duration
s to be added
+ * are both positive without losing generality (i.e.,
+ * (-X)+Y=Y-X
, X+(-Y)=X-Y
,
+ * (-X)+(-Y)=-(X+Y)
)
+ *
+ *
+ * Addition of two positive Duration
s are simply defined as
+ * field by field addition where missing fields are treated as 0.
+ *
+ * A field of the resulting Duration
will be unset if and
+ * only if respective fields of two input Duration
s are unset.
+ *
+ * Note that lhs.add(rhs)
will be always successful if
+ * lhs.signum()*rhs.signum()!=-1
or both of them are
+ * normalized.
Duration
to add to this Duration
+ *
+ * @return
+ * non-null valid Duration object.
+ *
+ * @throws NullPointerException
+ * If the rhs parameter is null.
+ * @throws IllegalStateException
+ * If two durations cannot be meaningfully added. For
+ * example, adding negative one day to one month causes
+ * this exception.
+ *
+ *
+ * @see #subtract(Duration)
+ */
+ public abstract Duration add(final Duration rhs);
+
+ /**
+ * Adds this duration to a {@link Calendar} object.
+ *
+ * + * Calls {@link java.util.Calendar#add(int,int)} in the + * order of YEARS, MONTHS, DAYS, HOURS, MINUTES, SECONDS, and MILLISECONDS + * if those fields are present. Because the {@link Calendar} class + * uses int to hold values, there are cases where this method + * won't work correctly (for example if values of fields + * exceed the range of int.) + *
+ * + *+ * Also, since this duration class is a Gregorian duration, this + * method will not work correctly if the given {@link Calendar} + * object is based on some other calendar systems. + *
+ * + *
+ * Any fractional parts of this Duration
object
+ * beyond milliseconds will be simply ignored. For example, if
+ * this duration is "P1.23456S", then 1 is added to SECONDS,
+ * 234 is added to MILLISECONDS, and the rest will be unused.
+ *
+ * Note that because {@link Calendar#add(int, int)} is using
+ * int, Duration
with values beyond the
+ * range of int in its fields
+ * will cause overflow/underflow to the given {@link Calendar}.
+ * {@link XMLGregorianCalendar#add(Duration)} provides the same
+ * basic operation as this method while avoiding
+ * the overflow/underflow issues.
+ *
+ * @param calendar
+ * A calendar object whose value will be modified.
+ * @throws NullPointerException
+ * if the calendar parameter is null.
+ */
+ public abstract void addTo(Calendar calendar);
+
+ /**
+ * Adds this duration to a {@link Date} object.
+ *
+ *
+ * The given date is first converted into + * a {@link java.util.GregorianCalendar}, then the duration + * is added exactly like the {@link #addTo(Calendar)} method. + * + *
+ * The updated time instant is then converted back into a + * {@link Date} object and used to update the given {@link Date} object. + * + *
+ * This somewhat redundant computation is necessary to unambiguously + * determine the duration of months and years. + * + * @param date + * A date object whose value will be modified. + * @throws NullPointerException + * if the date parameter is null. + */ + public void addTo(Date date) { + + // check data parameter + if (date == null) { + throw new NullPointerException( + "Cannot call " + + this.getClass().getName() + + "#addTo(Date date) with date == null." + ); + } + + Calendar cal = new GregorianCalendar(); + cal.setTime(date); + this.addTo(cal); + date.setTime(getCalendarTimeInMillis(cal)); + } + + /** + *
Computes a new duration whose value is this-rhs
.
For example:
+ *+ * "1 day" - "-3 days" = "4 days" + * "1 year" - "1 day" = IllegalStateException + * "-(1 hour,50 minutes)" - "-20 minutes" = "-(1hours,30 minutes)" + * "15 hours" - "-3 days" = "3 days and 15 hours" + * "1 year" - "-1 day" = "1 year and 1 day" + *+ * + *
Since there's no way to meaningfully subtract 1 day from 1 month, + * there are cases where the operation fails in {@link IllegalStateException}.
+ * + *Formally the computation is defined as follows.
+ * First, we can assume that two Duration
s are both positive
+ * without losing generality. (i.e.,
+ * (-X)-Y=-(X+Y)
, X-(-Y)=X+Y
,
+ * (-X)-(-Y)=-(X-Y)
)
Then two durations are subtracted field by field. + * If the sign of any non-zero field F is different from + * the sign of the most significant field, + * 1 (if F is negative) or -1 (otherwise) + * will be borrowed from the next bigger unit of F.
+ * + *This process is repeated until all the non-zero fields have + * the same sign.
+ * + *If a borrow occurs in the days field (in other words, if + * the computation needs to borrow 1 or -1 month to compensate + * days), then the computation fails by throwing an + * {@link IllegalStateException}.
+ * + * @param rhsDuration
to subtract from this Duration
.
+ *
+ * @return New Duration
created from subtracting rhs
from this Duration
.
+ *
+ * @throws IllegalStateException
+ * If two durations cannot be meaningfully subtracted. For
+ * example, subtracting one day from one month causes
+ * this exception.
+ *
+ * @throws NullPointerException
+ * If the rhs parameter is null.
+ *
+ * @see #add(Duration)
+ */
+ public Duration subtract(final Duration rhs) {
+ return add(rhs.negate());
+ }
+
+ /**
+ * Computes a new duration whose value is factor
times
+ * longer than the value of this duration.
This method is provided for the convenience. + * It is functionally equivalent to the following code:
+ *+ * multiply(new BigDecimal(String.valueOf(factor))) + *+ * + * @param factor Factor times longer of new
Duration
to create.
+ *
+ * @return New Duration
that is factor
times longer than this Duration
.
+ *
+ * @see #multiply(BigDecimal)
+ */
+ public Duration multiply(int factor) {
+ return multiply(BigDecimal.valueOf(factor));
+ }
+
+ /**
+ * Computes a new duration whose value is factor
times
+ * longer than the value of this duration.
+ *
+ * + * For example, + *
+ * "P1M" (1 month) * "12" = "P12M" (12 months) + * "PT1M" (1 min) * "0.3" = "PT18S" (18 seconds) + * "P1M" (1 month) * "1.5" = IllegalStateException + *+ * + *
+ * Since the Duration
class is immutable, this method
+ * doesn't change the value of this object. It simply computes
+ * a new Duration object and returns it.
+ *
+ *
+ * The operation will be performed field by field with the precision + * of {@link BigDecimal}. Since all the fields except seconds are + * restricted to hold integers, + * any fraction produced by the computation will be + * carried down toward the next lower unit. For example, + * if you multiply "P1D" (1 day) with "0.5", then it will be 0.5 day, + * which will be carried down to "PT12H" (12 hours). + * When fractions of month cannot be meaningfully carried down + * to days, or year to months, this will cause an + * {@link IllegalStateException} to be thrown. + * For example if you multiple one month by 0.5.
+ * + *
+ * To avoid {@link IllegalStateException}, use
+ * the {@link #normalizeWith(Calendar)} method to remove the years
+ * and months fields.
+ *
+ * @param factor to multiply by
+ *
+ * @return
+ * returns a non-null valid Duration
object
+ *
+ * @throws IllegalStateException if operation produces fraction in
+ * the months field.
+ *
+ * @throws NullPointerException if the factor
parameter is
+ * null
.
+ *
+ */
+ public abstract Duration multiply(final BigDecimal factor);
+
+ /**
+ * Returns a new Duration
object whose
+ * value is -this
.
+ *
+ *
+ * Since the Duration
class is immutable, this method
+ * doesn't change the value of this object. It simply computes
+ * a new Duration object and returns it.
+ *
+ * @return
+ * always return a non-null valid Duration
object.
+ */
+ public abstract Duration negate();
+
+ /**
+ *
Converts the years and months fields into the days field + * by using a specific time instant as the reference point.
+ * + *For example, duration of one month normalizes to 31 days + * given the start time instance "July 8th 2003, 17:40:32".
+ * + *Formally, the computation is done as follows:
+ *Note that since the Calendar class uses int
to
+ * hold the value of year and month, this method may produce
+ * an unexpected result if this duration object holds
+ * a very large value in the years or months fields.
Calendar
reference point.
+ *
+ * @return Duration
of years and months of this Duration
as days.
+ *
+ * @throws NullPointerException If the startTimeInstant parameter is null.
+ */
+ public abstract Duration normalizeWith(final Calendar startTimeInstant);
+
+ /**
+ * Partial order relation comparison with this Duration
instance.
Comparison result must be in accordance with + * W3C XML Schema 1.0 Part 2, Section 3.2.7.6.2, + * Order relation on duration.
+ * + *Return:
+ *Duration
is shorter than duration
parameterDuration
is equal to duration
parameterDuration
is longer than duration
parameterthis
Duration
and duration
parameter as
+ * {@link DatatypeConstants#LESSER}, {@link DatatypeConstants#EQUAL}, {@link DatatypeConstants#GREATER}
+ * or {@link DatatypeConstants#INDETERMINATE}.
+ *
+ * @throws 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.
+ * @throws NullPointerException if duration
is null
.
+ *
+ * @see #isShorterThan(Duration)
+ * @see #isLongerThan(Duration)
+ */
+ public abstract int compare(final Duration duration);
+
+ /**
+ * Checks if this duration object is strictly longer than
+ * another Duration
object.
Duration X is "longer" than Y if and only if X>Y + * as defined in the section 3.2.6.2 of the XML Schema 1.0 + * specification.
+ * + *For example, "P1D" (one day) > "PT12H" (12 hours) and + * "P2Y" (two years) > "P23M" (23 months).
+ * + * @param durationDuration
to test this Duration
against.
+ *
+ * @throws 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.
+ * @throws NullPointerException If duration
is null.
+ *
+ * @return
+ * true if the duration represented by this object
+ * is longer than the given duration. false otherwise.
+ *
+ * @see #isShorterThan(Duration)
+ * @see #compare(Duration duration)
+ */
+ public boolean isLongerThan(final Duration duration) {
+ return compare(duration) == DatatypeConstants.GREATER;
+ }
+
+ /**
+ * Checks if this duration object is strictly shorter than
+ * another Duration
object.
Duration
to test this Duration
against.
+ *
+ * @return true
if duration
parameter is shorter than this Duration
,
+ * else false
.
+ *
+ * @throws 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.
+ * @throws NullPointerException if duration
is null.
+ *
+ * @see #isLongerThan(Duration duration)
+ * @see #compare(Duration duration)
+ */
+ public boolean isShorterThan(final Duration duration) {
+ return compare(duration) == DatatypeConstants.LESSER;
+ }
+
+ /**
+ * 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")) + *+ * + * @param duration + * A non-null valid
Duration
object.
+ *
+ * @return
+ * true
if this duration is the same length as
+ * duration
.
+ * false
if duration
is not a
+ * Duration
object, is null
,
+ * or its length is different from this duration.
+ *
+ * @throws 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 #compare(Duration duration)
+ */
+ public boolean equals(final Object duration) {
+ if (duration == this) {
+ return true;
+ }
+ if (duration instanceof Duration) {
+ return compare((Duration) duration) == DatatypeConstants.EQUAL;
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code consistent with the definition of the equals method.
+ *
+ * @see Object#hashCode()
+ */
+ public abstract int hashCode();
+
+ /**
+ * Returns a String
representation of this Duration
Object
.
The result is formatted according to the XML Schema 1.0 specification and can be always parsed back later into the
+ * equivalent Duration
Object
by {@link DatatypeFactory#newDuration(String lexicalRepresentation)}.
Formally, the following holds for any Duration
+ * Object
x:
+ * new Duration(x.toString()).equals(x) + *+ * + * @return A non-
null
valid String
representation of this Duration
.
+ */
+ public String toString() {
+
+ StringBuffer buf = new StringBuffer();
+
+ if (getSign() < 0) {
+ buf.append('-');
+ }
+ buf.append('P');
+
+ BigInteger years = (BigInteger) getField(DatatypeConstants.YEARS);
+ if (years != null) {
+ buf.append(years).append('Y');
+ }
+
+ BigInteger months = (BigInteger) getField(DatatypeConstants.MONTHS);
+ if (months != null) {
+ buf.append(months).append('M');
+ }
+
+ BigInteger days = (BigInteger) getField(DatatypeConstants.DAYS);
+ if (days != null) {
+ buf.append(days).append('D');
+ }
+
+ BigInteger hours = (BigInteger) getField(DatatypeConstants.HOURS);
+ BigInteger minutes = (BigInteger) getField(DatatypeConstants.MINUTES);
+ BigDecimal seconds = (BigDecimal) getField(DatatypeConstants.SECONDS);
+ if (hours != null || minutes != null || seconds != null) {
+ buf.append('T');
+ if (hours != null) {
+ buf.append(hours).append('H');
+ }
+ if (minutes != null) {
+ buf.append(minutes).append('M');
+ }
+ if (seconds != null) {
+ buf.append(toString(seconds)).append('S');
+ }
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ * Turns {@link BigDecimal} to a string representation.
+ * + *Due to a behavior change in the {@link BigDecimal#toString()} + * method in JDK1.5, this had to be implemented here.
+ * + * @param bdBigDecimal
to format as a String
+ *
+ * @return String
representation of BigDecimal
+ */
+ private String toString(BigDecimal bd) {
+ String intString = bd.unscaledValue().toString();
+ int scale = bd.scale();
+
+ if (scale == 0) {
+ return intString;
+ }
+
+ /* Insert decimal point */
+ StringBuffer buf;
+ int insertionPoint = intString.length() - scale;
+ if (insertionPoint == 0) { /* Point goes right before intVal */
+ return "0." + intString;
+ }
+ else if (insertionPoint > 0) { /* Point goes inside intVal */
+ buf = new StringBuffer(intString);
+ buf.insert(insertionPoint, '.');
+ }
+ else { /* We must insert zeros between point and intVal */
+ buf = new StringBuffer(3 - insertionPoint + intString.length());
+ buf.append("0.");
+ for (int i = 0; i < -insertionPoint; i++) {
+ buf.append('0');
+ }
+ buf.append(intString);
+ }
+ return buf.toString();
+ }
+
+
+ /**
+ * Calls the {@link Calendar#getTimeInMillis} method. + * Prior to JDK1.4, this method was protected and therefore + * cannot be invoked directly.
+ * + *TODO: In future, this should be replaced by cal.getTimeInMillis()
.
Calendar
to get time in milliseconds.
+ *
+ * @return Milliseconds of cal
.
+ */
+ private static long getCalendarTimeInMillis(final Calendar cal) {
+ return cal.getTime().getTime();
+ }
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/FactoryFinder.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/FactoryFinder.java
new file mode 100644
index 000000000..6de44846a
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/FactoryFinder.java
@@ -0,0 +1,396 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: FactoryFinder.java 670432 2008-06-23 02:02:08Z mrglavas $
+
+package javax.xml.datatype;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * Implement pluggabile Datatypes.
+ * + *This class is duplicated for each JAXP subpackage so keep it in + * sync. It is package private for secure class loading.
+ * + * @author Jeff Suttor + * @version $Revision: 670432 $, $Date: 2008-06-22 22:02:08 -0400 (Sun, 22 Jun 2008) $ + * @since 1.5 + */ +final class FactoryFinder { + + /** + *Name of class to display in output messages.
+ */ + private static final String CLASS_NAME = "javax.xml.datatype.FactoryFinder"; + + /** + *Debug flag to trace loading process.
+ */ + private static boolean debug = false; + + /** + *Cache properties for performance.
+ */ + private static Properties cacheProps = new Properties(); + + /** + *First time requires initialization overhead.
+ */ + private static boolean firstTime = true; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + + /** + *Check to see if debugging enabled by property.
+ * + *Use try/catch block to support applets, which throws + * SecurityException out of this code.
+ * + */ + static { + try { + String val = SecuritySupport.getSystemProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && (! "false".equals(val)); + } catch (Exception x) { + debug = false; + } + } + + private FactoryFinder() {} + + /** + *Output debugging messages.
+ * + * @param msgString
to print to stderr
.
+ */
+ private static void debugPrintln(String msg) {
+ if (debug) {
+ System.err.println(
+ CLASS_NAME
+ + ":"
+ + msg);
+ }
+ }
+
+ /**
+ * Find the appropriate ClassLoader
to use.
The context ClassLoader is prefered.
+ * + * @returnClassLoader
to use.
+ *
+ * @throws ConfigurationError If a valid ClassLoader
cannot be identified.
+ */
+ private static ClassLoader findClassLoader()
+ throws ConfigurationError {
+ ClassLoader classLoader;
+
+ // Figure out which ClassLoader to use for loading the provider
+ // class. If there is a Context ClassLoader then use it.
+
+ classLoader = SecuritySupport.getContextClassLoader();
+
+ if (debug) debugPrintln(
+ "Using context class loader: "
+ + classLoader);
+
+ if (classLoader == null) {
+ // if we have no Context ClassLoader
+ // so use the current ClassLoader
+ classLoader = FactoryFinder.class.getClassLoader();
+ if (debug) debugPrintln(
+ "Using the class loader of FactoryFinder: "
+ + classLoader);
+ }
+
+ return classLoader;
+ }
+
+ /**
+ * Create an instance of a class using the specified ClassLoader.
+ * + * @param className Name of class to create. + * @param classLoader ClassLoader to use to create named class. + * + * @return New instance of specified class created using the specified ClassLoader. + * + * @throws ConfigurationError If class could not be created. + */ + static Object newInstance( + String className, + ClassLoader classLoader) + throws ConfigurationError { + + try { + Class spiClass; + if (classLoader == null) { + spiClass = Class.forName(className); + } else { + spiClass = classLoader.loadClass(className); + } + + if (debug) { + debugPrintln("Loaded " + className + " from " + which(spiClass)); + } + + return spiClass.newInstance(); + } catch (ClassNotFoundException x) { + throw new ConfigurationError( + "Provider " + className + " not found", x); + } catch (Exception x) { + throw new ConfigurationError( + "Provider " + className + " could not be instantiated: " + x, + x); + } + } + + /** + * Finds the implementation Class object in the specified order. Main + * entry point. + * Package private so this code can be shared. + * + * @param factoryId Name of the factory to find, same as a property name + * @param fallbackClassName Implementation class name, if nothing else is found. Use null to mean no fallback. + * + * @return Class Object of factory, never null + * + * @throws ConfigurationError If Class cannot be found. + */ + static Object find(String factoryId, String fallbackClassName) + throws ConfigurationError { + + ClassLoader classLoader = findClassLoader(); + + // Use the system property first + try { + String systemProp = SecuritySupport.getSystemProperty(factoryId); + if (systemProp != null && systemProp.length() > 0) { + if (debug) debugPrintln("found " + systemProp + " in the system property " + factoryId); + return newInstance(systemProp, classLoader); + } + } catch (SecurityException se) { + ; // NOP, explicitly ignore SecurityException + } + + // try to read from $java.home/lib/jaxp.properties + try { + String javah = SecuritySupport.getSystemProperty("java.home"); + String configFile = javah + File.separator + "lib" + File.separator + "jaxp.properties"; + String factoryClassName = null; + if (firstTime) { + synchronized (cacheProps) { + if (firstTime) { + File f = new File(configFile); + firstTime = false; + if (SecuritySupport.doesFileExist(f)) { + if (debug) debugPrintln("Read properties file " + f); + cacheProps.load(SecuritySupport.getFileInputStream(f)); + } + } + } + } + factoryClassName = cacheProps.getProperty(factoryId); + if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties"); + + if (factoryClassName != null) { + return newInstance(factoryClassName, classLoader); + } + } catch (Exception ex) { + if (debug) { + ex.printStackTrace(); + } + } + + // Try Jar Service Provider Mechanism + Object provider = findJarServiceProvider(factoryId); + if (provider != null) { + return provider; + } + + if (fallbackClassName == null) { + throw new ConfigurationError( + "Provider for " + factoryId + " cannot be found", null); + } + + if (debug) debugPrintln("loaded from fallback value: " + fallbackClassName); + return newInstance(fallbackClassName, classLoader); + } + + /* + * Try to find provider using Jar Service Provider Mechanism + * + * @return instance of provider class if found or null + */ + private static Object findJarServiceProvider(String factoryId) + throws ConfigurationError + { + + String serviceId = "META-INF/services/" + factoryId; + InputStream is = null; + + // First try the Context ClassLoader + ClassLoader cl = SecuritySupport.getContextClassLoader(); + if (cl != null) { + is = SecuritySupport.getResourceAsStream(cl, serviceId); + + // If no provider found then try the current ClassLoader + if (is == null) { + cl = FactoryFinder.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, serviceId); + } + } else { + // No Context ClassLoader, try the current + // ClassLoader + cl = FactoryFinder.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, serviceId); + } + + if (is == null) { + // No provider found + return null; + } + + if (debug) debugPrintln("found jar resource=" + serviceId + + " using ClassLoader: " + cl); + + BufferedReader rd; + try { + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); + } catch (java.io.UnsupportedEncodingException e) { + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); + } + + String factoryClassName = null; + try { + // XXX Does not handle all possible input as specified by the + // Jar Service Provider specification + factoryClassName = rd.readLine(); + } + catch (IOException x) { + // No provider found + return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} + } + + if (factoryClassName != null && + ! "".equals(factoryClassName)) { + if (debug) debugPrintln("found in resource, value=" + + factoryClassName); + + return newInstance(factoryClassName, cl); + } + + // No provider found + return null; + } + + /** + *Configuration Error.
+ */ + static class ConfigurationError extends Error { + + private static final long serialVersionUID = -3644413026244211347L; + + /** + *Exception that caused the error.
+ */ + private Exception exception; + + /** + *Construct a new instance with the specified detail string and + * exception.
+ * + * @param msg Detail message for this error. + * @param x Exception that caused the error. + */ + ConfigurationError(String msg, Exception x) { + super(msg); + this.exception = x; + } + + /** + *Get the Exception that caused the error.
+ * + * @return Exception that caused the error. + */ + Exception getException() { + return exception; + } + } + + + + /** + * Returns the location where the given Class is loaded from. + * + * @param clazz Class to find load location. + * + * @return Location where class would be loaded from. + */ + private static String which(Class clazz) { + try { + String classnameAsResource = clazz.getName().replace('.', '/') + ".class"; + + ClassLoader loader = clazz.getClassLoader(); + + URL it; + + if (loader != null) { + it = loader.getResource(classnameAsResource); + } else { + it = ClassLoader.getSystemResource(classnameAsResource); + } + + if (it != null) { + return it.toString(); + } + } + // The VM ran out of memory or there was some other serious problem. Re-throw. + catch (VirtualMachineError vme) { + throw vme; + } + // ThreadDeath should always be re-thrown + catch (ThreadDeath td) { + throw td; + } + catch (Throwable t) { + // work defensively. + if (debug) { + t.printStackTrace(); + } + } + return "unknown location"; + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/SecuritySupport.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/SecuritySupport.java new file mode 100644 index 000000000..da827484e --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/SecuritySupport.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: SecuritySupport.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.datatype; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + +/** + * This class is duplicated for each JAXP subpackage so keep it in sync. + * It is package private and therefore is not exposed as part of the JAXP + * API. + * + * Security related methods that only work on J2SE 1.2 and newer. + */ +final class SecuritySupport { + + private SecuritySupport() {} + + static ClassLoader getContextClassLoader() { + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); + } + + static String getSystemProperty(final String propName) { + return (String) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(propName); + } + }); + } + + static FileInputStream getFileInputStream(final File file) + throws FileNotFoundException + { + try { + return (FileInputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws FileNotFoundException { + return new FileInputStream(file); + } + }); + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } + } + + static InputStream getResourceAsStream(final ClassLoader cl, + final String name) + { + return (InputStream) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + InputStream ris; + if (cl == null) { + ris = ClassLoader.getSystemResourceAsStream(name); + } else { + ris = cl.getResourceAsStream(name); + } + return ris; + } + }); + } + + static boolean doesFileExist(final File f) { + return ((Boolean) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return f.exists() ? Boolean.TRUE : Boolean.FALSE; + } + })).booleanValue(); + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java new file mode 100644 index 000000000..d47f7bf0a --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java @@ -0,0 +1,1037 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLGregorianCalendar.java 759822 2009-03-30 01:15:11Z mrglavas $ + +package javax.xml.datatype; + +import javax.xml.namespace.QName; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.TimeZone; +import java.util.GregorianCalendar; + +/** + *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 | + * {@link #getYear()} + {@link #getEon()} or + * {@link #getEonAndYear} + * |
+ * getYear() is a value between -(10^9-1) to (10^9)-1
+ * or {@link DatatypeConstants#FIELD_UNDEFINED}.+ * {@link #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 | + *{@link #getMonth()} | + *1 to 12 or {@link DatatypeConstants#FIELD_UNDEFINED} | + *
day | + *{@link #getDay()} | + * Independent of month, max range is 1 to 31 or {@link 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 | + *{@link #getHour()} | + *+ * 0 to 24 or {@link DatatypeConstants#FIELD_UNDEFINED}. + * For a value of 24, the minute and second field must be zero per + * XML Schema Errata. + * | + *
minute | + *{@link #getMinute()} | + *0 to 59 or {@link DatatypeConstants#FIELD_UNDEFINED} | + *
second | + *
+ * {@link #getSecond()} + {@link #getMillisecond()}/1000 or + * {@link #getSecond()} + {@link #getFractionalSecond()} + * |
+ *
+ * {@link #getSecond()} from 0 to 60 or {@link DatatypeConstants#FIELD_UNDEFINED}. + * (Note: 60 only allowable for leap second.) + * {@link #getFractionalSecond()} allows for infinite precision over the range from 0.0 to 1.0 when + * the {@link #getSecond()} is defined. + * FractionalSecond is optional and has a value of null when it is undefined.+ * {@link #getMillisecond()} is the convenience + * millisecond precision of value of {@link #getFractionalSecond()}. + * |
+ *
timezone | + *{@link #getTimezone()} | + *Number of minutes or {@link 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: + *
Unset all fields to undefined.
+ * + *Set all int fields to {@link DatatypeConstants#FIELD_UNDEFINED} and reference fields + * to null.
+ */ + public abstract void clear(); + + /** + *Reset this XMLGregorianCalendar
to its original values.
XMLGregorianCalendar
is reset to the same values as when it was created with
+ * {@link DatatypeFactory#newXMLGregorianCalendar()},
+ * {@link DatatypeFactory#newXMLGregorianCalendar(String lexicalRepresentation)},
+ * {@link DatatypeFactory#newXMLGregorianCalendar(
+ * BigInteger year,
+ * int month,
+ * int day,
+ * int hour,
+ * int minute,
+ * int second,
+ * BigDecimal fractionalSecond,
+ * int timezone)},
+ * {@link DatatypeFactory#newXMLGregorianCalendar(
+ * int year,
+ * int month,
+ * int day,
+ * int hour,
+ * int minute,
+ * int second,
+ * int millisecond,
+ * int timezone)},
+ * {@link DatatypeFactory#newXMLGregorianCalendar(GregorianCalendar cal)},
+ * {@link DatatypeFactory#newXMLGregorianCalendarDate(
+ * int year,
+ * int month,
+ * int day,
+ * int timezone)},
+ * {@link DatatypeFactory#newXMLGregorianCalendarTime(
+ * int hours,
+ * int minutes,
+ * int seconds,
+ * int timezone)},
+ * {@link DatatypeFactory#newXMLGregorianCalendarTime(
+ * int hours,
+ * int minutes,
+ * int seconds,
+ * BigDecimal fractionalSecond,
+ * int timezone)} or
+ * {@link DatatypeFactory#newXMLGregorianCalendarTime(
+ * int hours,
+ * int minutes,
+ * int seconds,
+ * int milliseconds,
+ * int timezone)}.
+ *
reset()
is designed to allow the reuse of existing XMLGregorianCalendar
s
+ * thus saving resources associated with the creation of new XMLGregorianCalendar
s.
Set low and high order component of XSD dateTime
year field.
Unset this field by invoking the setter with a parameter value of null
.
year
parameter is
+ * outside value constraints for the field as specified in
+ * date/time field mapping table.
+ */
+ public abstract void setYear(BigInteger year);
+
+ /**
+ * Set year of XSD dateTime
year field.
Unset this field by invoking the setter with a parameter value of + * {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + *Note: if the absolute value of the year
parameter
+ * is less than 10^9, the eon component of the XSD year field is set to
+ * null
by this method.
null
.
+ */
+ public abstract void setYear(int year);
+
+ /**
+ * Set month.
+ * + *Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + * @param month value constraints summarized in month field of date/time field mapping table. + * + * @throws IllegalArgumentException ifmonth
parameter is
+ * outside value constraints for the field as specified in
+ * date/time field mapping table.
+ */
+ public abstract void setMonth(int month);
+
+ /**
+ * Set days in month.
+ * + *Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + * @param day value constraints summarized in day field of date/time field mapping table. + * + * @throws IllegalArgumentException ifday
parameter is
+ * outside value constraints for the field as specified in
+ * date/time field mapping table.
+ */
+ public abstract void setDay(int day);
+
+ /**
+ * Set the number of minutes in the timezone offset.
+ * + *Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + * @param offset value constraints summarized in + * timezone field of date/time field mapping table. + * + * @throws IllegalArgumentException ifoffset
parameter is
+ * outside value constraints for the field as specified in
+ * date/time field mapping table.
+ */
+ public abstract void setTimezone(int offset);
+
+ /**
+ * Set time as one unit.
+ * + * @param hour value constraints are summarized in + * hour field of date/time field mapping table. + * @param minute value constraints are summarized in + * minute field of date/time field mapping table. + * @param second value constraints are summarized in + * second field of date/time field mapping table. + * + * @see #setTime(int, int, int, BigDecimal) + * + * @throws IllegalArgumentException if any parameter is + * outside value constraints for the field as specified in + * date/time field mapping table. + */ + public void setTime(int hour, int minute, int second) { + + setTime( + hour, + minute, + second, + null // fractional + ); + } + + /** + *Set hours.
+ * + *Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + * @param hour value constraints summarized in hour field of date/time field mapping table. + * + * @throws IllegalArgumentException ifhour
parameter is outside value constraints for the field as specified in
+ * date/time field mapping table.
+ */
+ public abstract void setHour(int hour);
+
+ /**
+ * Set minutes.
+ * + *Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + * @param minute value constraints summarized in minute field of date/time field mapping table. + * + * @throws IllegalArgumentException ifminute
parameter is outside value constraints for the field as specified in
+ * date/time field mapping table.
+ */
+ public abstract void setMinute(int minute);
+
+ /**
+ * Set seconds.
+ * + *Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + * @param second value constraints summarized in second field of date/time field mapping table. + * + * @throws IllegalArgumentException ifsecond
parameter is outside value constraints for the field as specified in
+ * date/time field mapping table.
+ */
+ public abstract void setSecond(int second);
+
+ /**
+ * Set milliseconds.
+ * + *Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + * @param millisecond value constraints summarized in + * millisecond field of date/time field mapping table. + * + * @throws IllegalArgumentException ifmillisecond
parameter is outside value constraints for the field as specified
+ * in date/time field mapping table.
+ */
+ public abstract void setMillisecond(int millisecond);
+
+ /**
+ * Set fractional seconds.
+ * + *Unset this field by invoking the setter with a parameter value of null
.
fractional
parameter is outside value constraints for the field as specified
+ * in date/time field mapping table.
+ */
+ public abstract void setFractionalSecond(BigDecimal fractional);
+
+ /**
+ * Set time as one unit, including the optional infinite precision + * fractional seconds.
+ * + * @param hour value constraints are summarized in + * hour field of date/time field mapping table. + * @param minute value constraints are summarized in + * minute field of date/time field mapping table. + * @param second value constraints are summarized in + * second field of date/time field mapping table. + * @param fractional value ofnull
indicates this optional
+ * field is not set.
+ *
+ * @throws IllegalArgumentException if any parameter is
+ * outside value constraints for the field as specified in
+ * date/time field mapping table.
+ */
+ public void setTime(
+ int hour,
+ int minute,
+ int second,
+ BigDecimal fractional) {
+
+ setHour(hour);
+ setMinute(minute);
+ setSecond(second);
+ setFractionalSecond(fractional);
+ }
+
+ /**
+ * Set time as one unit, including optional milliseconds.
+ * + * @param hour value constraints are summarized in + * hour field of date/time field mapping table. + * @param minute value constraints are summarized in + * minute field of date/time field mapping table. + * @param second value constraints are summarized in + * second field of date/time field mapping table. + * @param millisecond value of {@link DatatypeConstants#FIELD_UNDEFINED} indicates this + * optional field is not set. + * + * @throws IllegalArgumentException if any parameter is + * outside value constraints for the field as specified in + * date/time field mapping table. + */ + public void setTime(int hour, int minute, int second, int millisecond) { + + setHour(hour); + setMinute(minute); + setSecond(second); + setMillisecond(millisecond); + } + + /** + *Return high order component for XML Schema 1.0 dateTime datatype field for
+ * year
.
+ * null
if this optional part of the year field is not defined.
Value constraints for this value are summarized in + * year field of date/time field mapping table.
+ * @return eon of thisXMLGregorianCalendar
. The value
+ * returned is an integer multiple of 10^9.
+ *
+ * @see #getYear()
+ * @see #getEonAndYear()
+ */
+ public abstract BigInteger getEon();
+
+ /**
+ * Return low order component for XML Schema 1.0 dateTime datatype field for
+ * year
or {@link DatatypeConstants#FIELD_UNDEFINED}.
Value constraints for this value are summarized in + * year field of date/time field mapping table.
+ * + * @return year of thisXMLGregorianCalendar
.
+ *
+ * @see #getEon()
+ * @see #getEonAndYear()
+ */
+ public abstract int getYear();
+
+ /**
+ * Return XML Schema 1.0 dateTime datatype field for
+ * year
.
Value constraints for this value are summarized in + * year field of date/time field mapping table.
+ * + * @return sum ofeon
and BigInteger.valueOf(year)
+ * when both fields are defined. When only year
is defined,
+ * return it. When both eon
and year
are not
+ * defined, return null
.
+ *
+ * @see #getEon()
+ * @see #getYear()
+ */
+ public abstract BigInteger getEonAndYear();
+
+ /**
+ * Return number of month or {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + *Value constraints for this value are summarized in + * month field of date/time field mapping table.
+ * + * @return year of thisXMLGregorianCalendar
.
+ *
+ */
+ public abstract int getMonth();
+
+ /**
+ * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}.
+ *
+ * Value constraints for this value are summarized in + * day field of date/time field mapping table.
+ * + * @see #setDay(int) + */ + public abstract int getDay(); + + /** + * Return timezone offset in minutes or + * {@link DatatypeConstants#FIELD_UNDEFINED} if this optional field is not defined. + * + *Value constraints for this value are summarized in + * timezone field of date/time field mapping table.
+ * + * @see #setTimezone(int) + */ + public abstract int getTimezone(); + + /** + * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. + * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. + * + *Value constraints for this value are summarized in + * hour field of date/time field mapping table.
+ * @see #setTime(int, int, int) + */ + public abstract int getHour(); + + /** + * Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}. + * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. + * + *Value constraints for this value are summarized in + * minute field of date/time field mapping table.
+ * @see #setTime(int, int, int) + */ + public abstract int getMinute(); + + /** + *Return seconds or {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + *Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. + * When this field is not defined, the optional xs:dateTime + * fractional seconds field, represented by + * {@link #getFractionalSecond()} and {@link #getMillisecond()}, + * must not be defined.
+ * + *Value constraints for this value are summarized in + * second field of date/time field mapping table.
+ * + * @return Second of thisXMLGregorianCalendar
.
+ *
+ * @see #getFractionalSecond()
+ * @see #getMillisecond()
+ * @see #setTime(int, int, int)
+ */
+ public abstract int getSecond();
+
+ /**
+ * Return millisecond precision of {@link #getFractionalSecond()}.
+ * + *This method represents a convenience accessor to infinite
+ * precision fractional second value returned by
+ * {@link #getFractionalSecond()}. The returned value is the rounded
+ * down to milliseconds value of
+ * {@link #getFractionalSecond()}. When {@link #getFractionalSecond()}
+ * returns null
, this method must return
+ * {@link DatatypeConstants#FIELD_UNDEFINED}.
Value constraints for this value are summarized in + * second field of date/time field mapping table.
+ * + * @return Millisecond of thisXMLGregorianCalendar
.
+ *
+ * @see #getFractionalSecond()
+ * @see #setTime(int, int, int)
+ */
+ public int getMillisecond() {
+
+ BigDecimal fractionalSeconds = getFractionalSecond();
+
+ // is field undefined?
+ if (fractionalSeconds == null) {
+ return DatatypeConstants.FIELD_UNDEFINED;
+ }
+
+ return getFractionalSecond().movePointRight(3).intValue();
+ }
+
+ /**
+ * Return fractional seconds.
+ * + *null
is returned when this optional field is not defined.
Value constraints are detailed in + * second field of date/time field mapping table.
+ * + *This optional field can only have a defined value when the + * xs:dateTime second field, represented by {@link #getSecond()}, + * does not return {@link DatatypeConstants#FIELD_UNDEFINED}.
+ * + * @return fractional seconds of thisXMLGregorianCalendar
.
+ *
+ * @see #getSecond()
+ * @see #setTime(int, int, int, BigDecimal)
+ */
+ public abstract BigDecimal getFractionalSecond();
+
+ // comparisons
+ /**
+ * Compare two instances of W3C XML Schema 1.0 date/time datatypes + * according to partial order relation defined in + * W3C XML Schema 1.0 Part 2, Section 3.2.7.3, + * Order relation on dateTime.
+ * + *xsd:dateTime
datatype field mapping to accessors of
+ * this class are defined in
+ * date/time field mapping table.
XMLGregorianCalendar
to compare
+ *
+ * @return The relationship between this
XMLGregorianCalendar
and
+ * the specified xmlGregorianCalendar
as
+ * {@link DatatypeConstants#LESSER},
+ * {@link DatatypeConstants#EQUAL},
+ * {@link DatatypeConstants#GREATER} or
+ * {@link DatatypeConstants#INDETERMINATE}.
+ *
+ * @throws NullPointerException if xmlGregorianCalendar
is null.
+ */
+ public abstract int compare(XMLGregorianCalendar xmlGregorianCalendar);
+
+ /**
+ * Normalize this instance to UTC.
+ * + *2000-03-04T23:00:00+03:00 normalizes to 2000-03-04T20:00:00Z
+ *Implements W3C XML Schema Part 2, Section 3.2.7.3 (A).
+ * + * @returnthis
XMLGregorianCalendar
normalized to UTC.
+ */
+ public abstract XMLGregorianCalendar normalize();
+
+ /**
+ * Indicates whether parameter obj
is "equal to" this one.
true
when obj
is an instance of XMLGregorianCalendar
+ * and {@link #compare(XMLGregorianCalendar obj)} returns {@link DatatypeConstants#EQUAL}, otherwise false
.
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (obj instanceof XMLGregorianCalendar) {
+ return compare((XMLGregorianCalendar) obj) == DatatypeConstants.EQUAL;
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash code consistent with the definition of the equals method.
+ * + * @return hash code of this object. + */ + public int hashCode() { + + // Following two dates compare to EQUALS since in different timezones. + // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 + // + // Must ensure both instances generate same hashcode by normalizing + // this to UTC timezone. + int timezone = getTimezone(); + if (timezone == DatatypeConstants.FIELD_UNDEFINED) { + timezone = 0; + } + XMLGregorianCalendar gc = this; + if (timezone != 0) { + gc = this.normalize(); + } + return gc.getYear() + + gc.getMonth() + + gc.getDay() + + gc.getHour() + + gc.getMinute() + + gc.getSecond(); + } + + /** + *Return the lexical representation of this
instance.
+ * The format is specified in
+ * XML Schema 1.0 Part 2, Section 3.2.[7-14].1,
+ * Lexical Representation".
Specific target lexical representation format is determined by + * {@link #getXMLSchemaType()}.
+ * + * @return XML, asString
, representation of this XMLGregorianCalendar
+ *
+ * @throws IllegalStateException if the combination of set fields
+ * does not match one of the eight defined XML Schema builtin date/time datatypes.
+ */
+ public abstract String toXMLFormat();
+
+ /**
+ * Return the name of the XML Schema date/time type that this instance + * maps to. Type is computed based on fields that are set.
+ * + *
+ * Required fields for XML Schema 1.0 Date/Time Datatypes. + * (timezone is optional for all date/time datatypes) + * |
+ * ||||||
---|---|---|---|---|---|---|
Datatype | + *year | + *month | + *day | + *hour | + *minute | + *second | + *
{@link DatatypeConstants#DATETIME} | + *X | + *X | + *X | + *X | + *X | + *X | + *
{@link DatatypeConstants#DATE} | + *X | + *X | + *X | + *+ * | + * | + * |
{@link DatatypeConstants#TIME} | + *+ * | + * | + * | X | + *X | + *X | + *
{@link DatatypeConstants#GYEARMONTH} | + *X | + *X | + *+ * | + * | + * | + * |
{@link DatatypeConstants#GMONTHDAY} | + *+ * | X | + *X | + *+ * | + * | + * |
{@link DatatypeConstants#GYEAR} | + *X | + *+ * | + * | + * | + * | + * |
{@link DatatypeConstants#GMONTH} | + *+ * | X | + *+ * | + * | + * | + * |
{@link DatatypeConstants#GDAY} | + *+ * | + * | X | + *+ * | + * | + * |
Returns a String
representation of this XMLGregorianCalendar
Object
.
The result is a lexical representation generated by {@link #toXMLFormat()}.
+ * + * @return A non-null
valid String
representation of this XMLGregorianCalendar
.
+ *
+ * @throws IllegalStateException if the combination of set fields
+ * does not match one of the eight defined XML Schema builtin date/time datatypes.
+ *
+ * @see #toXMLFormat()
+ */
+ public String toString() {
+
+ return toXMLFormat();
+ }
+
+ /**
+ * Validate instance by getXMLSchemaType()
constraints.
+ * @return true if data values are valid.
+ */
+ public abstract boolean isValid();
+
+ /**
+ * 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.
XMLGregorianCalendar
.
+ *
+ * @throws NullPointerException when duration
parameter is null
.
+ */
+ public abstract void add(Duration duration);
+
+ /**
+ * Convert this XMLGregorianCalendar
to a {@link 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
+ * {@link #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 |
+ * {@link #getEonAndYear()}.signum() < 0 ? GregorianCalendar.BC : GregorianCalendar.AD |
+ *
YEAR |
+ * {@link #getEonAndYear()}.abs().intValue() * |
+ *
MONTH |
+ * {@link #getMonth()} - {@link DatatypeConstants#JANUARY} + {@link GregorianCalendar#JANUARY} | + *
DAY_OF_MONTH |
+ * {@link #getDay()} | + *
HOUR_OF_DAY |
+ * {@link #getHour()} | + *
MINUTE |
+ * {@link #getMinute()} | + *
SECOND |
+ * {@link #getSecond()} | + *
MILLISECOND |
+ * get millisecond order from {@link #getFractionalSecond()}* | + *
GregorianCalendar.setTimeZone(TimeZone) |
+ * {@link #getTimezone()} formatted into Custom timezone id | + *
To ensure consistency in conversion implementations, the new
+ * GregorianCalendar
should be instantiated in following
+ * manner.
+ *
timeZone
value as defined above, create a new
+ * java.util.GregorianCalendar(timeZone,Locale.getDefault())
.
+ * GregorianCalendar.setGregorianChange(
+ * new Date(Long.MIN_VALUE))
.Calendar.set(int,int)
Convert this XMLGregorianCalendar
along with provided parameters
+ * to a {@link GregorianCalendar} instance.
Since XML Schema 1.0 date/time datetypes has no concept of
+ * timezone ids or daylight savings timezone ids, this conversion operation
+ * allows the user to explicitly specify one with
+ * timezone
parameter.
To compute the return value's TimeZone
field,
+ *
timeZone
is non-null,
+ * it is the timezone field.this.getTimezone() != FIELD_UNDEFINED
,
+ * create a java.util.TimeZone
with a custom timezone id
+ * using the this.getTimezone()
.defaults.getTimezone() != FIELD_UNDEFINED
,
+ * create a java.util.TimeZone
with a custom timezone id
+ * using defaults.getTimezone()
.GregorianCalendar
default timezone value
+ * for the host is defined as specified by
+ * java.util.TimeZone.getDefault()
.To ensure consistency in conversion implementations, the new
+ * GregorianCalendar
should be instantiated in following
+ * manner.
+ *
java.util.GregorianCalendar(TimeZone,
+ * Locale)
with TimeZone set as specified above and the
+ * Locale
parameter.
+ * GregorianCalendar.setGregorianChange(
+ * new Date(Long.MIN_VALUE))
.Calendar.set(int,int)
null
is a legal value.
+ * @param aLocale provide explicit Locale. Use default GregorianCalendar locale if
+ * value is null
.
+ * @param defaults provide default field values to use when corresponding
+ * field for this instance is FIELD_UNDEFINED or null.
+ * If defaults
is null
or a field
+ * within the specified defaults
is undefined,
+ * just use java.util.GregorianCalendar
defaults.
+ * @return a java.util.GregorianCalendar conversion of this instance.
+ */
+ public abstract GregorianCalendar toGregorianCalendar(
+ java.util.TimeZone timezone,
+ java.util.Locale aLocale,
+ XMLGregorianCalendar defaults);
+
+ /**
+ * Returns a java.util.TimeZone
for this class.
If timezone field is defined for this instance, + * returns TimeZone initialized with custom timezone id + * of zoneoffset. If timezone field is undefined, + * try the defaultZoneoffset that was passed in. + * If defaultZoneoffset is FIELD_UNDEFINED, return + * default timezone for this host. + * (Same default as java.util.GregorianCalendar).
+ * + * @param defaultZoneoffset default zoneoffset if this zoneoffset is + * {@link DatatypeConstants#FIELD_UNDEFINED}. + * + * @return TimeZone for this. + */ + public abstract TimeZone getTimeZone(int defaultZoneoffset); + + /** + *Creates and returns a copy of this object.
+ * + * @return copy of thisObject
+ */
+ public abstract Object clone();
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/package.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/package.html
new file mode 100644
index 000000000..d213d91e4
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/datatype/package.html
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+ XML/Java Type Mappings.
+ +The javax.xml.datatype
API provides XML/Java type mappings.
The following XML standards apply:
+W3C XML Schema Data Type | +Java Data Type | +
---|---|
xs:date | +{@link javax.xml.datatype.XMLGregorianCalendar} | +
xs:dateTime | +{@link javax.xml.datatype.XMLGregorianCalendar} | +
xs:duration | +{@link javax.xml.datatype.Duration} | +
xs:gDay | +{@link javax.xml.datatype.XMLGregorianCalendar} | +
xs:gMonth | +{@link javax.xml.datatype.XMLGregorianCalendar} | +
xs:gMonthDay | +{@link javax.xml.datatype.XMLGregorianCalendar} | +
xs:gYear | +{@link javax.xml.datatype.XMLGregorianCalendar} | +
xs:gYearMonth | +{@link javax.xml.datatype.XMLGregorianCalendar} | +
xs:time | +{@link javax.xml.datatype.XMLGregorianCalendar} | +
XQuery 1.0 and XPath 2.0 Data Model | +Java Data Type | +
---|---|
xdt:dayTimeDuration | +{@link javax.xml.datatype.Duration} | +
xdt:yearMonthDuration | +{@link javax.xml.datatype.Duration} | +
+ W3C XML Schema data types that have a "natural" mapping to Java types are defined by + JSR 31: Java™ Architecture for XML Binding (JAXB) Specification, Binding XML Schema to Java Representations. + JAXB defined mappings for XML Schema built-in data types include: +
+Interface for read only XML Namespace context processing.
+ * + *An XML Namespace has the properties:
+ *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.
+ * + * @author Jeff Suttor + * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $ + * @see javax.xml.XMLConstants javax.XMLConstants for declarations of common XML values + * @see XML Schema Part2: Datatypes + * @see Namespaces in XML + * @see Namespaces in XML Errata + * @since 1.5 + */ + +public interface NamespaceContext { + + /** + *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
+ * {@link javax.xml.XMLConstants#NULL_NS_URI 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 | + *{@link javax.xml.XMLConstants#NULL_NS_URI 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 |
+ *
Get prefix bound to Namespace URI in the current scope.
+ * + *To get all prefixes bound to a Namespace URI in the current + * scope, use {@link #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 |
+ *
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 |
+ *
Iterator
for all prefixes bound to the
+ * Namespace URI in the current scope
+ */
+ Iterator getPrefixes(String namespaceURI);
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/namespace/QName.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/namespace/QName.java
new file mode 100644
index 000000000..59b816cb6
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/namespace/QName.java
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: QName.java 754581 2009-03-15 01:32:39Z mrglavas $
+
+package javax.xml.namespace;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import javax.xml.XMLConstants;
+
+/**
+ * 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 {@link
+ * javax.xml.transform.Source XML input source}. The prefix is
+ * NOT used in {@link #equals(Object)
+ * QName.equals(Object)} or to compute the {@link #hashCode()
+ * 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 {@link + * javax.xml.XMLConstants#NULL_NS_URI XMLConstants.NULL_NS_URI}. + * If not specified, the prefix is set to {@link + * javax.xml.XMLConstants#DEFAULT_NS_PREFIX + * XMLConstants.DEFAULT_NS_PREFIX}.
+ * + *QName
is immutable.
Stream Unique Identifier.
+ * + *To enable the compatibility serialVersionUID
+ * set the System Property
+ * org.apache.xml.namespace.QName.useCompatibleSerialVersionUID
+ * to a value of "1.0".
The original default Stream Unique Identifier.
+ */ + private static final long defaultSerialVersionUID = -9120448754896609940L; + + /** + *The compatibility Stream Unique Identifier that was introduced + * with Java 5 SE SDK.
+ */ + private static final long compatabilitySerialVersionUID = 4418622981026545151L; + + static { + String compatPropValue = null; + try { + compatPropValue = (String)AccessController.doPrivileged( + new PrivilegedAction() { + public Object run() { + return System.getProperty("org.apache.xml.namespace.QName.useCompatibleSerialVersionUID"); + } + }); + } + catch (Exception e) {} + // If 1.0 use compatibility serialVersionUID + serialVersionUID = !"1.0".equals(compatPropValue) ? defaultSerialVersionUID : compatabilitySerialVersionUID; + } + + /** + *Namespace URI of this QName
.
local part of this QName
.
prefix of this QName
.
String
representation of this QName
.
QName
constructor specifying the Namespace URI
+ * and local part.
If the Namespace URI is null
, it is set to
+ * {@link javax.xml.XMLConstants#NULL_NS_URI
+ * 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 {@link
+ * javax.xml.XMLConstants#NULL_NS_URI
+ * 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 {@link + * javax.xml.XMLConstants#DEFAULT_NS_PREFIX + * 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.
+ * + * @param namespaceURI Namespace URI of theQName
+ * @param localPart local part of the QName
+ *
+ * @see #QName(String namespaceURI, String localPart, String
+ * prefix) QName(String namespaceURI, String localPart, String
+ * prefix)
+ */
+ public QName(final String namespaceURI, final String localPart) {
+ this(namespaceURI, localPart, XMLConstants.DEFAULT_NS_PREFIX);
+ }
+
+ /**
+ * QName
constructor specifying the Namespace URI,
+ * local part and prefix.
If the Namespace URI is null
, it is set to
+ * {@link javax.xml.XMLConstants#NULL_NS_URI
+ * 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 {@link
+ * javax.xml.XMLConstants#NULL_NS_URI
+ * 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 {@link
+ * javax.xml.XMLConstants#DEFAULT_NS_PREFIX
+ * 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.
+ * + * @param namespaceURI Namespace URI of theQName
+ * @param localPart local part of the QName
+ * @param prefix prefix of the QName
+ */
+ public QName(String namespaceURI, String localPart, String prefix) {
+
+ // map null Namespace URI to default to preserve compatibility with QName 1.0
+ if (namespaceURI == null) {
+ this.namespaceURI = XMLConstants.NULL_NS_URI;
+ } else {
+ this.namespaceURI = namespaceURI;
+ }
+
+ // local part is required. "" is allowed to preserve compatibility with QName 1.0
+ if (localPart == null) {
+ throw new IllegalArgumentException("local part cannot be \"null\" when creating a QName");
+ }
+ this.localPart = localPart;
+
+ // prefix is required
+ if (prefix == null) {
+ throw new IllegalArgumentException("prefix cannot be \"null\" when creating a QName");
+ }
+ this.prefix = prefix;
+ }
+
+ /**
+ * 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 + * {@link javax.xml.XMLConstants#NULL_NS_URI + * XMLConstants.NULL_NS_URI} and the prefix is set to {@link + * javax.xml.XMLConstants#DEFAULT_NS_PREFIX + * 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 {@link
+ * #QName(String namespaceURI, String localPart) QName(String
+ * namespaceURI, String localPart)} and
+ * {@link #QName(String namespaceURI, String localPart, String prefix)}
+ * are preferred.
The local part is not validated as a + * NCName + * as specified in Namespaces + * in XML.
+ * + * @param localPart local part of theQName
+ * @see #QName(String namespaceURI, String localPart) QName(String
+ * namespaceURI, String localPart)
+ * @see #QName(String namespaceURI, String localPart, String
+ * prefix) QName(String namespaceURI, String localPart, String
+ * prefix)
+ */
+ public QName(String localPart) {
+ this(
+ XMLConstants.NULL_NS_URI,
+ localPart,
+ XMLConstants.DEFAULT_NS_PREFIX);
+ }
+
+ /**
+ * Get the Namespace URI of this QName
.
QName
+ */
+ public String getNamespaceURI() {
+ return namespaceURI;
+ }
+
+ /**
+ * Get the local part of this QName
.
QName
+ */
+ public String getLocalPart() {
+ return localPart;
+ }
+
+ /**
+ * Get the prefix of this QName
.
The prefix assigned to a QName
might
+ * NOT be valid in a different
+ * context. For example, a QName
may be assigned a
+ * prefix in the context of parsing a document but that prefix may
+ * be invalid in the context of a different document.
QName
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * Test this QName
for equality with another
+ * Object
.
If the Object
to be tested is not a
+ * QName
or is null
, then this method
+ * returns false
.
Two QName
s are considered equal if and only if
+ * both the Namespace URI and local part are equal. This method
+ * uses String.equals()
to check equality of the
+ * Namespace URI and local part. The prefix is
+ * NOT used to determine equality.
This method satisfies the general contract of {@link + * java.lang.Object#equals(Object) Object.equals(Object)}
+ * + * @param objectToTest theObject
to test for
+ * equality with this QName
+ * @return true
if the given Object
is
+ * equal to this QName
else false
+ */
+ public final boolean equals(Object objectToTest) {
+ // Is this the same object?
+ if (objectToTest == this) {
+ return true;
+ }
+ // Is this a QName?
+ if (objectToTest instanceof QName) {
+ QName qName = (QName) objectToTest;
+ return localPart.equals(qName.localPart) && namespaceURI.equals(qName.namespaceURI);
+ }
+ return false;
+ }
+
+ /**
+ * Generate the hash code for this QName
.
The hash code is calculated using both the Namespace URI and
+ * the local part of the QName
. The prefix is
+ * NOT used to calculate the hash
+ * code.
This method satisfies the general contract of {@link + * java.lang.Object#hashCode() Object.hashCode()}.
+ * + * @return hash code for thisQName
Object
+ */
+ public final int hashCode() {
+ return namespaceURI.hashCode() ^ localPart.hashCode();
+ }
+
+ /**
+ * String
representation of this
+ * QName
.
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. {@link javax.xml.transform.Transformer#setParameter(String name, Object value)}.
+ * This implementation represents a QName
as:
+ * "{" + Namespace URI + "}" + local part. If the Namespace URI
+ * .equals(XMLConstants.NULL_NS_URI)
, only the
+ * local part is returned. An appropriate use of this method is
+ * for debugging or logging for human consumption.
Note the prefix value is NOT
+ * returned as part of the String
representation.
This method satisfies the general contract of {@link + * java.lang.Object#toString() Object.toString()}.
+ * + * @returnString
representation of this QName
+ */
+ public String toString() {
+ String _qNameAsString = qNameAsString;
+ if (_qNameAsString == null) {
+ final int nsLength = namespaceURI.length();
+ if (nsLength == 0) {
+ _qNameAsString = localPart;
+ }
+ else {
+ StringBuffer buffer = new StringBuffer(nsLength + localPart.length() + 2);
+ buffer.append('{');
+ buffer.append(namespaceURI);
+ buffer.append('}');
+ buffer.append(localPart);
+ _qNameAsString = buffer.toString();
+ }
+ qNameAsString = _qNameAsString;
+ }
+ return _qNameAsString;
+ }
+
+ /**
+ * QName
derived from parsing the formatted
+ * String
.
If the String
is null
or does not conform to
+ * {@link #toString() QName.toString()} formatting, an
+ * IllegalArgumentException
is thrown.
The String
MUST be in the
+ * form returned by {@link #toString() 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. {@link javax.xml.transform.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
+ * {@link javax.xml.XMLConstants#DEFAULT_NS_PREFIX
+ * 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.
+ * + * @param qNameAsStringString
representation
+ * of the QName
+ * @return QName
corresponding to the given String
+ * @see #toString() QName.toString()
+ */
+ public static QName valueOf(String qNameAsString) {
+
+ // null is not valid
+ if (qNameAsString == null) {
+ throw new IllegalArgumentException("cannot create QName from \"null\" or \"\" String");
+ }
+
+ // "" local part is valid to preserve compatible behavior with QName 1.0
+ if (qNameAsString.length() == 0) {
+ return new QName(
+ XMLConstants.NULL_NS_URI,
+ qNameAsString,
+ XMLConstants.DEFAULT_NS_PREFIX);
+ }
+
+ // local part only?
+ if (qNameAsString.charAt(0) != '{') {
+ return new QName(
+ XMLConstants.NULL_NS_URI,
+ qNameAsString,
+ XMLConstants.DEFAULT_NS_PREFIX);
+ }
+
+ // Namespace URI improperly specified?
+ if (qNameAsString.startsWith("{" + XMLConstants.NULL_NS_URI + "}")) {
+ throw new IllegalArgumentException(
+ "Namespace URI .equals(XMLConstants.NULL_NS_URI), "
+ + ".equals(\"" + XMLConstants.NULL_NS_URI + "\"), "
+ + "only the local part, "
+ + "\"" + qNameAsString.substring(2 + XMLConstants.NULL_NS_URI.length()) + "\", "
+ + "should be provided.");
+ }
+
+ // Namespace URI and local part specified
+ int endOfNamespaceURI = qNameAsString.indexOf('}');
+ if (endOfNamespaceURI == -1) {
+ throw new IllegalArgumentException(
+ "cannot create QName from \""
+ + qNameAsString
+ + "\", missing closing \"}\"");
+ }
+ return new QName(
+ qNameAsString.substring(1, endOfNamespaceURI),
+ qNameAsString.substring(endOfNamespaceURI + 1),
+ XMLConstants.DEFAULT_NS_PREFIX);
+ }
+
+ /*
+ * For old versions of QName which didn't have a prefix field,
+ * ObjectInputStream.defaultReadObject()
will initialize
+ * the prefix to null
instead of the empty string. This
+ * method fixes up the prefix field if it didn't exist in the serialized
+ * object.
+ */
+ private void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ if (prefix == null) {
+ prefix = XMLConstants.DEFAULT_NS_PREFIX;
+ }
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/namespace/package.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/namespace/package.html
new file mode 100644
index 000000000..a5296f74a
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/namespace/package.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+ XML Namespace processing.
+ +The following XML standards apply:
+ + + + diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/package.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/package.html new file mode 100644 index 000000000..7bb17f2d2 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/package.html @@ -0,0 +1,33 @@ + + + + + + + +Defines core XML constants and functionality from the XML specifications.
+ +The following core XML standards apply:
++ * + * An instance of this class can be obtained from the + * {@link DocumentBuilderFactory#newDocumentBuilder()} method. Once + * an instance of this class is obtained, XML can be parsed from a + * variety of input sources. These input sources are InputStreams, + * Files, URLs, and SAX InputSources.
+ *
+ * Note that this class reuses several classes from the SAX API. This
+ * does not require that the implementor of the underlying DOM
+ * implementation use a SAX parser to parse XML document into a
+ * Document
. It merely requires that the implementation
+ * communicate with the application using these existing APIs.
+ *
+ * @author Jeff Suttor
+ * @version $Revision: 584483 $, $Date: 2007-10-13 22:54:48 -0400 (Sat, 13 Oct 2007) $
+ */
+
+public abstract class DocumentBuilder {
+
+ private static final boolean DEBUG = false;
+
+ /** Protected constructor */
+ protected DocumentBuilder () {
+ }
+
+ /**
+ *
Reset this DocumentBuilder
to its original configuration.
DocumentBuilder
is reset to the same state as when it was created with
+ * {@link 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 {@link EntityResolver} or {@link ErrorHandler}
+ * Object
s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal
+ * EntityResolver
and ErrorHandler
.
InputStream
as an XML
+ * document and return a new DOM {@link Document} object.
+ * An IllegalArgumentException
is thrown if the
+ * InputStream
is null.
+ *
+ * @param is InputStream containing the content to be parsed.
+ * @return Document
result of parsing the
+ * InputStream
+ * @exception IOException If any IO errors occur.
+ * @exception SAXException If any parse errors occur.
+ * @see org.xml.sax.DocumentHandler
+ */
+
+ public Document parse(InputStream is)
+ throws SAXException, IOException {
+ if (is == null) {
+ throw new IllegalArgumentException("InputStream cannot be null");
+ }
+
+ InputSource in = new InputSource(is);
+ return parse(in);
+ }
+
+ /**
+ * Parse the content of the given InputStream
as an
+ * XML document and return a new DOM {@link Document} object.
+ * An IllegalArgumentException
is thrown if the
+ * InputStream
is null.
+ *
+ * @param is InputStream containing the content to be parsed.
+ * @param systemId Provide a base for resolving relative URIs.
+ * @return A new DOM Document object.
+ * @exception IOException If any IO errors occur.
+ * @exception SAXException If any parse errors occur.
+ * @see org.xml.sax.DocumentHandler
+ */
+
+ public Document parse(InputStream is, String systemId)
+ throws SAXException, IOException {
+ if (is == null) {
+ throw new IllegalArgumentException("InputStream cannot be null");
+ }
+
+ InputSource in = new InputSource(is);
+ in.setSystemId(systemId);
+ return parse(in);
+ }
+
+ /**
+ * Parse the content of the given URI as an XML document
+ * and return a new DOM {@link Document} object.
+ * An IllegalArgumentException
is thrown if the
+ * URI is null
null.
+ *
+ * @param uri The location of the content to be parsed.
+ * @return A new DOM Document object.
+ * @exception IOException If any IO errors occur.
+ * @exception SAXException If any parse errors occur.
+ * @see org.xml.sax.DocumentHandler
+ */
+
+ public Document parse(String uri)
+ throws SAXException, IOException {
+ if (uri == null) {
+ throw new IllegalArgumentException("URI cannot be null");
+ }
+
+ InputSource in = new InputSource(uri);
+ return parse(in);
+ }
+
+ /**
+ * Parse the content of the given file as an XML document
+ * and return a new DOM {@link Document} object.
+ * An IllegalArgumentException
is thrown if the
+ * File
is null
null.
+ *
+ * @param f The file containing the XML to parse.
+ * @exception IOException If any IO errors occur.
+ * @exception SAXException If any parse errors occur.
+ * @see org.xml.sax.DocumentHandler
+ * @return A new DOM Document object.
+ */
+
+ public Document parse(File f) throws SAXException, IOException {
+ if (f == null) {
+ throw new IllegalArgumentException("File cannot be null");
+ }
+
+ String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath());
+
+ if (DEBUG) {
+ System.out.println("Escaped URI = " + escapedURI);
+ }
+
+ InputSource in = new InputSource(escapedURI);
+ return parse(in);
+ }
+
+ /**
+ * Parse the content of the given input source as an XML document
+ * and return a new DOM {@link Document} object.
+ * An IllegalArgumentException
is thrown if the
+ * InputSource
is null
null.
+ *
+ * @param is InputSource containing the content to be parsed.
+ * @exception IOException If any IO errors occur.
+ * @exception SAXException If any parse errors occur.
+ * @see org.xml.sax.DocumentHandler
+ * @return A new DOM Document object.
+ */
+
+ public abstract Document parse(InputSource is)
+ throws SAXException, IOException;
+
+
+ /**
+ * Indicates whether or not this parser is configured to
+ * understand namespaces.
+ *
+ * @return true if this parser is configured to understand
+ * namespaces; false otherwise.
+ */
+
+ public abstract boolean isNamespaceAware();
+
+ /**
+ * Indicates whether or not this parser is configured to
+ * validate XML documents.
+ *
+ * @return true if this parser is configured to validate
+ * XML documents; false otherwise.
+ */
+
+ public abstract boolean isValidating();
+
+ /**
+ * Specify the {@link EntityResolver} to be used to resolve
+ * entities present in the XML document to be parsed. Setting
+ * this to null
will result in the underlying
+ * implementation using it's own default implementation and
+ * behavior.
+ *
+ * @param er The EntityResolver
to be used to resolve entities
+ * present in the XML document to be parsed.
+ */
+
+ public abstract void setEntityResolver(EntityResolver er);
+
+ /**
+ * Specify the {@link ErrorHandler} to be used by the parser.
+ * Setting this to null
will result in the underlying
+ * implementation using it's own default implementation and
+ * behavior.
+ *
+ * @param eh The ErrorHandler
to be used by the parser.
+ */
+
+ public abstract void setErrorHandler(ErrorHandler eh);
+
+ /**
+ * Obtain a new instance of a DOM {@link Document} object
+ * to build a DOM tree with.
+ *
+ * @return A new instance of a DOM Document object.
+ */
+
+ public abstract Document newDocument();
+
+ /**
+ * Obtain an instance of a {@link DOMImplementation} object.
+ *
+ * @return A new instance of a DOMImplementation
.
+ */
+
+ public abstract DOMImplementation getDOMImplementation();
+
+ /** Get a reference to the the {@link Schema} being used by + * the XML processor.
+ * + *If no schema is being used, null
is returned.
null
+ * if none in use
+ *
+ * @throws UnsupportedOperationException
+ * For backward compatibility, when implementations for
+ * earlier versions of JAXP is used, this exception will be
+ * thrown.
+ *
+ * @since 1.5
+ */
+ public Schema getSchema() {
+ throw new UnsupportedOperationException(
+ "This parser does not support specification \""
+ + this.getClass().getPackage().getSpecificationTitle()
+ + "\" version \""
+ + this.getClass().getPackage().getSpecificationVersion()
+ + "\""
+ );
+ }
+
+
+ /**
+ * Get the XInclude processing mode for this parser.
+ * + * @return + * the return value of + * the {@link DocumentBuilderFactory#isXIncludeAware()} + * when this parser was created from factory. + * + * @throws UnsupportedOperationException + * For backward compatibility, when implementations for + * earlier versions of JAXP is used, this exception will be + * thrown. + * + * @since 1.5 + * + * @see DocumentBuilderFactory#setXIncludeAware(boolean) + */ + public boolean isXIncludeAware() { + throw new UnsupportedOperationException( + "This parser does not support specification \"" + + this.getClass().getPackage().getSpecificationTitle() + + "\" version \"" + + this.getClass().getPackage().getSpecificationVersion() + + "\"" + ); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java new file mode 100644 index 000000000..0bf0db31a --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java @@ -0,0 +1,551 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: DocumentBuilderFactory.java 884950 2009-11-27 18:46:18Z mrglavas $ + +package javax.xml.parsers; + +import javax.xml.validation.Schema; + +/** + * Defines a factory API that enables applications to obtain a + * parser that produces DOM object trees from XML documents. + * + * @author Jeff Suttor + * @version $Revision: 884950 $, $Date: 2009-11-27 13:46:18 -0500 (Fri, 27 Nov 2009) $ + */ + +public abstract class DocumentBuilderFactory { + + private boolean validating = false; + private boolean namespaceAware = false; + private boolean whitespace = false; + private boolean expandEntityRef = true; + private boolean ignoreComments = false; + private boolean coalescing = false; + + protected DocumentBuilderFactory () { + } + + /** + * Obtain a new instance of a + *DocumentBuilderFactory
. This static method creates
+ * a new factory instance.
+ * This method uses the following ordered lookup procedure to determine
+ * the DocumentBuilderFactory
implementation class to
+ * load:
+ * javax.xml.parsers.DocumentBuilderFactory
system
+ * property.
+ * java.util.Properties
+ *
format and contains the fully qualified name of the
+ * implementation class with the key being the system property defined
+ * above.
+ *
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and it's values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
+ * META-INF/services/javax.xml.parsers.DocumentBuilderFactory
+ * in jars available to the runtime.
+ * DocumentBuilderFactory
instance.
+ * DocumentBuilderFactory
it can use the factory to
+ * configure and obtain parser instances.
+ *
+ *
+ * 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 loading {@link DocumentBuilder}s, try:
+ *+ * java -Djaxp.debug=1 YourProgram .... + *+ * + * @return New instance of a
DocumentBuilderFactory
+ *
+ * @exception FactoryConfigurationError if the implementation is not
+ * available or cannot be instantiated.
+ */
+ public static DocumentBuilderFactory newInstance() {
+ try {
+ return (DocumentBuilderFactory) FactoryFinder.find(
+ /* The default property name according to the JAXP spec */
+ "javax.xml.parsers.DocumentBuilderFactory",
+ /* The fallback implementation class name */
+ "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
+ }
+ catch (FactoryFinder.ConfigurationError e) {
+ throw new FactoryConfigurationError(e.getException(), e.getMessage());
+ }
+ }
+
+ /**
+ * @return New instance of a DocumentBuilderFactory
+ *
+ * @exception FactoryConfigurationError if the implementation is not
+ * available or cannot be instantiated.
+ */
+ public static DocumentBuilderFactory newInstance(String factoryClassName,
+ ClassLoader classLoader) {
+ if (factoryClassName == null) {
+ throw new FactoryConfigurationError("factoryClassName cannot be null.");
+ }
+ if (classLoader == null) {
+ classLoader = SecuritySupport.getContextClassLoader();
+ }
+ try {
+ return (DocumentBuilderFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false);
+ }
+ catch (FactoryFinder.ConfigurationError e) {
+ throw new FactoryConfigurationError(e.getException(), e.getMessage());
+ }
+ }
+
+ /**
+ * Creates a new instance of a {@link javax.xml.parsers.DocumentBuilder}
+ * using the currently configured parameters.
+ *
+ * @exception ParserConfigurationException if a DocumentBuilder
+ * cannot be created which satisfies the configuration requested.
+ * @return A new instance of a DocumentBuilder.
+ */
+
+ public abstract DocumentBuilder newDocumentBuilder()
+ throws ParserConfigurationException;
+
+
+ /**
+ * Specifies that the parser produced by this code will
+ * provide support for XML namespaces. By default the value of this is set
+ * to false
+ *
+ * @param awareness true if the parser produced will provide support
+ * for XML namespaces; false otherwise.
+ */
+
+ public void setNamespaceAware(boolean awareness) {
+ this.namespaceAware = awareness;
+ }
+
+ /**
+ * 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 {@link #setValidating(boolean)} + * method false, then use the {@link #setSchema(Schema)} + * method to associate a schema to a parser. + *
+ * + * @param validating true if the parser produced will validate documents + * as they are parsed; false otherwise. + */ + + public void setValidating(boolean validating) { + this.validating = validating; + } + + /** + * Specifies that the parsers created by this factory must eliminate + * whitespace in element content (sometimes known loosely as + * 'ignorable whitespace') when parsing XML documents (see XML Rec + * 2.10). Note that only whitespace which is directly contained within + * element content that has an element only content model (see XML + * Rec 3.2.1) will be eliminated. Due to reliance on the content model + * this setting requires the parser to be in validating mode. By default + * the value of this is set tofalse
.
+ *
+ * @param whitespace true if the parser created must eliminate whitespace
+ * in the element content when parsing XML documents;
+ * false otherwise.
+ */
+
+ public void setIgnoringElementContentWhitespace(boolean whitespace) {
+ this.whitespace = whitespace;
+ }
+
+ /**
+ * Specifies that the parser produced by this code will
+ * expand entity reference nodes. By default the value of this is set to
+ * true
+ *
+ * @param expandEntityRef true if the parser produced will expand entity
+ * reference nodes; false otherwise.
+ */
+
+ public void setExpandEntityReferences(boolean expandEntityRef) {
+ this.expandEntityRef = expandEntityRef;
+ }
+
+ /**
+ * Specifies that the parser produced by this code will
+ * ignore comments. By default the value of this is set to false
+ *
.
boolean
value to ignore comments during processing
+ */
+
+ public void setIgnoringComments(boolean ignoreComments) {
+ this.ignoreComments = ignoreComments;
+ }
+
+ /**
+ * Specifies that the parser produced by this code will
+ * convert CDATA nodes to Text nodes and append it to the
+ * adjacent (if any) text node. By default the value of this is set to
+ * false
+ *
+ * @param coalescing true if the parser produced will convert CDATA nodes
+ * to Text nodes and append it to the adjacent (if any)
+ * text node; false otherwise.
+ */
+
+ public void setCoalescing(boolean coalescing) {
+ this.coalescing = coalescing;
+ }
+
+ /**
+ * Indicates whether or not the factory is configured to produce
+ * parsers which are namespace aware.
+ *
+ * @return true if the factory is configured to produce parsers which
+ * are namespace aware; false otherwise.
+ */
+
+ public boolean isNamespaceAware() {
+ return namespaceAware;
+ }
+
+ /**
+ * Indicates whether or not the factory is configured to produce
+ * parsers which validate the XML content during parse.
+ *
+ * @return true if the factory is configured to produce parsers
+ * which validate the XML content during parse; false otherwise.
+ */
+
+ public boolean isValidating() {
+ return validating;
+ }
+
+ /**
+ * Indicates whether or not the factory is configured to produce
+ * parsers which ignore ignorable whitespace in element content.
+ *
+ * @return true if the factory is configured to produce parsers
+ * which ignore ignorable whitespace in element content;
+ * false otherwise.
+ */
+
+ public boolean isIgnoringElementContentWhitespace() {
+ return whitespace;
+ }
+
+ /**
+ * Indicates whether or not the factory is configured to produce
+ * parsers which expand entity reference nodes.
+ *
+ * @return true if the factory is configured to produce parsers
+ * which expand entity reference nodes; false otherwise.
+ */
+
+ public boolean isExpandEntityReferences() {
+ return expandEntityRef;
+ }
+
+ /**
+ * Indicates whether or not the factory is configured to produce
+ * parsers which ignores comments.
+ *
+ * @return true if the factory is configured to produce parsers
+ * which ignores comments; false otherwise.
+ */
+
+ public boolean isIgnoringComments() {
+ return ignoreComments;
+ }
+
+ /**
+ * Indicates whether or not the factory is configured to produce
+ * parsers which converts CDATA nodes to Text nodes and appends it to
+ * the adjacent (if any) Text node.
+ *
+ * @return true if the factory is configured to produce parsers
+ * which converts CDATA nodes to Text nodes and appends it to
+ * the adjacent (if any) Text node; false otherwise.
+ */
+
+ public boolean isCoalescing() {
+ return coalescing;
+ }
+
+ /**
+ * Allows the user to set specific attributes on the underlying
+ * implementation.
+ * @param name The name of the attribute.
+ * @param value The value of the attribute.
+ * @exception IllegalArgumentException thrown if the underlying
+ * implementation doesn't recognize the attribute.
+ */
+ public abstract void setAttribute(String name, Object value)
+ throws IllegalArgumentException;
+
+ /**
+ * Allows the user to retrieve specific attributes on the underlying
+ * implementation.
+ * @param name The name of the attribute.
+ * @return value The value of the attribute.
+ * @exception IllegalArgumentException thrown if the underlying
+ * implementation doesn't recognize the attribute.
+ */
+ public abstract Object getAttribute(String name)
+ throws IllegalArgumentException;
+
+ /**
+ * Set a feature for this DocumentBuilderFactory
and DocumentBuilder
s created by this factory.
+ * Feature names are fully qualified {@link java.net.URI}s.
+ * Implementations may define their own features.
+ * An {@link ParserConfigurationException} is thrown if this DocumentBuilderFactory
or the
+ * DocumentBuilder
s 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 {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is:
+ *true
: the implementation will limit XML processing to conform to implementation limits.
+ * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
+ * If XML processing is limited for security reasons, it will be reported via a call to the registered
+ * {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}.
+ * See {@link DocumentBuilder#setErrorHandler(org.xml.sax.ErrorHandler errorHandler)}.
+ * false
: the implementation will processing XML according to the XML specifications without
+ * regard to possible implementation limits.
+ * true
or false
.
+ *
+ * @throws ParserConfigurationException if this DocumentBuilderFactory
or the DocumentBuilder
s
+ * it creates cannot support this feature.
+ * @throws NullPointerException If the name
parameter is null.
+ */
+ public abstract void setFeature(String name, boolean value)
+ throws ParserConfigurationException;
+
+ /**
+ * Get the state of the named feature.
+ * + *
+ * Feature names are fully qualified {@link java.net.URI}s.
+ * Implementations may define their own features.
+ * An {@link ParserConfigurationException} is thrown if this DocumentBuilderFactory
or the
+ * DocumentBuilder
s it creates cannot support the feature.
+ * It is possible for an DocumentBuilderFactory
to expose a feature value but be unable to change its state.
+ *
DocumentBuilderFactory
+ * or the DocumentBuilder
s it creates cannot support this feature.
+ */
+ public abstract boolean getFeature(String name)
+ throws ParserConfigurationException;
+
+ /**
+ * Gets the {@link Schema} object specified through
+ * the {@link #setSchema(Schema schema)} method.
+ *
+ *
+ * @throws UnsupportedOperationException
+ * For backward compatibility, when implementations for
+ * earlier versions of JAXP is used, this exception will be
+ * thrown.
+ *
+ * @return
+ * the {@link Schema} object that was last set through
+ * the {@link #setSchema(Schema)} method, or null
+ * if the method was not invoked since a {@link DocumentBuilderFactory}
+ * is created.
+ *
+ * @since 1.5
+ */
+ public Schema getSchema() {
+ throw new UnsupportedOperationException(
+ "This parser does not support specification \""
+ + this.getClass().getPackage().getSpecificationTitle()
+ + "\" version \""
+ + this.getClass().getPackage().getSpecificationVersion()
+ + "\""
+ );
+
+ }
+
+ /**
+ * Set the {@link Schema} to be used by parsers created + * from this factory. + * + *
+ * When a {@link 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 {@link org.xml.sax.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 {@link org.xml.sax.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. + * + *
+ * Initially, null is set as the {@link Schema}. + * + *
+ * This processing will take effect even if + * the {@link #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 {@link Schema} object.
+ * Such configuration will cause a {@link ParserConfigurationException}
+ * exception when the {@link #newDocumentBuilder()} is invoked.
+ * A parser must be able to work with any {@link 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.
+ *
+ * @param schema Schema
to use or null
to remove a schema.
+ *
+ * @throws UnsupportedOperationException
+ * For backward compatibility, when implementations for
+ * earlier versions of JAXP is used, this exception will be
+ * thrown.
+ *
+ * @since 1.5
+ */
+ public void setSchema(Schema schema) {
+ throw new UnsupportedOperationException(
+ "This parser does not support specification \""
+ + this.getClass().getPackage().getSpecificationTitle()
+ + "\" version \""
+ + this.getClass().getPackage().getSpecificationVersion()
+ + "\""
+ );
+ }
+
+ /**
+ *
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
.
true
or
+ * false
+ *
+ * @throws UnsupportedOperationException
+ * For backward compatibility, when implementations for
+ * earlier versions of JAXP is used, this exception will be
+ * thrown.
+ *
+ * @since 1.5
+ */
+ public void setXIncludeAware(final boolean state) {
+ throw new UnsupportedOperationException(
+ "This parser does not support specification \""
+ + this.getClass().getPackage().getSpecificationTitle()
+ + "\" version \""
+ + this.getClass().getPackage().getSpecificationVersion()
+ + "\""
+ );
+ }
+
+ /**
+ * Get state of XInclude processing.
+ * + * @return current state of XInclude processing + * + * @throws UnsupportedOperationException + * For backward compatibility, when implementations for + * earlier versions of JAXP is used, this exception will be + * thrown. + * + * @since 1.5 + */ + public boolean isXIncludeAware() { + throw new UnsupportedOperationException( + "This parser does not support specification \"" + + this.getClass().getPackage().getSpecificationTitle() + + "\" version \"" + + this.getClass().getPackage().getSpecificationVersion() + + "\"" + ); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FactoryConfigurationError.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FactoryConfigurationError.java new file mode 100644 index 000000000..5f054066b --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FactoryConfigurationError.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: FactoryConfigurationError.java 569980 2007-08-27 03:58:15Z mrglavas $ + +package javax.xml.parsers; + +/** + * Thrown when a problem with configuration with the Parser Factories + * exists. This error will typically be thrown when the class of a + * parser factory specified in the system properties cannot be found + * or instantiated. + * + * @author Jeff Suttor + * @version $Revision: 569980 $, $Date: 2007-08-26 23:58:15 -0400 (Sun, 26 Aug 2007) $ + */ + +public class FactoryConfigurationError extends Error { + + /** + *Exception
that represents the error.
+ */
+ private Exception exception;
+
+ /**
+ * Create a new FactoryConfigurationError
with no
+ * detail message.
+ */
+
+ public FactoryConfigurationError() {
+ super();
+ this.exception = null;
+ }
+
+ /**
+ * Create a new FactoryConfigurationError
with
+ * the String
specified as an error message.
+ *
+ * @param msg The error message for the exception.
+ */
+
+ public FactoryConfigurationError(String msg) {
+ super(msg);
+ this.exception = null;
+ }
+
+
+ /**
+ * Create a new FactoryConfigurationError
with a
+ * given Exception
base cause of the error.
+ *
+ * @param e The exception to be encapsulated in a
+ * FactoryConfigurationError.
+ */
+
+ public FactoryConfigurationError(Exception e) {
+ super(e.toString());
+ this.exception = e;
+ }
+
+ /**
+ * Create a new FactoryConfigurationError
with the
+ * given Exception
base cause and detail message.
+ *
+ * @param e The exception to be encapsulated in a
+ * FactoryConfigurationError
+ * @param msg The detail message.
+ */
+
+ public FactoryConfigurationError(Exception e, String msg) {
+ super(msg);
+ this.exception = e;
+ }
+
+
+ /**
+ * Return the message (if any) for this error . If there is no
+ * message for the exception and there is an encapsulated
+ * exception then the message of that exception, if it exists will be
+ * returned. Else the name of the encapsulated exception will be
+ * returned.
+ *
+ * @return The error message.
+ */
+
+ public String getMessage () {
+ String message = super.getMessage ();
+
+ if (message == null && exception != null) {
+ return exception.getMessage();
+ }
+
+ return message;
+ }
+
+ /**
+ * Return the actual exception (if any) that caused this exception to
+ * be raised.
+ *
+ * @return The encapsulated exception, or null if there is none.
+ */
+
+ public Exception getException () {
+ return exception;
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FactoryFinder.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FactoryFinder.java
new file mode 100644
index 000000000..259469142
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FactoryFinder.java
@@ -0,0 +1,338 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: FactoryFinder.java 670431 2008-06-23 01:40:03Z mrglavas $
+
+package javax.xml.parsers;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in
+ * sync. It is package private.
+ *
+ * This code is designed to implement the JAXP 1.1 spec pluggability
+ * feature and is designed to run on JDK version 1.1 and later including
+ * JVMs that perform early linking like the Microsoft JVM in IE 5. Note
+ * however that it must be compiled on a JDK version 1.2 or later system
+ * since it calls Thread#getContextClassLoader(). The code also runs both
+ * as part of an unbundled jar file and when bundled as part of the JDK.
+ */
+final class FactoryFinder {
+
+ /**
+ * Debug flag to trace loading process.
+ */ + private static boolean debug = false; + + /** + *Cache properties for performance.
+ */ + private static Properties cacheProps = new Properties(); + + /** + *First time requires initialization overhead.
+ */ + private static boolean firstTime = true; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + + // Define system property "jaxp.debug" to get output + static { + // Use try/catch block to support applets, which throws + // SecurityException out of this code. + try { + String val = SecuritySupport.getSystemProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && (! "false".equals(val)); + } catch (SecurityException se) { + debug = false; + } + } + + private FactoryFinder() {} + + private static void dPrint(String msg) { + if (debug) { + System.err.println("JAXP: " + msg); + } + } + + /** + * Create an instance of a class using the specified ClassLoader and + * optionally fall back to the current ClassLoader if not found. + * + * @param className Name of the concrete class corresponding to the + * service provider + * + * @param cl ClassLoader to use to load the class, null means to use + * the bootstrap ClassLoader + * + * @param doFallback true if the current ClassLoader should be tried as + * a fallback if the class is not found using cl + */ + static Object newInstance(String className, ClassLoader cl, + boolean doFallback) + throws ConfigurationError + { + // assert(className != null); + + try { + Class providerClass; + if (cl == null) { + // If classloader is null Use the bootstrap ClassLoader. + // Thus Class.forName(String) will use the current + // ClassLoader which will be the bootstrap ClassLoader. + providerClass = Class.forName(className); + } else { + try { + providerClass = cl.loadClass(className); + } catch (ClassNotFoundException x) { + if (doFallback) { + // Fall back to current classloader + cl = FactoryFinder.class.getClassLoader(); + if (cl != null) { + providerClass = cl.loadClass(className); + } + else { + providerClass = Class.forName(className); + } + } else { + throw x; + } + } + } + + Object instance = providerClass.newInstance(); + if (debug) dPrint("created new instance of " + providerClass + + " using ClassLoader: " + cl); + return instance; + } catch (ClassNotFoundException x) { + throw new ConfigurationError( + "Provider " + className + " not found", x); + } catch (Exception x) { + throw new ConfigurationError( + "Provider " + className + " could not be instantiated: " + x, + x); + } + } + + /** + * Finds the implementation Class object in the specified order. Main + * entry point. + * @return Class object of factory, never null + * + * @param factoryId Name of the factory to find, same as + * a property name + * @param fallbackClassName Implementation class name, if nothing else + * is found. Use null to mean no fallback. + * + * Package private so this code can be shared. + */ + static Object find(String factoryId, String fallbackClassName) + throws ConfigurationError + { + + // Figure out which ClassLoader to use for loading the provider + // class. If there is a Context ClassLoader then use it. + + ClassLoader classLoader = SecuritySupport.getContextClassLoader(); + + if (classLoader == null) { + // if we have no Context ClassLoader + // so use the current ClassLoader + classLoader = FactoryFinder.class.getClassLoader(); + } + + if (debug) dPrint("find factoryId =" + factoryId); + + // Use the system property first + try { + String systemProp = SecuritySupport.getSystemProperty(factoryId); + if (systemProp != null && systemProp.length() > 0) { + if (debug) dPrint("found system property, value=" + systemProp); + return newInstance(systemProp, classLoader, true); + } + } catch (SecurityException se) { + //if first option fails due to any reason we should try next option in the + //look up algorithm. + } + + // try to read from $java.home/lib/jaxp.properties + try { + String javah = SecuritySupport.getSystemProperty("java.home"); + String configFile = javah + File.separator + + "lib" + File.separator + "jaxp.properties"; + String factoryClassName = null; + if(firstTime){ + synchronized(cacheProps){ + if(firstTime){ + File f=new File( configFile ); + firstTime = false; + if(SecuritySupport.doesFileExist(f)){ + if (debug) dPrint("Read properties file "+f); + //cacheProps.load( new FileInputStream(f)); + cacheProps.load(SecuritySupport.getFileInputStream(f)); + } + } + } + } + factoryClassName = cacheProps.getProperty(factoryId); + + if(factoryClassName != null){ + if (debug) dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName); + return newInstance(factoryClassName, classLoader, true); + } + } catch(Exception ex ) { + if( debug ) ex.printStackTrace(); + } + + // Try Jar Service Provider Mechanism + Object provider = findJarServiceProvider(factoryId); + if (provider != null) { + return provider; + } + if (fallbackClassName == null) { + throw new ConfigurationError( + "Provider for " + factoryId + " cannot be found", null); + } + + if (debug) dPrint("loaded from fallback value: " + fallbackClassName); + return newInstance(fallbackClassName, classLoader, true); + } + + /* + * Try to find provider using Jar Service Provider Mechanism + * + * @return instance of provider class if found or null + */ + private static Object findJarServiceProvider(String factoryId) + throws ConfigurationError + { + + String serviceId = "META-INF/services/" + factoryId; + InputStream is = null; + + // First try the Context ClassLoader + ClassLoader cl = SecuritySupport.getContextClassLoader(); + if (cl != null) { + is = SecuritySupport.getResourceAsStream(cl, serviceId); + + // If no provider found then try the current ClassLoader + if (is == null) { + cl = FactoryFinder.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, serviceId); + } + } else { + // No Context ClassLoader, try the current + // ClassLoader + cl = FactoryFinder.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, serviceId); + } + + if (is == null) { + // No provider found + return null; + } + + if (debug) dPrint("found jar resource=" + serviceId + + " using ClassLoader: " + cl); + + // Read the service provider name in UTF-8 as specified in + // the jar spec. Unfortunately this fails in Microsoft + // VJ++, which does not implement the UTF-8 + // encoding. Theoretically, we should simply let it fail in + // that case, since the JVM is obviously broken if it + // doesn't support such a basic standard. But since there + // are still some users attempting to use VJ++ for + // development, we have dropped in a fallback which makes a + // second attempt using the platform's default encoding. In + // VJ++ this is apparently ASCII, which is a subset of + // UTF-8... and since the strings we'll be reading here are + // also primarily limited to the 7-bit ASCII range (at + // least, in English versions), this should work well + // enough to keep us on the air until we're ready to + // officially decommit from VJ++. [Edited comment from + // jkesselm] + BufferedReader rd; + try { + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); + } catch (java.io.UnsupportedEncodingException e) { + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); + } + + String factoryClassName = null; + try { + // XXX Does not handle all possible input as specified by the + // Jar Service Provider specification + factoryClassName = rd.readLine(); + } + catch (IOException x) { + // No provider found + return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} + } + + if (factoryClassName != null && + ! "".equals(factoryClassName)) { + if (debug) dPrint("found in resource, value=" + + factoryClassName); + + // Note: here we do not want to fall back to the current + // ClassLoader because we want to avoid the case where the + // resource file was found using one ClassLoader and the + // provider class was instantiated using a different one. + return newInstance(factoryClassName, cl, false); + } + + // No provider found + return null; + } + + static class ConfigurationError extends Error { + private Exception exception; + + /** + * Construct a new instance with the specified detail string and + * exception. + */ + ConfigurationError(String msg, Exception x) { + super(msg); + this.exception = x; + } + + Exception getException() { + return exception; + } + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FilePathToURI.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FilePathToURI.java new file mode 100644 index 000000000..0dd38b7f2 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/FilePathToURI.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.xml.parsers; + +class FilePathToURI { + + // which ASCII characters need to be escaped + private static boolean gNeedEscaping[] = new boolean[128]; + // the first hex character if a character needs to be escaped + private static char gAfterEscaping1[] = new char[128]; + // the second hex character if a character needs to be escaped + private static char gAfterEscaping2[] = new char[128]; + private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + // initialize the above 3 arrays + static { + for (int i = 0; i <= 0x1f; i++) { + gNeedEscaping[i] = true; + gAfterEscaping1[i] = gHexChs[i >> 4]; + gAfterEscaping2[i] = gHexChs[i & 0xf]; + } + gNeedEscaping[0x7f] = true; + gAfterEscaping1[0x7f] = '7'; + gAfterEscaping2[0x7f] = 'F'; + char[] escChs = {' ', '<', '>', '#', '%', '"', '{', '}', + '|', '\\', '^', '~', '[', ']', '`'}; + int len = escChs.length; + char ch; + for (int i = 0; i < len; i++) { + ch = escChs[i]; + gNeedEscaping[ch] = true; + gAfterEscaping1[ch] = gHexChs[ch >> 4]; + gAfterEscaping2[ch] = gHexChs[ch & 0xf]; + } + } + + // To escape a file path to a URI, by using %HH to represent + // special ASCII characters: 0x00~0x1F, 0x7F, ' ', '<', '>', '#', '%' + // and '"' and non-ASCII characters (whose value >= 128). + public static String filepath2URI(String path){ + // return null if path is null. + if (path == null) + return null; + + char separator = java.io.File.separatorChar; + path = path.replace(separator, '/'); + + int len = path.length(), ch; + StringBuffer buffer = new StringBuffer(len*3); + buffer.append("file://"); + // change C:/blah to /C:/blah + if (len >= 2 && path.charAt(1) == ':') { + ch = Character.toUpperCase(path.charAt(0)); + if (ch >= 'A' && ch <= 'Z') { + buffer.append('/'); + } + } + + // for each character in the path + int i = 0; + for (; i < len; i++) { + ch = path.charAt(i); + // if it's not an ASCII character, break here, and use UTF-8 encoding + if (ch >= 128) + break; + if (gNeedEscaping[ch]) { + buffer.append('%'); + buffer.append(gAfterEscaping1[ch]); + buffer.append(gAfterEscaping2[ch]); + // record the fact that it's escaped + } + else { + buffer.append((char)ch); + } + } + + // we saw some non-ascii character + if (i < len) { + // get UTF-8 bytes for the remaining sub-string + byte[] bytes = null; + byte b; + try { + bytes = path.substring(i).getBytes("UTF-8"); + } catch (java.io.UnsupportedEncodingException e) { + // should never happen + return path; + } + len = bytes.length; + + // for each byte + for (i = 0; i < len; i++) { + b = bytes[i]; + // for non-ascii character: make it positive, then escape + if (b < 0) { + ch = b + 256; + buffer.append('%'); + buffer.append(gHexChs[ch >> 4]); + buffer.append(gHexChs[ch & 0xf]); + } + else if (gNeedEscaping[b]) { + buffer.append('%'); + buffer.append(gAfterEscaping1[b]); + buffer.append(gAfterEscaping2[b]); + } + else { + buffer.append((char)b); + } + } + } + + return buffer.toString(); + } + +}//FilePathToURI diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/ParserConfigurationException.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/ParserConfigurationException.java new file mode 100644 index 000000000..4c08be258 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/ParserConfigurationException.java @@ -0,0 +1,53 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: ParserConfigurationException.java 569981 2007-08-27 03:59:07Z mrglavas $ + +package javax.xml.parsers; + +/** + * Indicates a serious configuration error. + * + * @author Jeff Suttor + * @version $Revision: 569981 $, $Date: 2007-08-26 23:59:07 -0400 (Sun, 26 Aug 2007) $ + */ + +public class ParserConfigurationException extends Exception { + + /** + * Create a newParserConfigurationException
with no
+ * detail message.
+ */
+
+ public ParserConfigurationException() {
+ super();
+ }
+
+ /**
+ * Create a new ParserConfigurationException
with
+ * the String
specified as an error message.
+ *
+ * @param msg The error message for the exception.
+ */
+
+ public ParserConfigurationException(String msg) {
+ super(msg);
+ }
+
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SAXParser.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SAXParser.java
new file mode 100644
index 000000000..8b336dc72
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SAXParser.java
@@ -0,0 +1,526 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: SAXParser.java 584483 2007-10-14 02:54:48Z mrglavas $
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.validation.Schema;
+
+import org.xml.sax.HandlerBase;
+import org.xml.sax.InputSource;
+import org.xml.sax.Parser;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+
+/**
+ * Defines the API that wraps an {@link org.xml.sax.XMLReader}
+ * implementation class. In JAXP 1.0, this class wrapped the
+ * {@link org.xml.sax.Parser} interface, however this interface was
+ * replaced by the {@link org.xml.sax.XMLReader}. For ease
+ * of transition, this class continues to support the same name
+ * and interface as well as supporting new methods.
+ *
+ * An instance of this class can be obtained from the
+ * {@link javax.xml.parsers.SAXParserFactory#newSAXParser()} method.
+ * Once an instance of this class is obtained, XML can be parsed from
+ * a variety of input sources. These input sources are InputStreams,
+ * Files, URLs, and SAX InputSources.+ * + * This static method creates a new factory instance based + * on a system property setting or uses the platform default + * if no property has been defined.
+ *
+ * The system property that controls which Factory implementation
+ * to create is named "javax.xml.parsers.SAXParserFactory"
.
+ * This property names a class that is a concrete subclass of this
+ * abstract class. If no property is defined, a platform default
+ * will be used.
+ * + * Implementors of this class which wrap an underlaying implementation + * can consider using the {@link org.xml.sax.helpers.ParserAdapter} + * class to initially adapt their SAX1 implementation to work under + * this revised class. + * + * @author Jeff Suttor + * @version $Revision: 584483 $, $Date: 2007-10-13 22:54:48 -0400 (Sat, 13 Oct 2007) $ + */ +public abstract class SAXParser { + + private static final boolean DEBUG = false; + + /** + *
Protected constructor to prevent instantiation. + * Use {@link javax.xml.parsers.SAXParserFactory#newSAXParser()}.
+ */ + protected SAXParser () { + + } + + /** + *Reset this SAXParser
to its original configuration.
SAXParser
is reset to the same state as when it was created with
+ * {@link 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 {@link Schema}
+ * Object
, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal
+ * Schema
.
Parse the content of the given {@link java.io.InputStream} + * instance as XML using the specified {@link org.xml.sax.HandlerBase}. + * Use of the DefaultHandler version of this method is recommended as + * the HandlerBase class has been deprecated in SAX 2.0.
+ * + * @param is InputStream containing the content to be parsed. + * @param hb The SAX HandlerBase to use. + * + * @throws IllegalArgumentException If the given InputStream is null. + * @throws SAXException If parse produces a SAX error. + * @throws IOException If an IO error occurs interacting with the + *InputStream
.
+ *
+ * @see org.xml.sax.DocumentHandler
+ */
+ public void parse(InputStream is, HandlerBase hb)
+ throws SAXException, IOException {
+ if (is == null) {
+ throw new IllegalArgumentException("InputStream cannot be null");
+ }
+
+ InputSource input = new InputSource(is);
+ this.parse(input, hb);
+ }
+
+ /**
+ * Parse the content of the given {@link java.io.InputStream} + * instance as XML using the specified {@link org.xml.sax.HandlerBase}. + * Use of the DefaultHandler version of this method is recommended as + * the HandlerBase class has been deprecated in SAX 2.0.
+ * + * @param is InputStream containing the content to be parsed. + * @param hb The SAX HandlerBase to use. + * @param systemId The systemId which is needed for resolving relative URIs. + * + * @throws IllegalArgumentException If the givenInputStream
is
+ * null
.
+ * @throws IOException If any IO error occurs interacting with the
+ * InputStream
.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler version of this method instead.
+ */
+ public void parse(
+ InputStream is,
+ HandlerBase hb,
+ String systemId)
+ throws SAXException, IOException {
+ if (is == null) {
+ throw new IllegalArgumentException("InputStream cannot be null");
+ }
+
+ InputSource input = new InputSource(is);
+ input.setSystemId(systemId);
+ this.parse(input, hb);
+ }
+
+ /**
+ * Parse the content of the given {@link java.io.InputStream}
+ * instance as XML using the specified
+ * {@link org.xml.sax.helpers.DefaultHandler}.
+ *
+ * @param is InputStream containing the content to be parsed.
+ * @param dh The SAX DefaultHandler to use.
+ *
+ * @throws IllegalArgumentException If the given InputStream is null.
+ * @throws IOException If any IO errors occur.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler
+ */
+ public void parse(InputStream is, DefaultHandler dh)
+ throws SAXException, IOException {
+ if (is == null) {
+ throw new IllegalArgumentException("InputStream cannot be null");
+ }
+
+ InputSource input = new InputSource(is);
+ this.parse(input, dh);
+ }
+
+ /**
+ * Parse the content of the given {@link java.io.InputStream}
+ * instance as XML using the specified
+ * {@link org.xml.sax.helpers.DefaultHandler}.
+ *
+ * @param is InputStream containing the content to be parsed.
+ * @param dh The SAX DefaultHandler to use.
+ * @param systemId The systemId which is needed for resolving relative URIs.
+ *
+ * @throws IllegalArgumentException If the given InputStream is null.
+ * @throws IOException If any IO errors occur.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler version of this method instead.
+ */
+ public void parse(
+ InputStream is,
+ DefaultHandler dh,
+ String systemId)
+ throws SAXException, IOException {
+ if (is == null) {
+ throw new IllegalArgumentException("InputStream cannot be null");
+ }
+
+ InputSource input = new InputSource(is);
+ input.setSystemId(systemId);
+ this.parse(input, dh);
+ }
+
+ /**
+ * Parse the content described by the giving Uniform Resource
+ * Identifier (URI) as XML using the specified
+ * {@link org.xml.sax.HandlerBase}.
+ * Use of the DefaultHandler version of this method is recommended as
+ * the HandlerBase
class has been deprecated in SAX 2.0
+ *
+ * @param uri The location of the content to be parsed.
+ * @param hb The SAX HandlerBase to use.
+ *
+ * @throws IllegalArgumentException If the uri is null.
+ * @throws IOException If any IO errors occur.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler
+ */
+ public void parse(String uri, HandlerBase hb)
+ throws SAXException, IOException {
+ if (uri == null) {
+ throw new IllegalArgumentException("uri cannot be null");
+ }
+
+ InputSource input = new InputSource(uri);
+ this.parse(input, hb);
+ }
+
+ /**
+ * Parse the content described by the giving Uniform Resource
+ * Identifier (URI) as XML using the specified
+ * {@link org.xml.sax.helpers.DefaultHandler}.
+ *
+ * @param uri The location of the content to be parsed.
+ * @param dh The SAX DefaultHandler to use.
+ *
+ * @throws IllegalArgumentException If the uri is null.
+ * @throws IOException If any IO errors occur.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler
+ */
+ public void parse(String uri, DefaultHandler dh)
+ throws SAXException, IOException {
+ if (uri == null) {
+ throw new IllegalArgumentException("uri cannot be null");
+ }
+
+ InputSource input = new InputSource(uri);
+ this.parse(input, dh);
+ }
+
+ /**
+ * Parse the content of the file specified as XML using the
+ * specified {@link org.xml.sax.HandlerBase}.
+ * Use of the DefaultHandler version of this method is recommended as
+ * the HandlerBase class has been deprecated in SAX 2.0
+ *
+ * @param f The file containing the XML to parse
+ * @param hb The SAX HandlerBase to use.
+ *
+ * @throws IllegalArgumentException If the File object is null.
+ * @throws IOException If any IO errors occur.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler
+ */
+ public void parse(File f, HandlerBase hb)
+ throws SAXException, IOException {
+ if (f == null) {
+ throw new IllegalArgumentException("File cannot be null");
+ }
+
+ String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath());
+
+ if (DEBUG) {
+ System.out.println("Escaped URI = " + escapedURI);
+ }
+
+ InputSource input = new InputSource(escapedURI);
+ this.parse(input, hb);
+ }
+
+ /**
+ * Parse the content of the file specified as XML using the
+ * specified {@link org.xml.sax.helpers.DefaultHandler}.
+ *
+ * @param f The file containing the XML to parse
+ * @param dh The SAX DefaultHandler to use.
+ *
+ * @throws IllegalArgumentException If the File object is null.
+ * @throws IOException If any IO errors occur.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler
+ */
+ public void parse(File f, DefaultHandler dh)
+ throws SAXException, IOException {
+ if (f == null) {
+ throw new IllegalArgumentException("File cannot be null");
+ }
+
+ String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath());
+
+ if (DEBUG) {
+ System.out.println("Escaped URI = " + escapedURI);
+ }
+
+ InputSource input = new InputSource(escapedURI);
+ this.parse(input, dh);
+ }
+
+ /**
+ * Parse the content given {@link org.xml.sax.InputSource}
+ * as XML using the specified
+ * {@link org.xml.sax.HandlerBase}.
+ * Use of the DefaultHandler version of this method is recommended as
+ * the HandlerBase class has been deprecated in SAX 2.0
+ *
+ * @param is The InputSource containing the content to be parsed.
+ * @param hb The SAX HandlerBase to use.
+ *
+ * @throws IllegalArgumentException If the InputSource
object
+ * is null
.
+ * @throws IOException If any IO errors occur.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler
+ */
+ public void parse(InputSource is, HandlerBase hb)
+ throws SAXException, IOException {
+ if (is == null) {
+ throw new IllegalArgumentException("InputSource cannot be null");
+ }
+
+ Parser parser = this.getParser();
+ if (hb != null) {
+ parser.setDocumentHandler(hb);
+ parser.setEntityResolver(hb);
+ parser.setErrorHandler(hb);
+ parser.setDTDHandler(hb);
+ }
+ parser.parse(is);
+ }
+
+ /**
+ * Parse the content given {@link org.xml.sax.InputSource}
+ * as XML using the specified
+ * {@link org.xml.sax.helpers.DefaultHandler}.
+ *
+ * @param is The InputSource containing the content to be parsed.
+ * @param dh The SAX DefaultHandler to use.
+ *
+ * @throws IllegalArgumentException If the InputSource
object
+ * is null
.
+ * @throws IOException If any IO errors occur.
+ * @throws SAXException If any SAX errors occur during processing.
+ *
+ * @see org.xml.sax.DocumentHandler
+ */
+ public void parse(InputSource is, DefaultHandler dh)
+ throws SAXException, IOException {
+ if (is == null) {
+ throw new IllegalArgumentException("InputSource cannot be null");
+ }
+
+ XMLReader reader = this.getXMLReader();
+ if (dh != null) {
+ reader.setContentHandler(dh);
+ reader.setEntityResolver(dh);
+ reader.setErrorHandler(dh);
+ reader.setDTDHandler(dh);
+ }
+ reader.parse(is);
+ }
+
+ /**
+ * Returns the SAX parser that is encapsulated by the
+ * implementation of this class.
+ *
+ * @return The SAX parser that is encapsulated by the
+ * implementation of this class.
+ *
+ * @throws SAXException If any SAX errors occur during processing.
+ */
+ public abstract org.xml.sax.Parser getParser() throws SAXException;
+
+ /**
+ * Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the
+ * implementation of this class.
+ *
+ * @return The XMLReader that is encapsulated by the
+ * implementation of this class.
+ *
+ * @throws SAXException If any SAX errors occur during processing.
+ */
+
+ public abstract org.xml.sax.XMLReader getXMLReader() throws SAXException;
+
+ /**
+ * Indicates whether or not this parser is configured to
+ * understand namespaces.
+ *
+ * @return true if this parser is configured to
+ * understand namespaces; false otherwise.
+ */
+
+ public abstract boolean isNamespaceAware();
+
+ /**
+ * Indicates whether or not this parser is configured to
+ * validate XML documents.
+ *
+ * @return true if this parser is configured to
+ * validate XML documents; false otherwise.
+ */
+
+ public abstract boolean isValidating();
+
+ /**
+ * Sets the particular property in the underlying implementation of + * {@link org.xml.sax.XMLReader}. + * A list of the core features and properties can be found at + * + * http://sax.sourceforge.net/?selected=get-set.
+ * + * @param name The name of the property to be set. + * @param value The value of the property to be set. + * + * @throws SAXNotRecognizedException When the underlying XMLReader does + * not recognize the property name. + * @throws SAXNotSupportedException When the underlying XMLReader + * recognizes the property name but doesn't support the property. + * + * @see org.xml.sax.XMLReader#setProperty + */ + public abstract void setProperty(String name, Object value) + throws SAXNotRecognizedException, SAXNotSupportedException; + + /** + *Returns the particular property requested for in the underlying + * implementation of {@link org.xml.sax.XMLReader}.
+ * + * @param name The name of the property to be retrieved. + * @return Value of the requested property. + * + * @throws SAXNotRecognizedException When the underlying XMLReader does + * not recognize the property name. + * @throws SAXNotSupportedException When the underlying XMLReader + * recognizes the property name but doesn't support the property. + * + * @see org.xml.sax.XMLReader#getProperty + */ + public abstract Object getProperty(String name) + throws SAXNotRecognizedException, SAXNotSupportedException; + + /**Get a reference to the the {@link Schema} being used by + * the XML processor.
+ * + *If no schema is being used, null
is returned.
null
+ * if none in use
+ *
+ * @throws UnsupportedOperationException
+ * For backward compatibility, when implementations for
+ * earlier versions of JAXP is used, this exception will be
+ * thrown.
+ *
+ * @since 1.5
+ */
+ public Schema getSchema() {
+ throw new UnsupportedOperationException(
+ "This parser does not support specification \""
+ + this.getClass().getPackage().getSpecificationTitle()
+ + "\" version \""
+ + this.getClass().getPackage().getSpecificationVersion()
+ + "\""
+ );
+ }
+
+ /**
+ * Get the XInclude processing mode for this parser.
+ * + * @return + * the return value of + * the {@link SAXParserFactory#isXIncludeAware()} + * when this parser was created from factory. + * + * @throws UnsupportedOperationException + * For backward compatibility, when implementations for + * earlier versions of JAXP is used, this exception will be + * thrown. + * + * @since 1.5 + * + * @see SAXParserFactory#setXIncludeAware(boolean) + */ + public boolean isXIncludeAware() { + throw new UnsupportedOperationException( + "This parser does not support specification \"" + + this.getClass().getPackage().getSpecificationTitle() + + "\" version \"" + + this.getClass().getPackage().getSpecificationVersion() + + "\"" + ); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SAXParserFactory.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SAXParserFactory.java new file mode 100644 index 000000000..edadcdebb --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SAXParserFactory.java @@ -0,0 +1,428 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: SAXParserFactory.java 884950 2009-11-27 18:46:18Z mrglavas $ + +package javax.xml.parsers; + +import javax.xml.validation.Schema; + +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; + +/** + * Defines a factory API that enables applications to configure and + * obtain a SAX based parser to parse XML documents. + * + * @author Jeff Suttor + * @version $Revision: 884950 $, $Date: 2009-11-27 13:46:18 -0500 (Fri, 27 Nov 2009) $ + */ +public abstract class SAXParserFactory { + + /** + *Should Parsers be validating?
+ */ + private boolean validating = false; + + /** + *Should Parsers be namespace aware?
+ */ + private boolean namespaceAware = false; + + /** + *Protected constructor to force use of {@link #newInstance()}.
+ */ + protected SAXParserFactory () { + + } + + /** + * Obtain a new instance of aSAXParserFactory
. This
+ * static method creates a new factory instance
+ * This method uses the following ordered lookup procedure to determine
+ * the SAXParserFactory
implementation class to
+ * load:
+ * javax.xml.parsers.SAXParserFactory
system
+ * property.
+ * java.util.Properties
+ *
format and contains the fully qualified name of the
+ * implementation class with the key being the system property defined
+ * above.
+ *
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and it's values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
+ * META-INF/services/javax.xml.parsers.SAXParserFactory
+ * in jars available to the runtime.
+ * SAXParserFactory
instance.
+ * SAXParserFactory
it can use the factory to
+ * configure and obtain parser instances.
+ *
+ *
+ *
+ * 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 loading {@link SAXParser}s, try:
+ *+ * java -Djaxp.debug=1 YourProgram .... + *+ * + * + * @return A new instance of a SAXParserFactory. + * + * @exception FactoryConfigurationError if the implementation is + * not available or cannot be instantiated. + */ + + public static SAXParserFactory newInstance() { + try { + return (SAXParserFactory) FactoryFinder.find( + /* The default property name according to the JAXP spec */ + "javax.xml.parsers.SAXParserFactory", + /* The fallback implementation class name */ + "org.apache.xerces.jaxp.SAXParserFactoryImpl"); + } + catch (FactoryFinder.ConfigurationError e) { + throw new FactoryConfigurationError(e.getException(), e.getMessage()); + } + } + + /** + * @return A new instance of a SAXParserFactory. + * + * @exception FactoryConfigurationError if the implementation is + * not available or cannot be instantiated. + */ + public static SAXParserFactory newInstance(String factoryClassName, + ClassLoader classLoader) { + if (factoryClassName == null) { + throw new FactoryConfigurationError("factoryClassName cannot be null."); + } + if (classLoader == null) { + classLoader = SecuritySupport.getContextClassLoader(); + } + try { + return (SAXParserFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); + } + catch (FactoryFinder.ConfigurationError e) { + throw new FactoryConfigurationError(e.getException(), e.getMessage()); + } + } + + /** + *
Creates a new instance of a SAXParser using the currently + * configured factory parameters.
+ * + * @return A new instance of a SAXParser. + * + * @exception ParserConfigurationException if a parser cannot + * be created which satisfies the requested configuration. + * @exception SAXException for SAX errors. + */ + + public abstract SAXParser newSAXParser() + throws ParserConfigurationException, SAXException; + + + /** + * Specifies that the parser produced by this code will + * provide support for XML namespaces. By default the value of this is set + * tofalse
.
+ *
+ * @param awareness true if the parser produced by this code will
+ * provide support for XML namespaces; false otherwise.
+ */
+
+ public void setNamespaceAware(boolean awareness) {
+ this.namespaceAware = awareness;
+ }
+
+ /**
+ * 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 {@link #setValidating(boolean)} + * method false, then use the {@link #setSchema(Schema)} + * method to associate a schema to a parser. + *
+ * + * @param validating true if the parser produced by this code will + * validate documents as they are parsed; false otherwise. + */ + + public void setValidating(boolean validating) { + this.validating = validating; + } + + /** + * Indicates whether or not the factory is configured to produce + * parsers which are namespace aware. + * + * @return true if the factory is configured to produce + * parsers which are namespace aware; false otherwise. + */ + + public boolean isNamespaceAware() { + return namespaceAware; + } + + /** + * Indicates whether or not the factory is configured to produce + * parsers which validate the XML content during parse. + * + * @return true if the factory is configured to produce parsers which validate + * the XML content during parse; false otherwise. + */ + + public boolean isValidating() { + return validating; + } + + /** + * + *Sets the particular feature in the underlying implementation of + * org.xml.sax.XMLReader. + * A list of the core features and properties can be found at + * http://www.saxproject.org/
+ * + *All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is
+ *true
: the implementation will limit XML processing to conform to implementation limits.
+ * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
+ * If XML processing is limited for security reasons, it will be reported via a call to the registered
+ * {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}.
+ * See {@link SAXParser} parse
methods for handler specification.
+ * false
, the implementation will processing XML according to the XML specifications without
+ * regard to possible implementation limits.
+ * name
parameter is null.
+ *
+ * @see org.xml.sax.XMLReader#setFeature
+ */
+ public abstract void setFeature(String name, boolean value)
+ throws ParserConfigurationException, SAXNotRecognizedException,
+ SAXNotSupportedException;
+
+ /**
+ *
+ * Returns the particular property requested for in the underlying + * implementation of org.xml.sax.XMLReader.
+ * + * @param name The name of the property to be retrieved. + * + * @return Value of the requested property. + * + * @exception ParserConfigurationException if a parser cannot be created which satisfies the requested configuration. + * @exception SAXNotRecognizedException When the underlying XMLReader does not recognize the property name. + * @exception SAXNotSupportedException When the underlying XMLReader recognizes the property name but doesn't support the property. + * + * @see org.xml.sax.XMLReader#getProperty + */ + public abstract boolean getFeature(String name) + throws ParserConfigurationException, SAXNotRecognizedException, + SAXNotSupportedException; + + /** + * Gets the {@link Schema} object specified through + * the {@link #setSchema(Schema schema)} method. + * + * + * @throws UnsupportedOperationException + * For backward compatibility, when implementations for + * earlier versions of JAXP is used, this exception will be + * thrown. + * + * @return + * the {@link Schema} object that was last set through + * the {@link #setSchema(Schema)} method, or null + * if the method was not invoked since a {@link SAXParserFactory} + * is created. + * + * @since 1.5 + */ + public Schema getSchema() { + throw new UnsupportedOperationException( + "This parser does not support specification \"" + + this.getClass().getPackage().getSpecificationTitle() + + "\" version \"" + + this.getClass().getPackage().getSpecificationVersion() + + "\"" + ); + } + + /** + *Set the {@link Schema} to be used by parsers created + * from this factory.
+ * + *When a {@link 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 {@link org.xml.sax.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.
+ * + *Initially, null
is set as the {@link Schema}.
This processing will take effect even if
+ * the {@link #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 {@link Schema} object.
+ * Such configuration will cause a {@link SAXException}
+ * exception when those properties are set on a {@link SAXParser}.
+ * A parser must be able to work with any {@link 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. + *
+ * + * @param schemaSchema
to use, null
to remove a schema.
+ *
+ * @throws UnsupportedOperationException
+ * For backward compatibility, when implementations for
+ * earlier versions of JAXP is used, this exception will be
+ * thrown.
+ *
+ * @since 1.5
+ */
+ public void setSchema(Schema schema) {
+ throw new UnsupportedOperationException(
+ "This parser does not support specification \""
+ + this.getClass().getPackage().getSpecificationTitle()
+ + "\" version \""
+ + this.getClass().getPackage().getSpecificationVersion()
+ + "\""
+ );
+ }
+
+ /**
+ * 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
.
true
or
+ * false
+ *
+ * @throws UnsupportedOperationException
+ * For backward compatibility, when implementations for
+ * earlier versions of JAXP is used, this exception will be
+ * thrown.
+ *
+ * @since 1.5
+ */
+ public void setXIncludeAware(final boolean state) {
+ throw new UnsupportedOperationException(
+ "This parser does not support specification \""
+ + this.getClass().getPackage().getSpecificationTitle()
+ + "\" version \""
+ + this.getClass().getPackage().getSpecificationVersion()
+ + "\""
+ );
+ }
+
+ /**
+ * Get state of XInclude processing.
+ * + * @return current state of XInclude processing + * + * @throws UnsupportedOperationException + * For backward compatibility, when implementations for + * earlier versions of JAXP is used, this exception will be + * thrown. + * + * @since 1.5 + */ + public boolean isXIncludeAware() { + throw new UnsupportedOperationException( + "This parser does not support specification \"" + + this.getClass().getPackage().getSpecificationTitle() + + "\" version \"" + + this.getClass().getPackage().getSpecificationVersion() + + "\"" + ); + } +} + diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SecuritySupport.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SecuritySupport.java new file mode 100644 index 000000000..bd655a8c0 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/SecuritySupport.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: SecuritySupport.java 670282 2008-06-22 01:00:42Z mrglavas $ + +package javax.xml.parsers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + +/** + * This class is duplicated for each JAXP subpackage so keep it in sync. + * It is package private and therefore is not exposed as part of the JAXP + * API. + * + * Security related methods that only work on J2SE 1.2 and newer. + */ +final class SecuritySupport { + + private SecuritySupport() {} + + static ClassLoader getContextClassLoader() { + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); + } + + static String getSystemProperty(final String propName) { + return (String) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(propName); + } + }); + } + + static FileInputStream getFileInputStream(final File file) + throws FileNotFoundException + { + try { + return (FileInputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws FileNotFoundException { + return new FileInputStream(file); + } + }); + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } + } + + static InputStream getResourceAsStream(final ClassLoader cl, + final String name) + { + return (InputStream) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + InputStream ris; + if (cl == null) { + ris = ClassLoader.getSystemResourceAsStream(name); + } else { + ris = cl.getResourceAsStream(name); + } + return ris; + } + }); + } + + static boolean doesFileExist(final File f) { + return ((Boolean) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return f.exists() ? Boolean.TRUE : Boolean.FALSE; + } + })).booleanValue(); + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/package.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/package.html new file mode 100644 index 000000000..92e09d50c --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/parsers/package.html @@ -0,0 +1,17 @@ + + + + + +Provides classes allowing the processing of XML documents. Two types +of plugable parsers are supported: +Debug flag to trace loading process.
+ */ + private static boolean debug = false; + + /** + *Cache properties for performance.
+ */ + private static Properties cacheProps = new Properties(); + + /** + *First time requires initialization overhead.
+ */ + private static boolean firstTime = true; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + + // Define system property "jaxp.debug" to get output + static { + // Use try/catch block to support applets, which throws + // SecurityException out of this code. + try { + String val = SecuritySupport.getSystemProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && (! "false".equals(val)); + } catch (SecurityException se) { + debug = false; + } + } + + private FactoryFinder() {} + + private static void dPrint(String msg) { + if (debug) { + System.err.println("JAXP: " + msg); + } + } + + /** + * Create an instance of a class using the specified ClassLoader and + * optionally fall back to the current ClassLoader if not found. + * + * @param className Name of the concrete class corresponding to the + * service provider + * + * @param cl ClassLoader to use to load the class, null means to use + * the bootstrap ClassLoader + * + * @param doFallback true if the current ClassLoader should be tried as + * a fallback if the class is not found using cl + */ + private static Object newInstance(String className, ClassLoader cl, + boolean doFallback) + throws ConfigurationError + { + // assert(className != null); + + try { + Class providerClass; + if (cl == null) { + // If classloader is null Use the bootstrap ClassLoader. + // Thus Class.forName(String) will use the current + // ClassLoader which will be the bootstrap ClassLoader. + providerClass = Class.forName(className); + } else { + try { + providerClass = cl.loadClass(className); + } catch (ClassNotFoundException x) { + if (doFallback) { + // Fall back to current classloader + cl = FactoryFinder.class.getClassLoader(); + if (cl != null) { + providerClass = cl.loadClass(className); + } + else { + providerClass = Class.forName(className); + } + } else { + throw x; + } + } + } + + Object instance = providerClass.newInstance(); + if (debug) dPrint("created new instance of " + providerClass + + " using ClassLoader: " + cl); + return instance; + } catch (ClassNotFoundException x) { + throw new ConfigurationError( + "Provider " + className + " not found", x); + } catch (Exception x) { + throw new ConfigurationError( + "Provider " + className + " could not be instantiated: " + x, + x); + } + } + + /** + * Finds the implementation Class object in the specified order. Main + * entry point. + * @return Class object of factory, never null + * + * @param factoryId Name of the factory to find, same as + * a property name + * @param fallbackClassName Implementation class name, if nothing else + * is found. Use null to mean no fallback. + * + * Package private so this code can be shared. + */ + static Object find(String factoryId, String fallbackClassName) + throws ConfigurationError { + // Figure out which ClassLoader to use for loading the provider + // class. If there is a Context ClassLoader then use it. + ClassLoader classLoader = SecuritySupport.getContextClassLoader(); + if (classLoader == null) { + // if we have no Context ClassLoader + // so use the current ClassLoader + classLoader = FactoryFinder.class.getClassLoader(); + } + return find(factoryId, classLoader, fallbackClassName); + } + + /** + * Finds the implementation Class object in the specified order. Main + * entry point. + * @return Class object of factory, never null + * + * @param factoryId Name of the factory to find, same as + * a property name + * @param classLoader The ClassLoader to use + * @param fallbackClassName Implementation class name, if nothing else + * is found. Use null to mean no fallback. + * + * Package private so this code can be shared. + */ + static Object find(String factoryId, ClassLoader classLoader, String fallbackClassName) + throws ConfigurationError { + + if (debug) dPrint("find factoryId =" + factoryId); + + // Use the system property first + try { + String systemProp = SecuritySupport.getSystemProperty(factoryId); + if (systemProp != null && systemProp.length() > 0) { + if (debug) dPrint("found system property, value=" + systemProp); + return newInstance(systemProp, classLoader, true); + } + } catch (SecurityException se) { + //if first option fails due to any reason we should try next option in the + //look up algorithm. + } + + // try to read from $java.home/lib/stax.properties + try { + String javah = SecuritySupport.getSystemProperty("java.home"); + String configFile = javah + File.separator + + "lib" + File.separator + "stax.properties"; + String factoryClassName = null; + if(firstTime){ + synchronized(cacheProps){ + if(firstTime){ + File f=new File( configFile ); + firstTime = false; + if(SecuritySupport.doesFileExist(f)){ + if (debug) dPrint("Read properties file "+f); + //cacheProps.load( new FileInputStream(f)); + cacheProps.load(SecuritySupport.getFileInputStream(f)); + } + } + } + } + factoryClassName = cacheProps.getProperty(factoryId); + + if(factoryClassName != null){ + if (debug) dPrint("found in $java.home/stax.properties, value=" + factoryClassName); + return newInstance(factoryClassName, classLoader, true); + } + } catch(Exception ex ) { + if( debug ) ex.printStackTrace(); + } + + // Try Jar Service Provider Mechanism + Object provider = findJarServiceProvider(factoryId); + if (provider != null) { + return provider; + } + if (fallbackClassName == null) { + throw new ConfigurationError( + "Provider for " + factoryId + " cannot be found", null); + } + + if (debug) dPrint("loaded from fallback value: " + fallbackClassName); + return newInstance(fallbackClassName, classLoader, true); + } + + /* + * Try to find provider using Jar Service Provider Mechanism + * + * @return instance of provider class if found or null + */ + private static Object findJarServiceProvider(String factoryId) + throws ConfigurationError + { + + String serviceId = "META-INF/services/" + factoryId; + InputStream is = null; + + // First try the Context ClassLoader + ClassLoader cl = SecuritySupport.getContextClassLoader(); + if (cl != null) { + is = SecuritySupport.getResourceAsStream(cl, serviceId); + + // If no provider found then try the current ClassLoader + if (is == null) { + cl = FactoryFinder.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, serviceId); + } + } else { + // No Context ClassLoader, try the current + // ClassLoader + cl = FactoryFinder.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, serviceId); + } + + if (is == null) { + // No provider found + return null; + } + + if (debug) dPrint("found jar resource=" + serviceId + + " using ClassLoader: " + cl); + + // Read the service provider name in UTF-8 as specified in + // the jar spec. Unfortunately this fails in Microsoft + // VJ++, which does not implement the UTF-8 + // encoding. Theoretically, we should simply let it fail in + // that case, since the JVM is obviously broken if it + // doesn't support such a basic standard. But since there + // are still some users attempting to use VJ++ for + // development, we have dropped in a fallback which makes a + // second attempt using the platform's default encoding. In + // VJ++ this is apparently ASCII, which is a subset of + // UTF-8... and since the strings we'll be reading here are + // also primarily limited to the 7-bit ASCII range (at + // least, in English versions), this should work well + // enough to keep us on the air until we're ready to + // officially decommit from VJ++. [Edited comment from + // jkesselm] + BufferedReader rd; + try { + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); + } catch (java.io.UnsupportedEncodingException e) { + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); + } + + String factoryClassName = null; + try { + // XXX Does not handle all possible input as specified by the + // Jar Service Provider specification + factoryClassName = rd.readLine(); + } + catch (IOException x) { + // No provider found + return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} + } + + if (factoryClassName != null && + ! "".equals(factoryClassName)) { + if (debug) dPrint("found in resource, value=" + + factoryClassName); + + // Note: here we do not want to fall back to the current + // ClassLoader because we want to avoid the case where the + // resource file was found using one ClassLoader and the + // provider class was instantiated using a different one. + return newInstance(factoryClassName, cl, false); + } + + // No provider found + return null; + } + + static class ConfigurationError extends Error { + private static final long serialVersionUID = 1L; + private Exception exception; + + /** + * Construct a new instance with the specified detail string and + * exception. + */ + ConfigurationError(String msg, Exception x) { + super(msg); + this.exception = x; + } + + Exception getException() { + return exception; + } + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/Location.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/Location.java new file mode 100644 index 000000000..7bcc09fd6 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/Location.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Location.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream; + +public interface Location { + public int getCharacterOffset(); + + public int getColumnNumber(); + + public int getLineNumber(); + + public String getPublicId(); + + public String getSystemId(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/SecuritySupport.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/SecuritySupport.java new file mode 100644 index 000000000..bd151ac5c --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/SecuritySupport.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: SecuritySupport.java 670281 2008-06-22 00:55:09Z mrglavas $ + +package javax.xml.stream; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + +/** + * This class is duplicated for each JAXP subpackage so keep it in sync. + * It is package private and therefore is not exposed as part of the JAXP + * API. + * + * Security related methods that only work on J2SE 1.2 and newer. + */ +final class SecuritySupport { + + private SecuritySupport() {} + + static ClassLoader getContextClassLoader() { + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); + } + + static String getSystemProperty(final String propName) { + return (String) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(propName); + } + }); + } + + static FileInputStream getFileInputStream(final File file) + throws FileNotFoundException + { + try { + return (FileInputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws FileNotFoundException { + return new FileInputStream(file); + } + }); + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } + } + + static InputStream getResourceAsStream(final ClassLoader cl, + final String name) + { + return (InputStream) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + InputStream ris; + if (cl == null) { + ris = ClassLoader.getSystemResourceAsStream(name); + } else { + ris = cl.getResourceAsStream(name); + } + return ris; + } + }); + } + + static boolean doesFileExist(final File f) { + return ((Boolean) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return f.exists() ? Boolean.TRUE : Boolean.FALSE; + } + })).booleanValue(); + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/StreamFilter.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/StreamFilter.java new file mode 100644 index 000000000..6c3d8d359 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/StreamFilter.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: StreamFilter.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream; + +public interface StreamFilter { + public boolean accept(XMLStreamReader reader); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventFactory.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventFactory.java new file mode 100644 index 000000000..82fe867ac --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventFactory.java @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLEventFactory.java 730320 2008-12-31 06:20:06Z mrglavas $ + +package javax.xml.stream; + +import java.util.Iterator; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.stream.events.ProcessingInstruction; +import javax.xml.namespace.QName; +import javax.xml.stream.events.Characters; +import javax.xml.stream.events.Comment; +import javax.xml.stream.events.DTD; +import javax.xml.stream.events.EndElement; +import javax.xml.stream.events.EntityDeclaration; +import javax.xml.stream.events.Namespace; +import javax.xml.stream.events.Attribute; +import javax.xml.stream.events.EndDocument; +import javax.xml.stream.events.EntityReference; +import javax.xml.stream.events.StartDocument; +import javax.xml.stream.events.StartElement; + +public abstract class XMLEventFactory { + + private static final String PROPERTY_NAME = "javax.xml.stream.XMLEventFactory"; + private static final String DEFAULT_FACTORY = "org.apache.xerces.stax.XMLEventFactoryImpl"; + + protected XMLEventFactory() {} + + public static XMLEventFactory newInstance() + throws FactoryConfigurationError { + try { + return (XMLEventFactory) FactoryFinder.find(PROPERTY_NAME, DEFAULT_FACTORY); + } + catch (FactoryFinder.ConfigurationError e) { + throw new FactoryConfigurationError(e.getException(), e.getMessage()); + } + } + + public static XMLEventFactory newInstance(String factoryId, + ClassLoader classLoader) throws FactoryConfigurationError { + if (classLoader == null) { + classLoader = SecuritySupport.getContextClassLoader(); + } + try { + return (XMLEventFactory) FactoryFinder.find(factoryId, classLoader, DEFAULT_FACTORY); + } + catch (FactoryFinder.ConfigurationError e) { + throw new FactoryConfigurationError(e.getException(), e.getMessage()); + } + } + + public abstract void setLocation(Location location); + + public abstract Attribute createAttribute(QName name, String value); + + public abstract Attribute createAttribute(String localName, String value); + + public abstract Attribute createAttribute(String prefix, + String namespaceURI, String localName, String value); + + public abstract Namespace createNamespace(String namespaceUri); + + public abstract Namespace createNamespace(String prefix, String namespaceUri); + + public abstract StartElement createStartElement(QName name, + Iterator attributes, Iterator namespaces); + + public abstract StartElement createStartElement(String prefix, + String namespaceUri, String localName); + + public abstract StartElement createStartElement(String prefix, + String namespaceUri, String localName, Iterator attributes, + Iterator namespaces); + + public abstract StartElement createStartElement(String prefix, + String namespaceUri, String localName, Iterator attributes, + Iterator namespaces, NamespaceContext context); + + public abstract EndElement createEndElement(QName name, Iterator namespaces); + + public abstract EndElement createEndElement(String prefix, + String namespaceUri, String localName); + + public abstract EndElement createEndElement(String prefix, + String namespaceUri, String localName, Iterator namespaces); + + public abstract Characters createCharacters(String content); + + public abstract Characters createCData(String content); + + public abstract Characters createSpace(String content); + + public abstract Characters createIgnorableSpace(String content); + + public abstract StartDocument createStartDocument(); + + public abstract StartDocument createStartDocument(String encoding); + + public abstract StartDocument createStartDocument(String encoding, + String version); + + public abstract StartDocument createStartDocument(String encoding, + String version, boolean standalone); + + public abstract EndDocument createEndDocument(); + + public abstract EntityReference createEntityReference(String name, + EntityDeclaration declaration); + + public abstract Comment createComment(String text); + + public abstract ProcessingInstruction createProcessingInstruction( + String target, String data); + + public abstract DTD createDTD(String dtd); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventReader.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventReader.java new file mode 100644 index 000000000..87b433d1a --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventReader.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLEventReader.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream; + +import java.util.Iterator; + +import javax.xml.stream.events.XMLEvent; + +public interface XMLEventReader extends Iterator { + public void close() throws XMLStreamException; + + public String getElementText() throws XMLStreamException; + + public Object getProperty(String name) throws IllegalArgumentException; + + public boolean hasNext(); + + public XMLEvent nextEvent() throws XMLStreamException; + + public XMLEvent nextTag() throws XMLStreamException; + + public XMLEvent peek() throws XMLStreamException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventWriter.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventWriter.java new file mode 100644 index 000000000..cb6d949d5 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLEventWriter.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLEventWriter.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.stream.events.XMLEvent; +import javax.xml.stream.util.XMLEventConsumer; + +public interface XMLEventWriter extends XMLEventConsumer { + public void add(XMLEvent event) throws XMLStreamException; + + public void add(XMLEventReader reader) throws XMLStreamException; + + public void close() throws XMLStreamException; + + public void flush() throws XMLStreamException; + + public NamespaceContext getNamespaceContext(); + + public String getPrefix(String uri) throws XMLStreamException; + + public void setDefaultNamespace(String uri) throws XMLStreamException; + + public void setNamespaceContext(NamespaceContext context) throws XMLStreamException; + + public void setPrefix(String prefix, String uri) throws XMLStreamException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLInputFactory.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLInputFactory.java new file mode 100644 index 000000000..42f2926c8 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLInputFactory.java @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLInputFactory.java 670283 2008-06-22 01:04:09Z mrglavas $ + +package javax.xml.stream; + +import java.io.InputStream; +import java.io.Reader; + +import javax.xml.stream.util.XMLEventAllocator; + +public abstract class XMLInputFactory { + + public static final String ALLOCATOR = "javax.xml.stream.allocator"; + public static final String IS_COALESCING = "javax.xml.stream.isCoalescing"; + public static final String IS_NAMESPACE_AWARE = "javax.xml.stream.isNamespaceAware"; + public static final String IS_REPLACING_ENTITY_REFERENCES = "javax.xml.stream.isReplacingEntityReferences"; + public static final String IS_SUPPORTING_EXTERNAL_ENTITIES = "javax.xml.stream.isSupportingExternalEntities"; + public static final String IS_VALIDATING = "javax.xml.stream.isValidating"; + public static final String REPORTER = "javax.xml.stream.reporter"; + public static final String RESOLVER = "javax.xml.stream.resolver"; + public static final String SUPPORT_DTD = "javax.xml.stream.supportDTD"; + + private static final String PROPERTY_NAME = "javax.xml.stream.XMLInputFactory"; + private static final String DEFAULT_FACTORY = "com.ctc.wstx.stax.WstxInputFactory"; + + protected XMLInputFactory() {} + + public static XMLInputFactory newInstance() + throws FactoryConfigurationError { + try { + return (XMLInputFactory) FactoryFinder.find(PROPERTY_NAME, DEFAULT_FACTORY); + } + catch (FactoryFinder.ConfigurationError e) { + throw new FactoryConfigurationError(e.getException(), e.getMessage()); + } + } + + public static XMLInputFactory newInstance(String factoryId, + ClassLoader classLoader) throws FactoryConfigurationError { + if (classLoader == null) { + classLoader = SecuritySupport.getContextClassLoader(); + } + try { + return (XMLInputFactory) FactoryFinder.find(factoryId, classLoader, DEFAULT_FACTORY); + } + catch (FactoryFinder.ConfigurationError e) { + throw new FactoryConfigurationError(e.getException(), e.getMessage()); + } + } + + public abstract XMLStreamReader createXMLStreamReader(Reader reader) + throws XMLStreamException; + + public abstract XMLStreamReader createXMLStreamReader( + javax.xml.transform.Source source) throws XMLStreamException; + + public abstract XMLStreamReader createXMLStreamReader( + InputStream stream) throws XMLStreamException; + + public abstract XMLStreamReader createXMLStreamReader( + InputStream stream, String encoding) + throws XMLStreamException; + + public abstract XMLStreamReader createXMLStreamReader( + String systemId, InputStream stream) + throws XMLStreamException; + + public abstract XMLStreamReader createXMLStreamReader( + String systemId, Reader reader) + throws XMLStreamException; + + public abstract XMLEventReader createXMLEventReader(Reader reader) + throws XMLStreamException; + + public abstract XMLEventReader createXMLEventReader( + String systemId, Reader reader) + throws XMLStreamException; + + public abstract XMLEventReader createXMLEventReader(XMLStreamReader reader) + throws XMLStreamException; + + public abstract XMLEventReader createXMLEventReader( + javax.xml.transform.Source source) throws XMLStreamException; + + public abstract XMLEventReader createXMLEventReader( + InputStream stream) throws XMLStreamException; + + public abstract XMLEventReader createXMLEventReader( + InputStream stream, String encoding) + throws XMLStreamException; + + public abstract XMLEventReader createXMLEventReader( + String systemId, InputStream stream) + throws XMLStreamException; + + public abstract XMLStreamReader createFilteredReader( + XMLStreamReader reader, StreamFilter filter) + throws XMLStreamException; + + public abstract XMLEventReader createFilteredReader(XMLEventReader reader, + EventFilter filter) throws XMLStreamException; + + public abstract XMLResolver getXMLResolver(); + + public abstract void setXMLResolver(XMLResolver resolver); + + public abstract XMLReporter getXMLReporter(); + + public abstract void setXMLReporter(XMLReporter reporter); + + public abstract void setProperty(String name, + Object value) throws IllegalArgumentException; + + public abstract Object getProperty(String name) + throws IllegalArgumentException; + + public abstract boolean isPropertySupported(String name); + + public abstract void setEventAllocator(XMLEventAllocator allocator); + + public abstract XMLEventAllocator getEventAllocator(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLOutputFactory.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLOutputFactory.java new file mode 100644 index 000000000..618ab0eef --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLOutputFactory.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLOutputFactory.java 670283 2008-06-22 01:04:09Z mrglavas $ + +package javax.xml.stream; + +import java.io.OutputStream; +import java.io.Writer; + +public abstract class XMLOutputFactory { + + public static final String IS_REPAIRING_NAMESPACES = "javax.xml.stream.isRepairingNamespaces"; + + private static final String PROPERTY_NAME = "javax.xml.stream.XMLOutputFactory"; + private static final String DEFAULT_FACTORY = "com.ctc.wstx.stax.WstxOutputFactory"; + + protected XMLOutputFactory() {} + + public static XMLOutputFactory newInstance() + throws FactoryConfigurationError { + try { + return (XMLOutputFactory) FactoryFinder.find(PROPERTY_NAME, DEFAULT_FACTORY); + } + catch (FactoryFinder.ConfigurationError e) { + throw new FactoryConfigurationError(e.getException(), e.getMessage()); + } + } + + public static XMLInputFactory newInstance(String factoryId, + ClassLoader classLoader) throws FactoryConfigurationError { + if (classLoader == null) { + classLoader = SecuritySupport.getContextClassLoader(); + } + try { + return (XMLInputFactory) FactoryFinder.find(factoryId, + classLoader, "com.ctc.wstx.stax.WstxInputFactory"); + } + catch (FactoryFinder.ConfigurationError e) { + throw new FactoryConfigurationError(e.getException(), e.getMessage()); + } + } + + public abstract XMLStreamWriter createXMLStreamWriter(Writer stream) + throws XMLStreamException; + + public abstract XMLStreamWriter createXMLStreamWriter( + OutputStream stream) throws XMLStreamException; + + public abstract XMLStreamWriter createXMLStreamWriter( + OutputStream stream, String encoding) + throws XMLStreamException; + + public abstract XMLStreamWriter createXMLStreamWriter( + javax.xml.transform.Result result) throws XMLStreamException; + + public abstract XMLEventWriter createXMLEventWriter( + javax.xml.transform.Result result) throws XMLStreamException; + + public abstract XMLEventWriter createXMLEventWriter( + OutputStream stream) throws XMLStreamException; + + public abstract XMLEventWriter createXMLEventWriter( + OutputStream stream, String encoding) + throws XMLStreamException; + + public abstract XMLEventWriter createXMLEventWriter(Writer stream) + throws XMLStreamException; + + public abstract void setProperty(String name, Object value) + throws IllegalArgumentException; + + public abstract Object getProperty(String name) + throws IllegalArgumentException; + + public abstract boolean isPropertySupported(String name); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLReporter.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLReporter.java new file mode 100644 index 000000000..d1a14b72b --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLReporter.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLReporter.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream; + +public interface XMLReporter { + void report(String message, + String errorType, + Object relatedInformation, + Location location) throws XMLStreamException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLResolver.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLResolver.java new file mode 100644 index 000000000..9c6cc3bf8 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLResolver.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLResolver.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream; + +public interface XMLResolver { + public Object resolveEntity(String publicID, + String systemID, + String baseURI, + String namespace) throws XMLStreamException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamConstants.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamConstants.java new file mode 100644 index 000000000..477f59dd9 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamConstants.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLStreamConstants.java 670269 2008-06-21 23:27:48Z mrglavas $ + +package javax.xml.stream; + +public interface XMLStreamConstants { + + public static final int START_ELEMENT = 1; + public static final int END_ELEMENT = 2; + public static final int PROCESSING_INSTRUCTION = 3; + public static final int CHARACTERS = 4; + public static final int COMMENT = 5; + public static final int SPACE = 6; + public static final int START_DOCUMENT = 7; + public static final int END_DOCUMENT = 8; + public static final int ENTITY_REFERENCE = 9; + public static final int ATTRIBUTE = 10; + public static final int DTD = 11; + public static final int CDATA = 12; + public static final int NAMESPACE = 13; + public static final int NOTATION_DECLARATION = 14; + public static final int ENTITY_DECLARATION = 15; + +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamException.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamException.java new file mode 100644 index 000000000..033a19da4 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamException.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLStreamException.java 670245 2008-06-21 18:03:15Z mrglavas $ + +package javax.xml.stream; + +public class XMLStreamException extends Exception { + + private static final long serialVersionUID = 2018819321811497362L; + + protected Throwable nested; + protected Location location; + + public XMLStreamException() { + super(); + } + + public XMLStreamException(String msg) { + super(msg); + } + + public XMLStreamException(Throwable th) { + this.nested = th; + } + + public XMLStreamException(String msg, Throwable th) { + super(msg); + this.nested = th; + } + + public XMLStreamException(String msg, Location location, + Throwable th) { + super(msg); + this.location = location; + this.nested = th; + } + + public XMLStreamException(String msg, Location location) { + super(msg); + this.location = location; + } + + public Throwable getNestedException() { + return nested; + } + + public Location getLocation() { + return location; + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamReader.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamReader.java new file mode 100644 index 000000000..b9f23e3b4 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamReader.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLStreamReader.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; + +public interface XMLStreamReader extends XMLStreamConstants { + public void close() throws XMLStreamException; + + public int getAttributeCount(); + + public String getAttributeLocalName(int index); + + public QName getAttributeName(int index); + + public String getAttributeNamespace(int index); + + public String getAttributePrefix(int index); + + public String getAttributeType(int index); + + public String getAttributeValue(int index); + + public String getAttributeValue(String namespaceURI, + String localName); + + public String getCharacterEncodingScheme(); + + public String getElementText() throws XMLStreamException; + + public String getEncoding(); + + public int getEventType(); + + public String getLocalName(); + + public Location getLocation(); + + public QName getName(); + + public NamespaceContext getNamespaceContext(); + + public int getNamespaceCount(); + + public String getNamespacePrefix(int index); + + public String getNamespaceURI(); + + public String getNamespaceURI(int index); + + public String getNamespaceURI(String prefix); + + public String getPIData(); + + public String getPITarget(); + + public String getPrefix(); + + public java.lang.Object getProperty(String name) throws IllegalArgumentException; + + public String getText(); + + public char[] getTextCharacters(); + + public int getTextCharacters(int sourceStart, char[] target, int targetStart, + int length) throws XMLStreamException; + + public int getTextLength(); + + public int getTextStart(); + + public String getVersion(); + + public boolean hasName(); + + public boolean hasNext() throws XMLStreamException; + + public boolean hasText(); + + public boolean isAttributeSpecified(int index); + + public boolean isCharacters(); + + public boolean isEndElement(); + + public boolean isStandalone(); + + public boolean isStartElement(); + + public boolean isWhiteSpace(); + + public int next() throws XMLStreamException; + + public int nextTag() throws XMLStreamException ; + + public void require(int type, String namespaceURI, + String localName) throws XMLStreamException ; + + public boolean standaloneSet(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamWriter.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamWriter.java new file mode 100644 index 000000000..4eaff4a04 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/XMLStreamWriter.java @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLStreamWriter.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream; + +import javax.xml.namespace.NamespaceContext; + +public interface XMLStreamWriter { + public void close() throws XMLStreamException; + + public void flush() throws XMLStreamException; + + public NamespaceContext getNamespaceContext(); + + public String getPrefix(String uri) throws XMLStreamException; + + public Object getProperty(String name) throws IllegalArgumentException; + + public void setDefaultNamespace(String uri) throws XMLStreamException; + + public void setNamespaceContext(NamespaceContext context) + throws XMLStreamException; + + public void setPrefix(String prefix, String uri) throws XMLStreamException; + + public void writeAttribute(String localName, String value) + throws XMLStreamException; + + public void writeAttribute(String namespaceURI, String localName, + String value) throws XMLStreamException; + + public void writeAttribute(String prefix, String namespaceURI, + String localName, String value) throws XMLStreamException; + + public void writeCData(String data) throws XMLStreamException; + + public void writeCharacters(char[] text, int start, int len) + throws XMLStreamException; + + public void writeCharacters(String text) throws XMLStreamException; + + public void writeComment(String data) throws XMLStreamException; + + public void writeDefaultNamespace(String namespaceURI) + throws XMLStreamException; + + public void writeDTD(String dtd) throws XMLStreamException; + + public void writeEmptyElement(String localName) throws XMLStreamException; + + public void writeEmptyElement(String namespaceURI, String localName) + throws XMLStreamException; + + public void writeEmptyElement(String prefix, String localName, + String namespaceURI) throws XMLStreamException; + + public void writeEndDocument() throws XMLStreamException; + + public void writeEndElement() throws XMLStreamException; + + public void writeEntityRef(String name) throws XMLStreamException; + + public void writeNamespace(String prefix, String namespaceURI) + throws XMLStreamException; + + public void writeProcessingInstruction(String target) + throws XMLStreamException; + + public void writeProcessingInstruction(String target, String data) + throws XMLStreamException; + + public void writeStartDocument() throws XMLStreamException; + + public void writeStartDocument(String version) throws XMLStreamException; + + public void writeStartDocument(String encoding, String version) + throws XMLStreamException; + + public void writeStartElement(String localName) throws XMLStreamException; + + public void writeStartElement(String namespaceURI, String localName) + throws XMLStreamException; + + public void writeStartElement(String prefix, String localName, + String namespaceURI) throws XMLStreamException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Attribute.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Attribute.java new file mode 100644 index 000000000..a2eb10963 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Attribute.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Attribute.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +import javax.xml.namespace.QName; + +public interface Attribute extends XMLEvent { + public String getDTDType(); + + public QName getName(); + + public String getValue(); + + public boolean isSpecified(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Characters.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Characters.java new file mode 100644 index 000000000..600980d39 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Characters.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Characters.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +public interface Characters extends XMLEvent { + public String getData(); + + public boolean isCData(); + + public boolean isIgnorableWhiteSpace(); + + public boolean isWhiteSpace(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Comment.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Comment.java new file mode 100644 index 000000000..0cd514691 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Comment.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Comment.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +public interface Comment extends XMLEvent { + public String getText(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/DTD.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/DTD.java new file mode 100644 index 000000000..ea3392f9e --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/DTD.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: DTD.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +import java.util.List; + +public interface DTD extends XMLEvent { + public String getDocumentTypeDeclaration(); + + public List getEntities(); + + public List getNotations(); + + public Object getProcessedDTD(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EndDocument.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EndDocument.java new file mode 100644 index 000000000..f68974e84 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EndDocument.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: EndDocument.java 669791 2008-06-20 04:54:13Z mrglavas $ + +package javax.xml.stream.events; + +public interface EndDocument extends XMLEvent { +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EndElement.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EndElement.java new file mode 100644 index 000000000..8ba10d9e2 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EndElement.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: EndElement.java 669791 2008-06-20 04:54:13Z mrglavas $ + +package javax.xml.stream.events; + +import java.util.Iterator; + +import javax.xml.namespace.QName; + +public interface EndElement extends XMLEvent { + public QName getName(); + public Iterator getNamespaces(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EntityDeclaration.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EntityDeclaration.java new file mode 100644 index 000000000..41eefbfeb --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EntityDeclaration.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: EntityDeclaration.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +public interface EntityDeclaration extends XMLEvent { + public String getBaseURI(); + + public String getName(); + + public String getNotationName(); + + public String getPublicId(); + + public String getReplacementText(); + + public String getSystemId(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EntityReference.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EntityReference.java new file mode 100644 index 000000000..585464a4a --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/EntityReference.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: EntityReference.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +public interface EntityReference extends XMLEvent { + public EntityDeclaration getDeclaration(); + + public String getName(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Namespace.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Namespace.java new file mode 100644 index 000000000..613519247 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/Namespace.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Namespace.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +public interface Namespace extends Attribute { + public String getNamespaceURI(); + + public String getPrefix(); + + public boolean isDefaultNamespaceDeclaration(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/NotationDeclaration.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/NotationDeclaration.java new file mode 100644 index 000000000..cded7ca81 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/NotationDeclaration.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: NotationDeclaration.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +public interface NotationDeclaration extends XMLEvent { + public String getName(); + + public String getPublicId(); + + public String getSystemId(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/ProcessingInstruction.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/ProcessingInstruction.java new file mode 100644 index 000000000..61aa425e4 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/ProcessingInstruction.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: ProcessingInstruction.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +public interface ProcessingInstruction extends XMLEvent { + public String getData(); + + public String getTarget(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/StartDocument.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/StartDocument.java new file mode 100644 index 000000000..6806bfc6a --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/StartDocument.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: StartDocument.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +public interface StartDocument extends XMLEvent { + public boolean encodingSet(); + + public String getCharacterEncodingScheme(); + + public String getSystemId(); + + public String getVersion(); + + public boolean isStandalone(); + + public boolean standaloneSet(); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/StartElement.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/StartElement.java new file mode 100644 index 000000000..9e8a0e286 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/StartElement.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: StartElement.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +import java.util.Iterator; +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; + +public interface StartElement extends XMLEvent { + public Attribute getAttributeByName(QName name); + + public Iterator getAttributes(); + + public QName getName(); + + public NamespaceContext getNamespaceContext(); + + public Iterator getNamespaces(); + + public String getNamespaceURI(String prefix); +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/XMLEvent.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/XMLEvent.java new file mode 100644 index 000000000..b8c818081 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/events/XMLEvent.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLEvent.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.events; + +import java.io.Writer; + +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; + +public interface XMLEvent extends XMLStreamConstants { + public Characters asCharacters(); + + public EndElement asEndElement(); + + public StartElement asStartElement(); + + public int getEventType(); + + public Location getLocation(); + + public QName getSchemaType(); + + public boolean isAttribute(); + + public boolean isCharacters(); + + public boolean isEndDocument(); + + public boolean isEndElement(); + + public boolean isEntityReference(); + + public boolean isNamespace(); + + public boolean isProcessingInstruction(); + + public boolean isStartDocument(); + + public boolean isStartElement(); + + public void writeAsEncodedUnicode(Writer writer) throws XMLStreamException; +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/EventReaderDelegate.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/EventReaderDelegate.java new file mode 100644 index 000000000..e75e02ea9 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/EventReaderDelegate.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: EventReaderDelegate.java 670273 2008-06-21 23:31:31Z mrglavas $ + +package javax.xml.stream.util; + +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.XMLEvent; + +public class EventReaderDelegate implements XMLEventReader { + + private XMLEventReader reader; + + public EventReaderDelegate() {} + + public EventReaderDelegate(XMLEventReader reader) { + this.reader = reader; + } + + public void setParent(XMLEventReader reader) { + this.reader = reader; + } + + public XMLEventReader getParent() { + return reader; + } + + /* + * XMLEventReader methods + */ + + public void close() throws XMLStreamException { + reader.close(); + } + + public String getElementText() throws XMLStreamException { + return reader.getElementText(); + } + + public Object getProperty(String name) + throws IllegalArgumentException { + return reader.getProperty(name); + } + + public boolean hasNext() { + return reader.hasNext(); + } + + public Object next() { + return reader.next(); + } + + public XMLEvent nextEvent() throws XMLStreamException { + return reader.nextEvent(); + } + + public XMLEvent nextTag() throws XMLStreamException { + return reader.nextTag(); + } + + public XMLEvent peek() throws XMLStreamException { + return reader.peek(); + } + + public void remove() { + reader.remove(); + } +} \ No newline at end of file diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/StreamReaderDelegate.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/StreamReaderDelegate.java new file mode 100644 index 000000000..f0eda1272 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/StreamReaderDelegate.java @@ -0,0 +1,232 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: StreamReaderDelegate.java 670273 2008-06-21 23:31:31Z mrglavas $ + +package javax.xml.stream.util; + +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +public class StreamReaderDelegate implements XMLStreamReader { + + private XMLStreamReader reader; + + public StreamReaderDelegate() {} + + public StreamReaderDelegate(XMLStreamReader reader) { + this.reader = reader; + } + + public void setParent(XMLStreamReader reader) { + this.reader = reader; + } + + public XMLStreamReader getParent() { + return reader; + } + + /* + * XMLStreamReader methods + */ + + public int next() throws XMLStreamException { + return reader.next(); + } + + public int nextTag() throws XMLStreamException { + return reader.nextTag(); + } + + public String getElementText() throws XMLStreamException { + return reader.getElementText(); + } + + public void require(int type, String namespaceURI, String localName) + throws XMLStreamException { + reader.require(type, namespaceURI, localName); + } + + public boolean hasNext() throws XMLStreamException { + return reader.hasNext(); + } + + public void close() throws XMLStreamException { + reader.close(); + } + + public String getNamespaceURI(String prefix) { + return reader.getNamespaceURI(prefix); + } + + public NamespaceContext getNamespaceContext() { + return reader.getNamespaceContext(); + } + + public boolean isStartElement() { + return reader.isStartElement(); + } + + public boolean isEndElement() { + return reader.isEndElement(); + } + + public boolean isCharacters() { + return reader.isCharacters(); + } + + public boolean isWhiteSpace() { + return reader.isWhiteSpace(); + } + + public String getAttributeValue(String namespaceURI, String localName) { + return reader.getAttributeValue(namespaceURI, localName); + } + + public int getAttributeCount() { + return reader.getAttributeCount(); + } + + public QName getAttributeName(int index) { + return reader.getAttributeName(index); + } + + public String getAttributePrefix(int index) { + return reader.getAttributePrefix(index); + } + + public String getAttributeNamespace(int index) { + return reader.getAttributeNamespace(index); + } + + public String getAttributeLocalName(int index) { + return reader.getAttributeLocalName(index); + } + + public String getAttributeType(int index) { + return reader.getAttributeType(index); + } + + public String getAttributeValue(int index) { + return reader.getAttributeValue(index); + } + + public boolean isAttributeSpecified(int index) { + return reader.isAttributeSpecified(index); + } + + public int getNamespaceCount() { + return reader.getNamespaceCount(); + } + + public String getNamespacePrefix(int index) { + return reader.getNamespacePrefix(index); + } + + public String getNamespaceURI(int index) { + return reader.getNamespaceURI(index); + } + + public int getEventType() { + return reader.getEventType(); + } + + public String getText() { + return reader.getText(); + } + + public int getTextCharacters(int sourceStart, char[] target, + int targetStart, int length) throws XMLStreamException { + return reader.getTextCharacters(sourceStart, target, targetStart, + length); + } + + public char[] getTextCharacters() { + return reader.getTextCharacters(); + } + + public int getTextStart() { + return reader.getTextStart(); + } + + public int getTextLength() { + return reader.getTextLength(); + } + + public String getEncoding() { + return reader.getEncoding(); + } + + public boolean hasText() { + return reader.hasText(); + } + + public Location getLocation() { + return reader.getLocation(); + } + + public QName getName() { + return reader.getName(); + } + + public String getLocalName() { + return reader.getLocalName(); + } + + public boolean hasName() { + return reader.hasName(); + } + + public String getNamespaceURI() { + return reader.getNamespaceURI(); + } + + public String getPrefix() { + return reader.getPrefix(); + } + + public String getVersion() { + return reader.getVersion(); + } + + public boolean isStandalone() { + return reader.isStandalone(); + } + + public boolean standaloneSet() { + return reader.standaloneSet(); + } + + public String getCharacterEncodingScheme() { + return reader.getCharacterEncodingScheme(); + } + + public String getPITarget() { + return reader.getPITarget(); + } + + public String getPIData() { + return reader.getPIData(); + } + + public Object getProperty(String name) throws IllegalArgumentException { + return reader.getProperty(name); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/XMLEventAllocator.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/XMLEventAllocator.java new file mode 100644 index 000000000..4e4b920ac --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/XMLEventAllocator.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLEventAllocator.java 669794 2008-06-20 05:13:36Z mrglavas $ + +package javax.xml.stream.util; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.events.XMLEvent; + +public interface XMLEventAllocator { + public XMLEvent allocate(XMLStreamReader reader) throws XMLStreamException; + + public void allocate(XMLStreamReader reader, XMLEventConsumer consumer) + throws XMLStreamException; + + public XMLEventAllocator newInstance(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/XMLEventConsumer.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/XMLEventConsumer.java new file mode 100644 index 000000000..7bcb15338 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/stream/util/XMLEventConsumer.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: XMLEventConsumer.java 669791 2008-06-20 04:54:13Z mrglavas $ + +package javax.xml.stream.util; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.XMLEvent; + +public interface XMLEventConsumer { + public void add(XMLEvent event) throws XMLStreamException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/ErrorListener.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/ErrorListener.java new file mode 100644 index 000000000..08491329e --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/ErrorListener.java @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: ErrorListener.java 569994 2007-08-27 04:28:57Z mrglavas $ + +package javax.xml.transform; + +/** + *To provide customized error handling, implement this interface and
+ * use the setErrorListener
method to register an instance of the
+ * implementation with the {@link javax.xml.transform.Transformer}. The
+ * Transformer
then reports all errors and warnings through this
+ * interface.
If an application does not register its own custom
+ * ErrorListener
, the default ErrorListener
+ * is used which reports all warnings and errors to System.err
+ * and does not throw any Exception
s.
+ * Applications are strongly encouraged to register and use
+ * ErrorListener
s that insure proper behavior for warnings and
+ * errors.
For transformation errors, a Transformer
must use this
+ * interface instead of throwing an Exception
: it is up to the
+ * application to decide whether to throw an Exception
for
+ * different types of errors and warnings. Note however that the
+ * Transformer
is not required to continue with the transformation
+ * after a call to {@link #fatalError(TransformerException exception)}.
Transformer
s may use this mechanism to report XML parsing
+ * errors as well as transformation errors.
{@link javax.xml.transform.Transformer} can use this method to report + * conditions that are not errors or fatal errors. The default behaviour + * is to take no action.
+ * + *After invoking this method, the Transformer must continue with + * the transformation. It should still be possible for the + * application to process the document through to the end.
+ * + * @param exception The warning information encapsulated in a + * transformer exception. + * + * @throws javax.xml.transform.TransformerException if the application + * chooses to discontinue the transformation. + * + * @see javax.xml.transform.TransformerException + */ + public abstract void warning(TransformerException exception) + throws TransformerException; + + /** + * Receive notification of a recoverable error. + * + *The transformer must continue to try and provide normal transformation + * after invoking this method. It should still be possible for the + * application to process the document through to the end if no other errors + * are encountered.
+ * + * @param exception The error information encapsulated in a + * transformer exception. + * + * @throws javax.xml.transform.TransformerException if the application + * chooses to discontinue the transformation. + * + * @see javax.xml.transform.TransformerException + */ + public abstract void error(TransformerException exception) + throws TransformerException; + + /** + *Receive notification of a non-recoverable error.
+ * + *The Transformer
must continue to try and provide normal
+ * transformation after invoking this method. It should still be possible for the
+ * application to process the document through to the end if no other errors
+ * are encountered, but there is no guarantee that the output will be
+ * useable.
TransformerException
.
+ *
+ * @throws javax.xml.transform.TransformerException if the application
+ * chooses to discontinue the transformation.
+ *
+ * @see javax.xml.transform.TransformerException
+ */
+ public abstract void fatalError(TransformerException exception)
+ throws TransformerException;
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/FactoryFinder.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/FactoryFinder.java
new file mode 100644
index 000000000..623f47c0d
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/FactoryFinder.java
@@ -0,0 +1,338 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: FactoryFinder.java 670431 2008-06-23 01:40:03Z mrglavas $
+
+package javax.xml.transform;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+/**
+ * This class is duplicated for each JAXP subpackage so keep it in
+ * sync. It is package private.
+ *
+ * This code is designed to implement the JAXP 1.1 spec pluggability
+ * feature and is designed to run on JDK version 1.1 and later including
+ * JVMs that perform early linking like the Microsoft JVM in IE 5. Note
+ * however that it must be compiled on a JDK version 1.2 or later system
+ * since it calls Thread#getContextClassLoader(). The code also runs both
+ * as part of an unbundled jar file and when bundled as part of the JDK.
+ */
+final class FactoryFinder {
+
+ /**
+ * Debug flag to trace loading process.
+ */ + private static boolean debug = false; + + /** + *Cache properties for performance.
+ */ + private static Properties cacheProps = new Properties(); + + /** + *First time requires initialization overhead.
+ */ + private static boolean firstTime = true; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + + // Define system property "jaxp.debug" to get output + static { + // Use try/catch block to support applets, which throws + // SecurityException out of this code. + try { + String val = SecuritySupport.getSystemProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && (! "false".equals(val)); + } catch (SecurityException se) { + debug = false; + } + } + + private FactoryFinder() {} + + private static void dPrint(String msg) { + if (debug) { + System.err.println("JAXP: " + msg); + } + } + + /** + * Create an instance of a class using the specified ClassLoader and + * optionally fall back to the current ClassLoader if not found. + * + * @param className Name of the concrete class corresponding to the + * service provider + * + * @param cl ClassLoader to use to load the class, null means to use + * the bootstrap ClassLoader + * + * @param doFallback true if the current ClassLoader should be tried as + * a fallback if the class is not found using cl + */ + static Object newInstance(String className, ClassLoader cl, + boolean doFallback) + throws ConfigurationError + { + // assert(className != null); + + try { + Class providerClass; + if (cl == null) { + // If classloader is null Use the bootstrap ClassLoader. + // Thus Class.forName(String) will use the current + // ClassLoader which will be the bootstrap ClassLoader. + providerClass = Class.forName(className); + } else { + try { + providerClass = cl.loadClass(className); + } catch (ClassNotFoundException x) { + if (doFallback) { + // Fall back to current classloader + cl = FactoryFinder.class.getClassLoader(); + if (cl != null) { + providerClass = cl.loadClass(className); + } + else { + providerClass = Class.forName(className); + } + } else { + throw x; + } + } + } + + Object instance = providerClass.newInstance(); + if (debug) dPrint("created new instance of " + providerClass + + " using ClassLoader: " + cl); + return instance; + } catch (ClassNotFoundException x) { + throw new ConfigurationError( + "Provider " + className + " not found", x); + } catch (Exception x) { + throw new ConfigurationError( + "Provider " + className + " could not be instantiated: " + x, + x); + } + } + + /** + * Finds the implementation Class object in the specified order. Main + * entry point. + * @return Class object of factory, never null + * + * @param factoryId Name of the factory to find, same as + * a property name + * @param fallbackClassName Implementation class name, if nothing else + * is found. Use null to mean no fallback. + * + * Package private so this code can be shared. + */ + static Object find(String factoryId, String fallbackClassName) + throws ConfigurationError + { + + // Figure out which ClassLoader to use for loading the provider + // class. If there is a Context ClassLoader then use it. + + ClassLoader classLoader = SecuritySupport.getContextClassLoader(); + + if (classLoader == null) { + // if we have no Context ClassLoader + // so use the current ClassLoader + classLoader = FactoryFinder.class.getClassLoader(); + } + + if (debug) dPrint("find factoryId =" + factoryId); + + // Use the system property first + try { + String systemProp = SecuritySupport.getSystemProperty(factoryId); + if (systemProp != null && systemProp.length() > 0) { + if (debug) dPrint("found system property, value=" + systemProp); + return newInstance(systemProp, classLoader, true); + } + } catch (SecurityException se) { + //if first option fails due to any reason we should try next option in the + //look up algorithm. + } + + // try to read from $java.home/lib/jaxp.properties + try { + String javah = SecuritySupport.getSystemProperty("java.home"); + String configFile = javah + File.separator + + "lib" + File.separator + "jaxp.properties"; + String factoryClassName = null; + if(firstTime){ + synchronized(cacheProps){ + if(firstTime){ + File f=new File( configFile ); + firstTime = false; + if(SecuritySupport.doesFileExist(f)){ + if (debug) dPrint("Read properties file "+f); + //cacheProps.load( new FileInputStream(f)); + cacheProps.load(SecuritySupport.getFileInputStream(f)); + } + } + } + } + factoryClassName = cacheProps.getProperty(factoryId); + + if(factoryClassName != null){ + if (debug) dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName); + return newInstance(factoryClassName, classLoader, true); + } + } catch(Exception ex ) { + if( debug ) ex.printStackTrace(); + } + + // Try Jar Service Provider Mechanism + Object provider = findJarServiceProvider(factoryId); + if (provider != null) { + return provider; + } + if (fallbackClassName == null) { + throw new ConfigurationError( + "Provider for " + factoryId + " cannot be found", null); + } + + if (debug) dPrint("loaded from fallback value: " + fallbackClassName); + return newInstance(fallbackClassName, classLoader, true); + } + + /* + * Try to find provider using Jar Service Provider Mechanism + * + * @return instance of provider class if found or null + */ + private static Object findJarServiceProvider(String factoryId) + throws ConfigurationError + { + + String serviceId = "META-INF/services/" + factoryId; + InputStream is = null; + + // First try the Context ClassLoader + ClassLoader cl = SecuritySupport.getContextClassLoader(); + if (cl != null) { + is = SecuritySupport.getResourceAsStream(cl, serviceId); + + // If no provider found then try the current ClassLoader + if (is == null) { + cl = FactoryFinder.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, serviceId); + } + } else { + // No Context ClassLoader, try the current + // ClassLoader + cl = FactoryFinder.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, serviceId); + } + + if (is == null) { + // No provider found + return null; + } + + if (debug) dPrint("found jar resource=" + serviceId + + " using ClassLoader: " + cl); + + // Read the service provider name in UTF-8 as specified in + // the jar spec. Unfortunately this fails in Microsoft + // VJ++, which does not implement the UTF-8 + // encoding. Theoretically, we should simply let it fail in + // that case, since the JVM is obviously broken if it + // doesn't support such a basic standard. But since there + // are still some users attempting to use VJ++ for + // development, we have dropped in a fallback which makes a + // second attempt using the platform's default encoding. In + // VJ++ this is apparently ASCII, which is a subset of + // UTF-8... and since the strings we'll be reading here are + // also primarily limited to the 7-bit ASCII range (at + // least, in English versions), this should work well + // enough to keep us on the air until we're ready to + // officially decommit from VJ++. [Edited comment from + // jkesselm] + BufferedReader rd; + try { + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); + } catch (java.io.UnsupportedEncodingException e) { + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); + } + + String factoryClassName = null; + try { + // XXX Does not handle all possible input as specified by the + // Jar Service Provider specification + factoryClassName = rd.readLine(); + } + catch (IOException x) { + // No provider found + return null; + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} + } + + if (factoryClassName != null && + ! "".equals(factoryClassName)) { + if (debug) dPrint("found in resource, value=" + + factoryClassName); + + // Note: here we do not want to fall back to the current + // ClassLoader because we want to avoid the case where the + // resource file was found using one ClassLoader and the + // provider class was instantiated using a different one. + return newInstance(factoryClassName, cl, false); + } + + // No provider found + return null; + } + + static class ConfigurationError extends Error { + private Exception exception; + + /** + * Construct a new instance with the specified detail string and + * exception. + */ + ConfigurationError(String msg, Exception x) { + super(msg); + this.exception = x; + } + + Exception getException() { + return exception; + } + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/OutputKeys.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/OutputKeys.java new file mode 100644 index 000000000..8383cdb30 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/OutputKeys.java @@ -0,0 +1,193 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: OutputKeys.java 569994 2007-08-27 04:28:57Z mrglavas $ + +package javax.xml.transform; + +/** + * Provides string constants that can be used to set + * output properties for a Transformer, or to retrieve + * output properties from a Transformer or Templates object. + *All the fields in this class are read-only.
+ * + * @see + * section 16 of the XSL Transformations (XSLT) W3C Recommendation + */ +public class OutputKeys { + + /** + * Default constructor is private on purpose. This class is + * only for static variable access, and should never be constructed. + */ + private OutputKeys() { } + + /** + * method = "xml" | "html" | "text" | expanded name. + * + *The value of the method property identifies the overall method that + * should be used for outputting the result tree. Other non-namespaced + * values may be used, such as "xhtml", but, if accepted, the handling + * of such values is implementation defined. If any of the method values + * are not accepted and are not namespace qualified, + * then {@link javax.xml.transform.Transformer#setOutputProperty} + * or {@link javax.xml.transform.Transformer#setOutputProperties} will + * throw a {@link java.lang.IllegalArgumentException}.
+ * + * @see + * section 16 of the XSL Transformations (XSLT) W3C Recommendation + */ + public static final String METHOD = "method"; + + /** + * version = nmtoken. + * + *version
specifies the version of the output
+ * method.
When the output method is "xml", the version value specifies the + * version of XML to be used for outputting the result tree. The default + * value for the xml output method is 1.0. When the output method is + * "html", the version value indicates the version of the HTML. + * The default value for the xml output method is 4.0, which specifies + * that the result should be output as HTML conforming to the HTML 4.0 + * Recommendation [HTML]. If the output method is "text", the version + * property is ignored.
+ * @see + * section 16 of the XSL Transformations (XSLT) W3C Recommendation + */ + public static final String VERSION = "version"; + + /** + * encoding = string. + * + *encoding
specifies the preferred character
+ * encoding that the Transformer should use to encode sequences of
+ * characters as sequences of bytes. The value of the encoding property should be
+ * treated case-insensitively. The value must only contain characters in
+ * the range #x21 to #x7E (i.e., printable ASCII characters). The value
+ * should either be a charset
registered with the Internet
+ * Assigned Numbers Authority [IANA],
+ * [RFC2278] or start with X-
.
omit-xml-declaration
specifies whether the XSLT
+ * processor should output an XML declaration; the value must be
+ * yes
or no
.
standalone
specifies whether the Transformer
+ * should output a standalone document declaration; the value must be
+ * yes
or no
.
See the documentation for the {@link #DOCTYPE_SYSTEM} property + * for a description of what the value of the key should be.
+ * + * @see + * section 16 of the XSL Transformations (XSLT) W3C Recommendation + */ + public static final String DOCTYPE_PUBLIC = "doctype-public"; + + /** + * doctype-system = string. + *doctype-system
specifies the system identifier
+ * to be used in the document type declaration.
If the doctype-system property is specified, the xml output method + * should output a document type declaration immediately before the first + * element. The name following <!DOCTYPE should be the name of the first + * element. If doctype-public property is also specified, then the xml + * output method should output PUBLIC followed by the public identifier + * and then the system identifier; otherwise, it should output SYSTEM + * followed by the system identifier. The internal subset should be empty. + * The value of the doctype-public property should be ignored unless the doctype-system + * property is specified.
+ *If the doctype-public or doctype-system properties are specified, + * then the html output method should output a document type declaration + * immediately before the first element. The name following <!DOCTYPE + * should be HTML or html. If the doctype-public property is specified, + * then the output method should output PUBLIC followed by the specified + * public identifier; if the doctype-system property is also specified, + * it should also output the specified system identifier following the + * public identifier. If the doctype-system property is specified but + * the doctype-public property is not specified, then the output method + * should output SYSTEM followed by the specified system identifier.
+ * + *doctype-system
specifies the system identifier
+ * to be used in the document type declaration.
cdata-section-elements
specifies a whitespace delimited
+ * list of the names of elements whose text node children should be output
+ * using CDATA sections. Note that these names must use the format
+ * described in the section Qualfied Name Representation in
+ * {@link javax.xml.transform}.
indent
specifies whether the Transformer may
+ * add additional whitespace when outputting the result tree; the value
+ * must be yes
or no
.
media-type
specifies the media type (MIME
+ * content type) of the data that results from outputting the result
+ * tree. The charset
parameter should not be specified
+ * explicitly; instead, when the top-level media type is
+ * text
, a charset
parameter should be added
+ * according to the character encoding actually used by the output
+ * method.
An object that implements this interface contains the information + * needed to build a transformation result tree.
+ * + * @author Jeff Suttor + */ +public interface Result { + + /** + * The name of the processing instruction that is sent if the + * result tree disables output escaping. + * + *Normally, result tree serialization escapes & and < (and + * possibly other characters) when outputting text nodes. + * This ensures that the output is well-formed XML. However, + * it is sometimes convenient to be able to produce output that is + * almost, but not quite well-formed XML; for example, + * the output may include ill-formed sections that will + * be transformed into well-formed XML by a subsequent non-XML aware + * process. If a processing instruction is sent with this name, + * serialization should be output without any escaping.
+ * + *Result DOM trees may also have PI_DISABLE_OUTPUT_ESCAPING and + * PI_ENABLE_OUTPUT_ESCAPING inserted into the tree.
+ * + * @see disable-output-escaping in XSLT Specification + */ + public static final String PI_DISABLE_OUTPUT_ESCAPING = + "javax.xml.transform.disable-output-escaping"; + + /** + * The name of the processing instruction that is sent + * if the result tree enables output escaping at some point after having + * received a PI_DISABLE_OUTPUT_ESCAPING processing instruction. + * + * @see disable-output-escaping in XSLT Specification + */ + public static final String PI_ENABLE_OUTPUT_ESCAPING = + "javax.xml.transform.enable-output-escaping"; + + /** + * Set the system identifier for this Result. + * + *If the Result is not to be written to a file, the system identifier is optional. + * The application may still want to provide one, however, for use in error messages + * and warnings, or to resolve relative output identifiers.
+ * + * @param systemId The system identifier as a URI string. + */ + public void setSystemId(String systemId); + + /** + * Get the system identifier that was set with setSystemId. + * + * @return The system identifier that was set with setSystemId, + * or null if setSystemId was not called. + */ + public String getSystemId(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/SecuritySupport.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/SecuritySupport.java new file mode 100644 index 000000000..6ac527dac --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/SecuritySupport.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: SecuritySupport.java 670282 2008-06-22 01:00:42Z mrglavas $ + +package javax.xml.transform; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + +/** + * This class is duplicated for each JAXP subpackage so keep it in sync. + * It is package private and therefore is not exposed as part of the JAXP + * API. + * + * Security related methods that only work on J2SE 1.2 and newer. + */ +final class SecuritySupport { + + private SecuritySupport() {} + + static ClassLoader getContextClassLoader() { + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); + } + + static String getSystemProperty(final String propName) { + return (String) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(propName); + } + }); + } + + static FileInputStream getFileInputStream(final File file) + throws FileNotFoundException + { + try { + return (FileInputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws FileNotFoundException { + return new FileInputStream(file); + } + }); + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } + } + + static InputStream getResourceAsStream(final ClassLoader cl, + final String name) + { + return (InputStream) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + InputStream ris; + if (cl == null) { + ris = ClassLoader.getSystemResourceAsStream(name); + } else { + ris = cl.getResourceAsStream(name); + } + return ris; + } + }); + } + + static boolean doesFileExist(final File f) { + return ((Boolean) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return f.exists() ? Boolean.TRUE : Boolean.FALSE; + } + })).booleanValue(); + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Source.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Source.java new file mode 100644 index 000000000..44cbf248e --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Source.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Source.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.transform; + +/** + * An object that implements this interface contains the information + * needed to act as source input (XML source or transformation instructions). + */ +public interface Source { + + /** + * Set the system identifier for this Source. + * + *The system identifier is optional if the source does not + * get its data from a URL, but it may still be useful to provide one. + * The application can use a system identifier, for example, to resolve + * relative URIs and to include in error messages and warnings.
+ * + * @param systemId The system identifier as a URL string. + */ + public void setSystemId(String systemId); + + /** + * Get the system identifier that was set with setSystemId. + * + * @return The system identifier that was set with setSystemId, or null + * if setSystemId was not called. + */ + public String getSystemId(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/SourceLocator.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/SourceLocator.java new file mode 100644 index 000000000..632eee883 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/SourceLocator.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: SourceLocator.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.transform; + +/** + * This interface is primarily for the purposes of reporting where + * an error occurred in the XML source or transformation instructions. + */ +public interface SourceLocator { + + /** + * Return the public identifier for the current document event. + * + *The return value is the public identifier of the document + * entity or of the external parsed entity in which the markup that + * triggered the event appears.
+ * + * @return A string containing the public identifier, or + * null if none is available. + * @see #getSystemId + */ + public String getPublicId(); + + /** + * Return the system identifier for the current document event. + * + *The return value is the system identifier of the document + * entity or of the external parsed entity in which the markup that + * triggered the event appears.
+ * + *If the system identifier is a URL, the parser must resolve it + * fully before passing it to the application.
+ * + * @return A string containing the system identifier, or null + * if none is available. + * @see #getPublicId + */ + public String getSystemId(); + + /** + * Return the line number where the current document event ends. + * + *Warning: The return value from the method + * is intended only as an approximation for the sake of error + * reporting; it is not intended to provide sufficient information + * to edit the character content of the original XML document.
+ * + *The return value is an approximation of the line number + * in the document entity or external parsed entity where the + * markup that triggered the event appears.
+ * + * @return The line number, or -1 if none is available. + * @see #getColumnNumber + */ + public int getLineNumber(); + + /** + * Return the character position where the current document event ends. + * + *Warning: The return value from the method + * is intended only as an approximation for the sake of error + * reporting; it is not intended to provide sufficient information + * to edit the character content of the original XML document.
+ * + *The return value is an approximation of the column number + * in the document entity or external parsed entity where the + * markup that triggered the event appears.
+ * + * @return The column number, or -1 if none is available. + * @see #getLineNumber + */ + public int getColumnNumber(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Templates.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Templates.java new file mode 100644 index 000000000..1d6f46ab8 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Templates.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Templates.java 570103 2007-08-27 13:24:55Z mrglavas $ + +package javax.xml.transform; + +import java.util.Properties; + +/** + * An object that implements this interface is the runtime representation of processed + * transformation instructions. + * + *Templates must be thread-safe for a given instance + * over multiple threads running concurrently, and may + * be used multiple times in a given session.
+ */ +public interface Templates { + + /** + * Create a new transformation context for this Templates object. + * + * @return A valid non-null instance of a Transformer. + * + * @throws TransformerConfigurationException if a Transformer can not be created. + */ + Transformer newTransformer() throws TransformerConfigurationException; + + /** + * Get the properties corresponding to the effective xsl:output element. + * The object returned will + * be a clone of the internal values. Accordingly, it can be mutated + * without mutating the Templates object, and then handed in to + * {@link javax.xml.transform.Transformer#setOutputProperties}. + * + *The properties returned should contain properties set by the stylesheet, + * and these properties are "defaulted" by default properties specified by + * section 16 of the + * XSL Transformations (XSLT) W3C Recommendation. The properties that + * were specifically set by the stylesheet should be in the base + * Properties list, while the XSLT default properties that were not + * specifically set should be in the "default" Properties list. Thus, + * getOutputProperties().getProperty(String key) will obtain any + * property in that was set by the stylesheet, or the default + * properties, while + * getOutputProperties().get(String key) will only retrieve properties + * that were explicitly set in the stylesheet.
+ * + *For XSLT, + * Attribute + * Value Templates attribute values will + * be returned unexpanded (since there is no context at this point). The + * namespace prefixes inside Attribute Value Templates will be unexpanded, + * so that they remain valid XPath values.
+ * + * @return A Properties object, never null. + */ + Properties getOutputProperties(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Transformer.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Transformer.java new file mode 100644 index 000000000..b014a8160 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/Transformer.java @@ -0,0 +1,321 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Transformer.java 570103 2007-08-27 13:24:55Z mrglavas $ + +package javax.xml.transform; + +import java.util.Properties; + +/** + * An instance of this abstract class can transform a + * source tree into a result tree. + * + *An instance of this class can be obtained with the + * {@link TransformerFactory#newTransformer TransformerFactory.newTransformer} + * method. This instance may then be used to process XML from a + * variety of sources and write the transformation output to a + * variety of sinks.
+ * + *An object of this class may not be used in multiple threads + * running concurrently. Different Transformers may be used + * concurrently by different threads.
+ * + *A Transformer
may be used multiple times. Parameters and
+ * output properties are preserved across transformations.
Reset this Transformer
to its original configuration.
Transformer
is reset to the same state as when it was created with
+ * {@link TransformerFactory#newTransformer()},
+ * {@link TransformerFactory#newTransformer(Source source)} or
+ * {@link Templates#newTransformer()}.
+ * reset()
is designed to allow the reuse of existing Transformer
s
+ * thus saving resources associated with the creation of new Transformer
s.
The reset Transformer
is not guaranteed to have the same {@link URIResolver}
+ * or {@link ErrorListener} Object
s, e.g. {@link Object#equals(Object obj)}.
+ * It is guaranteed to have a functionally equal URIResolver
+ * and ErrorListener
.
Transform the XML Source
to a Result
.
+ * Specific transformation behavior is determined by the settings of the
+ * TransformerFactory
in effect when the
+ * Transformer
was instantiated and any modifications made to
+ * the Transformer
instance.
An empty Source
is represented as an empty document
+ * as constructed by {@link javax.xml.parsers.DocumentBuilder#newDocument()}.
+ * The result of transforming an empty Source
depends on
+ * the transformation behavior; it is not always an empty
+ * Result
.
Result
of transforming the
+ * xmlSource
.
+ *
+ * @throws TransformerException If an unrecoverable error occurs
+ * during the course of the transformation.
+ */
+ public abstract void transform(Source xmlSource, Result outputTarget)
+ throws TransformerException;
+
+ /**
+ * Add a parameter for the transformation.
+ *
+ * Pass a qualified name as a two-part string, the namespace URI + * enclosed in curly braces ({}), followed by the local name. If the + * name has a null URL, the String only contain the local name. An + * application can safely check for a non-null URI by testing to see if the + * first character of the name is a '{' character.
+ *For example, if a URI and local name were obtained from an element + * defined with <xyz:foo + * xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, + * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". + * Note that no prefix is used.
+ * + * @param name The name of the parameter, which may begin with a + * namespace URI in curly braces ({}). + * @param value The value object. This can be any valid Java object. It is + * up to the processor to provide the proper object coercion or to simply + * pass the object on for use in an extension. + * + * @throws NullPointerException If value is null. + */ + public abstract void setParameter(String name, Object value); + + /** + * Get a parameter that was explicitly set with setParameter. + * + *This method does not return a default parameter value, which
+ * cannot be determined until the node context is evaluated during
+ * the transformation process.
+ *
+ * @param name of Object
to get
+ * @return A parameter that has been set with setParameter.
+ */
+ public abstract Object getParameter(String name);
+
+ /**
+ *
Set a list of parameters.
+ * + *Note that the list of parameters is specified as a
+ * Properties
Object
which limits the parameter
+ * values to String
s. Multiple calls to
+ * {@link #setParameter(String name, Object value)} should be used when the
+ * desired values are non-String
Object
s.
+ * The parameter names should conform as specified in
+ * {@link #setParameter(String name, Object value)}.
+ * An IllegalArgumentException
is thrown if any names do not
+ * conform.
New parameters in the list are added to any existing parameters. + * If the name of a new parameter is equal to the name of an existing + * parameter as determined by {@link java.lang.Object#equals(Object obj)}, + * the existing parameter is set to the new value.
+ * + * @param params Parameters to set. + * + * @throws IllegalArgumentException If any parameter names do not conform + * to the naming rules. + */ + + /** + * Clear all parameters set with setParameter. + */ + public abstract void clearParameters(); + + /** + * Set an object that will be used to resolve URIs used in + * document(). + * + *If the resolver argument is null, the URIResolver value will + * be cleared and the transformer will no longer have a resolver.
+ * + * @param resolver An object that implements the URIResolver interface, + * or null. + */ + public abstract void setURIResolver(URIResolver resolver); + + /** + * Get an object that will be used to resolve URIs used in + * document(). + * + * @return An object that implements the URIResolver interface, + * or null. + */ + public abstract URIResolver getURIResolver(); + + /** + * Set the output properties for the transformation. These + * properties will override properties set in the Templates + * with xsl:output. + * + *If argument to this function is null, any properties + * previously set are removed, and the value will revert to the value + * defined in the templates object.
+ * + *Pass a qualified property key name as a two-part string, the namespace + * URI enclosed in curly braces ({}), followed by the local name. If the + * name has a null URL, the String only contain the local name. An + * application can safely check for a non-null URI by testing to see if the + * first character of the name is a '{' character.
+ *For example, if a URI and local name were obtained from an element + * defined with <xyz:foo + * xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, + * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". + * Note that no prefix is used.
+ * AnIllegalArgumentException
is thrown if any of the
+ * argument keys are not recognized and are not namespace qualified.
+ *
+ * @param oformat A set of output properties that will be
+ * used to override any of the same properties in affect
+ * for the transformation.
+ *
+ * @see javax.xml.transform.OutputKeys
+ * @see java.util.Properties
+ *
+ */
+ public abstract void setOutputProperties(Properties oformat);
+
+ /**
+ * Get a copy of the output properties for the transformation.
+ * + *The properties returned should contain properties set by the user, + * and properties set by the stylesheet, and these properties + * are "defaulted" by default properties specified by + * section 16 of the + * XSL Transformations (XSLT) W3C Recommendation. The properties that + * were specifically set by the user or the stylesheet should be in the base + * Properties list, while the XSLT default properties that were not + * specifically set should be the default Properties list. Thus, + * getOutputProperties().getProperty(String key) will obtain any + * property in that was set by {@link #setOutputProperty}, + * {@link #setOutputProperties}, in the stylesheet, or the default + * properties, while + * getOutputProperties().get(String key) will only retrieve properties + * that were explicitly set by {@link #setOutputProperty}, + * {@link #setOutputProperties}, or in the stylesheet.
+ * + *Note that mutation of the Properties object returned will not + * effect the properties that the transformer contains.
+ * + *If any of the argument keys are not recognized and are not + * namespace qualified, the property will be ignored and not returned. + * In other words the behaviour is not orthogonal with + * {@link #setOutputProperties setOutputProperties}.
+ * + * @return A copy of the set of output properties in effect for + * the next transformation. + * + * @see javax.xml.transform.OutputKeys + * @see java.util.Properties + * @see + * XSL Transformations (XSLT) Version 1.0 + */ + public abstract Properties getOutputProperties(); + + /** + * Set an output property that will be in effect for the + * transformation. + * + *Pass a qualified property name as a two-part string, the namespace URI + * enclosed in curly braces ({}), followed by the local name. If the + * name has a null URL, the String only contain the local name. An + * application can safely check for a non-null URI by testing to see if the + * first character of the name is a '{' character.
+ *For example, if a URI and local name were obtained from an element + * defined with <xyz:foo + * xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, + * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". + * Note that no prefix is used.
+ * + *The Properties object that was passed to {@link #setOutputProperties} + * won't be effected by calling this method.
+ * + * @param name A non-null String that specifies an output + * property name, which may be namespace qualified. + * @param value The non-null string value of the output property. + * + * @throws IllegalArgumentException If the property is not supported, and is + * not qualified with a namespace. + * + * @see javax.xml.transform.OutputKeys + */ + public abstract void setOutputProperty(String name, String value) + throws IllegalArgumentException; + + /** + * Get an output property that is in effect for the + * transformer. The property specified may be a property + * that was set with setOutputProperty, or it may be a + * property specified in the stylesheet. + * + * @param name A non-null String that specifies an output + * property name, which may be namespace qualified. + * + * @return The string value of the output property, or null + * if no property was found. + * + * @throws IllegalArgumentException If the property is not supported. + * + * @see javax.xml.transform.OutputKeys + */ + public abstract String getOutputProperty(String name) + throws IllegalArgumentException; + + /** + * Set the error event listener in effect for the transformation. + * + * @param listener The new error listener. + * @throws IllegalArgumentException if listener is null. + */ + public abstract void setErrorListener(ErrorListener listener) + throws IllegalArgumentException; + + /** + * Get the error event handler in effect for the transformation. + * Implementations must provide a default error listener. + * + * @return The current error handler, which should never be null. + */ + public abstract ErrorListener getErrorListener(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerConfigurationException.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerConfigurationException.java new file mode 100644 index 000000000..50fe50d77 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerConfigurationException.java @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: TransformerConfigurationException.java 569994 2007-08-27 04:28:57Z mrglavas $ + +package javax.xml.transform; + +/** + * Indicates a serious configuration error. + */ +public class TransformerConfigurationException extends TransformerException { + + /** + * Create a newTransformerConfigurationException
with no
+ * detail message.
+ */
+ public TransformerConfigurationException() {
+ super("Configuration Error");
+ }
+
+ /**
+ * Create a new TransformerConfigurationException
with
+ * the String
specified as an error message.
+ *
+ * @param msg The error message for the exception.
+ */
+ public TransformerConfigurationException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Create a new TransformerConfigurationException
with a
+ * given Exception
base cause of the error.
+ *
+ * @param e The exception to be encapsulated in a
+ * TransformerConfigurationException.
+ */
+ public TransformerConfigurationException(Throwable e) {
+ super(e);
+ }
+
+ /**
+ * Create a new TransformerConfigurationException
with the
+ * given Exception
base cause and detail message.
+ *
+ * @param e The exception to be encapsulated in a
+ * TransformerConfigurationException
+ * @param msg The detail message.
+ */
+ public TransformerConfigurationException(String msg, Throwable e) {
+ super(msg, e);
+ }
+
+ /**
+ * Create a new TransformerConfigurationException from a message and a Locator.
+ *
+ * This constructor is especially useful when an application is + * creating its own exception from within a DocumentHandler + * callback.
+ * + * @param message The error or warning message. + * @param locator The locator object for the error or warning. + */ + public TransformerConfigurationException(String message, + SourceLocator locator) { + super(message, locator); + } + + /** + * Wrap an existing exception in a TransformerConfigurationException. + * + * @param message The error or warning message, or null to + * use the message from the embedded exception. + * @param locator The locator object for the error or warning. + * @param e Any exception. + */ + public TransformerConfigurationException(String message, + SourceLocator locator, + Throwable e) { + super(message, locator, e); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerException.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerException.java new file mode 100644 index 000000000..4c9e35dac --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerException.java @@ -0,0 +1,380 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: TransformerException.java 569994 2007-08-27 04:28:57Z mrglavas $ + +package javax.xml.transform; + +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; + +/** + * This class specifies an exceptional condition that occurred + * during the transformation process. + */ +public class TransformerException extends Exception { + + // Added serialVersionUID to preserve binary compatibility + private static final long serialVersionUID = 975798773772956428L; + + /** Field locator specifies where the error occurred */ + SourceLocator locator; + + /** + * Method getLocator retrieves an instance of a SourceLocator + * object that specifies where an error occurred. + * + * @return A SourceLocator object, or null if none was specified. + */ + public SourceLocator getLocator() { + return locator; + } + + /** + * Method setLocator sets an instance of a SourceLocator + * object that specifies where an error occurred. + * + * @param location A SourceLocator object, or null to clear the location. + */ + public void setLocator(SourceLocator location) { + locator = location; + } + + /** Field containedException specifies a wrapped exception. May be null. */ + Throwable containedException; + + /** + * This method retrieves an exception that this exception wraps. + * + * @return An Throwable object, or null. + * @see #getCause + */ + public Throwable getException() { + return containedException; + } + + /** + * Returns the cause of this throwable ornull
if the
+ * cause is nonexistent or unknown. (The cause is the throwable that
+ * caused this throwable to get thrown.)
+ */
+ public Throwable getCause() {
+
+ return ((containedException == this)
+ ? null
+ : containedException);
+ }
+
+ /**
+ * Initializes the cause of this throwable to the specified value.
+ * (The cause is the throwable that caused this throwable to get thrown.)
+ *
+ * This method can be called at most once. It is generally called from
+ * within the constructor, or immediately after creating the
+ * throwable. If this throwable was created
+ * with {@link #TransformerException(Throwable)} or
+ * {@link #TransformerException(String,Throwable)}, this method cannot be called
+ * even once.
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @return a reference to this Throwable
instance.
+ * @throws IllegalArgumentException if cause
is this
+ * throwable. (A throwable cannot
+ * be its own cause.)
+ * @throws IllegalStateException if this throwable was
+ * created with {@link #TransformerException(Throwable)} or
+ * {@link #TransformerException(String,Throwable)}, or this method has already
+ * been called on this throwable.
+ */
+ public synchronized Throwable initCause(Throwable cause) {
+
+ if (this.containedException != null) {
+ throw new IllegalStateException("Can't overwrite cause");
+ }
+
+ if (cause == this) {
+ throw new IllegalArgumentException(
+ "Self-causation not permitted");
+ }
+
+ this.containedException = cause;
+
+ return this;
+ }
+
+ /**
+ * Create a new TransformerException.
+ *
+ * @param message The error or warning message.
+ */
+ public TransformerException(String message) {
+
+ super(message);
+
+ this.containedException = null;
+ this.locator = null;
+ }
+
+ /**
+ * Create a new TransformerException wrapping an existing exception.
+ *
+ * @param e The exception to be wrapped.
+ */
+ public TransformerException(Throwable e) {
+
+ super(e.toString());
+
+ this.containedException = e;
+ this.locator = null;
+ }
+
+ /**
+ * Wrap an existing exception in a TransformerException.
+ *
+ *
This is used for throwing processor exceptions before + * the processing has started.
+ * + * @param message The error or warning message, or null to + * use the message from the embedded exception. + * @param e Any exception + */ + public TransformerException(String message, Throwable e) { + + super(((message == null) || (message.length() == 0)) + ? e.toString() + : message); + + this.containedException = e; + this.locator = null; + } + + /** + * Create a new TransformerException from a message and a Locator. + * + *This constructor is especially useful when an application is + * creating its own exception from within a DocumentHandler + * callback.
+ * + * @param message The error or warning message. + * @param locator The locator object for the error or warning. + */ + public TransformerException(String message, SourceLocator locator) { + + super(message); + + this.containedException = null; + this.locator = locator; + } + + /** + * Wrap an existing exception in a TransformerException. + * + * @param message The error or warning message, or null to + * use the message from the embedded exception. + * @param locator The locator object for the error or warning. + * @param e Any exception + */ + public TransformerException(String message, SourceLocator locator, + Throwable e) { + + super(message); + + this.containedException = e; + this.locator = locator; + } + + /** + * Get the error message with location information + * appended. + * + * @return AString
representing the error message with
+ * location information appended.
+ */
+ public String getMessageAndLocation() {
+
+ StringBuffer sbuffer = new StringBuffer();
+ String message = super.getMessage();
+
+ if (null != message) {
+ sbuffer.append(message);
+ }
+
+ if (null != locator) {
+ String systemID = locator.getSystemId();
+ int line = locator.getLineNumber();
+ int column = locator.getColumnNumber();
+
+ if (null != systemID) {
+ sbuffer.append("; SystemID: ");
+ sbuffer.append(systemID);
+ }
+
+ if (0 != line) {
+ sbuffer.append("; Line#: ");
+ sbuffer.append(line);
+ }
+
+ if (0 != column) {
+ sbuffer.append("; Column#: ");
+ sbuffer.append(column);
+ }
+ }
+
+ return sbuffer.toString();
+ }
+
+ /**
+ * Get the location information as a string.
+ *
+ * @return A string with location info, or null
+ * if there is no location information.
+ */
+ public String getLocationAsString() {
+
+ if (null != locator) {
+ StringBuffer sbuffer = new StringBuffer();
+ String systemID = locator.getSystemId();
+ int line = locator.getLineNumber();
+ int column = locator.getColumnNumber();
+
+ if (null != systemID) {
+ sbuffer.append("; SystemID: ");
+ sbuffer.append(systemID);
+ }
+
+ if (0 != line) {
+ sbuffer.append("; Line#: ");
+ sbuffer.append(line);
+ }
+
+ if (0 != column) {
+ sbuffer.append("; Column#: ");
+ sbuffer.append(column);
+ }
+
+ return sbuffer.toString();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Print the the trace of methods from where the error
+ * originated. This will trace all nested exception
+ * objects, as well as this object.
+ */
+ public void printStackTrace() {
+ printStackTrace(new java.io.PrintWriter(System.err, true));
+ }
+
+ /**
+ * Print the the trace of methods from where the error
+ * originated. This will trace all nested exception
+ * objects, as well as this object.
+ * @param s The stream where the dump will be sent to.
+ */
+ public void printStackTrace(java.io.PrintStream s) {
+ printStackTrace(new java.io.PrintWriter(s));
+ }
+
+ /**
+ * Print the the trace of methods from where the error
+ * originated. This will trace all nested exception
+ * objects, as well as this object.
+ * @param s The writer where the dump will be sent to.
+ */
+ public void printStackTrace(java.io.PrintWriter s) {
+
+ if (s == null) {
+ s = new java.io.PrintWriter(System.err, true);
+ }
+
+ try {
+ String locInfo = getLocationAsString();
+
+ if (null != locInfo) {
+ s.println(locInfo);
+ }
+
+ super.printStackTrace(s);
+ } catch (Throwable e) {}
+
+ boolean isJdk14OrHigher = false;
+ try {
+ Throwable.class.getMethod("getCause",(Class[]) null);
+ isJdk14OrHigher = true;
+ } catch (NoSuchMethodException nsme) {
+ // do nothing
+ }
+
+ // The printStackTrace method of the Throwable class in jdk 1.4
+ // and higher will include the cause when printing the backtrace.
+ // The following code is only required when using jdk 1.3 or lower
+ if (!isJdk14OrHigher) {
+ Throwable exception = getException();
+
+ for (int i = 0; (i < 10) && (null != exception); i++) {
+ s.println("---------");
+
+ try {
+ if (exception instanceof TransformerException) {
+ String locInfo =
+ ((TransformerException) exception)
+ .getLocationAsString();
+
+ if (null != locInfo) {
+ s.println(locInfo);
+ }
+ }
+
+ exception.printStackTrace(s);
+ } catch (Throwable e) {
+ s.println("Could not print stack trace...");
+ }
+
+ try {
+ Method meth =
+ ((Object) exception).getClass().getMethod("getException",
+ (Class[]) null);
+
+ if (null != meth) {
+ Throwable prev = exception;
+
+ exception = (Throwable) meth.invoke(exception, (Object[]) null);
+
+ if (prev == exception) {
+ break;
+ }
+ } else {
+ exception = null;
+ }
+ } catch (InvocationTargetException ite) {
+ exception = null;
+ } catch (IllegalAccessException iae) {
+ exception = null;
+ } catch (NoSuchMethodException nsme) {
+ exception = null;
+ }
+ }
+ }
+ // insure output is written
+ s.flush();
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerFactory.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerFactory.java
new file mode 100644
index 000000000..8b0f823a6
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerFactory.java
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: TransformerFactory.java 884963 2009-11-27 19:11:59Z mrglavas $
+
+package javax.xml.transform;
+
+/**
+ * A TransformerFactory instance can be used to create + * {@link javax.xml.transform.Transformer} and + * {@link javax.xml.transform.Templates} objects.
+ * + *The system property that determines which Factory implementation
+ * to create is named "javax.xml.transform.TransformerFactory"
.
+ * This property names a concrete subclass of the
+ * TransformerFactory
abstract class. If the property is not
+ * defined, a platform default is be used.
Get current state of canonicalization.
+ * + * @return current state canonicalization control + */ + /* + public boolean getCanonicalization() { + return canonicalState; + } + */ + + /** + *Set canonicalization control to true
or
+ * false.
TransformerFactory
.
+ * This static method creates a new factory instance
+ * This method uses the following ordered lookup procedure to determine
+ * the TransformerFactory
implementation class to
+ * load:
+ * javax.xml.transform.TransformerFactory
system
+ * property.
+ * java.util.Properties
+ *
format and contains the fully qualified name of the
+ * implementation class with the key being the system property defined
+ * above.
+ *
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and it's values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
+ * META-INF/services/javax.xml.transform.TransformerFactory
+ * in jars available to the runtime.
+ * TransformerFactory
instance.
+ *
+ * TransformerFactory
it can use the factory to configure
+ * and obtain parser instances.
+ *
+ * @return new TransformerFactory instance, never null.
+ *
+ * @throws TransformerFactoryConfigurationError Thrown if the implementation
+ * is not available or cannot be instantiated.
+ */
+ public static TransformerFactory newInstance()
+ throws TransformerFactoryConfigurationError {
+ try {
+ return (TransformerFactory) FactoryFinder.find(
+ /* The default property name according to the JAXP spec */
+ "javax.xml.transform.TransformerFactory",
+ /* The fallback implementation class name */
+ "org.apache.xalan.processor.TransformerFactoryImpl");
+ }
+ catch (FactoryFinder.ConfigurationError e) {
+ throw new TransformerFactoryConfigurationError(e.getException(), e.getMessage());
+ }
+ }
+
+ /**
+ * @return new TransformerFactory instance, never null.
+ *
+ * @throws TransformerFactoryConfigurationError Thrown if the implementation
+ * is not available or cannot be instantiated.
+ */
+ public static TransformerFactory newInstance(String factoryClassName,
+ ClassLoader classLoader) throws TransformerFactoryConfigurationError {
+ if (factoryClassName == null) {
+ throw new TransformerFactoryConfigurationError("factoryClassName cannot be null.");
+ }
+ if (classLoader == null) {
+ classLoader = SecuritySupport.getContextClassLoader();
+ }
+ try {
+ return (TransformerFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false);
+ }
+ catch (FactoryFinder.ConfigurationError e) {
+ throw new TransformerFactoryConfigurationError(e.getException(), e.getMessage());
+ }
+ }
+
+ /**
+ * Process the Source
into a Transformer
+ * Object
. The Source
is an XSLT document that
+ * conforms to
+ * XSL Transformations (XSLT) Version 1.0. Care must
+ * be taken not to use this Transformer
in multiple
+ * Thread
s running concurrently.
+ * Different TransformerFactories
can be used concurrently by
+ * different Thread
s.
Source
of XSLT document used to create
+ * Transformer
.
+ * Examples of XML Source
s include
+ * {@link javax.xml.transform.stream.StreamSource StreamSource},
+ * {@link javax.xml.transform.sax.SAXSource SAXSource},
+ * {@link javax.xml.transform.dom.DOMSource DOMSource} and
+ * {@link javax.xml.transform.stax.StAXSource StAXSource}.
+ *
+ * @return A Transformer
object that may be used to perform
+ * a transformation in a single Thread
, never
+ * null
.
+ *
+ * @throws TransformerConfigurationException Thrown if there are errors when
+ * parsing the Source
or it is not possible to create a
+ * Transformer
instance.
+ *
+ * @see
+ * XSL Transformations (XSLT) Version 1.0
+ */
+ public abstract Transformer newTransformer(Source source)
+ throws TransformerConfigurationException;
+
+ /**
+ * Create a new Transformer
that performs a copy
+ * of the Source
to the Result
.
+ * i.e. the "identity transform".
Transformer
instance.
+ */
+ public abstract Transformer newTransformer()
+ throws TransformerConfigurationException;
+
+ /**
+ * Process the Source into a Templates object, which is a
+ * a compiled representation of the source. This Templates object
+ * may then be used concurrently across multiple threads. Creating
+ * a Templates object allows the TransformerFactory to do detailed
+ * performance optimization of transformation instructions, without
+ * penalizing runtime transformation.
+ *
+ * @param source An object that holds a URL, input stream, etc.
+ *
+ * @return A Templates object capable of being used for transformation
+ * purposes, never null.
+ *
+ * @exception TransformerConfigurationException May throw this during the
+ * parse when it is constructing the Templates object and fails.
+ */
+ public abstract Templates newTemplates(Source source)
+ throws TransformerConfigurationException;
+
+ /**
+ * Get the stylesheet specification(s) associated with the
+ * XML Source
document via the
+ *
+ * xml-stylesheet processing instruction that match the given criteria.
+ * Note that it is possible to return several stylesheets, in which case
+ * they are applied as if they were a list of imports or cascades in a
+ * single stylesheet.
Source
Object
suitable for passing
+ * to the TransformerFactory
.
+ *
+ * @throws TransformerConfigurationException An Exception
+ * is thrown if an error occurs during parsing of the
+ * source
.
+ *
+ * @see
+ * Associating Style Sheets with XML documents Version 1.0
+ */
+ public abstract Source getAssociatedStylesheet(
+ Source source,
+ String media,
+ String title,
+ String charset)
+ throws TransformerConfigurationException;
+
+ /**
+ * Set an object that is used by default during the transformation
+ * to resolve URIs used in document(), xsl:import, or xsl:include.
+ *
+ * @param resolver An object that implements the URIResolver interface,
+ * or null.
+ */
+ public abstract void setURIResolver(URIResolver resolver);
+
+ /**
+ * Get the object that is used by default during the transformation
+ * to resolve URIs used in document(), xsl:import, or xsl:include.
+ *
+ * @return The URIResolver that was set with setURIResolver.
+ */
+ public abstract URIResolver getURIResolver();
+
+ //======= CONFIGURATION METHODS =======
+
+ /**
+ * Set a feature for this TransformerFactory
and Transformer
s
+ * or Template
s created by this factory.
+ * Feature names are fully qualified {@link java.net.URI}s.
+ * Implementations may define their own features.
+ * An {@link TransformerConfigurationException} is thrown if this TransformerFactory
or the
+ * Transformer
s or Template
s it creates cannot support the feature.
+ * It is possible for an TransformerFactory
to expose a feature value but be unable to change its state.
+ *
All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is:
+ *true
: the implementation will limit XML processing to conform to implementation limits
+ * and behave in a secure fashion as defined by the implementation.
+ * Examples include resolving user defined style sheets and functions.
+ * If XML processing is limited for security reasons, it will be reported via a call to the registered
+ * {@link ErrorListener#fatalError(TransformerException exception)}.
+ * See {@link #setErrorListener(ErrorListener listener)}.
+ * false
: the implementation will processing XML according to the XML specifications without
+ * regard to possible implementation limits.
+ * true
or false
.
+ *
+ * @throws TransformerConfigurationException if this TransformerFactory
+ * or the Transformer
s or Template
s it creates cannot support this feature.
+ * @throws NullPointerException If the name
parameter is null.
+ */
+ public abstract void setFeature(String name, boolean value)
+ throws TransformerConfigurationException;
+
+ /**
+ * Look up the value of a feature.
+ *
+ *
+ * Feature names are fully qualified {@link java.net.URI}s.
+ * Implementations may define their own features.
+ * false
is returned if this TransformerFactory
or the
+ * Transformer
s or Template
s it creates cannot support the feature.
+ * It is possible for an TransformerFactory
to expose a feature value but be unable to change its state.
+ *
true
or false
.
+ *
+ * @throws NullPointerException If the name
parameter is null.
+ */
+ public abstract boolean getFeature(String name);
+
+ /**
+ * Allows the user to set specific attributes on the underlying
+ * implementation. An attribute in this context is defined to
+ * be an option that the implementation provides.
+ * An IllegalArgumentException
is thrown if the underlying
+ * implementation doesn't recognize the attribute.
+ *
+ * @param name The name of the attribute.
+ * @param value The value of the attribute.
+ */
+ public abstract void setAttribute(String name, Object value);
+
+ /**
+ * Allows the user to retrieve specific attributes on the underlying
+ * implementation.
+ * An IllegalArgumentException
is thrown if the underlying
+ * implementation doesn't recognize the attribute.
+ *
+ * @param name The name of the attribute.
+ * @return value The value of the attribute.
+ */
+ public abstract Object getAttribute(String name);
+
+ /**
+ * Set the error event listener for the TransformerFactory, which
+ * is used for the processing of transformation instructions,
+ * and not for the transformation itself.
+ * An IllegalArgumentException
is thrown if the
+ * ErrorListener
listener is null
.
+ *
+ * @param listener The new error listener.
+ */
+ public abstract void setErrorListener(ErrorListener listener);
+
+ /**
+ * Get the error event handler for the TransformerFactory.
+ *
+ * @return The current error handler, which should never be null.
+ */
+ public abstract ErrorListener getErrorListener();
+
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerFactoryConfigurationError.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerFactoryConfigurationError.java
new file mode 100644
index 000000000..b738a7c9e
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/TransformerFactoryConfigurationError.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: TransformerFactoryConfigurationError.java 569994 2007-08-27 04:28:57Z mrglavas $
+
+package javax.xml.transform;
+
+/**
+ * Thrown when a problem with configuration with the Transformer Factories
+ * exists. This error will typically be thrown when the class of a
+ * transformation factory specified in the system properties cannot be found
+ * or instantiated.
+ */
+public class TransformerFactoryConfigurationError extends Error {
+
+ /**
+ * Exception
for the
+ * TransformerFactoryConfigurationError
.
+ */
+ private Exception exception;
+
+ /**
+ * Create a new TransformerFactoryConfigurationError
with no
+ * detail message.
+ */
+ public TransformerFactoryConfigurationError() {
+
+ super();
+
+ this.exception = null;
+ }
+
+ /**
+ * Create a new TransformerFactoryConfigurationError
with
+ * the String
specified as an error message.
+ *
+ * @param msg The error message for the exception.
+ */
+ public TransformerFactoryConfigurationError(String msg) {
+
+ super(msg);
+
+ this.exception = null;
+ }
+
+ /**
+ * Create a new TransformerFactoryConfigurationError
with a
+ * given Exception
base cause of the error.
+ *
+ * @param e The exception to be encapsulated in a
+ * TransformerFactoryConfigurationError.
+ */
+ public TransformerFactoryConfigurationError(Exception e) {
+
+ super(e.toString());
+
+ this.exception = e;
+ }
+
+ /**
+ * Create a new TransformerFactoryConfigurationError
with the
+ * given Exception
base cause and detail message.
+ *
+ * @param e The exception to be encapsulated in a
+ * TransformerFactoryConfigurationError
+ * @param msg The detail message.
+ */
+ public TransformerFactoryConfigurationError(Exception e, String msg) {
+
+ super(msg);
+
+ this.exception = e;
+ }
+
+ /**
+ * Return the message (if any) for this error . If there is no
+ * message for the exception and there is an encapsulated
+ * exception then the message of that exception will be returned.
+ *
+ * @return The error message.
+ */
+ public String getMessage() {
+
+ String message = super.getMessage();
+
+ if ((message == null) && (exception != null)) {
+ return exception.getMessage();
+ }
+
+ return message;
+ }
+
+ /**
+ * Return the actual exception (if any) that caused this exception to
+ * be raised.
+ *
+ * @return The encapsulated exception, or null if there is none.
+ */
+ public Exception getException() {
+ return exception;
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/URIResolver.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/URIResolver.java
new file mode 100644
index 000000000..f8ab60193
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/URIResolver.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: URIResolver.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.transform;
+
+/**
+ * An object that implements this interface that can be called by the processor + * to turn a URI used in document(), xsl:import, or xsl:include into a Source object. + */ +public interface URIResolver { + + /** + * Called by the processor when it encounters + * an xsl:include, xsl:import, or document() function. + * + * @param href An href attribute, which may be relative or absolute. + * @param base The base URI against which the first argument will be made + * absolute if the absolute URI is required. + * + * @return A Source object, or null if the href cannot be resolved, + * and the processor should try to resolve the URI itself. + * + * @throws TransformerException if an error occurs when trying to + * resolve the URI. + */ + public Source resolve(String href, String base) + throws TransformerException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMLocator.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMLocator.java new file mode 100644 index 000000000..c4389aba6 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMLocator.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: DOMLocator.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.transform.dom; + +import javax.xml.transform.SourceLocator; + +import org.w3c.dom.Node; + + +/** + * Indicates the position of a node in a source DOM, intended + * primarily for error reporting. To use a DOMLocator, the receiver of an + * error must downcast the {@link javax.xml.transform.SourceLocator} + * object returned by an exception. A {@link javax.xml.transform.Transformer} + * may use this object for purposes other than error reporting, for instance, + * to indicate the source node that originated a result node. + */ +public interface DOMLocator extends SourceLocator { + + /** + * Return the node where the event occurred. + * + * @return The node that is the location for the event. + */ + public Node getOriginatingNode(); +} + diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMResult.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMResult.java new file mode 100644 index 000000000..8a1c0d591 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMResult.java @@ -0,0 +1,350 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: DOMResult.java 569995 2007-08-27 04:31:06Z mrglavas $ + +package javax.xml.transform.dom; + +import javax.xml.transform.Result; +import org.w3c.dom.Node; + +/** + *
Acts as a holder for a transformation result tree in the form of a Document Object Model (DOM) tree.
+ * + *If no output DOM source is set, the transformation will create a Document node as the holder for the result of the transformation, + * which may be retrieved with {@link #getNode()}.
+ * + * @author Jeff Suttor + * @version $Revision: 569995 $, $Date: 2007-08-27 00:31:06 -0400 (Mon, 27 Aug 2007) $ + */ +public class DOMResult implements Result { + + /**If {@link javax.xml.transform.TransformerFactory#getFeature}
+ * returns true
when passed this value as an argument,
+ * the Transformer
supports Result
output of this type.
Zero-argument default constructor.
+ * + *node
,
+ * siblingNode
and
+ * systemId
+ * will be set to null
.
Use a DOM node to create a new output target.
+ * + *In practice, the node should be + * a {@link org.w3c.dom.Document} node, + * a {@link org.w3c.dom.DocumentFragment} node, or + * a {@link org.w3c.dom.Element} node. + * In other words, a node that accepts children.
+ * + *siblingNode
and
+ * systemId
+ * will be set to null
.
Use a DOM node to create a new output target with the specified System ID.
+ * + *
In practice, the node should be + * a {@link org.w3c.dom.Document} node, + * a {@link org.w3c.dom.DocumentFragment} node, or + * a {@link org.w3c.dom.Element} node. + * In other words, a node that accepts children.
+ * + *siblingNode
will be set to null
.
Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before.
+ * + *In practice, node
and nextSibling
should be
+ * a {@link org.w3c.dom.Document} node,
+ * a {@link org.w3c.dom.DocumentFragment} node, or
+ * a {@link org.w3c.dom.Element} node.
+ * In other words, a node that accepts children.
Use nextSibling
to specify the child node
+ * where the result nodes should be inserted before.
+ * If nextSibling
is not a sibling of node
,
+ * then an IllegalArgumentException
is thrown.
+ * If node
is null
and nextSibling
is not null
,
+ * then an IllegalArgumentException
is thrown.
+ * If nextSibling
is null
,
+ * then the behavior is the same as calling {@link #DOMResult(Node node)},
+ * i.e. append the result nodes as the last child of the specified node
.
systemId
will be set to null
.
nextSibling
is not a sibling of node
.
+ * @throws IllegalArgumentException If node
is null
and nextSibling
is not null
.
+ *
+ * @since 1.5
+ */
+ public DOMResult(Node node, Node nextSibling) {
+
+ // does the corrent parent/child relationship exist?
+ if (nextSibling != null) {
+ // cannot be a sibling of a null node
+ if (node == null) {
+ throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
+ }
+
+ // nextSibling contained by node?
+ if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
+ throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
+ }
+ }
+
+ setNode(node);
+ setNextSibling(nextSibling);
+ setSystemId(null);
+ }
+
+ /**
+ * Use a DOM node to create a new output target specifying the child node where the result nodes should be inserted before and + * the specified System ID.
+ * + *In practice, node
and nextSibling
should be
+ * a {@link org.w3c.dom.Document} node,
+ * a {@link org.w3c.dom.DocumentFragment} node, or a
+ * {@link org.w3c.dom.Element} node.
+ * In other words, a node that accepts children.
Use nextSibling
to specify the child node
+ * where the result nodes should be inserted before.
+ * If nextSibling
is not a sibling of node
,
+ * then an IllegalArgumentException
is thrown.
+ * If node
is null
and nextSibling
is not null
,
+ * then an IllegalArgumentException
is thrown.
+ * If nextSibling
is null
,
+ * then the behavior is the same as calling {@link #DOMResult(Node node, String systemId)},
+ * i.e. append the result nodes as the last child of the specified node and use the specified System ID.
nextSibling
is not a sibling of node
.
+ * @throws IllegalArgumentException If node
is null
and nextSibling
is not null
.
+ *
+ * @since 1.5
+ */
+ public DOMResult(Node node, Node nextSibling, String systemId) {
+
+ // does the current parent/child relationship exist?
+ if (nextSibling != null) {
+ // cannot be a sibling of a null node
+ if (node == null) {
+ throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
+ }
+
+ // nextSibling contained by node?
+ if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
+ throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
+ }
+ }
+
+ setNode(node);
+ setNextSibling(nextSibling);
+ setSystemId(systemId);
+ }
+
+ /**
+ * Set the node that will contain the result DOM tree.
+ * + *
In practice, the node should be + * a {@link org.w3c.dom.Document} node, + * a {@link org.w3c.dom.DocumentFragment} node, or + * a {@link org.w3c.dom.Element} node. + * In other words, a node that accepts children.
+ * + *An IllegalStateException
is thrown if nextSibling
is not null
and
+ * node
is not a parent of nextSibling
.
+ * An IllegalStateException
is thrown if node
is null
and
+ * nextSibling
is not null
.
nextSibling
is not null
and
+ * nextSibling
is not a child of node
.
+ * @throws IllegalStateException If node
is null
and
+ * nextSibling
is not null
.
+ */
+ public void setNode(Node node) {
+ // does the corrent parent/child relationship exist?
+ if (nextSibling != null) {
+ // cannot be a sibling of a null node
+ if (node == null) {
+ throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
+ }
+
+ // nextSibling contained by node?
+ if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
+ throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
+ }
+ }
+
+ this.node = node;
+ }
+
+ /**
+ * Get the node that will contain the result DOM tree.
+ * + *If no node was set via
+ * {@link #DOMResult(Node node)},
+ * {@link #DOMResult(Node node, String systeId)},
+ * {@link #DOMResult(Node node, Node nextSibling)},
+ * {@link #DOMResult(Node node, Node nextSibling, String systemId)} or
+ * {@link #setNode(Node node)},
+ * then the node will be set by the transformation, and may be obtained from this method once the transformation is complete.
+ * Calling this method before the transformation will return null
.
Set the child node before which the result nodes will be inserted.
+ * + *Use nextSibling
to specify the child node
+ * before which the result nodes should be inserted.
+ * If nextSibling
is not a descendant of node
,
+ * then an IllegalArgumentException
is thrown.
+ * If node
is null
and nextSibling
is not null
,
+ * then an IllegalStateException
is thrown.
+ * If nextSibling
is null
,
+ * then the behavior is the same as calling {@link #DOMResult(Node node)},
+ * i.e. append the result nodes as the last child of the specified node
.
nextSibling
is not a descendant of node
.
+ * @throws IllegalStateException If node
is null
and nextSibling
is not null
.
+ *
+ * @since 1.5
+ */
+ public void setNextSibling(Node nextSibling) {
+
+ // does the corrent parent/child relationship exist?
+ if (nextSibling != null) {
+ // cannot be a sibling of a null node
+ if (node == null) {
+ throw new IllegalStateException("Cannot create a DOMResult when the nextSibling is contained by the \"null\" node.");
+ }
+
+ // nextSibling contained by node?
+ if ((node.compareDocumentPosition(nextSibling)&Node.DOCUMENT_POSITION_CONTAINED_BY)==0) {
+ throw new IllegalArgumentException("Cannot create a DOMResult when the nextSibling is not contained by the node.");
+ }
+ }
+
+ this.nextSibling = nextSibling;
+ }
+
+ /**
+ * Get the child node before which the result nodes will be inserted.
+ * + *If no node was set via
+ * {@link #DOMResult(Node node, Node nextSibling)},
+ * {@link #DOMResult(Node node, Node nextSibling, String systemId)} or
+ * {@link #setNextSibling(Node nextSibling)},
+ * then null
will be returned.
Set the systemId that may be used in association with the node.
+ * + * @param systemId The system identifier as a URI string. + */ + public void setSystemId(String systemId) { + this.systemId = systemId; + } + + /** + *Get the System Identifier.
+ * + *If no System ID was set via
+ * {@link #DOMResult(Node node, String systemId)},
+ * {@link #DOMResult(Node node, Node nextSibling, String systemId)} or
+ * {@link #setSystemId(String systemId)},
+ * then null
will be returned.
The node to which the transformation will be appended.
+ */ + private Node node = null; + + /** + *The child node before which the result nodes will be inserted.
+ * + * @since 1.5 + */ + private Node nextSibling = null; + + /** + *The System ID that may be used in association with the node.
+ */ + private String systemId = null; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMSource.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMSource.java new file mode 100644 index 000000000..95d63171e --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/dom/DOMSource.java @@ -0,0 +1,132 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: DOMSource.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.transform.dom; + +import javax.xml.transform.Source; + +import org.w3c.dom.Node; + +/** + *Acts as a holder for a transformation Source tree in the + * form of a Document Object Model (DOM) tree.
+ * + *Note that XSLT requires namespace support. Attempting to transform a DOM + * that was not contructed with a namespace-aware parser may result in errors. + * Parsers can be made namespace aware by calling + * {@link javax.xml.parsers.DocumentBuilderFactory#setNamespaceAware(boolean awareness)}.
+ * + * @author Jeff Suttor + * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $ + * @see Document Object Model (DOM) Level 2 Specification + */ +public class DOMSource implements Source { + + /** + *Node
to serve as DOM source.
The base ID (URL or system ID) from where URLs + * will be resolved.
+ */ + private String systemID; + + /** If {@link javax.xml.transform.TransformerFactory#getFeature} + * returns true when passed this value as an argument, + * the Transformer supports Source input of this type. + */ + public static final String FEATURE = + "http://javax.xml.transform.dom.DOMSource/feature"; + + /** + *Zero-argument default constructor. If this constructor is used, and
+ * no DOM source is set using {@link #setNode(Node node)} , then the
+ * Transformer
will
+ * create an empty source {@link org.w3c.dom.Document} using
+ * {@link javax.xml.parsers.DocumentBuilder#newDocument()}.
This package implements DOM-specific transformation APIs.
+The {@link javax.xml.transform.dom.DOMSource} class allows the +client of the implementation of this API to specify a DOM +{@link org.w3c.dom.Node} as the source of the input tree. The model of +how the Transformer deals with the DOM tree in terms of mismatches with the +XSLT data model or +other data models is beyond the scope of this document. Any of the nodes +derived from {@link org.w3c.dom.Node} are legal input.
+The {@link javax.xml.transform.dom.DOMResult} class allows +a {@link org.w3c.dom.Node} to be specified to which result DOM nodes will +be appended. If an output node is not specified, the transformer will use +{@link javax.xml.parsers.DocumentBuilder#newDocument} to create an +output {@link org.w3c.dom.Document} node. If a node is specified, it +should be one of the following: {@link org.w3c.dom.Document}, +{@link org.w3c.dom.Element}, or +{@link org.w3c.dom.DocumentFragment}. Specification of any other node +type is implementation dependent and undefined by this API. If the result is a +{@link org.w3c.dom.Document}, the output of the transformation must have +a single element root to set as the document element.
+The {@link javax.xml.transform.dom.DOMLocator} node may be passed +to {@link javax.xml.transform.TransformerException} objects, and +retrieved by trying to cast the result of the +{@link javax.xml.transform.TransformerException#getLocator()} method. +The implementation has no responsibility to use a DOMLocator instead of a +{@link javax.xml.transform.SourceLocator} (though line numbers and the +like do not make much sense for a DOM), so the result of getLocator must always +be tested with an instanceof.
+ + diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/overview.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/overview.html new file mode 100644 index 000000000..918db9b59 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/overview.html @@ -0,0 +1,257 @@ + + + + +This overview describes the set of APIs contained in + javax.xml.transform. For the sake of brevity, these interfaces are referred to + as TrAX (Transformations for XML).
+ +There is a broad need for Java applications to be able to transform XML + and related tree-shaped data structures. In fact, XML is not normally very + useful to an application without going through some sort of transformation, + unless the semantic structure is used directly as data. Almost all XML-related + applications need to perform transformations. Transformations may be described + by Java code, Perl code, XSLT + Stylesheets, other types of script, or by proprietary formats. The inputs, one + or multiple, to a transformation, may be a URL, XML stream, a DOM tree, SAX + Events, or a proprietary format or data structure. The output types are the + pretty much the same types as the inputs, but different inputs may need to be + combined with different outputs.
+ +The great challenge of a transformation API is how to deal with all the + possible combinations of inputs and outputs, without becoming specialized for + any of the given types.
+ +The Java community will greatly benefit from a common API that will + allow them to understand and apply a single model, write to consistent + interfaces, and apply the transformations polymorphically. TrAX attempts to + define a model that is clean and generic, yet fills general application + requirements across a wide variety of uses.
+ + +This section will explain some general terminology used in this + document. Technical terminology will be explained in the Model section. In many + cases, the general terminology overlaps with the technical terminology.
+ +
+Tree
+
This term, as used within this document, describes an
+ abstract structure that consists of nodes or events that may be produced by
+ XML. A Tree physically may be a DOM tree, a series of well balanced parse
+ events (such as those coming from a SAX2 ContentHander), a series of requests
+ (the result of which can describe a tree), or a stream of marked-up
+ characters.
+Source Tree(s)
+
One or more trees that are the inputs to the
+ transformation.
+Result Tree(s)
+
One or more trees that are the output of the
+ transformation.
+Transformation
+
The processor of consuming a stream or tree to produce
+ another stream or tree.
+Identity (or Copy) Transformation
+
The process of transformation from a source to a result,
+ making as few structural changes as possible and no informational changes. The
+ term is somewhat loosely used, as the process is really a copy. from one
+ "format" (such as a DOM tree, stream, or set of SAX events) to
+ another.
+Serialization
+
The process of taking a tree and turning it into a stream. In
+ some sense, a serialization is a specialized transformation.
+Parsing
+
The process of taking a stream and turning it into a tree. In
+ some sense, parsing is a specialized transformation.
+Transformer
+
A Transformer is the object that executes the transformation.
+
+Transformation instructions
+
Describes the transformation. A form of code, script, or
+ simply a declaration or series of declarations.
+Stylesheet
+
The same as "transformation instructions," except it is
+ likely to be used in conjunction with XSLT.
+Templates
+
Another form of "transformation instructions." In the TrAX
+ interface, this term is used to describe processed or compiled transformation
+ instructions. The Source flows through a Templates object to be formed into the
+ Result.
+Processor
+
A general term for the thing that may both process the
+ transformation instructions, and perform the transformation.
+DOM
+
Document Object Model, specifically referring to the
+ Document Object Model
+ (DOM) Level 2 Specification.
+ SAX
+ Simple API for XML, specifically referring to the SAX 2.0.2 release.
+
The section defines the abstract model for TrAX, apart from the details + of the interfaces.
+ +A TRaX TransformerFactory is an object + that processes transformation instructions, and produces + Templates (in the technical + terminology). A Templates + object provides a Transformer, which transforms one or + more Sources into one or more + Results.
+ +To use the TRaX interface, you create a + TransformerFactory, + which may directly provide a Transformers, or which can provide + Templates from a variety of + Sources. The + Templates object is a processed + or compiled representation of the transformation instructions, and provides a + Transformer. The + Transformer processes a + Source according to the + instructions found in the Templates, and produces a + Result.
+ +The process of transformation from a tree, either in the form of an
+ object model, or in the form of parse events, into a stream, is known as
+ serialization
. We believe this is the most suitable term for
+ this process, despite the overlap with Java object serialization.
+Processor
+
+
+Intent: Generic concept for the
+ set of objects that implement the TrAX interfaces.
+Responsibilities: Create compiled transformation instructions, transform
+ sources, and manage transformation parameters and
+ properties.
+Thread safety: Only the Templates object can be
+ used concurrently in multiple threads. The rest of the processor does not do
+ synchronized blocking, and so may not be used to perform multiple concurrent
+ operations. Different Processors can be used concurrently by different
+ threads.
+TransformerFactory
+
+
+Intent: Serve as a vendor-neutral Processor interface for
+ XSLT and similar
+ processors.
+Responsibilities: Serve as a factory for a concrete
+ implementation of an TransformerFactory, serve as a direct factory for
+ Transformer objects, serve as a factory for Templates objects, and manage
+ processor specific features.
+Thread safety: A
+ TransformerFactory may not perform multiple concurrent
+ operations.
+Templates
+
+
+Intent: The
+ runtime representation of the transformation instructions.
+Responsibilities: A data bag for transformation instructions; act as a factory
+ for Transformers.
+Thread safety: Thread-safe for concurrent
+ usage over multiple threads once construction is complete.
+Transformer
+
+
+Intent: Act as a per-thread
+ execution context for transformations, act as an interface for performing the
+ transformation.
+Responsibilities: Perform the
+ transformation.
+Thread safety: Only one instance per thread
+ is safe.
+Notes: The Transformer is bound to the Templates
+ object that created it.
+Source
+
+
+Intent: Serve as a
+ single vendor-neutral object for multiple types of input.
+Responsibilities: Act as simple data holder for System IDs, DOM nodes, streams,
+ etc.
+Thread safety: Thread-safe concurrently over multiple
+ threads for read-only operations; must be synchronized for edit
+ operations.
+Result
+
+
+Potential alternate name: ResultTarget
+Intent: Serve
+ as a single object for multiple types of output, so there can be simple process
+ method signatures.
+Responsibilities: Act as simple data holder for
+ output stream, DOM node, ContentHandler, etc.
+Thread safety: Thread-safe concurrently over multiple threads for read-only,
+ must be synchronized for edit.
This package defines the generic APIs for processing transformation +instructions, and performing a transformation from source to result. These +interfaces have no dependencies on SAX or the DOM standard, and try to make as +few assumptions as possible about the details of the source and result of a +transformation. It achieves this by defining +{@link javax.xml.transform.Source} and +{@link javax.xml.transform.Result} interfaces. +
+ +To define concrete classes for the user, the API defines specializations +of the interfaces found at the root level. These interfaces are found in +{@link javax.xml.transform.sax}, {@link javax.xml.transform.dom}, +and {@link javax.xml.transform.stream}. +
+ + +The API allows a concrete +{@link javax.xml.transform.TransformerFactory} object to be created from +the static function +{@link javax.xml.transform.TransformerFactory#newInstance}. +
+ + +This API defines two interface objects called +{@link javax.xml.transform.Source} and +{@link javax.xml.transform.Result}. In order to pass Source and Result +objects to the interfaces, concrete classes must be used. +Three concrete representations are defined for each of these +objects: +{@link javax.xml.transform.stream.StreamSource} and +{@link javax.xml.transform.stream.StreamResult}, +{@link javax.xml.transform.sax.SAXSource} and +{@link javax.xml.transform.sax.SAXResult}, and +{@link javax.xml.transform.dom.DOMSource} and +{@link javax.xml.transform.dom.DOMResult}. Each of these objects defines +a FEATURE string (which is i the form of a URL), which can be passed into +{@link javax.xml.transform.TransformerFactory#getFeature} to see if the +given type of Source or Result object is supported. For instance, to test if a +DOMSource and a StreamResult is supported, you can apply the following +test. +
+ +
+
+TransformerFactory tfactory = TransformerFactory.newInstance();
+if (tfactory.getFeature(DOMSource.FEATURE) && tfactory.getFeature(StreamResult.FEATURE)) {
+...
+}
+
+
+
+
+Namespaces +present something of a problem area when dealing with XML objects. Qualified +Names appear in XML markup as prefixed names. But the prefixes themselves do +not hold identity. Rather, it is the URIs that they contextually map to that +hold the identity. Therefore, when passing a Qualified Name like "xyz:foo" +among Java programs, one must provide a means to map "xyz" to a namespace. +
+ +One solution has been to create a "QName" object that holds the +namespace URI, as well as the prefix and local name, but this is not always an +optimal solution, as when, for example, you want to use unique strings as keys +in a dictionary object. Not having a string representation also makes it +difficult to specify a namespaced identity outside the context of an XML +document. +
+ +In order to pass namespaced values to transformations, +for +instance when setting a property or a parameter on a +{@link javax.xml.transform.Transformer} object, +this specification defines that a +String "qname" object parameter be passed as two-part string, the namespace URI +enclosed in curly braces ({}), followed by the local name. If the qname has a +null URI, then the String object only contains the local name. An application +can safely check for a non-null URI by testing to see if the first character of +the name is a '{' character. +
+ +For example, if a URI and local name were obtained from an element +defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, +then the Qualified Name would be "{http://xyz.foo.com/yada/baz.html}foo". +Note that the prefix is lost. +
+ + +Serialization of the result tree to a stream can be controlled with +the {@link javax.xml.transform.Transformer#setOutputProperties} and the +{@link javax.xml.transform.Transformer#setOutputProperty} methods. +These properties only apply to stream results, they have no effect when +the result is a DOM tree or SAX event stream.
+ +Strings that match the XSLT +specification for xsl:output attributes can be referenced from the +{@link javax.xml.transform.OutputKeys} class. Other strings can be +specified as well. +If the transformer does not recognize an output key, a +{@link java.lang.IllegalArgumentException} is thrown, unless the +key name is namespace qualified. Output key names +that are namespace qualified are always allowed, although they may be +ignored by some implementations.
+ +If all that is desired is the simple identity transformation of a +source to a result, then {@link javax.xml.transform.TransformerFactory} +provides a +{@link javax.xml.transform.TransformerFactory#newTransformer()} method +with no arguments. This method creates a Transformer that effectively copies +the source to the result. This method may be used to create a DOM from SAX +events or to create an XML or HTML stream from a DOM or SAX events.
+ +The transformation API throw three types of specialized exceptions. A +{@link javax.xml.transform.TransformerFactoryConfigurationError} is parallel to +the {@link javax.xml.parsers.FactoryConfigurationError}, and is thrown +when a configuration problem with the TransformerFactory exists. This error +will typically be thrown when the transformation factory class specified with +the "javax.xml.transform.TransformerFactory" system property cannot be found or +instantiated.
+ +A {@link javax.xml.transform.TransformerConfigurationException} +may be thrown if for any reason a Transformer can not be created. A +TransformerConfigurationException may be thrown if there is a syntax error in +the transformation instructions, for example when +{@link javax.xml.transform.TransformerFactory#newTransformer} is +called.
+ +{@link javax.xml.transform.TransformerException} is a general +exception that occurs during the course of a transformation. A transformer +exception may wrap another exception, and if any of the +{@link javax.xml.transform.TransformerException#printStackTrace()} +methods are called on it, it will produce a list of stack dumps, starting from +the most recent. The transformer exception also provides a +{@link javax.xml.transform.SourceLocator} object which indicates where +in the source tree or transformation instructions the error occurred. +{@link javax.xml.transform.TransformerException#getMessageAndLocation()} +may be called to get an error message with location info, and +{@link javax.xml.transform.TransformerException#getLocationAsString()} +may be called to get just the location string.
+ +Transformation warnings and errors are sent to an
+{@link javax.xml.transform.ErrorListener}, at which point the
+application may decide to report the error or warning, and may decide to throw
+an Exception
for a non-fatal error. The ErrorListener
may be set via
+{@link javax.xml.transform.TransformerFactory#setErrorListener} for
+reporting errors that have to do with syntax errors in the transformation
+instructions, or via
+{@link javax.xml.transform.Transformer#setErrorListener} to report
+errors that occur during the transformation. The ErrorListener
on both objects
+will always be valid and non-null
, whether set by the application or a default
+implementation provided by the processor.
+The default implementation provided by the processor will report all warnings and errors to System.err
+and does not throw any Exception
s.
+Applications are strongly encouraged to register and use
+ErrorListener
s that insure proper behavior for warnings and
+errors.
+
The API provides a way for URIs referenced from within the stylesheet
+instructions or within the transformation to be resolved by the calling
+application. This can be done by creating a class that implements the
+{@link javax.xml.transform.URIResolver} interface, with its one method,
+{@link javax.xml.transform.URIResolver#resolve}, and use this class to
+set the URI resolution for the transformation instructions or transformation
+with {@link javax.xml.transform.TransformerFactory#setURIResolver} or
+{@link javax.xml.transform.Transformer#setURIResolver}. The
+URIResolver.resolve
method takes two String arguments, the URI found in the
+stylesheet instructions or built as part of the transformation process, and the
+base URI
+against which the first argument will be made absolute if the
+absolute URI is required.
+The returned {@link javax.xml.transform.Source} object must be usable by
+the transformer, as specified in its implemented features.
Acts as an holder for a transformation Result.
+ * + * @author Jeff Suttor + */ +public class SAXResult implements Result { + + /** + * If {@link javax.xml.transform.TransformerFactory#getFeature} + * returns true when passed this value as an argument, + * the Transformer supports Result output of this type. + */ + public static final String FEATURE = + "http://javax.xml.transform.sax.SAXResult/feature"; + + /** + * Zero-argument default constructor. + */ + public SAXResult() { + } + + /** + * Create a SAXResult that targets a SAX2 {@link org.xml.sax.ContentHandler}. + * + * @param handler Must be a non-null ContentHandler reference. + */ + public SAXResult(ContentHandler handler) { + setHandler(handler); + } + + /** + * Set the target to be a SAX2 {@link org.xml.sax.ContentHandler}. + * + * @param handler Must be a non-null ContentHandler reference. + */ + public void setHandler(ContentHandler handler) { + this.handler = handler; + } + + /** + * Get the {@link org.xml.sax.ContentHandler} that is the Result. + * + * @return The ContentHandler that is to be transformation output. + */ + public ContentHandler getHandler() { + return handler; + } + + /** + * Set the SAX2 {@link org.xml.sax.ext.LexicalHandler} for the output. + * + *This is needed to handle XML comments and the like. If the
+ * lexical handler is not set, an attempt should be made by the
+ * transformer to cast the {@link org.xml.sax.ContentHandler} to a
+ * LexicalHandler
.
LexicalHandler
for
+ * handling lexical parse events.
+ */
+ public void setLexicalHandler(LexicalHandler handler) {
+ this.lexhandler = handler;
+ }
+
+ /**
+ * Get a SAX2 {@link org.xml.sax.ext.LexicalHandler} for the output.
+ *
+ * @return A LexicalHandler
, or null.
+ */
+ public LexicalHandler getLexicalHandler() {
+ return lexhandler;
+ }
+
+ /**
+ * Method setSystemId Set the systemID that may be used in association
+ * with the {@link org.xml.sax.ContentHandler}.
+ *
+ * @param systemId The system identifier as a URI string.
+ */
+ public void setSystemId(String systemId) {
+ this.systemId = systemId;
+ }
+
+ /**
+ * Get the system identifier that was set with setSystemId.
+ *
+ * @return The system identifier that was set with setSystemId, or null
+ * if setSystemId was not called.
+ */
+ public String getSystemId() {
+ return systemId;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Internal state.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * The handler for parse events.
+ */
+ private ContentHandler handler;
+
+ /**
+ * The handler for lexical events.
+ */
+ private LexicalHandler lexhandler;
+
+ /**
+ * The systemID that may be used in association
+ * with the node.
+ */
+ private String systemId;
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/SAXSource.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/SAXSource.java
new file mode 100644
index 000000000..bd4c31d32
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/SAXSource.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id: SAXSource.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.transform.sax;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * Acts as an holder for SAX-style Source.
+ * + *Note that XSLT requires namespace support. Attempting to transform an + * input source that is not + * generated with a namespace-aware parser may result in errors. + * Parsers can be made namespace aware by calling the + * {@link javax.xml.parsers.SAXParserFactory#setNamespaceAware(boolean awareness)} method.
+ * + * @author Jeff Suttor + * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $ + */ +public class SAXSource implements Source { + + /** + * If {@link javax.xml.transform.TransformerFactory#getFeature} + * returns true when passed this value as an argument, + * the Transformer supports Source input of this type. + */ + public static final String FEATURE = + "http://javax.xml.transform.sax.SAXSource/feature"; + + /** + *Zero-argument default constructor. If this constructor is used, and
+ * no SAX source is set using
+ * {@link #setInputSource(InputSource inputSource)} , then the
+ * Transformer
will
+ * create an empty source {@link org.xml.sax.InputSource} using
+ * {@link org.xml.sax.InputSource#InputSource() new InputSource()}.
SAXSource
, using an {@link org.xml.sax.XMLReader}
+ * and a SAX InputSource. The {@link javax.xml.transform.Transformer}
+ * or {@link javax.xml.transform.sax.SAXTransformerFactory} will set itself
+ * to be the reader's {@link org.xml.sax.ContentHandler}, and then will call
+ * reader.parse(inputSource).
+ *
+ * @param reader An XMLReader to be used for the parse.
+ * @param inputSource A SAX input source reference that must be non-null
+ * and that will be passed to the reader parse method.
+ */
+ public SAXSource(XMLReader reader, InputSource inputSource) {
+ this.reader = reader;
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Create a SAXSource
, using a SAX InputSource
.
+ * The {@link javax.xml.transform.Transformer} or
+ * {@link javax.xml.transform.sax.SAXTransformerFactory} creates a
+ * reader via {@link org.xml.sax.helpers.XMLReaderFactory}
+ * (if setXMLReader is not used), sets itself as
+ * the reader's {@link org.xml.sax.ContentHandler}, and calls
+ * reader.parse(inputSource).
+ *
+ * @param inputSource An input source reference that must be non-null
+ * and that will be passed to the parse method of the reader.
+ */
+ public SAXSource(InputSource inputSource) {
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Set the XMLReader to be used for the Source.
+ *
+ * @param reader A valid XMLReader or XMLFilter reference.
+ */
+ public void setXMLReader(XMLReader reader) {
+ this.reader = reader;
+ }
+
+ /**
+ * Get the XMLReader to be used for the Source.
+ *
+ * @return A valid XMLReader or XMLFilter reference, or null.
+ */
+ public XMLReader getXMLReader() {
+ return reader;
+ }
+
+ /**
+ * Set the SAX InputSource to be used for the Source.
+ *
+ * @param inputSource A valid InputSource reference.
+ */
+ public void setInputSource(InputSource inputSource) {
+ this.inputSource = inputSource;
+ }
+
+ /**
+ * Get the SAX InputSource to be used for the Source.
+ *
+ * @return A valid InputSource reference, or null.
+ */
+ public InputSource getInputSource() {
+ return inputSource;
+ }
+
+ /**
+ * Set the system identifier for this Source. If an input source
+ * has already been set, it will set the system ID or that
+ * input source, otherwise it will create a new input source.
+ *
+ * The system identifier is optional if there is a byte stream + * or a character stream, but it is still useful to provide one, + * since the application can use it to resolve relative URIs + * and can include it in error messages and warnings (the parser + * will attempt to open a connection to the URI only if + * no byte stream or character stream is specified).
+ * + * @param systemId The system identifier as a URI string. + */ + public void setSystemId(String systemId) { + + if (null == inputSource) { + inputSource = new InputSource(systemId); + } else { + inputSource.setSystemId(systemId); + } + } + + /** + *Get the base ID (URI or system ID) from where URIs + * will be resolved.
+ * + * @return Base URL for theSource
, or null
.
+ */
+ public String getSystemId() {
+
+ if (inputSource == null) {
+ return null;
+ } else {
+ return inputSource.getSystemId();
+ }
+ }
+
+ /**
+ * The XMLReader to be used for the source tree input. May be null.
+ */
+ private XMLReader reader;
+
+ /**
+ * The SAX InputSource to be used for the source tree input.
+ * Should not be null
.
If an application wants to set the ErrorHandler or EntityResolver + * for an XMLReader used during a transformation, it should use a URIResolver + * to return the SAXSource which provides (with getXMLReader) a reference to + * the XMLReader.
+ */ +public abstract class SAXTransformerFactory extends TransformerFactory { + + /** If {@link javax.xml.transform.TransformerFactory#getFeature} + * returns true when passed this value as an argument, + * the TransformerFactory returned from + * {@link javax.xml.transform.TransformerFactory#newInstance} may + * be safely cast to a SAXTransformerFactory. + */ + public static final String FEATURE = + "http://javax.xml.transform.sax.SAXTransformerFactory/feature"; + + /** If {@link javax.xml.transform.TransformerFactory#getFeature} + * returns true when passed this value as an argument, + * the {@link #newXMLFilter(Source src)} + * and {@link #newXMLFilter(Templates templates)} methods are supported. + */ + public static final String FEATURE_XMLFILTER = + "http://javax.xml.transform.sax.SAXTransformerFactory/feature/xmlfilter"; + + /** + * The default constructor is protected on purpose. + */ + protected SAXTransformerFactory() {} + + /** + * Get a TransformerHandler object that can process SAX + * ContentHandler events into a Result, based on the transformation + * instructions specified by the argument. + * + * @param src The Source of the transformation instructions. + * + * @return TransformerHandler ready to transform SAX events. + * + * @throws TransformerConfigurationException If for some reason the + * TransformerHandler can not be created. + */ + public abstract TransformerHandler newTransformerHandler(Source src) + throws TransformerConfigurationException; + + /** + * Get a TransformerHandler object that can process SAX + * ContentHandler events into a Result, based on the Templates argument. + * + * @param templates The compiled transformation instructions. + * + * @return TransformerHandler ready to transform SAX events. + * + * @throws TransformerConfigurationException If for some reason the + * TransformerHandler can not be created. + */ + public abstract TransformerHandler newTransformerHandler( + Templates templates) throws TransformerConfigurationException; + + /** + * Get a TransformerHandler object that can process SAX + * ContentHandler events into a Result. The transformation + * is defined as an identity (or copy) transformation, for example + * to copy a series of SAX parse events into a DOM tree. + * + * @return A non-null reference to a TransformerHandler, that may + * be used as a ContentHandler for SAX parse events. + * + * @throws TransformerConfigurationException If for some reason the + * TransformerHandler cannot be created. + */ + public abstract TransformerHandler newTransformerHandler() + throws TransformerConfigurationException; + + /** + * Get a TemplatesHandler object that can process SAX + * ContentHandler events into a Templates object. + * + * @return A non-null reference to a TransformerHandler, that may + * be used as a ContentHandler for SAX parse events. + * + * @throws TransformerConfigurationException If for some reason the + * TemplatesHandler cannot be created. + */ + public abstract TemplatesHandler newTemplatesHandler() + throws TransformerConfigurationException; + + /** + * Create an XMLFilter that uses the given Source as the + * transformation instructions. + * + * @param src The Source of the transformation instructions. + * + * @return An XMLFilter object, or null if this feature is not supported. + * + * @throws TransformerConfigurationException If for some reason the + * TemplatesHandler cannot be created. + */ + public abstract XMLFilter newXMLFilter(Source src) + throws TransformerConfigurationException; + + /** + * Create an XMLFilter, based on the Templates argument.. + * + * @param templates The compiled transformation instructions. + * + * @return An XMLFilter object, or null if this feature is not supported. + * + * @throws TransformerConfigurationException If for some reason the + * TemplatesHandler cannot be created. + */ + public abstract XMLFilter newXMLFilter(Templates templates) + throws TransformerConfigurationException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/TemplatesHandler.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/TemplatesHandler.java new file mode 100644 index 000000000..4a31c2f7b --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/TemplatesHandler.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: TemplatesHandler.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.transform.sax; + +import javax.xml.transform.*; + +import org.xml.sax.ContentHandler; + +/** + * A SAX ContentHandler that may be used to process SAX + * parse events (parsing transformation instructions) into a Templates object. + * + *Note that TemplatesHandler does not need to implement LexicalHandler.
+ */ +public interface TemplatesHandler extends ContentHandler { + + /** + * When a TemplatesHandler object is used as a ContentHandler + * for the parsing of transformation instructions, it creates a Templates object, + * which the caller can get once the SAX events have been completed. + * + * @return The Templates object that was created during + * the SAX event process, or null if no Templates object has + * been created. + * + */ + public Templates getTemplates(); + + /** + * Set the base ID (URI or system ID) for the Templates object + * created by this builder. This must be set in order to + * resolve relative URIs in the stylesheet. This must be + * called before the startDocument event. + * + * @param systemID Base URI for this stylesheet. + */ + public void setSystemId(String systemID); + + /** + * Get the base ID (URI or system ID) from where relative + * URLs will be resolved. + * @return The systemID that was set with {@link #setSystemId}. + */ + public String getSystemId(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/TransformerHandler.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/TransformerHandler.java new file mode 100644 index 000000000..f044ac0ce --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/TransformerHandler.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: TransformerHandler.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.transform.sax; + +import javax.xml.transform.Result; +import javax.xml.transform.Transformer; + +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.ext.LexicalHandler; + +/** + * A TransformerHandler + * listens for SAX ContentHandler parse events and transforms + * them to a Result. + */ +public interface TransformerHandler + extends ContentHandler, LexicalHandler, DTDHandler { + + /** + *Set the Result
associated with this
+ * TransformerHandler
to be used for the transformation.
Result
instance, should not be
+ * null
.
+ *
+ * @throws IllegalArgumentException if result is invalid for some reason.
+ */
+ public void setResult(Result result) throws IllegalArgumentException;
+
+ /**
+ * Set the base ID (URI or system ID) from where relative
+ * URLs will be resolved.
+ * @param systemID Base URI for the source tree.
+ */
+ public void setSystemId(String systemID);
+
+ /**
+ * Get the base ID (URI or system ID) from where relative
+ * URLs will be resolved.
+ * @return The systemID that was set with {@link #setSystemId}.
+ */
+ public String getSystemId();
+
+ /**
+ * Get the Transformer
associated with this handler, which
+ * is needed in order to set parameters and output properties.
Transformer
associated with this
+ * TransformerHandler
.
+ */
+ public Transformer getTransformer();
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/package.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/package.html
new file mode 100644
index 000000000..7a0d707bc
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/sax/package.html
@@ -0,0 +1,69 @@
+
+
+
+
+This package implements SAX2-specific transformation APIs. It provides + classes which allow input from {@link org.xml.sax.ContentHandler} + events, and also classes that produce org.xml.sax.ContentHandler events. It + also provides methods to set the input source as an + {@link org.xml.sax.XMLReader}, or to use a + {@link org.xml.sax.InputSource} as the source. It also allows the + creation of a {@link org.xml.sax.XMLFilter}, which enables + transformations to "pull" from other transformations, and lets the transformer + to be used polymorphically as an {@link org.xml.sax.XMLReader}.
+The {@link javax.xml.transform.sax.SAXSource} class allows the + setting of an {@link org.xml.sax.XMLReader} to be used for "pulling" + parse events, and an {@link org.xml.sax.InputSource} that may be used to + specify the SAX source.
+The {@link javax.xml.transform.sax.SAXResult} class allows the + setting of a {@link org.xml.sax.ContentHandler} to be the receiver of + SAX2 events from the transformation. +
The {@link javax.xml.transform.sax.SAXTransformerFactory} extends + {@link javax.xml.transform.TransformerFactory} to provide factory + methods for creating {@link javax.xml.transform.sax.TemplatesHandler}, + {@link javax.xml.transform.sax.TransformerHandler}, and + {@link org.xml.sax.XMLReader} instances.
+To obtain a {@link javax.xml.transform.sax.SAXTransformerFactory}, + the caller must cast the {@link javax.xml.transform.TransformerFactory} + instance returned from + {@link javax.xml.transform.TransformerFactory#newInstance}. + +
The {@link javax.xml.transform.sax.TransformerHandler} interface + allows a transformation to be created from SAX2 parse events, which is a "push" + model rather than the "pull" model that normally occurs for a transformation. + Normal parse events are received through the + {@link org.xml.sax.ContentHandler} interface, lexical events such as + startCDATA and endCDATA are received through the + {@link org.xml.sax.ext.LexicalHandler} interface, and events that signal + the start or end of disabling output escaping are received via + {@link org.xml.sax.ContentHandler#processingInstruction}, with the + target parameter being + {@link javax.xml.transform.Result#PI_DISABLE_OUTPUT_ESCAPING} and + {@link javax.xml.transform.Result#PI_ENABLE_OUTPUT_ESCAPING}. If + parameters, output properties, or other features need to be set on the + Transformer handler, a {@link javax.xml.transform.Transformer} reference + will need to be obtained from + {@link javax.xml.transform.sax.TransformerHandler#getTransformer}, and + the methods invoked from that reference. + +
The {@link javax.xml.transform.sax.TemplatesHandler} interface + allows the creation of {@link javax.xml.transform.Templates} objects + from SAX2 parse events. Once the {@link org.xml.sax.ContentHandler} + events are complete, the Templates object may be obtained from + {@link javax.xml.transform.sax.TemplatesHandler#getTemplates}. Note that + {@link javax.xml.transform.sax.TemplatesHandler#setSystemId} should + normally be called in order to establish a base system ID from which relative + URLs may be resolved. +
The + {@link javax.xml.transform.sax.SAXTransformerFactory#newXMLFilter} + method allows the creation of a {@link org.xml.sax.XMLFilter}, which + encapsulates the SAX2 notion of a "pull" transformation. The following + illustrates several transformations chained together. Each filter points to a + parent {@link org.xml.sax.XMLReader}, and the final transformation is + caused by invoking {@link org.xml.sax.XMLReader#parse} on the final + reader in the chain.
+ + diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stax/StAXResult.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stax/StAXResult.java new file mode 100644 index 000000000..0c19f98a8 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stax/StAXResult.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: StAXResult.java 670395 2008-06-22 18:50:54Z mrglavas $ + +package javax.xml.transform.stax; + +import javax.xml.stream.XMLEventWriter; +import javax.xml.stream.XMLStreamWriter; +import javax.xml.transform.Result; + +public class StAXResult implements Result { + + public static final String FEATURE = "http://javax.xml.transform.stax.StAXResult/feature"; + + private final XMLStreamWriter xmlStreamWriter; + private final XMLEventWriter xmlEventWriter; + + public StAXResult(XMLStreamWriter xmlStreamWriter) { + if (xmlStreamWriter == null) { + throw new IllegalArgumentException("XMLStreamWriter cannot be null."); + } + this.xmlStreamWriter = xmlStreamWriter; + this.xmlEventWriter = null; + } + + public StAXResult(XMLEventWriter xmlEventWriter) { + if (xmlEventWriter == null) { + throw new IllegalArgumentException("XMLEventWriter cannot be null."); + } + this.xmlStreamWriter = null; + this.xmlEventWriter = xmlEventWriter; + } + + public XMLStreamWriter getXMLStreamWriter() { + return xmlStreamWriter; + } + + public XMLEventWriter getXMLEventWriter() { + return xmlEventWriter; + } + + public String getSystemId() { + return null; + } + + public void setSystemId(String systemId) { + throw new UnsupportedOperationException("Setting systemId is not supported."); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stax/StAXSource.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stax/StAXSource.java new file mode 100644 index 000000000..5cc384f03 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stax/StAXSource.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: StAXSource.java 670394 2008-06-22 18:50:36Z mrglavas $ + +package javax.xml.transform.stax; + +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.events.XMLEvent; +import javax.xml.transform.Source; + +public class StAXSource implements Source { + + public static final String FEATURE = "http://javax.xml.transform.stax.StAXSource/feature"; + + private final XMLStreamReader xmlStreamReader; + private final XMLEventReader xmlEventReader; + private final String systemId; + + public StAXSource(XMLStreamReader xmlStreamReader) { + if (xmlStreamReader == null) { + throw new IllegalArgumentException("XMLStreamReader cannot be null."); + } + final int event = xmlStreamReader.getEventType(); + if (event != XMLStreamConstants.START_DOCUMENT && + event != XMLStreamConstants.START_ELEMENT) { + throw new IllegalStateException("The state of the XMLStreamReader must be START_DOCUMENT or START_ELEMENT"); + } + this.xmlStreamReader = xmlStreamReader; + this.xmlEventReader = null; + this.systemId = xmlStreamReader.getLocation().getSystemId(); + } + + public StAXSource(XMLEventReader xmlEventReader) + throws XMLStreamException { + if (xmlEventReader == null) { + throw new IllegalArgumentException("XMLEventReader cannot be null."); + } + final XMLEvent event = xmlEventReader.peek(); + if (!event.isStartDocument() && + !event.isStartElement()) { + throw new IllegalStateException("The state of the XMLEventReader must be START_DOCUMENT or START_ELEMENT"); + } + this.xmlStreamReader = null; + this.xmlEventReader = xmlEventReader; + this.systemId = event.getLocation().getSystemId(); + } + + public XMLStreamReader getXMLStreamReader() { + return xmlStreamReader; + } + + public XMLEventReader getXMLEventReader() { + return xmlEventReader; + } + + public String getSystemId() { + return systemId; + } + + public void setSystemId(String systemId) { + throw new UnsupportedOperationException("Setting systemId is not supported."); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/FilePathToURI.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/FilePathToURI.java new file mode 100644 index 000000000..631031221 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/FilePathToURI.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.xml.transform.stream; + +class FilePathToURI { + + // which ASCII characters need to be escaped + private static boolean gNeedEscaping[] = new boolean[128]; + // the first hex character if a character needs to be escaped + private static char gAfterEscaping1[] = new char[128]; + // the second hex character if a character needs to be escaped + private static char gAfterEscaping2[] = new char[128]; + private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + // initialize the above 3 arrays + static { + for (int i = 0; i <= 0x1f; i++) { + gNeedEscaping[i] = true; + gAfterEscaping1[i] = gHexChs[i >> 4]; + gAfterEscaping2[i] = gHexChs[i & 0xf]; + } + gNeedEscaping[0x7f] = true; + gAfterEscaping1[0x7f] = '7'; + gAfterEscaping2[0x7f] = 'F'; + char[] escChs = {' ', '<', '>', '#', '%', '"', '{', '}', + '|', '\\', '^', '~', '[', ']', '`'}; + int len = escChs.length; + char ch; + for (int i = 0; i < len; i++) { + ch = escChs[i]; + gNeedEscaping[ch] = true; + gAfterEscaping1[ch] = gHexChs[ch >> 4]; + gAfterEscaping2[ch] = gHexChs[ch & 0xf]; + } + } + + // To escape a file path to a URI, by using %HH to represent + // special ASCII characters: 0x00~0x1F, 0x7F, ' ', '<', '>', '#', '%' + // and '"' and non-ASCII characters (whose value >= 128). + public static String filepath2URI(String path){ + // return null if path is null. + if (path == null) + return null; + + char separator = java.io.File.separatorChar; + path = path.replace(separator, '/'); + + int len = path.length(), ch; + StringBuffer buffer = new StringBuffer(len*3); + buffer.append("file://"); + // change C:/blah to /C:/blah + if (len >= 2 && path.charAt(1) == ':') { + ch = Character.toUpperCase(path.charAt(0)); + if (ch >= 'A' && ch <= 'Z') { + buffer.append('/'); + } + } + + // for each character in the path + int i = 0; + for (; i < len; i++) { + ch = path.charAt(i); + // if it's not an ASCII character, break here, and use UTF-8 encoding + if (ch >= 128) + break; + if (gNeedEscaping[ch]) { + buffer.append('%'); + buffer.append(gAfterEscaping1[ch]); + buffer.append(gAfterEscaping2[ch]); + // record the fact that it's escaped + } + else { + buffer.append((char)ch); + } + } + + // we saw some non-ascii character + if (i < len) { + // get UTF-8 bytes for the remaining sub-string + byte[] bytes = null; + byte b; + try { + bytes = path.substring(i).getBytes("UTF-8"); + } catch (java.io.UnsupportedEncodingException e) { + // should never happen + return path; + } + len = bytes.length; + + // for each byte + for (i = 0; i < len; i++) { + b = bytes[i]; + // for non-ascii character: make it positive, then escape + if (b < 0) { + ch = b + 256; + buffer.append('%'); + buffer.append(gHexChs[ch >> 4]); + buffer.append(gHexChs[ch & 0xf]); + } + else if (gNeedEscaping[b]) { + buffer.append('%'); + buffer.append(gAfterEscaping1[b]); + buffer.append(gAfterEscaping2[b]); + } + else { + buffer.append((char)b); + } + } + } + + return buffer.toString(); + } + +}//FilePathToURI diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/StreamResult.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/StreamResult.java new file mode 100644 index 000000000..7a92a7c0d --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/StreamResult.java @@ -0,0 +1,195 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: StreamResult.java 829970 2009-10-26 21:15:29Z mrglavas $ + +package javax.xml.transform.stream; + +import java.io.File; +import java.io.OutputStream; +import java.io.Writer; + +import javax.xml.transform.Result; + +/** + *Acts as an holder for a transformation result, + * which may be XML, plain Text, HTML, or some other form of markup.
+ * + * @author Jeff Suttor + */ +public class StreamResult implements Result { + + /** If {@link javax.xml.transform.TransformerFactory#getFeature} + * returns true when passed this value as an argument, + * the Transformer supports Result output of this type. + */ + public static final String FEATURE = + "http://javax.xml.transform.stream.StreamResult/feature"; + + /** + * Zero-argument default constructor. + */ + public StreamResult() { + } + + /** + * Construct a StreamResult from a byte stream. Normally, + * a stream should be used rather than a reader, so that + * the transformer may use instructions contained in the + * transformation instructions to control the encoding. + * + * @param outputStream A valid OutputStream reference. + */ + public StreamResult(OutputStream outputStream) { + setOutputStream(outputStream); + } + + /** + * Construct a StreamResult from a character stream. Normally, + * a stream should be used rather than a reader, so that + * the transformer may use instructions contained in the + * transformation instructions to control the encoding. However, + * there are times when it is useful to write to a character + * stream, such as when using a StringWriter. + * + * @param writer A valid Writer reference. + */ + public StreamResult(Writer writer) { + setWriter(writer); + } + + /** + * Construct a StreamResult from a URL. + * + * @param systemId Must be a String that conforms to the URI syntax. + */ + public StreamResult(String systemId) { + this.systemId = systemId; + } + + /** + * Construct a StreamResult from a File. + * + * @param f Must a non-null File reference. + */ + public StreamResult(File f) { + setSystemId(f); + } + + /** + * Set the ByteStream that is to be written to. Normally, + * a stream should be used rather than a reader, so that + * the transformer may use instructions contained in the + * transformation instructions to control the encoding. + * + * @param outputStream A valid OutputStream reference. + */ + public void setOutputStream(OutputStream outputStream) { + this.outputStream = outputStream; + } + + /** + * Get the byte stream that was set with setOutputStream. + * + * @return The byte stream that was set with setOutputStream, or null + * if setOutputStream or the ByteStream constructor was not called. + */ + public OutputStream getOutputStream() { + return outputStream; + } + + /** + * Set the writer that is to receive the result. Normally, + * a stream should be used rather than a writer, so that + * the transformer may use instructions contained in the + * transformation instructions to control the encoding. However, + * there are times when it is useful to write to a writer, + * such as when using a StringWriter. + * + * @param writer A valid Writer reference. + */ + public void setWriter(Writer writer) { + this.writer = writer; + } + + /** + * Get the character stream that was set with setWriter. + * + * @return The character stream that was set with setWriter, or null + * if setWriter or the Writer constructor was not called. + */ + public Writer getWriter() { + return writer; + } + + /** + * Set the systemID that may be used in association + * with the byte or character stream, or, if neither is set, use + * this value as a writeable URI (probably a file name). + * + * @param systemId The system identifier as a URI string. + */ + public void setSystemId(String systemId) { + this.systemId = systemId; + } + + /** + *Set the system ID from a File
reference.
Note the use of {@link File#toURI()} and {@link File#toURL()}.
+ * toURI()
is preferred and used if possible.
+ * To allow JAXP 1.3 to run on J2SE 1.3, toURL()
+ * is used if a {@link NoSuchMethodException} is thrown by the attempt
+ * to use toURI()
.
Acts as an holder for a transformation Source in the form + * of a stream of XML markup.
+ * + *Note: Due to their internal use of either a {@link Reader} or {@link InputStream} instance,
+ * StreamSource
instances may only be used once.
Zero-argument default constructor. If this constructor is used, and
+ * no Stream source is set using
+ * {@link #setInputStream(java.io.InputStream inputStream)} or
+ * {@link #setReader(java.io.Reader reader)}, then the
+ * Transformer
will
+ * create an empty source {@link java.io.InputStream} using
+ * {@link java.io.InputStream#InputStream() new InputStream()}.
If this constructor is used to process a stylesheet, normally + * setSystemId should also be called, so that relative URI references + * can be resolved.
+ * + * @param inputStream A valid InputStream reference to an XML stream. + */ + public StreamSource(InputStream inputStream) { + setInputStream(inputStream); + } + + /** + * Construct a StreamSource from a byte stream. Normally, + * a stream should be used rather than a reader, so that + * the XML parser can resolve character encoding specified + * by the XML declaration. + * + *This constructor allows the systemID to be set in addition + * to the input stream, which allows relative URIs + * to be processed.
+ * + * @param inputStream A valid InputStream reference to an XML stream. + * @param systemId Must be a String that conforms to the URI syntax. + */ + public StreamSource(InputStream inputStream, String systemId) { + setInputStream(inputStream); + setSystemId(systemId); + } + + /** + * Construct a StreamSource from a character reader. Normally, + * a stream should be used rather than a reader, so that + * the XML parser can resolve character encoding specified + * by the XML declaration. However, in many cases the encoding + * of the input stream is already resolved, as in the case of + * reading XML from a StringReader. + * + * @param reader A valid Reader reference to an XML character stream. + */ + public StreamSource(Reader reader) { + setReader(reader); + } + + /** + * Construct a StreamSource from a character reader. Normally, + * a stream should be used rather than a reader, so that + * the XML parser may resolve character encoding specified + * by the XML declaration. However, in many cases the encoding + * of the input stream is already resolved, as in the case of + * reading XML from a StringReader. + * + * @param reader A valid Reader reference to an XML character stream. + * @param systemId Must be a String that conforms to the URI syntax. + */ + public StreamSource(Reader reader, String systemId) { + setReader(reader); + setSystemId(systemId); + } + + /** + * Construct a StreamSource from a URL. + * + * @param systemId Must be a String that conforms to the URI syntax. + */ + public StreamSource(String systemId) { + this.systemId = systemId; + } + + /** + * Construct a StreamSource from a File. + * + * @param f Must a non-null File reference. + */ + public StreamSource(File f) { + setSystemId(f); + } + + /** + * Set the byte stream to be used as input. Normally, + * a stream should be used rather than a reader, so that + * the XML parser can resolve character encoding specified + * by the XML declaration. + * + *If this Source object is used to process a stylesheet, normally + * setSystemId should also be called, so that relative URL references + * can be resolved.
+ * + * @param inputStream A valid InputStream reference to an XML stream. + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + + /** + * Get the byte stream that was set with setByteStream. + * + * @return The byte stream that was set with setByteStream, or null + * if setByteStream or the ByteStream constructor was not called. + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * Set the input to be a character reader. Normally, + * a stream should be used rather than a reader, so that + * the XML parser can resolve character encoding specified + * by the XML declaration. However, in many cases the encoding + * of the input stream is already resolved, as in the case of + * reading XML from a StringReader. + * + * @param reader A valid Reader reference to an XML CharacterStream. + */ + public void setReader(Reader reader) { + this.reader = reader; + } + + /** + * Get the character stream that was set with setReader. + * + * @return The character stream that was set with setReader, or null + * if setReader or the Reader constructor was not called. + */ + public Reader getReader() { + return reader; + } + + /** + * Set the public identifier for this Source. + * + *The public identifier is always optional: if the application + * writer includes one, it will be provided as part of the + * location information.
+ * + * @param publicId The public identifier as a string. + */ + public void setPublicId(String publicId) { + this.publicId = publicId; + } + + /** + * Get the public identifier that was set with setPublicId. + * + * @return The public identifier that was set with setPublicId, or null + * if setPublicId was not called. + */ + public String getPublicId() { + return publicId; + } + + /** + * Set the system identifier for this Source. + * + *The system identifier is optional if there is a byte stream + * or a character stream, but it is still useful to provide one, + * since the application can use it to resolve relative URIs + * and can include it in error messages and warnings (the parser + * will attempt to open a connection to the URI only if + * there is no byte stream or character stream specified).
+ * + * @param systemId The system identifier as a URL string. + */ + public void setSystemId(String systemId) { + this.systemId = systemId; + } + + /** + * Get the system identifier that was set with setSystemId. + * + * @return The system identifier that was set with setSystemId, or null + * if setSystemId was not called. + */ + public String getSystemId() { + return systemId; + } + + /** + * Set the system ID from a File reference. + * + * @param f Must a non-null File reference. + */ + public void setSystemId(File f) { + this.systemId = FilePathToURI.filepath2URI(f.getAbsolutePath()); + } + + ////////////////////////////////////////////////////////////////////// + // Internal state. + ////////////////////////////////////////////////////////////////////// + + /** + * The public identifier for this input source, or null. + */ + private String publicId; + + /** + * The system identifier as a URL string, or null. + */ + private String systemId; + + /** + * The byte stream for this Source, or null. + */ + private InputStream inputStream; + + /** + * The character stream for this Source, or null. + */ + private Reader reader; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/package.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/package.html new file mode 100644 index 000000000..df54abd24 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/transform/stream/package.html @@ -0,0 +1,30 @@ + + + + +This package implements stream- and URI- specific transformation APIs. +
+The {@link javax.xml.transform.stream.StreamSource} class + provides methods for specifying {@link java.io.InputStream} input, + {@link java.io.Reader} input, and URL input in the form of strings. Even + if an input stream or reader is specified as the source, + {@link javax.xml.transform.stream.StreamSource#setSystemId} should still + be called, so that the transformer can know from where it should resolve + relative URIs. The public identifier is always optional: if the application + writer includes one, it will be provided as part of the + {@link javax.xml.transform.SourceLocator} information.
+The {@link javax.xml.transform.stream.StreamResult} class + provides methods for specifying {@link java.io.OutputStream}, + {@link java.io.Writer}, or an output system ID, as the output of the + transformation result.
+Normally streams should be used rather than readers or writers, for + both the Source and Result, since readers and writers already have the encoding + established to and from the internal Unicode format. However, there are times + when it is useful to write to a character stream, such as when using a + StringWriter in order to write to a String, or in the case of reading source + XML from a StringReader.
+ + diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/Schema.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/Schema.java new file mode 100644 index 000000000..9dd046d1f --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/Schema.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: Schema.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.validation; + +/** + * Immutable in-memory representation of grammar. + * + *+ * This object represents a set of constraints that can be checked/ + * enforced against an XML document. + * + *
+ * A {@link Schema} object is thread safe and applications are + * encouraged to share it across many parsers in many threads. + * + *
+ * A {@link Schema} object is immutable in the sense that it shouldn't + * change the set of constraints once it is created. In other words, + * if an application validates the same document twice against the same + * {@link Schema}, it must always produce the same result. + * + *
+ * A {@link Schema} object is usually created from {@link SchemaFactory}. + * + *
+ * Two kinds of validators can be created from a {@link Schema} object. + * One is {@link Validator}, which provides highly-level validation + * operations that cover typical use cases. The other is + * {@link ValidatorHandler}, which works on top of SAX for better + * modularity. + * + *
+ * This specification does not refine
+ * the {@link java.lang.Object#equals(java.lang.Object)} method.
+ * In other words, if you parse the same schema twice, you may
+ * still get !schemaA.equals(schemaB)
.
+ *
+ * @author Kohsuke Kawaguchi
+ * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $
+ * @see XML Schema Part 1: Structures
+ * @see Extensible Markup Language (XML) 1.1
+ * @see Extensible Markup Language (XML) 1.0 (Second Edition)
+ * @since 1.5
+ */
+public abstract class Schema {
+
+ /**
+ * Constructor for the derived class.
+ *
+ *
+ * The constructor does nothing. + */ + protected Schema() { + } + + /** + * Creates a new {@link Validator} for this {@link Schema}. + * + *
+ * A validator enforces/checks the set of constraints this object + * represents. + * + * @return + * Always return a non-null valid object. + */ + public abstract Validator newValidator(); + + /** + * Creates a new {@link ValidatorHandler} for this {@link Schema}. + * + * @return + * Always return a non-null valid object. + */ + public abstract ValidatorHandler newValidatorHandler(); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactory.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactory.java new file mode 100644 index 000000000..207668634 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactory.java @@ -0,0 +1,672 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// $Id: SchemaFactory.java 884952 2009-11-27 18:55:08Z mrglavas $ + +package javax.xml.validation; + +import java.io.File; +import java.net.URL; + +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; + +import org.w3c.dom.ls.LSResourceResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; + +/** + * Factory that creates {@link Schema} objects. Entry-point to + * the validation API. + * + *
+ * {@link SchemaFactory} is a schema compiler. It reads external + * representations of schemas and prepares them for validation. + * + *
+ * The {@link SchemaFactory} class is not thread-safe. In other words, + * it is the application's responsibility to ensure that at most + * one thread is using a {@link SchemaFactory} object at any + * given moment. Implementations are encouraged to mark methods + * as synchronized to protect themselves from broken clients. + * + *
+ * {@link SchemaFactory} is not re-entrant. While one of the
+ * newSchema
methods is being invoked, applications
+ * may not attempt to recursively invoke the newSchema
method,
+ * even from the same thread.
+ *
+ *
+ * This spec uses a namespace URI to designate a schema language. + * The following table shows the values defined by this specification. + *
+ * To be compliant with the spec, the implementation + * is only required to support W3C XML Schema 1.0. However, + * if it chooses to support other schema languages listed here, + * it must conform to the relevant behaviors described in this spec. + * + *
+ * Schema languages not listed here are expected to + * introduce their own URIs to represent themselves. + * The {@link SchemaFactory} class is capable of locating other + * implementations for other schema languages at run-time. + * + *
+ * Note that because the XML DTD is strongly tied to the parsing process + * and has a significant effect on the parsing process, it is impossible + * to define the DTD validation as a process independent from parsing. + * For this reason, this specification does not define the semantics for + * the XML DTD. This doesn't prohibit implementors from implementing it + * in a way they see fit, but users are warned that any DTD + * validation implemented on this interface necessarily deviate from + * the XML DTD semantics as defined in the XML 1.0. + * + *
value | + *language | + *
---|---|
{@link javax.xml.XMLConstants#W3C_XML_SCHEMA_NS_URI} ("http://www.w3.org/2001/XMLSchema ") |
+ * W3C XML Schema 1.0 | + *
{@link javax.xml.XMLConstants#RELAXNG_NS_URI} ("http://relaxng.org/ns/structure/1.0 ") |
+ * RELAX NG 1.0 | + *
Constructor for derived classes.
+ * + *The constructor does nothing.
+ * + *Derived classes must create {@link SchemaFactory} objects that have
+ * null
{@link ErrorHandler} and
+ * null
{@link LSResourceResolver}.
Lookup an implementation of the SchemaFactory
that supports the specified
+ * schema language and return it.
To find a SchemaFactory
object for a given schema language,
+ * this method looks the following places in the following order
+ * where "the class loader" refers to the context class loader:
"javax.xml.validation.SchemaFactory:schemaLanguage"
+ * is present (where schemaLanguage is the parameter
+ * to this method), then its value is read
+ * as a class name. The method will try to
+ * create a new instance of this class by using the class loader,
+ * and returns it if it is successfully created.
+ * $java.home/lib/jaxp.properties
is read and
+ * the value associated with the key being the system property above
+ * is looked for. If present, the value is processed just like above.
+ * The class loader is asked for service provider provider-configuration files matching
+ * javax.xml.validation.SchemaFactory
in the resource directory META-INF/services.
+ * See the JAR File Specification for file format and parsing rules.
+ * Each potential service provider is required to implement the method:
+ * {@link #isSchemaLanguageSupported(String schemaLanguage)} + *+ * The first service provider found in class loader order that supports the specified schema language is returned. + *
SchemaFactory
is located
+ * in a implementation specific way. There must be a platform default
+ * SchemaFactory
for W3C XML Schema.
+ * If everything fails, {@link IllegalArgumentException} will be thrown.
+ * + *Tip for Trouble-shooting:
+ *See {@link java.util.Properties#load(java.io.InputStream)} for + * exactly how a property file is parsed. In particular, colons ':' + * need to be escaped in a property file, so make sure schema language + * URIs are properly escaped in it. For example:
+ *+ * http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory + *+ * + * @param schemaLanguage + * Specifies the schema language which the returned + * SchemaFactory will understand. See + * the list of available + * schema languages for the possible values. + * + * @return New instance of a
SchemaFactory
+ *
+ * @throws IllegalArgumentException
+ * If no implementation of the schema language is available.
+ *
+ * @throws NullPointerException
+ * If the schemLanguage parameter is null.
+ */
+ public static final SchemaFactory newInstance(String schemaLanguage) {
+ ClassLoader cl;
+ cl = SecuritySupport.getContextClassLoader();
+
+ if (cl == null) {
+ //cl = ClassLoader.getSystemClassLoader();
+ //use the current class loader
+ cl = SchemaFactory.class.getClassLoader();
+ }
+
+ SchemaFactory f = new SchemaFactoryFinder(cl).newFactory(schemaLanguage);
+ if (f == null) {
+ throw new IllegalArgumentException(schemaLanguage);
+ }
+ return f;
+ }
+
+ /**
+ * @return New instance of a SchemaFactory
+ *
+ * @throws IllegalArgumentException
+ * If no implementation of the schema language is available.
+ *
+ * @throws NullPointerException
+ * If the schemLanguage parameter is null.
+ */
+ public static SchemaFactory newInstance(String schemaLanguage,
+ String factoryClassName, ClassLoader classLoader) {
+ if (schemaLanguage == null) {
+ throw new NullPointerException();
+ }
+ if (factoryClassName == null) {
+ throw new IllegalArgumentException("factoryClassName cannot be null.");
+ }
+ if (classLoader == null) {
+ classLoader = SecuritySupport.getContextClassLoader();
+ }
+ SchemaFactory f = new SchemaFactoryFinder(classLoader).createInstance(factoryClassName);
+ if (f == null || !f.isSchemaLanguageSupported(schemaLanguage)) {
+ throw new IllegalArgumentException(schemaLanguage);
+ }
+ return f;
+ }
+
+ /**
+ * Is specified schema supported by this SchemaFactory
?
SchemaFactory
will understand.
+ * schemaLanguage
must specify a valid schema language.
+ *
+ * @return true
if SchemaFactory
supports schemaLanguage
, else false
.
+ *
+ * @throws NullPointerException If schemaLanguage
is null
.
+ * @throws IllegalArgumentException If schemaLanguage.length() == 0
+ * or schemaLanguage
does not specify a valid schema language.
+ */
+ public abstract boolean isSchemaLanguageSupported(String schemaLanguage);
+
+ /**
+ * Look up the value of a feature flag.
+ *
+ * The feature name is any fully-qualified URI. It is + * possible for a {@link SchemaFactory} to recognize a feature name but + * temporarily be unable to return its value. + * + *
Implementors are free (and encouraged) to invent their own features, + * using names built on their own URIs.
+ * + * @param name The feature name, which is a non-null fully-qualified URI. + * @return The current value of the feature (true or false). + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * {@link SchemaFactory} recognizes the feature name but + * cannot determine its value at this time. + * @exception NullPointerException + * if the name parameter is null. + * @see #setFeature(String, boolean) + */ + public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { + + if (name == null) { + throw new NullPointerException("the name parameter is null"); + } + throw new SAXNotRecognizedException(name); + } + + /** + * Set the value of a feature flag. + * + *+ * Feature can be used to control the way a {@link SchemaFactory} + * parses schemas, although {@link SchemaFactory}s are not required + * to recognize any specific feature names.
+ * + *The feature name is any fully-qualified URI. It is + * possible for a {@link SchemaFactory} to expose a feature value but + * to be unable to change the current value.
+ * + *All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature. + * When the feature is:
+ *true
: the implementation will limit XML processing to conform to implementation limits.
+ * Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
+ * If XML processing is limited for security reasons, it will be reported via a call to the registered
+ * {@link ErrorHandler#fatalError(SAXParseException exception)}.
+ * See {@link #setErrorHandler(ErrorHandler errorHandler)}.
+ * false
: the implementation will processing XML according to the XML specifications without
+ * regard to possible implementation limits.
+ * The property name is any fully-qualified URI. It is + * possible for a {@link SchemaFactory} to recognize a property name but + * to be unable to change the current value.
+ * + *{@link SchemaFactory}s are not required to recognize setting + * any specific property names.
+ * + * @param name The property name, which is a non-null fully-qualified URI. + * @param object The requested value for the property. + * @exception org.xml.sax.SAXNotRecognizedException If the property + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * {@link SchemaFactory} recognizes the property name but + * cannot set the requested value. + * @exception NullPointerException + * if the name parameter is null. + */ + public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { + + if (name == null) { + throw new NullPointerException("the name parameter is null"); + } + throw new SAXNotRecognizedException(name); + } + + /** + * Look up the value of a property. + * + *The property name is any fully-qualified URI. It is + * possible for a {@link SchemaFactory} to recognize a property name but + * temporarily be unable to return its value.
+ * + *{@link SchemaFactory}s are not required to recognize any specific + * property names.
+ * + *Implementors are free (and encouraged) to invent their own properties, + * using names built on their own URIs.
+ * + * @param name The property name, which is a non-null fully-qualified URI. + * @return The current value of the property. + * @exception org.xml.sax.SAXNotRecognizedException If the property + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot determine its value at this time. + * @exception NullPointerException + * if the name parameter is null. + * @see #setProperty(String, Object) + */ + public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { + + if (name == null) { + throw new NullPointerException("the name parameter is null"); + } + throw new SAXNotRecognizedException(name); + } + + /** + * Sets the {@link ErrorHandler} to receive errors encountered + * during thenewSchema
method invocation.
+ *
+ * + * Error handler can be used to customize the error handling process + * during schema parsing. When an {@link ErrorHandler} is set, + * errors found during the parsing of schemas will be first sent + * to the {@link ErrorHandler}. + * + *
+ * The error handler can abort the parsing of a schema immediately + * by throwing {@link SAXException} from the handler. Or for example + * it can print an error to the screen and try to continue the + * processing by returning normally from the {@link ErrorHandler} + * + *
+ * If any {@link Throwable} (or instances of its derived classes)
+ * is thrown from an {@link ErrorHandler},
+ * the caller of the newSchema
method will be thrown
+ * the same {@link Throwable} object.
+ *
+ *
+ * {@link SchemaFactory} is not allowed to + * throw {@link SAXException} without first reporting it to + * {@link ErrorHandler}. + * + *
+ * Applications can call this method even during a {@link Schema} + * is being parsed. + * + *
+ * When the {@link ErrorHandler} is null, the implementation will + * behave as if the following {@link ErrorHandler} is set: + *
+ * class DraconianErrorHandler implements {@link ErrorHandler} { + * public void fatalError( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} { + * throw e; + * } + * public void error( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} { + * throw e; + * } + * public void warning( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} { + * // noop + * } + * } + *+ * + *
+ * When a new {@link SchemaFactory} object is created, initially + * this field is set to null. This field will NOT be + * inherited to {@link Schema}s, {@link Validator}s, or + * {@link ValidatorHandler}s that are created from this {@link SchemaFactory}. + * + * + * @param errorHandler + * A new error handler to be set. This parameter can be null. + */ + public abstract void setErrorHandler(ErrorHandler errorHandler); + + /** + * Gets the current {@link ErrorHandler} set to this {@link SchemaFactory}. + * + * @return + * This method returns the object that was last set through + * the {@link #setErrorHandler(ErrorHandler)} method, or null + * if that method has never been called since this {@link SchemaFactory} + * has created. + * + * @see #setErrorHandler(ErrorHandler) + */ + public abstract ErrorHandler getErrorHandler(); + + /** + * Sets the {@link LSResourceResolver} to customize + * resource resolution when parsing schemas. + * + *
+ * {@link SchemaFactory} uses a {@link LSResourceResolver} + * when it needs to locate external resources while parsing schemas, + * although exactly what constitutes "locating external resources" is + * up to each schema language. For example, for W3C XML Schema, + * this includes files <include>d or <import>ed, + * and DTD referenced from schema files, etc. + * + *
+ * Applications can call this method even during a {@link Schema} + * is being parsed. + * + *
+ * When the {@link LSResourceResolver} is null, the implementation will + * behave as if the following {@link LSResourceResolver} is set: + *
+ * class DumbDOMResourceResolver implements {@link LSResourceResolver} { + * public {@link org.w3c.dom.ls.LSInput} resolveResource( + * String publicId, String systemId, String baseURI) { + * + * return null; // always return null + * } + * } + *+ * + *
+ * If a {@link LSResourceResolver} throws a {@link RuntimeException}
+ * (or instances of its derived classes),
+ * then the {@link SchemaFactory} will abort the parsing and
+ * the caller of the newSchema
method will receive
+ * the same {@link RuntimeException}.
+ *
+ *
+ * When a new {@link SchemaFactory} object is created, initially + * this field is set to null. This field will NOT be + * inherited to {@link Schema}s, {@link Validator}s, or + * {@link ValidatorHandler}s that are created from this {@link SchemaFactory}. + * + * @param resourceResolver + * A new resource resolver to be set. This parameter can be null. + */ + public abstract void setResourceResolver(LSResourceResolver resourceResolver); + + /** + * Gets the current {@link LSResourceResolver} set to this {@link SchemaFactory}. + * + * @return + * This method returns the object that was last set through + * the {@link #setResourceResolver(LSResourceResolver)} method, or null + * if that method has never been called since this {@link SchemaFactory} + * has created. + * + * @see #setErrorHandler(ErrorHandler) + */ + public abstract LSResourceResolver getResourceResolver(); + + /** + *
Parses the specified source as a schema and returns it as a schema.
+ * + *This is a convenience method for {@link #newSchema(Source[] schemas)}.
+ * + * @param schema Source that represents a schema. + * + * @return NewSchema
from parsing schema
.
+ *
+ * @throws SAXException If a SAX error occurs during parsing.
+ * @throws NullPointerException if schema is null.
+ */
+ public Schema newSchema(Source schema) throws SAXException {
+ return newSchema(new Source[]{schema});
+ }
+
+ /**
+ * Parses the specified File
as a schema and returns it as a Schema
.
This is a convenience method for {@link #newSchema(Source schema)}.
+ * + * @param schema File that represents a schema. + * + * @return NewSchema
from parsing schema
.
+ *
+ * @throws SAXException If a SAX error occurs during parsing.
+ * @throws NullPointerException if schema is null.
+ */
+ public Schema newSchema(File schema) throws SAXException {
+ return newSchema(new StreamSource(schema));
+ }
+
+ /**
+ * Parses the specified URL
as a schema and returns it as a Schema
.
This is a convenience method for {@link #newSchema(Source schema)}.
+ * + * @param schemaURL
that represents a schema.
+ *
+ * @return New Schema
from parsing schema
.
+ *
+ * @throws SAXException If a SAX error occurs during parsing.
+ * @throws NullPointerException if schema is null.
+ */
+ public Schema newSchema(URL schema) throws SAXException {
+ return newSchema(new StreamSource(schema.toExternalForm()));
+ }
+
+ /**
+ * Parses the specified source(s) as a schema and returns it as a schema.
+ *
+ * + * The callee will read all the {@link Source}s and combine them into a + * single schema. The exact semantics of the combination depends on the schema + * language that this {@link SchemaFactory} object is created for. + * + *
+ * When an {@link ErrorHandler} is set, the callee will report all the errors + * found in sources to the handler. If the handler throws an exception, it will + * abort the schema compilation and the same exception will be thrown from + * this method. Also, after an error is reported to a handler, the callee is allowed + * to abort the further processing by throwing it. If an error handler is not set, + * the callee will throw the first error it finds in the sources. + * + *
+ * The resulting schema contains components from the specified sources. + * The same result would be achieved if all these sources were + * imported, using appropriate values for schemaLocation and namespace, + * into a single schema document with a different targetNamespace + * and no components of its own, if the import elements were given + * in the same order as the sources. Section 4.2.3 of the XML Schema + * recommendation describes the options processors have in this + * regard. While a processor should be consistent in its treatment of + * JAXP schema sources and XML Schema imports, the behaviour between + * JAXP-compliant parsers may vary; in particular, parsers may choose + * to ignore all but the first <import> for a given namespace, + * regardless of information provided in schemaLocation. + * + *
+ * If the parsed set of schemas includes error(s) as + * specified in the section 5.1 of the XML Schema spec, then + * the error must be reported to the {@link ErrorHandler}. + * + *
For RELAX NG, this method must throw {@link UnsupportedOperationException}
+ * if schemas.length!=1.
+ *
+ *
+ * @param schemas
+ * inputs to be parsed. {@link SchemaFactory} is required
+ * to recognize {@link StreamSource},
+ * {@link javax.xml.transform.sax.SAXSource},
+ * {@link javax.xml.transform.dom.DOMSource}
+ * and {@link javax.xml.transform.stax.StAXSource}.
+ *
+ * @return
+ * Always return a non-null valid {@link Schema} object.
+ * Note that when an error has been reported, there is no
+ * guarantee that the returned {@link Schema} object is
+ * meaningful.
+ *
+ * @throws SAXException
+ * If an error is found during processing the specified inputs.
+ * When an {@link ErrorHandler} is set, errors are reported to
+ * there first. See {@link #setErrorHandler(ErrorHandler)}.
+ * @throws NullPointerException
+ * If the schemas
parameter itself is null or
+ * any item in the array is null.
+ * @throws IllegalArgumentException
+ * If any item in the array is not recognized by this method.
+ * @throws UnsupportedOperationException
+ * If the schema language doesn't support this operation.
+ */
+ public abstract Schema newSchema(Source[] schemas) throws SAXException;
+
+ /**
+ * Creates a special {@link Schema} object.
+ *
+ *
+ * The exact semantics of the returned {@link Schema} object depends + * on the schema language that this {@link SchemaFactory} is created + * for. + * + *
+ * Also, implementations are allowed to use implementation-specific + * property/feature to alter the semantics of this method. + * + * + *
+ * For XML Schema, this method creates a {@link Schema} object that + * performs validation by using location hints specified in documents. + * + *
+ * The returned {@link Schema} object assumes that if documents + * refer to the same URL in the schema location hints, + * they will always resolve to the same schema document. This + * assumption allows implementations to reuse parsed results of + * schema documents so that multiple validations against the same + * schema will run faster. + * + *
+ * Note that the use of schema location hints introduces a + * vulnerability to denial-of-service attacks. + * + * + *
+ * RELAX NG does not support this operation. + * + * @return + * Always return non-null valid {@link Schema} object. + * + * @throws UnsupportedOperationException + * If this operation is not supported by the callee. + * @throws SAXException + * If this operation is supported but failed for some reason. + */ + public abstract Schema newSchema() throws SAXException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactoryFinder.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactoryFinder.java new file mode 100644 index 000000000..9b90fdca7 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactoryFinder.java @@ -0,0 +1,499 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: SchemaFactoryFinder.java 727367 2008-12-17 13:05:26Z mrglavas $ + +package javax.xml.validation; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Properties; + +import javax.xml.XMLConstants; + +/** + * Implementation of {@link SchemaFactory#newInstance(String)}. + * + * @author Kohsuke Kawaguchi + * @version $Revision: 727367 $, $Date: 2008-12-17 08:05:26 -0500 (Wed, 17 Dec 2008) $ + * @since 1.5 + */ +final class SchemaFactoryFinder { + + /** XML Schema language identifiers. */ + private static final String W3C_XML_SCHEMA10_NS_URI = "http://www.w3.org/XML/XMLSchema/v1.0"; + private static final String W3C_XML_SCHEMA11_NS_URI = "http://www.w3.org/XML/XMLSchema/v1.1"; + + /** debug support code. */ + private static boolean debug = false; + + /** + *
Cache properties for performance.
+ */ + private static Properties cacheProps = new Properties(); + + /** + *First time requires initialization overhead.
+ */ + private static boolean firstTime = true; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + + static { + // Use try/catch block to support applets + try { + String val = SecuritySupport.getSystemProperty("jaxp.debug"); + // Allow simply setting the prop to turn on debug + debug = val != null && (! "false".equals(val)); + } catch (Exception _) { + debug = false; + } + } + + /** + *Conditional debug printing.
+ * + * @param msg to print + */ + private static void debugPrintln(String msg) { + if (debug) { + System.err.println("JAXP: " + msg); + } + } + + /** + *ClassLoader
to use to find SchemaFactory
.
Constructor that specifies ClassLoader
to use
+ * to find SchemaFactory
.
Creates a new {@link SchemaFactory} object for the specified + * schema language.
+ * + * @param schemaLanguage + * See {@link SchemaFactory Schema Language} table inSchemaFactory
+ * for the list of available schema languages.
+ *
+ * @return null
if the callee fails to create one.
+ *
+ * @throws NullPointerException
+ * If the schemaLanguage parameter is null.
+ */
+ public SchemaFactory newFactory(String schemaLanguage) {
+ if(schemaLanguage==null) throw new NullPointerException();
+ SchemaFactory f = _newFactory(schemaLanguage);
+ if (debug) {
+ if (f != null) {
+ debugPrintln("factory '" + f.getClass().getName() + "' was found for " + schemaLanguage);
+ } else {
+ debugPrintln("unable to find a factory for " + schemaLanguage);
+ }
+ }
+ return f;
+ }
+
+ /**
+ * Lookup a SchemaFactory
for the given schemaLanguage
.
SchemaFactory
for.
+ *
+ * @return SchemaFactory
for the given schemaLanguage
.
+ */
+ private SchemaFactory _newFactory(String schemaLanguage) {
+ SchemaFactory sf;
+ String propertyName = SERVICE_CLASS.getName() + ":" + schemaLanguage;
+
+ // system property look up
+ try {
+ if (debug) debugPrintln("Looking up system property '"+propertyName+"'" );
+ String r = SecuritySupport.getSystemProperty(propertyName);
+ if (r != null && r.length() > 0) {
+ if (debug) debugPrintln("The value is '"+r+"'");
+ sf = createInstance(r);
+ if(sf!=null) return sf;
+ }
+ else if (debug) {
+ debugPrintln("The property is undefined.");
+ }
+ }
+ // The VM ran out of memory or there was some other serious problem. Re-throw.
+ catch (VirtualMachineError vme) {
+ throw vme;
+ }
+ // ThreadDeath should always be re-thrown
+ catch (ThreadDeath td) {
+ throw td;
+ }
+ catch (Throwable t) {
+ if( debug ) {
+ debugPrintln("failed to look up system property '"+propertyName+"'" );
+ t.printStackTrace();
+ }
+ }
+
+ String javah = SecuritySupport.getSystemProperty( "java.home" );
+ String configFile = javah + File.separator +
+ "lib" + File.separator + "jaxp.properties";
+
+ String factoryClassName = null ;
+
+ // try to read from $java.home/lib/jaxp.properties
+ try {
+ if(firstTime){
+ synchronized(cacheProps){
+ if(firstTime){
+ File f=new File( configFile );
+ firstTime = false;
+ if(SecuritySupport.doesFileExist(f)){
+ if (debug) debugPrintln("Read properties file " + f);
+ cacheProps.load(SecuritySupport.getFileInputStream(f));
+ }
+ }
+ }
+ }
+ factoryClassName = cacheProps.getProperty(propertyName);
+ if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
+
+ if (factoryClassName != null) {
+ sf = createInstance(factoryClassName);
+ if(sf != null){
+ return sf;
+ }
+ }
+ } catch (Exception ex) {
+ if (debug) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ // try to read from $java.home/lib/jaxp.properties
+ try {
+ String javah = ss.getSystemProperty( "java.home" );
+ String configFile = javah + File.separator +
+ "lib" + File.separator + "jaxp.properties";
+ File f = new File( configFile );
+ if( ss.doesFileExist(f)) {
+ sf = loadFromProperty(
+ propertyName,f.getAbsolutePath(), new FileInputStream(f));
+ if(sf!=null) return sf;
+ } else {
+ debugPrintln("Tried to read "+ f.getAbsolutePath()+", but it doesn't exist.");
+ }
+ } catch(Throwable e) {
+ if( debug ) {
+ debugPrintln("failed to read $java.home/lib/jaxp.properties");
+ e.printStackTrace();
+ }
+ }
+ */
+
+ // try META-INF/services files
+ Iterator sitr = createServiceFileIterator();
+ while(sitr.hasNext()) {
+ URL resource = (URL)sitr.next();
+ if (debug) debugPrintln("looking into " + resource);
+ try {
+ sf = loadFromServicesFile(schemaLanguage,resource.toExternalForm(),SecuritySupport.getURLInputStream(resource));
+ if(sf!=null) return sf;
+ } catch(IOException e) {
+ if( debug ) {
+ debugPrintln("failed to read "+resource);
+ e.printStackTrace();
+ }
+ }
+ }
+
+ // platform defaults
+ if (schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI) || schemaLanguage.equals(W3C_XML_SCHEMA10_NS_URI)) {
+ if (debug) debugPrintln("attempting to use the platform default XML Schema 1.0 validator");
+ return createInstance("org.apache.xerces.jaxp.validation.XMLSchemaFactory");
+ }
+ else if (schemaLanguage.equals(W3C_XML_SCHEMA11_NS_URI)) {
+ if (debug) debugPrintln("attempting to use the platform default XML Schema 1.1 validator");
+ return createInstance("org.apache.xerces.jaxp.validation.XMLSchema11Factory");
+ }
+
+ if (debug) debugPrintln("all things were tried, but none was found. bailing out.");
+ return null;
+ }
+
+ /**
+ * Creates an instance of the specified and returns it.
+ * + * @param className + * fully qualified class name to be instantiated. + * + * @return null + * if it fails. Error messages will be printed by this method. + */ + SchemaFactory createInstance( String className ) { + try { + if (debug) debugPrintln("instanciating "+className); + Class clazz; + if( classLoader!=null ) + clazz = classLoader.loadClass(className); + else + clazz = Class.forName(className); + if(debug) debugPrintln("loaded it from "+which(clazz)); + Object o = clazz.newInstance(); + + if( o instanceof SchemaFactory ) + return (SchemaFactory)o; + + if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName()); + } + // The VM ran out of memory or there was some other serious problem. Re-throw. + catch (VirtualMachineError vme) { + throw vme; + } + // ThreadDeath should always be re-thrown + catch (ThreadDeath td) { + throw td; + } + catch (Throwable t) { + debugPrintln("failed to instanciate "+className); + if(debug) t.printStackTrace(); + } + return null; + } + + /** Iterator that lazily computes one value and returns it. */ + private static abstract class SingleIterator implements Iterator { + private boolean seen = false; + + public final void remove() { throw new UnsupportedOperationException(); } + public final boolean hasNext() { return !seen; } + public final Object next() { + if(seen) throw new NoSuchElementException(); + seen = true; + return value(); + } + + protected abstract Object value(); + } + + /** + * Returns an {@link Iterator} that enumerates all + * the META-INF/services files that we care. + */ + private Iterator createServiceFileIterator() { + if (classLoader == null) { + return new SingleIterator() { + protected Object value() { + ClassLoader classLoader = SchemaFactoryFinder.class.getClassLoader(); + //return (ClassLoader.getSystemResource( SERVICE_ID )); + return SecuritySupport.getResourceAsURL(classLoader, SERVICE_ID); + } + }; + } else { + try { + //final Enumeration e = classLoader.getResources(SERVICE_ID); + final Enumeration e = SecuritySupport.getResources(classLoader, SERVICE_ID); + if(debug && !e.hasMoreElements()) { + debugPrintln("no "+SERVICE_ID+" file was found"); + } + + // wrap it into an Iterator. + return new Iterator() { + public void remove() { + throw new UnsupportedOperationException(); + } + + public boolean hasNext() { + return e.hasMoreElements(); + } + + public Object next() { + return e.nextElement(); + } + }; + } catch (IOException e) { + if (debug) { + debugPrintln("failed to enumerate resources "+SERVICE_ID); + e.printStackTrace(); + } + return new ArrayList().iterator(); // empty iterator + } + } + } + + /** Searches for a SchemaFactory for a given schema language in a META-INF/services file. */ + private SchemaFactory loadFromServicesFile(String schemaLanguage, String resourceName, InputStream in) { + + if (debug) debugPrintln("Reading "+resourceName ); + + // Read the service provider name in UTF-8 as specified in + // the jar spec. Unfortunately this fails in Microsoft + // VJ++, which does not implement the UTF-8 + // encoding. Theoretically, we should simply let it fail in + // that case, since the JVM is obviously broken if it + // doesn't support such a basic standard. But since there + // are still some users attempting to use VJ++ for + // development, we have dropped in a fallback which makes a + // second attempt using the platform's default encoding. In + // VJ++ this is apparently ASCII, which is a subset of + // UTF-8... and since the strings we'll be reading here are + // also primarily limited to the 7-bit ASCII range (at + // least, in English versions), this should work well + // enough to keep us on the air until we're ready to + // officially decommit from VJ++. [Edited comment from + // jkesselm] + BufferedReader rd; + try { + rd = new BufferedReader(new InputStreamReader(in, "UTF-8"), DEFAULT_LINE_LENGTH); + } catch (java.io.UnsupportedEncodingException e) { + rd = new BufferedReader(new InputStreamReader(in), DEFAULT_LINE_LENGTH); + } + + String factoryClassName = null; + SchemaFactory resultFactory = null; + // See spec for provider-configuration files: http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Provider%20Configuration%20File + while (true) { + try { + factoryClassName = rd.readLine(); + } catch (IOException x) { + // No provider found + break; + } + if (factoryClassName != null) { + // Ignore comments in the provider-configuration file + int hashIndex = factoryClassName.indexOf('#'); + if (hashIndex != -1) { + factoryClassName = factoryClassName.substring(0, hashIndex); + } + + // Ignore leading and trailing whitespace + factoryClassName = factoryClassName.trim(); + + // If there's no text left or if this was a blank line, go to the next one. + if (factoryClassName.length() == 0) { + continue; + } + + try { + // Found the right SchemaFactory if its isSchemaLanguageSupported(schemaLanguage) method returns true. + SchemaFactory foundFactory = (SchemaFactory) createInstance(factoryClassName); + if (foundFactory.isSchemaLanguageSupported(schemaLanguage)) { + resultFactory = foundFactory; + break; + } + } + catch (Exception e) {} + } + else { + break; + } + } + + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} + + return resultFactory; + } + + private static final Class SERVICE_CLASS = SchemaFactory.class; + private static final String SERVICE_ID = "META-INF/services/" + SERVICE_CLASS.getName(); + + + + private static String which( Class clazz ) { + return which( clazz.getName(), clazz.getClassLoader() ); + } + + /** + *Search the specified classloader for the given classname.
+ * + * @param classname the fully qualified name of the class to search for + * @param loader the classloader to search + * + * @return the source location of the resource, or null if it wasn't found + */ + private static String which(String classname, ClassLoader loader) { + + String classnameAsResource = classname.replace('.', '/') + ".class"; + + if( loader==null ) loader = ClassLoader.getSystemClassLoader(); + + //URL it = loader.getResource(classnameAsResource); + URL it = SecuritySupport.getResourceAsURL(loader, classnameAsResource); + if (it != null) { + return it.toString(); + } else { + return null; + } + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactoryLoader.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactoryLoader.java new file mode 100644 index 000000000..34c94a46f --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SchemaFactoryLoader.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: SchemaFactoryLoader.java 448801 2006-09-22 04:19:20Z mrglavas $ + +package javax.xml.validation; + +/** + *This class was removed from JAXP 1.3 before it was finalized but + * was mistakenly included in Java 5. It only exists now for compatibility + * reasons. Applications should avoid using it.
+ */ +public abstract class SchemaFactoryLoader { + + protected SchemaFactoryLoader() {} + public abstract SchemaFactory newFactory(String schemaLanguage); + +} // SchemaFactoryLoader diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SecuritySupport.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SecuritySupport.java new file mode 100644 index 000000000..7821ad9b6 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/SecuritySupport.java @@ -0,0 +1,162 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: SecuritySupport.java 522337 2007-03-25 20:03:27Z mrglavas $ + +package javax.xml.validation; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.Enumeration; + +/** + * This class is duplicated for each JAXP subpackage so keep it in sync. + * It is package private and therefore is not exposed as part of the JAXP + * API. + * + * Security related methods that only work on J2SE 1.2 and newer. + */ +final class SecuritySupport { + + private SecuritySupport() {} + + static ClassLoader getContextClassLoader() { + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); + } + + static String getSystemProperty(final String propName) { + return (String) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(propName); + } + }); + } + + static FileInputStream getFileInputStream(final File file) + throws FileNotFoundException + { + try { + return (FileInputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws FileNotFoundException { + return new FileInputStream(file); + } + }); + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } + } + + static InputStream getURLInputStream(final URL url) + throws IOException + { + try { + return (InputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IOException { + return url.openStream(); + } + }); + } catch (PrivilegedActionException e) { + throw (IOException)e.getException(); + } + } + + static URL getResourceAsURL(final ClassLoader cl, + final String name) + { + return (URL) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + URL url; + if (cl == null) { + url = ClassLoader.getSystemResource(name); + } + else { + url = cl.getResource(name); + } + return url; + } + }); + } + + static Enumeration getResources(final ClassLoader cl, + final String name) throws IOException + { + try{ + return (Enumeration) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IOException{ + Enumeration enumeration; + if (cl == null) { + enumeration = ClassLoader.getSystemResources(name); + } + else { + enumeration = cl.getResources(name); + } + return enumeration; + } + }); + }catch(PrivilegedActionException e){ + throw (IOException)e.getException(); + } + } + + static InputStream getResourceAsStream(final ClassLoader cl, + final String name) + { + return (InputStream) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + InputStream ris; + if (cl == null) { + ris = ClassLoader.getSystemResourceAsStream(name); + } else { + ris = cl.getResourceAsStream(name); + } + return ris; + } + }); + } + + static boolean doesFileExist(final File f) { + return ((Boolean) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return f.exists() ? Boolean.TRUE : Boolean.FALSE; + } + })).booleanValue(); + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/TypeInfoProvider.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/TypeInfoProvider.java new file mode 100644 index 000000000..41717da54 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/TypeInfoProvider.java @@ -0,0 +1,181 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: TypeInfoProvider.java 884939 2009-11-27 18:20:46Z mrglavas $ + +package javax.xml.validation; + +import org.w3c.dom.TypeInfo; + +/** + * This class provides access to the type information determined + * by {@link ValidatorHandler}. + * + *+ * Some schema languages, such as W3C XML Schema, encourages a validator + * to report the "type" it assigns to each attribute/element. + * Those applications who wish to access this type information can invoke + * methods defined on this "interface" to access such type information. + * + *
+ * Implementation of this "interface" can be obtained through the + * {@link ValidatorHandler#getTypeInfoProvider()} method. + * + * @author Kohsuke Kawaguchi + * @version $Revision: 884939 $, $Date: 2009-11-27 13:20:46 -0500 (Fri, 27 Nov 2009) $ + * @see org.w3c.dom.TypeInfo + * @since 1.5 + */ +public abstract class TypeInfoProvider { + + /** + * Constructor for the derived class. + * + *
+ * The constructor does nothing. + */ + protected TypeInfoProvider() { + } + + /** + *
Returns the immutable {@link TypeInfo} object for the current element.
+ * + *+ * The method may only be called by the startElement and endElement event of + * the {@link org.xml.sax.ContentHandler} that the application sets to the + * {@link ValidatorHandler}.
+ * + * @throws IllegalStateException + * If this method is called from other {@link org.xml.sax.ContentHandler} + * methods. + * @return + * An immutable {@link TypeInfo} object that represents the + * type of the current element. + * Note that the caller can keep references to the obtained + * {@link TypeInfo} longer than the callback scope. + * + * Otherwise, this method returns + * null if the validator is unable to + * determine the type of the current element for some reason + * (for example, if the validator is recovering from + * an earlier error.) + * + */ + public abstract TypeInfo getElementTypeInfo(); + + /** + * Returns the immutable {@link TypeInfo} object for the specified + * attribute of the current element. + * + *+ * The method may only be called by the startElement event of + * the {@link org.xml.sax.ContentHandler} that the application sets to the + * {@link ValidatorHandler}. + * + * @param index + * The index of the attribute. The same index for + * the {@link org.xml.sax.Attributes} object passed to the + * startElement callback. + * + * @throws IndexOutOfBoundsException + * If the index is invalid. + * @throws IllegalStateException + * If this method is called from other {@link org.xml.sax.ContentHandler} + * methods. + * + * @return + * An immutable {@link TypeInfo} object that represents the + * type of the specified attribute. + * Note that the caller can keep references to the obtained + * {@link TypeInfo} longer than the callback scope. + * + * Otherwise, this method returns + * null if the validator is unable to + * determine the type. + */ + public abstract TypeInfo getAttributeTypeInfo(int index); + + /** + * Returns true if the specified attribute is determined + * to be ID. + * + *
+ * Exactly how an attribute is "determined to be ID" is up to the + * schema language. In case of W3C XML Schema, this means + * that the actual type of the attribute is the built-in ID type + * or its derived type. + * + *
+ * A {@link javax.xml.parsers.DocumentBuilder} uses this information + * to properly implement {@link org.w3c.dom.Attr#isId()}. + * + *
+ * The method may only be called by the startElement event of + * the {@link org.xml.sax.ContentHandler} that the application sets to the + * {@link ValidatorHandler}. + * + * @param index + * The index of the attribute. The same index for + * the {@link org.xml.sax.Attributes} object passed to the + * startElement callback. + * + * @throws IndexOutOfBoundsException + * If the index is invalid. + * @throws IllegalStateException + * If this method is called from other {@link org.xml.sax.ContentHandler} + * methods. + * + * @return true + * if the type of the specified attribute is ID. + */ + public abstract boolean isIdAttribute(int index); + + /** + * Returns false if the attribute was added by the validator. + * + *
+ * This method provides information necessary for + * a {@link javax.xml.parsers.DocumentBuilder} to determine what + * the DOM tree should return from the {@link org.w3c.dom.Attr#getSpecified()} method. + * + *
+ * The method may only be called by the startElement event of + * the {@link org.xml.sax.ContentHandler} that the application sets to the + * {@link ValidatorHandler}. + * + *
+ * A general guideline for validators is to return true if + * the attribute was originally present in the pipeline, and + * false if it was added by the validator. + * + * @param index + * The index of the attribute. The same index for + * the {@link org.xml.sax.Attributes} object passed to the + * startElement callback. + * + * @throws IndexOutOfBoundsException + * If the index is invalid. + * @throws IllegalStateException + * If this method is called from other {@link org.xml.sax.ContentHandler} + * methods. + * + * @return + * true if the attribute was present before the validator + * processes input. false if the attribute was added + * by the validator. + */ + public abstract boolean isSpecified(int index); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/Validator.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/Validator.java new file mode 100644 index 000000000..5285e39ff --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/Validator.java @@ -0,0 +1,448 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: Validator.java 888884 2009-12-09 17:36:46Z mrglavas $ + +package javax.xml.validation; + +import java.io.IOException; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; + +import org.w3c.dom.ls.LSResourceResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; + +/** + *
A processor that checks an XML document against {@link Schema}.
+ * + *+ * A validator is a thread-unsafe and non-reentrant object. + * In other words, it is the application's responsibility to make + * sure that one {@link Validator} object is not used from + * more than one thread at any given time, and while the validate + * method is invoked, applications may not recursively call + * the validate method. + *
+ *
+ * Note that while the {@link #validate(javax.xml.transform.Source)} and {@link #validate(javax.xml.transform.Source, javax.xml.transform.Result)}
+ * methods take a {@link Source} instance, the Source
+ * instance must be a SAXSource
, DOMSource
, StAXSource
or StreamSource
.
+ *
+ * @author Kohsuke Kawaguchi
+ * @version $Revision: 888884 $, $Date: 2009-12-09 12:36:46 -0500 (Wed, 09 Dec 2009) $
+ * @since 1.5
+ */
+public abstract class Validator {
+
+ /**
+ * Constructor for derived classes.
+ *
+ *
+ * The constructor does nothing. + * + *
+ * Derived classes must create {@link Validator} objects that have + * null {@link ErrorHandler} and + * null {@link LSResourceResolver}. + */ + protected Validator() { + } + + /** + *
Reset this Validator
to its original configuration.
Validator
is reset to the same state as when it was created with
+ * {@link Schema#newValidator()}.
+ * reset()
is designed to allow the reuse of existing Validator
s
+ * thus saving resources associated with the creation of new Validator
s.
The reset Validator
is not guaranteed to have the same {@link LSResourceResolver} or {@link ErrorHandler}
+ * Object
s, e.g. {@link Object#equals(Object obj)}. It is guaranteed to have a functionally equal
+ * LSResourceResolver
and ErrorHandler
.
+ * This is just a convenience method of: + *
+ * validate(source,null); + *+ * + * @see #setErrorHandler(ErrorHandler) + */ + public void validate(Source source) throws SAXException, IOException { + validate(source, null); + } + + /** + * Validates the specified input and send the augmented validation + * result to the specified output. + * + *
+ * This method places the following restrictions on the types of + * the {@link Source}/{@link Result} accepted. + * + *
+ * | {@link javax.xml.transform.sax.SAXSource} | + *{@link javax.xml.transform.dom.DOMSource} | + *{@link javax.xml.transform.stax.StAXSource} | + *{@link javax.xml.transform.stream.StreamSource} | + *
null | + *OK | + *OK | + *OK | + *OK | + *
{@link javax.xml.transform.sax.SAXResult} | + *OK | + *Err | + *Err | + *Err | + *
{@link javax.xml.transform.dom.DOMResult} | + *Err | + *OK | + *Err | + *Err | + *
{@link javax.xml.transform.stax.StAXResult} | + *Err | + *Err | + *OK | + *Err | + *
{@link javax.xml.transform.stream.StreamResult} | + *Err | + *Err | + *Err | + *OK | + *
+ * To validate one {@link Source} into another kind of {@link Result}, use the identity transformer + * (see {@link javax.xml.transform.TransformerFactory#newTransformer()}). + * + *
+ * Errors found during the validation is sent to the specified + * {@link ErrorHandler}. + * + *
+ * If a document is valid, or if a document contains some errors
+ * but none of them were fatal and the {@link ErrorHandler} didn't
+ * throw any exception, then the method returns normally.
+ *
+ * @param source
+ * XML to be validated. Must not be null.
+ *
+ * @param result
+ * The {@link Result} object that receives (possibly augmented)
+ * XML. This parameter can be null if the caller is not interested
+ * in it.
+ *
+ * Note that when a {@link javax.xml.transform.dom.DOMResult} is used,
+ * a validator might just pass the same DOM node from
+ * {@link javax.xml.transform.dom.DOMSource} to
+ * {@link javax.xml.transform.dom.DOMResult}
+ * (in which case source.getNode()==result.getNode()),
+ * it might copy the entire DOM tree, or it might alter the
+ * node given by the source.
+ *
+ * @throws IllegalArgumentException
+ * If the {@link Result} type doesn't match the {@link Source} type,
+ * or if the specified source is not a
+ * {@link javax.xml.transform.sax.SAXSource},
+ * {@link javax.xml.transform.dom.DOMSource},
+ * {@link javax.xml.transform.stax.StAXSource} or
+ * {@link javax.xml.transform.stream.StreamSource}.
+ *
+ * @throws SAXException
+ * If the {@link ErrorHandler} throws a {@link SAXException} or
+ * if a fatal error is found and the {@link ErrorHandler} returns
+ * normally.
+ *
+ * @throws IOException
+ * If the validator is processing a
+ * {@link javax.xml.transform.sax.SAXSource} and the
+ * underlying {@link org.xml.sax.XMLReader} throws an
+ * {@link IOException}.
+ *
+ * @throws NullPointerException
+ * If the source parameter is null.
+ *
+ * @see #validate(Source)
+ */
+ public abstract void validate(Source source, Result result) throws SAXException, IOException;
+
+ /**
+ * Sets the {@link ErrorHandler} to receive errors encountered
+ * during the validate
method invocation.
+ *
+ *
+ * Error handler can be used to customize the error handling process + * during a validation. When an {@link ErrorHandler} is set, + * errors found during the validation will be first sent + * to the {@link ErrorHandler}. + * + *
+ * The error handler can abort further validation immediately + * by throwing {@link SAXException} from the handler. Or for example + * it can print an error to the screen and try to continue the + * validation by returning normally from the {@link ErrorHandler} + * + *
+ * If any {@link Throwable} is thrown from an {@link ErrorHandler},
+ * the caller of the validate
method will be thrown
+ * the same {@link Throwable} object.
+ *
+ *
+ * {@link Validator} is not allowed to + * throw {@link SAXException} without first reporting it to + * {@link ErrorHandler}. + * + *
+ * When the {@link ErrorHandler} is null, the implementation will + * behave as if the following {@link ErrorHandler} is set: + *
+ * class DraconianErrorHandler implements {@link ErrorHandler} { + * public void fatalError( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} { + * throw e; + * } + * public void error( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} { + * throw e; + * } + * public void warning( {@link org.xml.sax.SAXParseException} e ) throws {@link SAXException} { + * // noop + * } + * } + *+ * + *
+ * When a new {@link Validator} object is created, initially + * this field is set to null. + * + * @param errorHandler + * A new error handler to be set. This parameter can be null. + */ + public abstract void setErrorHandler(ErrorHandler errorHandler); + + /** + * Gets the current {@link ErrorHandler} set to this {@link Validator}. + * + * @return + * This method returns the object that was last set through + * the {@link #setErrorHandler(ErrorHandler)} method, or null + * if that method has never been called since this {@link Validator} + * has created. + * + * @see #setErrorHandler(ErrorHandler) + */ + public abstract ErrorHandler getErrorHandler(); + + /** + * Sets the {@link LSResourceResolver} to customize + * resource resolution while in a validation episode. + * + *
+ * {@link Validator} uses a {@link LSResourceResolver} + * when it needs to locate external resources while a validation, + * although exactly what constitutes "locating external resources" is + * up to each schema language. + * + *
+ * When the {@link LSResourceResolver} is null, the implementation will + * behave as if the following {@link LSResourceResolver} is set: + *
+ * class DumbLSResourceResolver implements {@link LSResourceResolver} { + * public {@link org.w3c.dom.ls.LSInput} resolveResource( + * String publicId, String systemId, String baseURI) { + * + * return null; // always return null + * } + * } + *+ * + *
+ * If a {@link LSResourceResolver} throws a {@link RuntimeException}
+ * (or instances of its derived classes),
+ * then the {@link Validator} will abort the parsing and
+ * the caller of the validate
method will receive
+ * the same {@link RuntimeException}.
+ *
+ *
+ * When a new {@link Validator} object is created, initially + * this field is set to null. + * + * @param resourceResolver + * A new resource resolver to be set. This parameter can be null. + */ + public abstract void setResourceResolver(LSResourceResolver resourceResolver); + + /** + * Gets the current {@link LSResourceResolver} set to this {@link Validator}. + * + * @return + * This method returns the object that was last set through + * the {@link #setResourceResolver(LSResourceResolver)} method, or null + * if that method has never been called since this {@link Validator} + * has created. + * + * @see #setErrorHandler(ErrorHandler) + */ + public abstract LSResourceResolver getResourceResolver(); + + + + /** + * Look up the value of a feature flag. + * + *
The feature name is any fully-qualified URI. It is + * possible for a {@link Validator} to recognize a feature name but + * temporarily be unable to return its value. + * Some feature values may be available only in specific + * contexts, such as before, during, or after a validation. + * + *
Implementors are free (and encouraged) to invent their own features, + * using names built on their own URIs.
+ * + * @param name The feature name, which is a non-null fully-qualified URI. + * @return The current value of the feature (true or false). + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * {@link Validator} recognizes the feature name but + * cannot determine its value at this time. + * @throws NullPointerException + * When the name parameter is null. + * @see #setFeature(String, boolean) + */ + public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { + if(name==null) throw new NullPointerException("the name parameter is null"); + throw new SAXNotRecognizedException(name); + } + + /** + * Set the value of a feature flag. + * + *+ * Feature can be used to control the way a {@link Validator} + * parses schemas, although {@link Validator}s are not required + * to recognize any specific property names.
+ * + *The feature name is any fully-qualified URI. It is + * possible for a {@link Validator} to expose a feature value but + * to be unable to change the current value. + * Some feature values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a validation.
+ * + * @param name The feature name, which is a non-null fully-qualified URI. + * @param value The requested value of the feature (true or false). + * + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * {@link Validator} recognizes the feature name but + * cannot set the requested value. + * @throws NullPointerException + * When the name parameter is null. + * + * @see #getFeature(String) + */ + public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { + if(name==null) throw new NullPointerException("the name parameter is null"); + throw new SAXNotRecognizedException(name); + } + + /** + * Set the value of a property. + * + *The property name is any fully-qualified URI. It is + * possible for a {@link Validator} to recognize a property name but + * to be unable to change the current value. + * Some property values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a validation.
+ * + *{@link Validator}s are not required to recognize setting + * any specific property names.
+ * + * @param name The property name, which is a non-null fully-qualified URI. + * @param object The requested value for the property. + * @exception org.xml.sax.SAXNotRecognizedException If the property + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * {@link Validator} recognizes the property name but + * cannot set the requested value. + * @throws NullPointerException + * When the name parameter is null. + */ + public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { + if(name==null) throw new NullPointerException("the name parameter is null"); + throw new SAXNotRecognizedException(name); + } + + /** + * Look up the value of a property. + * + *The property name is any fully-qualified URI. It is + * possible for a {@link Validator} to recognize a property name but + * temporarily be unable to return its value. + * Some property values may be available only in specific + * contexts, such as before, during, or after a validation.
+ * + *{@link Validator}s are not required to recognize any specific + * property names.
+ * + *Implementors are free (and encouraged) to invent their own properties, + * using names built on their own URIs.
+ * + * @param name The property name, which is a non-null fully-qualified URI. + * @return The current value of the property. + * @exception org.xml.sax.SAXNotRecognizedException If the property + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot determine its value at this time. + * @throws NullPointerException + * When the name parameter is null. + * @see #setProperty(String, Object) + */ + public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { + if(name==null) throw new NullPointerException("the name parameter is null"); + throw new SAXNotRecognizedException(name); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/ValidatorHandler.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/ValidatorHandler.java new file mode 100644 index 000000000..2e48522b6 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/ValidatorHandler.java @@ -0,0 +1,450 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: ValidatorHandler.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.validation; + +import org.w3c.dom.ls.LSResourceResolver; +import org.xml.sax.ContentHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; + +/** + * Streaming validator that works on SAX stream. + * + *+ * A {@link ValidatorHandler} object is a thread-unsafe, non-reentrant object. + * In other words, it is the application's responsibility to make + * sure that one {@link ValidatorHandler} object is not used from + * more than one thread at any given time. + * + *
+ * {@link ValidatorHandler} checks if the SAX events follow + * the set of constraints described in the associated {@link Schema}, + * and additionally it may modify the SAX events (for example + * by adding default values, etc.) + * + *
+ * {@link ValidatorHandler} extends from {@link ContentHandler}, + * but it refines the underlying {@link ContentHandler} in + * the following way: + *
uri
, localName
, and qname
,
+ * even though SAX allows some of them to be null.
+ * Similarly, the user-specified {@link ContentHandler} will receive non-null
+ * Strings for all three parameters.
+ *
+ * + * A {@link ValidatorHandler} is automatically reset every time + * the startDocument method is invoked. + * + *
+ * This spec defines the following feature that must be recognized + * by all {@link ValidatorHandler} implementations. + * + *
http://xml.org/sax/features/namespace-prefixes
+ * This feature controls how a {@link ValidatorHandler} introduces
+ * namespace bindings that were not present in the original SAX event
+ * stream.
+ * When this feature is set to true, it must make
+ * sure that the user's {@link ContentHandler} will see
+ * the corresponding xmlns*
attribute in
+ * the {@link org.xml.sax.Attributes} object of the
+ * {@link ContentHandler#startElement(String,String,String,Attributes)}
+ * callback. Otherwise, xmlns*
attributes must not be
+ * added to {@link org.xml.sax.Attributes} that's passed to the
+ * user-specified {@link ContentHandler}.
+ *
+ * (Note that regardless of this switch, namespace bindings are + * always notified to applications through + * {@link ContentHandler#startPrefixMapping(String,String)} and + * {@link ContentHandler#endPrefixMapping(String)} methods of the + * {@link ContentHandler} specified by the user.) + * + *
+ * Note that this feature does NOT affect the way + * a {@link ValidatorHandler} receives SAX events. It merely + * changes the way it augments SAX events. + * + *
This feature is set to false
by default.
+ * The constructor does nothing. + * + *
+ * Derived classes must create {@link ValidatorHandler} objects that have + * null {@link ErrorHandler} and + * null {@link LSResourceResolver}. + */ + protected ValidatorHandler() { + } + + /** + * Sets the {@link ContentHandler} which receives + * the augmented validation result. + * + *
+ * When a {@link ContentHandler} is specified, a + * {@link ValidatorHandler} will work as a filter + * and basically copy the incoming events to the + * specified {@link ContentHandler}. + * + *
+ * In doing so, a {@link ValidatorHandler} may modify + * the events, for example by adding defaulted attributes. + * + *
+ * A {@link ValidatorHandler} may buffer events to certain + * extent, but to allow {@link ValidatorHandler} to be used + * by a parser, the following requirement has to be met. + * + *
+ * When a callback method on the specified {@link ContentHandler} + * throws an exception, the same exception object must be thrown + * from the {@link ValidatorHandler}. The {@link ErrorHandler} + * should not be notified of such an exception. + * + *
+ * This method can be called even during a middle of a validation. + * + * @param receiver + * A {@link ContentHandler} or a null value. + */ + public abstract void setContentHandler(ContentHandler receiver); + + /** + * Gets the {@link ContentHandler} which receives the + * augmented validation result. + * + * @return + * This method returns the object that was last set through + * the {@link #getContentHandler()} method, or null + * if that method has never been called since this {@link ValidatorHandler} + * has created. + * + * @see #setContentHandler(ContentHandler) + */ + public abstract ContentHandler getContentHandler(); + + /** + * Sets the {@link ErrorHandler} to receive errors encountered + * during the validation. + * + *
+ * Error handler can be used to customize the error handling process + * during a validation. When an {@link ErrorHandler} is set, + * errors found during the validation will be first sent + * to the {@link ErrorHandler}. + * + *
+ * The error handler can abort further validation immediately + * by throwing {@link org.xml.sax.SAXException} from the handler. Or for example + * it can print an error to the screen and try to continue the + * validation by returning normally from the {@link ErrorHandler} + * + *
+ * If any {@link Throwable} is thrown from an {@link ErrorHandler}, + * the same {@link Throwable} object will be thrown toward the + * root of the call stack. + * + *
+ * {@link ValidatorHandler} is not allowed to + * throw {@link org.xml.sax.SAXException} without first reporting it to + * {@link ErrorHandler}. + * + *
+ * When the {@link ErrorHandler} is null, the implementation will + * behave as if the following {@link ErrorHandler} is set: + *
+ * class DraconianErrorHandler implements {@link ErrorHandler} { + * public void fatalError( {@link org.xml.sax.SAXParseException} e ) throws {@link org.xml.sax.SAXException} { + * throw e; + * } + * public void error( {@link org.xml.sax.SAXParseException} e ) throws {@link org.xml.sax.SAXException} { + * throw e; + * } + * public void warning( {@link org.xml.sax.SAXParseException} e ) throws {@link org.xml.sax.SAXException} { + * // noop + * } + * } + *+ * + *
+ * When a new {@link ValidatorHandler} object is created, initially + * this field is set to null. + * + * @param errorHandler + * A new error handler to be set. This parameter can be null. + */ + public abstract void setErrorHandler(ErrorHandler errorHandler); + + /** + * Gets the current {@link ErrorHandler} set to this {@link ValidatorHandler}. + * + * @return + * This method returns the object that was last set through + * the {@link #setErrorHandler(ErrorHandler)} method, or null + * if that method has never been called since this {@link ValidatorHandler} + * has created. + * + * @see #setErrorHandler(ErrorHandler) + */ + public abstract ErrorHandler getErrorHandler(); + + /** + * Sets the {@link LSResourceResolver} to customize + * resource resolution while in a validation episode. + * + *
+ * {@link ValidatorHandler} uses a {@link LSResourceResolver} + * when it needs to locate external resources while a validation, + * although exactly what constitutes "locating external resources" is + * up to each schema language. + * + *
+ * When the {@link LSResourceResolver} is null, the implementation will + * behave as if the following {@link LSResourceResolver} is set: + *
+ * class DumbLSResourceResolver implements {@link LSResourceResolver} { + * public {@link org.w3c.dom.ls.LSInput} resolveResource( + * String publicId, String systemId, String baseURI) { + * + * return null; // always return null + * } + * } + *+ * + *
+ * If a {@link LSResourceResolver} throws a {@link RuntimeException}
+ * (or instances of its derived classes),
+ * then the {@link ValidatorHandler} will abort the parsing and
+ * the caller of the validate
method will receive
+ * the same {@link RuntimeException}.
+ *
+ *
+ * When a new {@link ValidatorHandler} object is created, initially + * this field is set to null. + * + * @param resourceResolver + * A new resource resolver to be set. This parameter can be null. + */ + public abstract void setResourceResolver(LSResourceResolver resourceResolver); + + /** + * Gets the current {@link LSResourceResolver} set to this {@link ValidatorHandler}. + * + * @return + * This method returns the object that was last set through + * the {@link #setResourceResolver(LSResourceResolver)} method, or null + * if that method has never been called since this {@link ValidatorHandler} + * has created. + * + * @see #setErrorHandler(ErrorHandler) + */ + public abstract LSResourceResolver getResourceResolver(); + + /** + * Obtains the {@link TypeInfoProvider} implementation of this + * {@link ValidatorHandler}. + * + *
+ * The obtained {@link TypeInfoProvider} can be queried during a parse + * to access the type information determined by the validator. + * + *
+ * Some schema languages do not define the notion of type, + * for those languages, this method may not be supported. + * However, to be compliant with this specification, implementations + * for W3C XML Schema 1.0 must support this operation. + * + * @return + * null if the validator / schema language does not support + * the notion of {@link org.w3c.dom.TypeInfo}. + * Otherwise a non-null valid {@link TypeInfoProvider}. + */ + public abstract TypeInfoProvider getTypeInfoProvider(); + + + /** + * Look up the value of a feature flag. + * + *
The feature name is any fully-qualified URI. It is + * possible for a {@link ValidatorHandler} to recognize a feature name but + * temporarily be unable to return its value. + * Some feature values may be available only in specific + * contexts, such as before, during, or after a validation. + * + *
Implementors are free (and encouraged) to invent their own features, + * using names built on their own URIs.
+ * + * @param name The feature name, which is a non-null fully-qualified URI. + * @return The current value of the feature (true or false). + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * {@link ValidatorHandler} recognizes the feature name but + * cannot determine its value at this time. + * @throws NullPointerException + * When the name parameter is null. + * @see #setFeature(String, boolean) + */ + public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { + if(name==null) + throw new NullPointerException(); + throw new SAXNotRecognizedException(name); + } + + /** + * Set the value of a feature flag. + * + *+ * Feature can be used to control the way a {@link ValidatorHandler} + * parses schemas, although {@link ValidatorHandler}s are not required + * to recognize any specific property names.
+ * + *The feature name is any fully-qualified URI. It is + * possible for a {@link ValidatorHandler} to expose a feature value but + * to be unable to change the current value. + * Some feature values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a validation.
+ * + * @param name The feature name, which is a non-null fully-qualified URI. + * @param value The requested value of the feature (true or false). + * + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * {@link ValidatorHandler} recognizes the feature name but + * cannot set the requested value. + * @throws NullPointerException + * When the name parameter is null. + * + * @see #getFeature(String) + */ + public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { + if(name==null) + throw new NullPointerException(); + throw new SAXNotRecognizedException(name); + } + + /** + * Set the value of a property. + * + *The property name is any fully-qualified URI. It is + * possible for a {@link ValidatorHandler} to recognize a property name but + * to be unable to change the current value. + * Some property values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a validation.
+ * + *{@link ValidatorHandler}s are not required to recognize setting + * any specific property names.
+ * + * @param name The property name, which is a non-null fully-qualified URI. + * @param object The requested value for the property. + * + * @exception org.xml.sax.SAXNotRecognizedException If the property + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * {@link ValidatorHandler} recognizes the property name but + * cannot set the requested value. + * @throws NullPointerException + * When the name parameter is null. + */ + public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { + if(name==null) + throw new NullPointerException(); + throw new SAXNotRecognizedException(name); + } + + /** + * Look up the value of a property. + * + *The property name is any fully-qualified URI. It is + * possible for a {@link ValidatorHandler} to recognize a property name but + * temporarily be unable to return its value. + * Some property values may be available only in specific + * contexts, such as before, during, or after a validation.
+ * + *{@link ValidatorHandler}s are not required to recognize any specific + * property names.
+ * + *Implementors are free (and encouraged) to invent their own properties, + * using names built on their own URIs.
+ * + * @param name The property name, which is a non-null fully-qualified URI. + * @return The current value of the property. + * @exception org.xml.sax.SAXNotRecognizedException If the property + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot determine its value at this time. + * @throws NullPointerException + * When the name parameter is null. + * @see #setProperty(String, Object) + */ + public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { + if(name==null) + throw new NullPointerException(); + throw new SAXNotRecognizedException(name); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/package.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/package.html new file mode 100644 index 000000000..b9f71a415 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/validation/package.html @@ -0,0 +1,91 @@ + + + + ++ This package provides an API for validation of XML documents. Validation is the process of verifying + that an XML document is an instance of a specified XML schema. An XML schema defines the + content model (also called a grammar or vocabulary) that its instance documents + will represent. +
++ There are a number of popular technologies available for creating an XML schema. Some of the most + popular include: +
+ Previous versions of JAXP supported validation as a feature of an XML parser, represented by + either a {@link javax.xml.parsers.SAXParser} or {@link javax.xml.parsers.DocumentBuilder} instance. +
++ The JAXP validation API decouples the validation of an instance document from the parsing of an + XML document. This is advantageous for several reasons, some of which are: +
+ Usage example. The following example demonstrates validating + an XML document with the Validation API (for readability, some exception handling is not shown): +
+ + // parse an XML document into a DOM tree + DocumentBuilderFactory parserFactory = DocumentBuilderFactory.newInstance(); + parserFactory.setNamespaceAware(true); + DocumentBuilder parser = parserFactory.newDocumentBuilder(); + Document document = parser.parse(new File("instance.xml")); + + // create a SchemaFactory capable of understanding WXS schemas + SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + + // load a WXS schema, represented by a Schema instance + Source schemaFile = new StreamSource(new File("mySchema.xsd")); + Schema schema = factory.newSchema(schemaFile); + + // create a Validator instance, which can be used to validate an instance document + Validator validator = schema.newValidator(); + + // validate the DOM tree + try { + validator.validate(new DOMSource(document)); + } catch (SAXException e) { + // instance document is invalid! + } ++ +
+ The JAXP parsing API has been integrated with the Validation API. Applications may create a {@link javax.xml.validation.Schema} with the validation API
+ and associate it with a {@link javax.xml.parsers.DocumentBuilderFactory} or a {@link javax.xml.parsers.SAXParserFactory} instance
+ by using the {@link javax.xml.parsers.DocumentBuilderFactory#setSchema(Schema)} and {@link javax.xml.parsers.SAXParserFactory#setSchema(Schema)}
+ methods. You should not both set a schema and call setValidating(true)
on a parser factory. The former technique
+ will cause parsers to use the new validation API; the latter will cause parsers to use their own internal validation
+ facilities. Turning on both of these options simultaneously will cause either redundant behavior or error conditions.
+
+ + + diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/SecuritySupport.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/SecuritySupport.java new file mode 100644 index 000000000..24905522b --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/SecuritySupport.java @@ -0,0 +1,162 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: SecuritySupport.java 522337 2007-03-25 20:03:27Z mrglavas $ + +package javax.xml.xpath; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.Enumeration; + +/** + * This class is duplicated for each JAXP subpackage so keep it in sync. + * It is package private and therefore is not exposed as part of the JAXP + * API. + * + * Security related methods that only work on J2SE 1.2 and newer. + */ +final class SecuritySupport { + + private SecuritySupport() {} + + static ClassLoader getContextClassLoader() { + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); + } + + static String getSystemProperty(final String propName) { + return (String) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(propName); + } + }); + } + + static FileInputStream getFileInputStream(final File file) + throws FileNotFoundException + { + try { + return (FileInputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws FileNotFoundException { + return new FileInputStream(file); + } + }); + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } + } + + static InputStream getURLInputStream(final URL url) + throws IOException + { + try { + return (InputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IOException { + return url.openStream(); + } + }); + } catch (PrivilegedActionException e) { + throw (IOException)e.getException(); + } + } + + static URL getResourceAsURL(final ClassLoader cl, + final String name) + { + return (URL) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + URL url; + if (cl == null) { + url = ClassLoader.getSystemResource(name); + } + else { + url = cl.getResource(name); + } + return url; + } + }); + } + + static Enumeration getResources(final ClassLoader cl, + final String name) throws IOException + { + try{ + return (Enumeration) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws IOException{ + Enumeration enumeration; + if (cl == null) { + enumeration = ClassLoader.getSystemResources(name); + } + else { + enumeration = cl.getResources(name); + } + return enumeration; + } + }); + }catch(PrivilegedActionException e){ + throw (IOException)e.getException(); + } + } + + static InputStream getResourceAsStream(final ClassLoader cl, + final String name) + { + return (InputStream) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + InputStream ris; + if (cl == null) { + ris = ClassLoader.getSystemResourceAsStream(name); + } else { + ris = cl.getResourceAsStream(name); + } + return ris; + } + }); + } + + static boolean doesFileExist(final File f) { + return ((Boolean) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return f.exists() ? Boolean.TRUE : Boolean.FALSE; + } + })).booleanValue(); + } + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPath.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPath.java new file mode 100644 index 000000000..529573d65 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPath.java @@ -0,0 +1,299 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: XPath.java 569998 2007-08-27 04:40:02Z mrglavas $ + +package javax.xml.xpath; + +import org.xml.sax.InputSource; +import javax.xml.namespace.QName; +import javax.xml.namespace.NamespaceContext; + +/** + *
XPath
provides access to the XPath evaluation environment and expressions.
Evaluation of XPath Expressions. | + *|
---|---|
context | + *+ * If a request is made to evaluate the expression in the absence + * of a context item, an empty document node will be used for the context. + * For the purposes of evaluating XPath expressions, a DocumentFragment + * is treated like a Document node. + * | + *
variables | + *
+ * If the expression contains a variable reference, its value will be found through the {@link XPathVariableResolver}
+ * set with {@link #setXPathVariableResolver(XPathVariableResolver resolver)}.
+ * An {@link XPathExpressionException} is raised if the variable resolver is undefined or
+ * the resolver returns null for the variable.
+ * The value of a variable must be immutable through the course of any single evaluation.
+ * |
+ *
functions | + *
+ * If the expression contains a function reference, the function will be found through the {@link XPathFunctionResolver}
+ * set with {@link #setXPathFunctionResolver(XPathFunctionResolver resolver)}.
+ * An {@link XPathExpressionException} is raised if the function resolver is undefined or
+ * the function resolver returns null for the function.
+ * |
+ *
QNames | + *+ * QNames in the expression are resolved against the XPath namespace context + * set with {@link #setNamespaceContext(NamespaceContext nsContext)}. + * | + *
result | + *+ * This result of evaluating an expression is converted to an instance of the desired return type. + * Valid return types are defined in {@link XPathConstants}. + * Conversion to the return type follows XPath conversion rules. + * | + *
Reset this XPath
to its original configuration.
XPath
is reset to the same state as when it was created with
+ * {@link XPathFactory#newXPath()}.
+ * reset()
is designed to allow the reuse of existing XPath
s
+ * thus saving resources associated with the creation of new XPath
s.
The reset XPath
is not guaranteed to have the same {@link XPathFunctionResolver}, {@link XPathVariableResolver}
+ * or {@link NamespaceContext} Object
s, e.g. {@link Object#equals(Object obj)}.
+ * It is guaranteed to have a functionally equal XPathFunctionResolver
, XPathVariableResolver
+ * and NamespaceContext
.
Establish a variable resolver.
+ * + *A NullPointerException
is thrown if resolver
is null
.
resolver
is null
.
+ */
+ public void setXPathVariableResolver(XPathVariableResolver resolver);
+
+ /**
+ * Return the current variable resolver.
+ * + *null
is returned in no variable resolver is in effect.
Establish a function resolver.
+ * + *A NullPointerException
is thrown if resolver
is null
.
resolver
is null
.
+ */
+ public void setXPathFunctionResolver(XPathFunctionResolver resolver);
+
+ /**
+ * Return the current function resolver.
+ * + *null
is returned in no function resolver is in effect.
Establish a namespace context.
+ * + *A NullPointerException
is thrown if nsContext
is null
.
nsContext
is null
.
+ */
+ public void setNamespaceContext(NamespaceContext nsContext);
+
+ /**
+ * Return the current namespace context.
+ * + *null
is returned in no namespace context is in effect.
Compile an XPath expression for later evaluation.
+ * + *If expression
contains any {@link XPathFunction}s,
+ * they must be available via the {@link XPathFunctionResolver}.
+ * An {@link XPathExpressionException} will be thrown if the XPathFunction
+ * cannot be resolved with the XPathFunctionResolver
.
If expression
is null
, a NullPointerException
is thrown.
expression
cannot be compiled.
+ * @throws NullPointerException If expression
is null
.
+ */
+ public XPathExpression compile(String expression)
+ throws XPathExpressionException;
+
+ /**
+ * Evaluate an XPath
expression in the specified context and return the result as the specified type.
See Evaluation of XPath Expressions for context item evaluation,
+ * variable, function and QName
resolution and return type conversion.
If returnType
is not one of the types defined in {@link XPathConstants} (
+ * {@link XPathConstants#NUMBER NUMBER},
+ * {@link XPathConstants#STRING STRING},
+ * {@link XPathConstants#BOOLEAN BOOLEAN},
+ * {@link XPathConstants#NODE NODE} or
+ * {@link XPathConstants#NODESET NODESET})
+ * then an IllegalArgumentException
is thrown.
If a null
value is provided for
+ * item
, an empty document will be used for the
+ * context.
+ * If expression
or returnType
is null
, then a
+ * NullPointerException
is thrown.
Object
of returnType
.
+ *
+ * @throws XPathExpressionException If expression
cannot be evaluated.
+ * @throws IllegalArgumentException If returnType
is not one of the types defined in {@link XPathConstants}.
+ * @throws NullPointerException If expression
or returnType
is null
.
+ */
+ public Object evaluate(String expression, Object item, QName returnType)
+ throws XPathExpressionException;
+
+ /**
+ * Evaluate an XPath expression in the specified context and return the result as a String
.
This method calls {@link #evaluate(String expression, Object item, QName returnType)} with a returnType
of
+ * {@link XPathConstants#STRING}.
See Evaluation of XPath Expressions for context item evaluation, + * variable, function and QName resolution and return type conversion.
+ * + *If a null
value is provided for
+ * item
, an empty document will be used for the
+ * context.
+ * If expression
is null
, then a NullPointerException
is thrown.
String
that is the result of evaluating the expression and
+ * converting the result to a String
.
+ *
+ * @throws XPathExpressionException If expression
cannot be evaluated.
+ * @throws NullPointerException If expression
is null
.
+ */
+ public String evaluate(String expression, Object item)
+ throws XPathExpressionException;
+
+ /**
+ * Evaluate an XPath expression in the context of the specified InputSource
+ * and return the result as the specified type.
This method builds a data model for the {@link InputSource} and calls + * {@link #evaluate(String expression, Object item, QName returnType)} on the resulting document object.
+ * + *See Evaluation of XPath Expressions for context item evaluation, + * variable, function and QName resolution and return type conversion.
+ * + *If returnType
is not one of the types defined in {@link XPathConstants},
+ * then an IllegalArgumentException
is thrown.
If expression
, source
or returnType
is null
,
+ * then a NullPointerException
is thrown.
Object
that encapsulates the result of evaluating the expression.
+ *
+ * @throws XPathExpressionException If expression cannot be evaluated.
+ * @throws IllegalArgumentException If returnType
is not one of the types defined in {@link XPathConstants}.
+ * @throws NullPointerException If expression
, source
or returnType
+ * is null
.
+ */
+ public Object evaluate(
+ String expression,
+ InputSource source,
+ QName returnType)
+ throws XPathExpressionException;
+
+ /**
+ * Evaluate an XPath expression in the context of the specified InputSource
+ * and return the result as a String
.
This method calls {@link #evaluate(String expression, InputSource source, QName returnType)} with a
+ * returnType
of {@link XPathConstants#STRING}.
See Evaluation of XPath Expressions for context item evaluation, + * variable, function and QName resolution and return type conversion.
+ * + *If expression
or source
is null
,
+ * then a NullPointerException
is thrown.
InputSource
of the document to evaluate over.
+ *
+ * @return The String
that is the result of evaluating the expression and
+ * converting the result to a String
.
+ *
+ * @throws XPathExpressionException If expression cannot be evaluated.
+ * @throws NullPointerException If expression
or source
is null
.
+ */
+ public String evaluate(String expression, InputSource source)
+ throws XPathExpressionException;
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathConstants.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathConstants.java
new file mode 100644
index 000000000..ac683d72b
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathConstants.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathConstants.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+import javax.xml.namespace.QName;
+
+/**
+ * XPath constants.
+ * + * @author Norman Walsh + * @author Jeff Suttor + * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $ + * @see XML Path Language (XPath) Version 1.0 + * @since 1.5 + */ +public class XPathConstants { + + /** + *Private constructor to prevent instantiation.
+ */ + private XPathConstants() { } + + /** + *The XPath 1.0 number data type.
+ * + *Maps to Java {@link Double}.
+ */ + public static final QName NUMBER = new QName("http://www.w3.org/1999/XSL/Transform", "NUMBER"); + + /** + *The XPath 1.0 string data type.
+ * + *Maps to Java {@link String}.
+ */ + public static final QName STRING = new QName("http://www.w3.org/1999/XSL/Transform", "STRING"); + + /** + *The XPath 1.0 boolean data type.
+ * + *Maps to Java {@link Boolean}.
+ */ + public static final QName BOOLEAN = new QName("http://www.w3.org/1999/XSL/Transform", "BOOLEAN"); + + /** + *The XPath 1.0 NodeSet data type.
+ * + *Maps to Java {@link org.w3c.dom.NodeList}.
+ */ + public static final QName NODESET = new QName("http://www.w3.org/1999/XSL/Transform", "NODESET"); + + /** + *The XPath 1.0 NodeSet data type. + * + *
Maps to Java {@link org.w3c.dom.Node}.
+ */ + public static final QName NODE = new QName("http://www.w3.org/1999/XSL/Transform", "NODE"); + + /** + *The URI for the DOM object model, "http://java.sun.com/jaxp/xpath/dom".
+ */ + public static final String DOM_OBJECT_MODEL = "http://java.sun.com/jaxp/xpath/dom"; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathException.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathException.java new file mode 100644 index 000000000..efad90fe9 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathException.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: XPathException.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.xpath; + +import java.io.PrintWriter; + +/** + *XPathException
represents a generic XPath exception.
+ *
+ * @author Norman Walsh
+ * @author Jeff Suttor
+ * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $
+ * @since 1.5
+ */
+public class XPathException extends Exception {
+
+ private final Throwable cause;
+
+ /**
+ * Stream Unique Identifier.
+ */ + private static final long serialVersionUID = -1837080260374986980L; + + /** + *Constructs a new XPathException
with the specified detail message
.
The cause
is not initialized.
If message
is null
, then a NullPointerException
is thrown.
Constructs a new XPathException
with the specified cause
.
If cause
is null
, then a NullPointerException
is thrown.
cause
is null
.
+ */
+ public XPathException(Throwable cause) {
+ super(cause == null ? null : cause.toString());
+ this.cause = cause;
+ if ( cause == null ) {
+ throw new NullPointerException ( "cause can't be null");
+ }
+ }
+
+ public Throwable getCause() {
+ return cause;
+ }
+
+ public void printStackTrace( java.io.PrintStream s ) {
+ if( getCause() != null ) {
+ getCause().printStackTrace(s);
+ s.println("--------------- linked to ------------------");
+ }
+
+ super.printStackTrace(s);
+ }
+
+ public void printStackTrace() {
+ printStackTrace(System.err);
+ }
+
+ public void printStackTrace(PrintWriter s) {
+ if( getCause() != null ) {
+ getCause().printStackTrace(s);
+ s.println("--------------- linked to ------------------");
+ }
+
+ super.printStackTrace(s);
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathExpression.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathExpression.java
new file mode 100644
index 000000000..c1ca5f9e6
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathExpression.java
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathExpression.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+import org.xml.sax.InputSource;
+import javax.xml.namespace.QName;
+
+/**
+ * XPathExpression
provides access to compiled XPath expressions.
Evaluation of XPath Expressions. | + *|
---|---|
context | + *+ * If a request is made to evaluate the expression in the absence + * of a context item, an empty document node will be used for the context. + * For the purposes of evaluating XPath expressions, a DocumentFragment + * is treated like a Document node. + * | + *
variables | + *
+ * If the expression contains a variable reference, its value will be found through the {@link XPathVariableResolver}.
+ * An {@link XPathExpressionException} is raised if the variable resolver is undefined or
+ * the resolver returns null for the variable.
+ * The value of a variable must be immutable through the course of any single evaluation.
+ * |
+ *
functions | + *
+ * If the expression contains a function reference, the function will be found through the {@link XPathFunctionResolver}.
+ * An {@link XPathExpressionException} is raised if the function resolver is undefined or
+ * the function resolver returns null for the function.
+ * |
+ *
QNames | + *+ * QNames in the expression are resolved against the XPath namespace context. + * | + *
result | + *+ * This result of evaluating an expression is converted to an instance of the desired return type. + * Valid return types are defined in {@link XPathConstants}. + * Conversion to the return type follows XPath conversion rules. + * | + *
Evaluate the compiled XPath expression in the specified context and return the result as the specified type.
+ * + *See Evaluation of XPath Expressions for context item evaluation, + * variable, function and QName resolution and return type conversion.
+ * + *If returnType
is not one of the types defined in {@link XPathConstants},
+ * then an IllegalArgumentException
is thrown.
If a null
value is provided for
+ * item
, an empty document will be used for the
+ * context.
+ * If returnType
is null
, then a NullPointerException
is thrown.
Object
that is the result of evaluating the expression and converting the result to
+ * returnType
.
+ *
+ * @throws XPathExpressionException If the expression cannot be evaluated.
+ * @throws IllegalArgumentException If returnType
is not one of the types defined in {@link XPathConstants}.
+ * @throws NullPointerException If returnType
is null
.
+ */
+ public Object evaluate(Object item, QName returnType)
+ throws XPathExpressionException;
+
+ /**
+ * Evaluate the compiled XPath expression in the specified context and return the result as a String
.
This method calls {@link #evaluate(Object item, QName returnType)} with a returnType
of
+ * {@link XPathConstants#STRING}.
See Evaluation of XPath Expressions for context item evaluation, + * variable, function and QName resolution and return type conversion.
+ * + *If a null
value is provided for
+ * item
, an empty document will be used for the
+ * context.
+ *
+ * @param item The starting context (node or node list, for example).
+ *
+ * @return The String
that is the result of evaluating the expression and converting the result to a
+ * String
.
+ *
+ * @throws XPathExpressionException If the expression cannot be evaluated.
+ */
+ public String evaluate(Object item)
+ throws XPathExpressionException;
+
+ /**
+ *
Evaluate the compiled XPath expression in the context of the specified InputSource
and return the result as the
+ * specified type.
This method builds a data model for the {@link InputSource} and calls + * {@link #evaluate(Object item, QName returnType)} on the resulting document object.
+ * + *See Evaluation of XPath Expressions for context item evaluation, + * variable, function and QName resolution and return type conversion.
+ * + *If returnType
is not one of the types defined in {@link XPathConstants},
+ * then an IllegalArgumentException
is thrown.
If source
or returnType
is null
,
+ * then a NullPointerException
is thrown.
InputSource
of the document to evaluate over.
+ * @param returnType The desired return type.
+ *
+ * @return The Object
that is the result of evaluating the expression and converting the result to
+ * returnType
.
+ *
+ * @throws XPathExpressionException If the expression cannot be evaluated.
+ * @throws IllegalArgumentException If returnType
is not one of the types defined in {@link XPathConstants}.
+ * @throws NullPointerException If source
or returnType
is null
.
+ */
+ public Object evaluate(InputSource source, QName returnType)
+ throws XPathExpressionException;
+
+ /**
+ * Evaluate the compiled XPath expression in the context of the specified InputSource
and return the result as a
+ * String
.
This method calls {@link #evaluate(InputSource source, QName returnType)} with a returnType
of
+ * {@link XPathConstants#STRING}.
See Evaluation of XPath Expressions for context item evaluation, + * variable, function and QName resolution and return type conversion.
+ * + *If source
is null
, then a NullPointerException
is thrown.
InputSource
of the document to evaluate over.
+ *
+ * @return The String
that is the result of evaluating the expression and converting the result to a
+ * String
.
+ *
+ * @throws XPathExpressionException If the expression cannot be evaluated.
+ * @throws NullPointerException If source
is null
.
+ */
+ public String evaluate(InputSource source)
+ throws XPathExpressionException;
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathExpressionException.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathExpressionException.java
new file mode 100644
index 000000000..449789c00
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathExpressionException.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathExpressionException.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+/**
+ * XPathExpressionException
represents an error in an XPath expression.
+ *
+ * @author Norman Walsh
+ * @author Jeff Suttor
+ * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $
+ * @since 1.5
+ */
+public class XPathExpressionException extends XPathException {
+
+ /**
+ * Stream Unique Identifier.
+ */ + private static final long serialVersionUID = -1837080260374986980L; + + /** + *Constructs a new XPathExpressionException
with the specified detail message
.
The cause
is not initialized.
If message
is null
, then a NullPointerException
is thrown.
Constructs a new XPathExpressionException
with the specified cause
.
If cause
is null
, then a NullPointerException
is thrown.
cause
is null
.
+ */
+ public XPathExpressionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactory.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactory.java
new file mode 100644
index 000000000..636bb2ae7
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactory.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathFactory.java 888889 2009-12-09 17:43:18Z mrglavas $
+
+package javax.xml.xpath;
+
+/**
+ * An XPathFactory
instance can be used to create
+ * {@link javax.xml.xpath.XPath} objects.
See {@link #newInstance(String uri)} for lookup mechanism.
+ * + * @author Norman Walsh + * @author Jeff Suttor + * @version $Revision: 888889 $, $Date: 2009-12-09 12:43:18 -0500 (Wed, 09 Dec 2009) $ + * @since 1.5 + */ +public abstract class XPathFactory { + + + /** + *The default property name according to the JAXP spec.
+ */ + public static final String DEFAULT_PROPERTY_NAME = "javax.xml.xpath.XPathFactory"; + + /** + *Default Object Model URI.
+ */ + public static final String DEFAULT_OBJECT_MODEL_URI = "http://java.sun.com/jaxp/xpath/dom"; + + /** + *Protected constructor as {@link #newInstance()}, {@link #newInstance(String uri)}
+ * or {@link #newInstance(String uri, String factoryClassName, ClassLoader classLoader)}
+ * should be used to create a new instance of an XPathFactory
.
Get a new XPathFactory
instance using the default object model,
+ * {@link #DEFAULT_OBJECT_MODEL_URI},
+ * the W3C DOM.
This method is functionally equivalent to:
+ *+ * newInstance(DEFAULT_OBJECT_MODEL_URI) + *+ * + *
Since the implementation for the W3C DOM is always available, this method will never fail.
+ * + * @return Instance of anXPathFactory
.
+ */
+ public static final XPathFactory newInstance() {
+ try {
+ return newInstance(DEFAULT_OBJECT_MODEL_URI);
+ }
+ catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) {
+ throw new RuntimeException(
+ "XPathFactory#newInstance() failed to create an XPathFactory for the default object model: "
+ + DEFAULT_OBJECT_MODEL_URI
+ + " with the XPathFactoryConfigurationException: "
+ + xpathFactoryConfigurationException.toString()
+ );
+ }
+ }
+
+ /**
+ * Get a new XPathFactory
instance using the specified object model.
To find a XPathFactory
object,
+ * this method looks the following places in the following order where "the class loader" refers to the context class loader:
javax.xml.xpath.XPathFactory
+ * in the resource directory META-INF/services.
+ * See the JAR File Specification for file format and parsing rules.
+ * Each potential service provider is required to implement the method:
+ * + * {@link #isObjectModelSupported(String objectModel)} + *+ * The first service provider found in class loader order that supports the specified object model is returned. + *
XPathFactory
is located in a platform specific way.
+ * There must be a platform default XPathFactory for the W3C DOM, i.e. {@link #DEFAULT_OBJECT_MODEL_URI}.
+ * If everything fails, an XPathFactoryConfigurationException
will be thrown.
Tip for Trouble-shooting:
+ *See {@link java.util.Properties#load(java.io.InputStream)} for exactly how a property file is parsed. + * In particular, colons ':' need to be escaped in a property file, so make sure the URIs are properly escaped in it. + * For example:
+ *+ * http\://java.sun.com/jaxp/xpath/dom=org.acme.DomXPathFactory + *+ * + * @param uri Identifies the underlying object model. + * The specification only defines the URI {@link #DEFAULT_OBJECT_MODEL_URI}, + *
http://java.sun.com/jaxp/xpath/dom
for the W3C DOM,
+ * the org.w3c.dom package, and implementations are free to introduce other URIs for other object models.
+ *
+ * @return Instance of an XPathFactory
.
+ *
+ * @throws XPathFactoryConfigurationException If the specified object model is unavailable.
+ * @throws NullPointerException If uri
is null
.
+ * @throws IllegalArgumentException If uri.length() == 0
.
+ */
+ public static final XPathFactory newInstance(final String uri)
+ throws XPathFactoryConfigurationException {
+ if (uri == null) {
+ throw new NullPointerException(
+ "XPathFactory#newInstance(String uri) cannot be called with uri == null"
+ );
+ }
+ if (uri.length() == 0) {
+ throw new IllegalArgumentException(
+ "XPathFactory#newInstance(String uri) cannot be called with uri == \"\""
+ );
+ }
+ ClassLoader classLoader = SecuritySupport.getContextClassLoader();
+ if (classLoader == null) {
+ //use the current class loader
+ classLoader = XPathFactory.class.getClassLoader();
+ }
+ XPathFactory xpathFactory = new XPathFactoryFinder(classLoader).newFactory(uri);
+ if (xpathFactory == null) {
+ throw new XPathFactoryConfigurationException(
+ "No XPathFctory implementation found for the object model: "
+ + uri
+ );
+ }
+ return xpathFactory;
+ }
+
+ /**
+ * @return Instance of an XPathFactory
.
+ *
+ * @throws XPathFactoryConfigurationException If the specified object model is unavailable.
+ * @throws NullPointerException If uri
is null
.
+ * @throws IllegalArgumentException If uri.length() == 0
.
+ */
+ public static XPathFactory newInstance(String uri, String factoryClassName,
+ ClassLoader classLoader) throws XPathFactoryConfigurationException {
+ if (uri == null) {
+ throw new NullPointerException(
+ "XPathFactory#newInstance(String uri) cannot be called with uri == null"
+ );
+ }
+ if (uri.length() == 0) {
+ throw new IllegalArgumentException(
+ "XPathFactory#newInstance(String uri) cannot be called with uri == \"\""
+ );
+ }
+ if (factoryClassName == null) {
+ throw new XPathFactoryConfigurationException("factoryClassName cannot be null.");
+ }
+ if (classLoader == null) {
+ classLoader = SecuritySupport.getContextClassLoader();
+ }
+ XPathFactory xpathFactory = new XPathFactoryFinder(classLoader).createInstance(factoryClassName);
+ if (xpathFactory == null || !xpathFactory.isObjectModelSupported(uri)) {
+ throw new XPathFactoryConfigurationException(
+ "No XPathFctory implementation found for the object model: "
+ + uri
+ );
+ }
+ return xpathFactory;
+ }
+
+ /**
+ * Is specified object model supported by this XPathFactory
?
XPathFactory
will understand.
+ *
+ * @return true
if XPathFactory
supports objectModel
, else false
.
+ *
+ * @throws NullPointerException If objectModel
is null
.
+ * @throws IllegalArgumentException If objectModel.length() == 0
.
+ */
+ public abstract boolean isObjectModelSupported(String objectModel);
+
+ /**
+ * Set a feature for this XPathFactory
and XPath
s created by this factory.
+ * Feature names are fully qualified {@link java.net.URI}s.
+ * Implementations may define their own features.
+ * An {@link XPathFactoryConfigurationException} is thrown if this XPathFactory
or the XPath
s
+ * it creates cannot support the feature.
+ * It is possible for an XPathFactory
to expose a feature value but be unable to change its state.
+ *
+ * All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature.
+ * When the feature is true
, any reference to an external function is an error.
+ * Under these conditions, the implementation must not call the {@link XPathFunctionResolver}
+ * and must throw an {@link XPathFunctionException}.
+ *
true
or false
.
+ *
+ * @throws XPathFactoryConfigurationException if this XPathFactory
or the XPath
s
+ * it creates cannot support this feature.
+ * @throws NullPointerException if name
is null
.
+ */
+ public abstract void setFeature(String name, boolean value)
+ throws XPathFactoryConfigurationException;
+
+ /**
+ * Get the state of the named feature.
+ * + *
+ * Feature names are fully qualified {@link java.net.URI}s.
+ * Implementations may define their own features.
+ * An {@link XPathFactoryConfigurationException} is thrown if this XPathFactory
or the XPath
s
+ * it creates cannot support the feature.
+ * It is possible for an XPathFactory
to expose a feature value but be unable to change its state.
+ *
XPathFactory
or the XPath
s
+ * it creates cannot support this feature.
+ * @throws NullPointerException if name
is null
.
+ */
+ public abstract boolean getFeature(String name)
+ throws XPathFactoryConfigurationException;
+
+ /**
+ * Establish a default variable resolver.
+ * + *Any XPath
objects constructed from this factory will use
+ * the specified resolver by default.
A NullPointerException
is thrown if resolver
is null
.
resolver
is null
.
+ */
+ public abstract void setXPathVariableResolver(XPathVariableResolver resolver);
+
+ /**
+ * Establish a default function resolver.
+ * + *Any XPath
objects constructed from this factory will use
+ * the specified resolver by default.
A NullPointerException
is thrown if resolver
is null
.
resolver
is null
.
+ */
+ public abstract void setXPathFunctionResolver(XPathFunctionResolver resolver);
+
+ /**
+ * Return a new XPath
using the underlying object
+ * model determined when the XPathFactory
was instantiated.
XPath
.
+ */
+ public abstract XPath newXPath();
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactoryConfigurationException.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactoryConfigurationException.java
new file mode 100644
index 000000000..d79489f35
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactoryConfigurationException.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathFactoryConfigurationException.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+/**
+ * XPathFactoryConfigurationException
represents a configuration error in a XPathFactory
environment.
+ *
+ * @author Norman Walsh
+ * @author Jeff Suttor
+ * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $
+ * @since 1.5
+ */
+public class XPathFactoryConfigurationException extends XPathException {
+
+ /**
+ * Stream Unique Identifier.
+ */ + private static final long serialVersionUID = -1837080260374986980L; + + /** + *Constructs a new XPathFactoryConfigurationException
with the specified detail message
.
The cause
is not initialized.
If message
is null
, then a NullPointerException
is thrown.
Constructs a new XPathFactoryConfigurationException
with the specified cause
.
If cause
is null
, then a NullPointerException
is thrown.
cause
is null
.
+ */
+ public XPathFactoryConfigurationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactoryFinder.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
new file mode 100644
index 000000000..f6c65c654
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
@@ -0,0 +1,455 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathFactoryFinder.java 670432 2008-06-23 02:02:08Z mrglavas $
+
+package javax.xml.xpath;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+
+import javax.xml.validation.SchemaFactory;
+
+/**
+ * Implementation of {@link XPathFactory#newInstance(String)}.
+ *
+ * @author Kohsuke Kawaguchi
+ * @version $Revision: 670432 $, $Date: 2008-06-22 22:02:08 -0400 (Sun, 22 Jun 2008) $
+ * @since 1.5
+ */
+final class XPathFactoryFinder {
+
+ /** debug support code. */
+ private static boolean debug = false;
+
+ /**
+ * Default columns per line.
+ */
+ private static final int DEFAULT_LINE_LENGTH = 80;
+
+ static {
+ // Use try/catch block to support applets
+ try {
+ String val = SecuritySupport.getSystemProperty("jaxp.debug");
+ // Allow simply setting the prop to turn on debug
+ debug = val != null && (! "false".equals(val));
+ } catch (Exception _) {
+ debug = false;
+ }
+ }
+
+ /**
+ * Cache properties for performance.
+ */ + private static Properties cacheProps = new Properties(); + + /** + *First time requires initialization overhead.
+ */ + private static boolean firstTime = true; + + /** + *Conditional debug printing.
+ * + * @param msg to print + */ + private static void debugPrintln(String msg) { + if (debug) { + System.err.println("JAXP: " + msg); + } + } + + /** + *ClassLoader
to use to find SchemaFactory
.
Constructor that specifies ClassLoader
to use
+ * to find SchemaFactory
.
Creates a new {@link XPathFactory} object for the specified + * schema language.
+ * + * @param uri + * Identifies the underlying object model. + * + * @returnnull
if the callee fails to create one.
+ *
+ * @throws NullPointerException
+ * If the parameter is null.
+ */
+ public XPathFactory newFactory(String uri) {
+ if(uri==null) throw new NullPointerException();
+ XPathFactory f = _newFactory(uri);
+ if (debug) {
+ if (f != null) {
+ debugPrintln("factory '" + f.getClass().getName() + "' was found for " + uri);
+ } else {
+ debugPrintln("unable to find a factory for " + uri);
+ }
+ }
+ return f;
+ }
+
+ /**
+ * Lookup a {@link XPathFactory} for the given object model.
+ * + * @param uri identifies the object model. + * + * @return {@link XPathFactory} for the given object model. + */ + private XPathFactory _newFactory(String uri) { + XPathFactory xpf; + + String propertyName = SERVICE_CLASS.getName() + ":" + uri; + + // system property look up + try { + if (debug) debugPrintln("Looking up system property '"+propertyName+"'" ); + String r = SecuritySupport.getSystemProperty(propertyName); + if (r != null && r.length() > 0) { + if (debug) debugPrintln("The value is '"+r+"'"); + xpf = createInstance(r); + if(xpf!=null) return xpf; + } + else if (debug) { + debugPrintln("The property is undefined."); + } + } + // The VM ran out of memory or there was some other serious problem. Re-throw. + catch (VirtualMachineError vme) { + throw vme; + } + // ThreadDeath should always be re-thrown + catch (ThreadDeath td) { + throw td; + } + catch (Throwable t) { + if( debug ) { + debugPrintln("failed to look up system property '"+propertyName+"'" ); + t.printStackTrace(); + } + } + + String javah = SecuritySupport.getSystemProperty( "java.home" ); + String configFile = javah + File.separator + + "lib" + File.separator + "jaxp.properties"; + + String factoryClassName = null ; + + // try to read from $java.home/lib/jaxp.properties + try { + if(firstTime){ + synchronized(cacheProps){ + if(firstTime){ + File f=new File( configFile ); + firstTime = false; + if(SecuritySupport.doesFileExist(f)){ + if (debug) debugPrintln("Read properties file " + f); + cacheProps.load(SecuritySupport.getFileInputStream(f)); + } + } + } + } + factoryClassName = cacheProps.getProperty(propertyName); + if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties"); + + if (factoryClassName != null) { + xpf = createInstance(factoryClassName); + if(xpf != null){ + return xpf; + } + } + } catch (Exception ex) { + if (debug) { + ex.printStackTrace(); + } + } + + // try META-INF/services files + Iterator sitr = createServiceFileIterator(); + while(sitr.hasNext()) { + URL resource = (URL)sitr.next(); + if (debug) debugPrintln("looking into " + resource); + try { + xpf = loadFromServicesFile(uri, resource.toExternalForm(), SecuritySupport.getURLInputStream(resource)); + if(xpf!=null) return xpf; + } catch(IOException e) { + if( debug ) { + debugPrintln("failed to read "+resource); + e.printStackTrace(); + } + } + } + + // platform default + if(uri.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) { + if (debug) debugPrintln("attempting to use the platform default W3C DOM XPath lib"); + return createInstance("org.apache.xpath.jaxp.XPathFactoryImpl"); + } + + if (debug) debugPrintln("all things were tried, but none was found. bailing out."); + return null; + } + + /** + *Creates an instance of the specified and returns it.
+ * + * @param className + * fully qualified class name to be instanciated. + * + * @return null + * if it fails. Error messages will be printed by this method. + */ + XPathFactory createInstance( String className ) { + try { + if (debug) debugPrintln("instanciating "+className); + Class clazz; + if( classLoader!=null ) + clazz = classLoader.loadClass(className); + else + clazz = Class.forName(className); + if(debug) debugPrintln("loaded it from "+which(clazz)); + Object o = clazz.newInstance(); + + if( o instanceof XPathFactory ) + return (XPathFactory)o; + + if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName()); + } + // The VM ran out of memory or there was some other serious problem. Re-throw. + catch (VirtualMachineError vme) { + throw vme; + } + // ThreadDeath should always be re-thrown + catch (ThreadDeath td) { + throw td; + } + catch (Throwable t) { + if (debug) { + debugPrintln("failed to instanciate "+className); + t.printStackTrace(); + } + } + return null; + } + + /** Iterator that lazily computes one value and returns it. */ + private static abstract class SingleIterator implements Iterator { + private boolean seen = false; + + public final void remove() { throw new UnsupportedOperationException(); } + public final boolean hasNext() { return !seen; } + public final Object next() { + if(seen) throw new NoSuchElementException(); + seen = true; + return value(); + } + + protected abstract Object value(); + } + + /** Searches for a XPathFactory for a given uri in a META-INF/services file. */ + private XPathFactory loadFromServicesFile(String uri, String resourceName, InputStream in) { + + if (debug) debugPrintln("Reading " + resourceName ); + + BufferedReader rd; + try { + rd = new BufferedReader(new InputStreamReader(in, "UTF-8"), DEFAULT_LINE_LENGTH); + } catch (java.io.UnsupportedEncodingException e) { + rd = new BufferedReader(new InputStreamReader(in), DEFAULT_LINE_LENGTH); + } + + String factoryClassName = null; + XPathFactory resultFactory = null; + // See spec for provider-configuration files: http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Provider%20Configuration%20File + while (true) { + try { + factoryClassName = rd.readLine(); + } catch (IOException x) { + // No provider found + break; + } + if (factoryClassName != null) { + // Ignore comments in the provider-configuration file + int hashIndex = factoryClassName.indexOf('#'); + if (hashIndex != -1) { + factoryClassName = factoryClassName.substring(0, hashIndex); + } + + // Ignore leading and trailing whitespace + factoryClassName = factoryClassName.trim(); + + // If there's no text left or if this was a blank line, go to the next one. + if (factoryClassName.length() == 0) { + continue; + } + + try { + // Found the right XPathFactory if its isObjectModelSupported(String uri) method returns true. + XPathFactory foundFactory = (XPathFactory) createInstance(factoryClassName); + if (foundFactory.isObjectModelSupported(uri)) { + resultFactory = foundFactory; + break; + } + } + catch (Exception e) {} + } + else { + break; + } + } + + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} + + return resultFactory; + } + + /** + * Returns an {@link Iterator} that enumerates all + * the META-INF/services files that we care. + */ + private Iterator createServiceFileIterator() { + if (classLoader == null) { + return new SingleIterator() { + protected Object value() { + ClassLoader classLoader = XPathFactoryFinder.class.getClassLoader(); + return SecuritySupport.getResourceAsURL(classLoader, SERVICE_ID); + //return (ClassLoader.getSystemResource( SERVICE_ID )); + } + }; + } else { + try { + //final Enumeration e = classLoader.getResources(SERVICE_ID); + final Enumeration e = SecuritySupport.getResources(classLoader, SERVICE_ID); + if (debug && !e.hasMoreElements()) { + debugPrintln("no "+SERVICE_ID+" file was found"); + } + + // wrap it into an Iterator. + return new Iterator() { + public void remove() { + throw new UnsupportedOperationException(); + } + + public boolean hasNext() { + return e.hasMoreElements(); + } + + public Object next() { + return e.nextElement(); + } + }; + } catch (IOException e) { + if (debug) { + debugPrintln("failed to enumerate resources "+SERVICE_ID); + e.printStackTrace(); + } + return new ArrayList().iterator(); // empty iterator + } + } + } + + private static final Class SERVICE_CLASS = XPathFactory.class; + private static final String SERVICE_ID = "META-INF/services/" + SERVICE_CLASS.getName(); + + + + private static String which( Class clazz ) { + return which( clazz.getName(), clazz.getClassLoader() ); + } + + /** + *Search the specified classloader for the given classname.
+ * + * @param classname the fully qualified name of the class to search for + * @param loader the classloader to search + * + * @return the source location of the resource, or null if it wasn't found + */ + private static String which(String classname, ClassLoader loader) { + + String classnameAsResource = classname.replace('.', '/') + ".class"; + + if( loader==null ) loader = ClassLoader.getSystemClassLoader(); + + //URL it = loader.getResource(classnameAsResource); + URL it = SecuritySupport.getResourceAsURL(loader, classnameAsResource); + if (it != null) { + return it.toString(); + } else { + return null; + } + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunction.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunction.java new file mode 100644 index 000000000..fb2a9adb7 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunction.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// $Id: XPathFunction.java 446598 2006-09-15 12:55:40Z jeremias $ + +package javax.xml.xpath; + +import java.util.List; + +/** + *XPathFunction
provides access to XPath functions.
Functions are identified by QName and arity in XPath.
+ * + * @author Norman Walsh + * @author Jeff Suttor + * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $ + * @since 1.5 + */ +public interface XPathFunction { + /** + *Evaluate the function with the specified arguments.
+ * + *To the greatest extent possible, side-effects should be avoided in the + * definition of extension functions. The implementation evaluating an + * XPath expression is under no obligation to call extension functions in + * any particular order or any particular number of times.
+ * + * @param args The arguments,null
is a valid value.
+ *
+ * @return The result of evaluating the XPath
function as an Object
.
+ *
+ * @throws XPathFunctionException If args
cannot be evaluated with this XPath
function.
+ */
+ public Object evaluate(List args)
+ throws XPathFunctionException;
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunctionException.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunctionException.java
new file mode 100644
index 000000000..192defa64
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunctionException.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathFunctionException.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+/**
+ * XPathFunctionException
represents an error with an XPath function.
+ *
+ * @author Norman Walsh
+ * @author Jeff Suttor
+ * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $
+ * @since 1.5
+ */
+public class XPathFunctionException extends XPathExpressionException {
+
+ /**
+ * Stream Unique Identifier.
+ */ + private static final long serialVersionUID = -1837080260374986980L; + + /** + *Constructs a new XPathFunctionException
with the specified detail message
.
The cause
is not initialized.
If message
is null
, then a NullPointerException
is thrown.
Constructs a new XPathFunctionException
with the specified cause
.
If cause
is null
, then a NullPointerException
is thrown.
cause
is null
.
+ */
+ public XPathFunctionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunctionResolver.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunctionResolver.java
new file mode 100644
index 000000000..9fbe98aea
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathFunctionResolver.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathFunctionResolver.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+import javax.xml.namespace.QName;
+
+/**
+ * XPathFunctionResolver
provides access to the set of user defined XPathFunction
s.
XPath functions are resolved by name and arity. + * The resolver is not needed for XPath built-in functions and the resolver + * cannot be used to override those functions.
+ * + *In particular, the resolver is only called for functions in an another
+ * namespace (functions with an explicit prefix). This means that you cannot
+ * use the XPathFunctionResolver
to implement specifications
+ * like XML-Signature Syntax
+ * and Processing which extend the function library of XPath 1.0 in the
+ * same namespace. This is a consequence of the design of the resolver.
If you wish to implement additional built-in functions, you will have to + * extend the underlying implementation directly.
+ * + * @author Norman Walsh + * @author Jeff Suttor + * @version $Revision: 446598 $, $Date: 2006-09-15 08:55:40 -0400 (Fri, 15 Sep 2006) $ + * @see XML Path Language (XPath) Version 1.0, Core Function Library + * @since 1.5 + */ +public interface XPathFunctionResolver { + /** + *Find a function in the set of available functions.
+ * + *If functionName
or arity
is null
, then a NullPointerException
is thrown.
null
if no function named functionName
with arity
arguments exists.
+ *
+ * @throws NullPointerException If functionName
or arity
is null
.
+ */
+ public XPathFunction resolveFunction(QName functionName, int arity);
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathVariableResolver.java b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathVariableResolver.java
new file mode 100644
index 000000000..f130dfbf2
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/XPathVariableResolver.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// $Id: XPathVariableResolver.java 446598 2006-09-15 12:55:40Z jeremias $
+
+package javax.xml.xpath;
+
+import javax.xml.namespace.QName;
+
+/**
+ * XPathVariableResolver
provides access to the set of user defined XPath variables.
The XPathVariableResolver
and the XPath evaluator must adhere to a contract that
+ * cannot be directly enforced by the API. Although variables may be mutable,
+ * that is, an application may wish to evaluate the same XPath expression more
+ * than once with different variable values, in the course of evaluating any
+ * single XPath expression, a variable's value must be immutable.
Find a variable in the set of available variables.
+ * + *If variableName
is null
, then a NullPointerException
is thrown.
QName
of the variable name.
+ *
+ * @return The variables value, or null
if no variable named variableName
+ * exists. The value returned must be of a type appropriate for the underlying object model.
+ *
+ * @throws NullPointerException If variableName
is null
.
+ */
+ public Object resolveVariable(QName variableName);
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/package.html b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/package.html
new file mode 100644
index 000000000..04ee7a17d
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/javax/xml/xpath/package.html
@@ -0,0 +1,261 @@
+
+
+
+
+
+
+This package provides an object-model neutral API for the +evaluation of XPath expressions and access to the evaluation +environment. +
+ +The following XML standards apply:
+ + + +The XPath language provides a simple, concise syntax for selecting +nodes from an XML document. XPath also provides rules for converting a +node in an XML document object model (DOM) tree to a boolean, double, +or string value. XPath is a W3C-defined language and an official W3C +recommendation; the W3C hosts the XML Path Language (XPath) Version +1.0 specification. +
+ +XPath started in life in 1999 as a supplement to the XSLT and +XPointer languages, but has more recently become popular as a +stand-alone language, as a single XPath expression can be used to +replace many lines of DOM API code. +
+ +An XPath expression is composed of a location +path and one or more optional predicates. Expressions +may also include XPath variables. +
+ +The following is an example of a simple XPath expression:
+ ++/foo/bar ++ +
This example would select the <bar>
element in
+an XML document such as the following:
+<foo> +<bar/> +</foo> ++ +
The expression /foo/bar
is an example of a location
+path. While XPath location paths resemble Unix-style file system
+paths, an important distinction is that XPath expressions return
+all nodes that match the expression. Thus, all three
+<bar>
elements in the following document would be
+selected by the /foo/bar
expression:
+<foo> +<bar/> +<bar/> +<bar/> +</foo> ++ +
A special location path operator, //
, selects nodes at
+any depth in an XML document. The following example selects all
+<bar>
elements regardless of their location in a
+document:
+//bar ++ +
A wildcard operator, *, causes all element nodes to be selected.
+The following example selects all children elements of a
+<foo>
element:
+/foo/* ++ +
In addition to element nodes, XPath location paths may also address +attribute nodes, text nodes, comment nodes, and processing instruction +nodes. The following table gives examples of location paths for each +of these node types:
+ +Location Path | +Description | +
+/foo/bar/@id
+ |
+Selects the attribute id of the <bar> element
+ |
+
/foo/bar/text()
+ |
+Selects the text nodes of the <bar> element. No
+distinction is made between escaped and non-escaped character data.
+ |
+
/foo/bar/comment()
+ |
+Selects all comment nodes contained in the <bar> element.
+ |
+
/foo/bar/processing-instruction()
+ |
+Selects all processing-instruction nodes contained in the
+<bar> element.
+ |
+
Predicates allow for refining the nodes selected by an XPath
+location path. Predicates are of the form
+[expression]
. The following example selects all
+<foo>
elements that contain an include
+attribute with the value of true
:
+//foo[@include='true'] ++ +
Predicates may be appended to each other to further refine an +expression, such as:
+ ++//foo[@include='true'][@mode='bar'] ++ +
+The following example demonstrates using the XPath API to select one +or more nodes from an XML document:
+ ++XPath xpath = XPathFactory.newInstance().newXPath(); +String expression = "/widgets/widget"; +InputSource inputSource = new InputSource("widgets.xml"); +NodeSet nodes = (NodeSet) xpath.evaluate(expression, inputSource, XPathConstants.NODESET); ++ +
While XPath expressions select nodes in the XML document, the XPath +API allows the selected nodes to be coalesced into one of the +following other data types:
+ +Boolean
Number
String
The desired return type is specified by a {@link
+javax.xml.namespace.QName} parameter in method call used to evaluate
+the expression, which is either a call to
+XPathExpression.evaluate(...)
or to one of the
+XPath.evaluate(...)
convenience methods. The allowed
+QName values are specified as constants in the {@link
+javax.xml.xpath.XPathConstants} class; they are:
When a Boolean
return type is requested,
+Boolean.TRUE
is returned if one or more nodes were
+selected; otherwise, Boolean.FALSE
is returned.
The String
return type is a convenience for retrieving
+the character data from a text node, attribute node, comment node, or
+processing-instruction node. When used on an element node, the value
+of the child text nodes is returned.
+
The Number
return type attempts to coalesce the text
+of a node to a double
data type.
+
XPath location paths may be relative to a particular node in the
+document, known as the context
. Consider the following
+XML document:
+<widgets> +<widget> +<manufacturer/> +<dimensions/> +</widget> +</widgets> ++ +
The <widget>
element can be selected with the
+following XPath API code:
+// parse the XML as a W3C Document +DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); +builderFactory.setNamespaceAware(true); +DocumentBuilder builder = builderFactory.newDocumentBuilder(); +Document document = builder.parse(new File("/widgets.xml")); + +XPath xpath = XPathFactory.newInstance().newXPath(); +String expression = "/widgets/widget"; +Node widgetNode = (Node) xpath.evaluate(expression, document, XPathConstants.NODE); ++ +
With a reference to the <widget>
element, a
+relative XPath expression can now written to select the
+<manufacturer>
child element:
+XPath xpath = XPathFactory.newInstance().newXPath(); +String expression = "manufacturer"; +Node manufacturerNode = (Node) xpath.evaluate(expression, widgetNode, XPathConstants.NODE); ++ +
"XmlCommons v.r"
.
+ *
+ * Futurework: have this read version info from jar manifest.
+ *
+ * @return String denoting our current version
+ */
+ public static String getVersion()
+ {
+ return getProduct()+" "+getVersionNum();
+ }
+
+ /**
+ * Get just the product name.
+ *
+ * @return String denoting our product name
+ */
+ public static String getProduct()
+ {
+ return "XmlCommonsExternal";
+ }
+
+ /**
+ * Get just the version number v.r.
+ * @return String denoting our current version number
+ */
+ public static String getVersionNum()
+ {
+ return "1.4.01";
+ }
+
+ /**
+ * Print the release version to the command line.
+ * @param argv command line arguments, unused.
+ */
+ public static void main(String argv[])
+ {
+ System.out.println(getVersion());
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/apache/xmlcommons/Version.src b/fine-third-jdk8/xml-apis/src/main/java/org/apache/xmlcommons/Version.src
new file mode 100644
index 000000000..61d0f440d
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/apache/xmlcommons/Version.src
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xmlcommons;
+
+/**
+ *
+ * Administrative class to keep track of the version number of
+ * xml-commons external sources releases.
+ * See xml-commons/java/external/build.xml for filtering on 1.0, etc.
+ */
+public class Version
+{
+
+ /**
+ * Get the basic version string for the current
+ * xml-commons external sources release.
+ * Version String formatted like
+ * "XmlCommons v.r"
.
+ *
+ * Futurework: have this read version info from jar manifest.
+ *
+ * @return String denoting our current version
+ */
+ public static String getVersion()
+ {
+ return getProduct()+" "+getVersionNum();
+ }
+
+ /**
+ * Get just the product name.
+ *
+ * @return String denoting our product name
+ */
+ public static String getProduct()
+ {
+ return "@impl.name@";
+ }
+
+ /**
+ * Get just the version number v.r.
+ * @return String denoting our current version number
+ */
+ public static String getVersionNum()
+ {
+ return "@impl.version@";
+ }
+
+ /**
+ * Print the release version to the command line.
+ * @param argv command line arguments, unused.
+ */
+ public static void main(String argv[])
+ {
+ System.out.println(getVersion());
+ }
+}
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/AttributeCondition.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/AttributeCondition.java
similarity index 95%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/AttributeCondition.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/AttributeCondition.java
index e23f0d0d0..8026a9baa 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/AttributeCondition.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/AttributeCondition.java
@@ -9,12 +9,12 @@
* PURPOSE.
* See W3C License http://www.w3.org/Consortium/Legal/ for more details.
*
- * $Id: AttributeCondition.java,v 1.5 2002/06/17 14:10:09 plehegar Exp $
+ * $Id: AttributeCondition.java 477010 2006-11-20 02:54:38Z mrglavas $
*/
package org.w3c.css.sac;
/**
- * @version $Revision: 1.5 $
+ * @version $Revision: 477010 $
* @author Philippe Le Hegaret
* @see Condition#SAC_ATTRIBUTE_CONDITION
* @see Condition#SAC_ONE_OF_ATTRIBUTE_CONDITION
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CSSException.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CSSException.java
similarity index 97%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CSSException.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CSSException.java
index 255bcd88e..864f5498a 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CSSException.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CSSException.java
@@ -7,12 +7,12 @@
* The original version of this interface comes from SAX :
* http://www.megginson.com/SAX/
*
- * $Id: CSSException.java,v 1.3 2002/06/17 14:09:36 plehegar Exp $
+ * $Id: CSSException.java 477010 2006-11-20 02:54:38Z mrglavas $
*/
package org.w3c.css.sac;
/**
- * @version $Revision: 1.3 $
+ * @version $Revision: 477010 $
* @author Philippe Le Hegaret
*/
public class CSSException extends RuntimeException {
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CSSParseException.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CSSParseException.java
similarity index 98%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CSSParseException.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CSSParseException.java
index 89a4e1fd7..2e63f36ce 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CSSParseException.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CSSParseException.java
@@ -7,7 +7,7 @@
* The original version of this interface comes from SAX :
* http://www.megginson.com/SAX/
*
- * $Id: CSSParseException.java,v 1.3 2000/02/15 02:07:34 plehegar Exp $
+ * $Id: CSSParseException.java 477010 2006-11-20 02:54:38Z mrglavas $
*/
package org.w3c.css.sac;
@@ -24,7 +24,7 @@ package org.w3c.css.sac;
* Since this exception is a subclass of CSSException, it * inherits the ability to wrap another exception.
* - * @version $Revision: 1.3 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public class CSSParseException extends CSSException { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CharacterDataSelector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CharacterDataSelector.java similarity index 84% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CharacterDataSelector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CharacterDataSelector.java index 708b3fbfd..4f5bf7cc9 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CharacterDataSelector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CharacterDataSelector.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: CharacterDataSelector.java,v 1.3 1999/09/26 10:05:32 plehegar Exp $ + * $Id: CharacterDataSelector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.3 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Selector#SAC_TEXT_NODE_SELECTOR * @see Selector#SAC_CDATA_SECTION_NODE_SELECTOR diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CombinatorCondition.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CombinatorCondition.java similarity index 86% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CombinatorCondition.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CombinatorCondition.java index 26c63d0c8..6cafac2e0 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/CombinatorCondition.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/CombinatorCondition.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: CombinatorCondition.java,v 1.3 2000/03/08 20:55:41 plehegar Exp $ + * $Id: CombinatorCondition.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.3 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Condition#SAC_AND_CONDITION * @see Condition#SAC_OR_CONDITION diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Condition.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Condition.java similarity index 97% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Condition.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Condition.java index 8e7543661..92d7c4042 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Condition.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Condition.java @@ -9,12 +9,12 @@ * PURPOSE. * See W3C License http://www.w3.org/Consortium/Legal/ for more details. * - * $Id: Condition.java,v 1.8 2000/02/14 15:54:12 plehegar Exp $ + * $Id: Condition.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.8 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface Condition { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ConditionFactory.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ConditionFactory.java similarity index 98% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ConditionFactory.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ConditionFactory.java index 13a1a4082..ac76260a4 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ConditionFactory.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ConditionFactory.java @@ -9,12 +9,12 @@ * PURPOSE. * See W3C License http://www.w3.org/Consortium/Legal/ for more details. * - * $Id: ConditionFactory.java,v 1.2 2000/02/15 02:07:34 plehegar Exp $ + * $Id: ConditionFactory.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.2 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface ConditionFactory { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ConditionalSelector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ConditionalSelector.java similarity index 87% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ConditionalSelector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ConditionalSelector.java index 28f89a55b..ccfb32915 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ConditionalSelector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ConditionalSelector.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: ConditionalSelector.java,v 1.2 1999/09/25 12:32:36 plehegar Exp $ + * $Id: ConditionalSelector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.2 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Selector#SAC_CONDITIONAL_SELECTOR */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ContentCondition.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ContentCondition.java similarity index 82% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ContentCondition.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ContentCondition.java index 3893bb7d3..4b1a39553 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ContentCondition.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ContentCondition.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: ContentCondition.java,v 1.1 1999/09/26 09:54:37 plehegar Exp $ + * $Id: ContentCondition.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.1 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Condition#SAC_CONTENT_CONDITION */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/DescendantSelector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/DescendantSelector.java similarity index 86% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/DescendantSelector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/DescendantSelector.java index 0f864e4df..b4508f38d 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/DescendantSelector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/DescendantSelector.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: DescendantSelector.java,v 1.1 2000/07/15 22:08:32 plehegar Exp $ + * $Id: DescendantSelector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.1 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Selector#SAC_DESCENDANT_SELECTOR * @see Selector#SAC_CHILD_SELECTOR diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/DocumentHandler.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/DocumentHandler.java similarity index 98% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/DocumentHandler.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/DocumentHandler.java index 45899d574..0b6cbc7b7 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/DocumentHandler.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/DocumentHandler.java @@ -4,7 +4,7 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: DocumentHandler.java,v 1.4 2000/02/16 21:29:35 plehegar Exp $ + * $Id: DocumentHandler.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -14,7 +14,7 @@ package org.w3c.css.sac; * interface and registers an instance with the CSS parser using the * setCSSHandler method. * - * @version $Revision: 1.4 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface DocumentHandler { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ElementSelector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ElementSelector.java similarity index 93% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ElementSelector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ElementSelector.java index 20d60032e..7c06bf9f2 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ElementSelector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ElementSelector.java @@ -9,12 +9,12 @@ * PURPOSE. * See W3C License http://www.w3.org/Consortium/Legal/ for more details. * - * $Id: ElementSelector.java,v 1.6 2000/02/14 15:54:12 plehegar Exp $ + * $Id: ElementSelector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.6 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Selector#SAC_ELEMENT_NODE_SELECTOR */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ErrorHandler.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ErrorHandler.java similarity index 97% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ErrorHandler.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ErrorHandler.java index 393a132ae..8f5591324 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ErrorHandler.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ErrorHandler.java @@ -7,7 +7,7 @@ * The original version of this interface comes from SAX : * http://www.megginson.com/SAX/ * - * $Id: ErrorHandler.java,v 1.2 1999/09/26 10:10:34 plehegar Exp $ + * $Id: ErrorHandler.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -34,7 +34,7 @@ package org.w3c.css.sac; * that class rather than implementing the complete interface * itself. * - * @version $Revision: 1.2 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface ErrorHandler { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/InputSource.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/InputSource.java similarity index 98% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/InputSource.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/InputSource.java index c622845d5..3f443c3e0 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/InputSource.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/InputSource.java @@ -7,7 +7,7 @@ * The original version of this interface comes from SAX : * http://www.megginson.com/SAX/ * - * $Id: InputSource.java,v 1.2 1999/09/26 10:09:48 plehegar Exp $ + * $Id: InputSource.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -32,7 +32,7 @@ import java.io.Reader; * shall never modify it in any way (it may modify a copy if * necessary). * - * @version $Revision: 1.2 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public class InputSource { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/LangCondition.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/LangCondition.java similarity index 82% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/LangCondition.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/LangCondition.java index d793864f3..8a9a9e797 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/LangCondition.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/LangCondition.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: LangCondition.java,v 1.1 1999/09/26 09:54:37 plehegar Exp $ + * $Id: LangCondition.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.1 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Condition#SAC_LANG_CONDITION */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/LexicalUnit.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/LexicalUnit.java similarity index 98% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/LexicalUnit.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/LexicalUnit.java index d2edc717a..f69d57324 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/LexicalUnit.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/LexicalUnit.java @@ -4,7 +4,7 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: LexicalUnit.java,v 1.9 2000/03/08 20:55:33 plehegar Exp $ + * $Id: LexicalUnit.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -14,7 +14,7 @@ package org.w3c.css.sac; * will be supported) by CSS. *All examples are CSS2 compliant. * - * @version $Revision: 1.9 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface LexicalUnit { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Locator.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Locator.java similarity index 96% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Locator.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Locator.java index 0395f0900..8c7aad530 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Locator.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Locator.java @@ -7,7 +7,7 @@ * The original version of this interface comes from SAX : * http://www.megginson.com/SAX/ * - * $Id: Locator.java,v 1.1 1999/09/26 09:58:46 plehegar Exp $ + * $Id: Locator.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -33,7 +33,7 @@ package org.w3c.css.sac; * the startDocument event, the application should assume that a * locator is not available.
* - * @version $Revision: 1.1 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface Locator { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/NegativeCondition.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/NegativeCondition.java similarity index 83% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/NegativeCondition.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/NegativeCondition.java index a6165d964..2725652ad 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/NegativeCondition.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/NegativeCondition.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: NegativeCondition.java,v 1.2 1999/09/26 10:15:58 plehegar Exp $ + * $Id: NegativeCondition.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.2 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Condition#SAC_NEGATIVE_CONDITION */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/NegativeSelector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/NegativeSelector.java similarity index 83% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/NegativeSelector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/NegativeSelector.java index 0aef283bd..d338a289f 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/NegativeSelector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/NegativeSelector.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: NegativeSelector.java,v 1.2 1999/09/25 12:32:36 plehegar Exp $ + * $Id: NegativeSelector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.2 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Selector#SAC_NEGATIVE_SELECTOR */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Parser.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Parser.java similarity index 98% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Parser.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Parser.java index 194d8e470..21e90b1e0 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Parser.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Parser.java @@ -7,7 +7,7 @@ * The original version of this interface comes from SAX : * http://www.megginson.com/SAX/ * - * $Id: Parser.java,v 1.13 2000/10/27 20:45:21 plehegar Exp $ + * $Id: Parser.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -29,7 +29,7 @@ import java.util.Locale; * once the first parse has completed successfully, but it may not * invoke the parse() methods recursively within a parse. * - * @version $Revision: 1.13 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see DocumentHandler * @see ErrorHandler diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/PositionalCondition.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/PositionalCondition.java similarity index 90% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/PositionalCondition.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/PositionalCondition.java index ed5eb8c7e..98b9ebd32 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/PositionalCondition.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/PositionalCondition.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: PositionalCondition.java,v 1.4 2000/02/14 15:54:12 plehegar Exp $ + * $Id: PositionalCondition.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.4 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Condition#SAC_POSITIONAL_CONDITION */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ProcessingInstructionSelector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ProcessingInstructionSelector.java similarity index 87% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ProcessingInstructionSelector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ProcessingInstructionSelector.java index 214685b84..210f8c780 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/ProcessingInstructionSelector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/ProcessingInstructionSelector.java @@ -4,7 +4,7 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: ProcessingInstructionSelector.java,v 1.2 1999/09/25 12:32:36 plehegar Exp $ + * $Id: ProcessingInstructionSelector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -12,7 +12,7 @@ package org.w3c.css.sac; * This simple matches a * processing instruction. * - * @version $Revision: 1.2 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Selector#SAC_PROCESSING_INSTRUCTION_NODE_SELECTOR */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SACMediaList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SACMediaList.java similarity index 86% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SACMediaList.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SACMediaList.java index 822d2d3d8..103d574db 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SACMediaList.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SACMediaList.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: SACMediaList.java,v 1.1 2000/02/16 21:27:32 plehegar Exp $ + * $Id: SACMediaList.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.1 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface SACMediaList { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Selector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Selector.java similarity index 97% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Selector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Selector.java index fd54fdefb..c4d4fc562 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/Selector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/Selector.java @@ -9,7 +9,7 @@ * PURPOSE. * See W3C License http://www.w3.org/Consortium/Legal/ for more details. * - * $Id: Selector.java,v 1.12 2000/07/15 22:08:45 plehegar Exp $ + * $Id: Selector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -19,7 +19,7 @@ package org.w3c.css.sac; * supported) by CSS. *All examples are CSS2 compliant. * - * @version $Revision: 1.12 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface Selector { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SelectorFactory.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SelectorFactory.java similarity index 98% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SelectorFactory.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SelectorFactory.java index cace5bb1a..6ce97baaf 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SelectorFactory.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SelectorFactory.java @@ -9,12 +9,12 @@ * PURPOSE. * See W3C License http://www.w3.org/Consortium/Legal/ for more details. * - * $Id: SelectorFactory.java,v 1.3 2000/07/27 21:19:21 plehegar Exp $ + * $Id: SelectorFactory.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.3 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see org.w3c.css.sac.Selector */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SelectorList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SelectorList.java similarity index 88% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SelectorList.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SelectorList.java index 4028e4615..ffd229656 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SelectorList.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SelectorList.java @@ -4,7 +4,7 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: SelectorList.java,v 1.1 1999/09/26 10:06:45 plehegar Exp $ + * $Id: SelectorList.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -13,7 +13,7 @@ package org.w3c.css.sac; * of selectors, without defining or constraining how this collection is * implemented. * - * @version $Revision: 1.1 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret */ public interface SelectorList { diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SiblingSelector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SiblingSelector.java similarity index 90% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SiblingSelector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SiblingSelector.java index 075b71135..fe007963e 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SiblingSelector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SiblingSelector.java @@ -4,12 +4,12 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: SiblingSelector.java,v 1.3 2000/07/27 21:19:21 plehegar Exp $ + * $Id: SiblingSelector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; /** - * @version $Revision: 1.3 $ + * @version $Revision: 477010 $ * @author Philippe Le Hegaret * @see Selector#SAC_DIRECT_ADJACENT_SELECTOR */ diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SimpleSelector.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SimpleSelector.java similarity index 84% rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SimpleSelector.java rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SimpleSelector.java index 6860b7a75..8d7d09c8d 100644 --- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/css/sac/SimpleSelector.java +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/css/sac/SimpleSelector.java @@ -4,7 +4,7 @@ * en Informatique et en Automatique, Keio University). * All Rights Reserved. http://www.w3.org/Consortium/Legal/ * - * $Id: SimpleSelector.java,v 1.2 1999/09/30 16:54:22 plehegar Exp $ + * $Id: SimpleSelector.java 477010 2006-11-20 02:54:38Z mrglavas $ */ package org.w3c.css.sac; @@ -14,7 +14,7 @@ package org.w3c.css.sac; *
A ConditionalSelector
can only accept a simple selector or a
* negative selector.
Attr
interface represents an attribute in an
+ * Element
object. Typically the allowable values for the
+ * attribute are defined in a schema associated with the document.
+ * Attr
objects inherit the Node
interface, but
+ * since they are not actually child nodes of the element they describe, the
+ * DOM does not consider them part of the document tree. Thus, the
+ * Node
attributes parentNode
,
+ * previousSibling
, and nextSibling
have a
+ * null
value for Attr
objects. The DOM takes the
+ * view that attributes are properties of elements rather than having a
+ * separate identity from the elements they are associated with; this should
+ * make it more efficient to implement such features as default attributes
+ * associated with all elements of a given type. Furthermore,
+ * Attr
nodes may not be immediate children of a
+ * DocumentFragment
. However, they can be associated with
+ * Element
nodes contained within a
+ * DocumentFragment
. In short, users and implementors of the
+ * DOM need to be aware that Attr
nodes have some things in
+ * common with other objects inheriting the Node
interface, but
+ * they also are quite distinct.
+ *
The attribute's effective value is determined as follows: if this
+ * attribute has been explicitly assigned any value, that value is the
+ * attribute's effective value; otherwise, if there is a declaration for
+ * this attribute, and that declaration includes a default value, then that
+ * default value is the attribute's effective value; otherwise, the
+ * attribute does not exist on this element in the structure model until it
+ * has been explicitly added. Note that the Node.nodeValue
+ * attribute on the Attr
instance can also be used to retrieve
+ * the string version of the attribute's value(s).
+ *
If the attribute was not explicitly given a value in the instance
+ * document but has a default value provided by the schema associated with
+ * the document, an attribute node will be created with
+ * specified
set to false
. Removing attribute
+ * nodes for which a default value is defined in the schema generates a new
+ * attribute node with the default value and specified
set to
+ * false
. If validation occurred while invoking
+ * Document.normalizeDocument()
, attribute nodes with
+ * specified
equals to false
are recomputed
+ * according to the default attribute values provided by the schema. If no
+ * default value is associate with this attribute in the schema, the
+ * attribute node is discarded.
+ *
In XML, where the value of an attribute can contain entity references,
+ * the child nodes of the Attr
node may be either
+ * Text
or EntityReference
nodes (when these are
+ * in use; see the description of EntityReference
for
+ * discussion).
+ *
The DOM Core represents all attribute values as simple strings, even if + * the DTD or schema associated with the document declares them of some + * specific type such as tokenized. + *
The way attribute value normalization is performed by the DOM
+ * implementation depends on how much the implementation knows about the
+ * schema in use. Typically, the value
and
+ * nodeValue
attributes of an Attr
node initially
+ * returns the normalized value given by the parser. It is also the case
+ * after Document.normalizeDocument()
is called (assuming the
+ * right options have been set). But this may not be the case after
+ * mutation, independently of whether the mutation is performed by setting
+ * the string value directly or by changing the Attr
child
+ * nodes. In particular, this is true when character
+ * references are involved, given that they are not represented in the DOM and they
+ * impact attribute value normalization. On the other hand, if the
+ * implementation knows about the schema in use when the attribute value is
+ * changed, and it is of a different type than CDATA, it may normalize it
+ * again at that time. This is especially true of specialized DOM
+ * implementations, such as SVG DOM implementations, which store attribute
+ * values in an internal form different from a string.
+ *
The following table gives some examples of the relations between the + * attribute value in the original document (parsed attribute), the value as + * exposed in the DOM, and the serialization of the value: + *
Examples | + *Parsed + * attribute value | + *Initial Attr.value |
+ * Serialized attribute value | + *
---|---|---|---|
+ * Character reference | + *
+ * "x²=5"+ * |
+ *
+ * "x\u00b2=5"+ * |
+ *
+ * "x²=5"+ * |
+ *
Built-in + * character entity | + *
+ * "y<6"+ * |
+ *
+ * "y<6"+ * |
+ *
+ * "y<6"+ * |
+ *
Literal newline between | + *
+ * + * "x=5 y=6"+ * |
+ *
+ * "x=5 y=6"+ * |
+ *
+ * "x=5 y=6"+ * |
+ *
Normalized newline between | + *
+ * "x=5 + * y=6"+ * |
+ *
+ * "x=5 y=6"+ * |
+ *
+ * "x=5 y=6"+ * |
+ *
Entity e with literal newline |
+ *
+ * + * <!ENTITY e '... ...'> [...]> "x=5&e;y=6"+ * |
+ * Dependent on Implementation and Load Options | + *Dependent on Implementation and Load/Save Options | + *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public interface Attr extends Node {
+ /**
+ * Returns the name of this attribute. If Node.localName
is
+ * different from null
, this attribute is a qualified name.
+ */
+ public String getName();
+
+ /**
+ * True
if this attribute was explicitly given a value in
+ * the instance document, false
otherwise. If the
+ * application changed the value of this attribute node (even if it ends
+ * up having the same value as the default value) then it is set to
+ * true
. The implementation may handle attributes with
+ * default values from other schemas similarly but applications should
+ * use Document.normalizeDocument()
to guarantee this
+ * information is up-to-date.
+ */
+ public boolean getSpecified();
+
+ /**
+ * On retrieval, the value of the attribute is returned as a string.
+ * Character and general entity references are replaced with their
+ * values. See also the method getAttribute
on the
+ * Element
interface.
+ *
On setting, this creates a Text
node with the unparsed
+ * contents of the string, i.e. any characters that an XML processor
+ * would recognize as markup are instead treated as literal text. See
+ * also the method Element.setAttribute()
.
+ *
Some specialized implementations, such as some [SVG 1.1]
+ * implementations, may do normalization automatically, even after
+ * mutation; in such case, the value on retrieval may differ from the
+ * value on setting.
+ */
+ public String getValue();
+ /**
+ * On retrieval, the value of the attribute is returned as a string.
+ * Character and general entity references are replaced with their
+ * values. See also the method getAttribute
on the
+ * Element
interface.
+ *
On setting, this creates a Text
node with the unparsed
+ * contents of the string, i.e. any characters that an XML processor
+ * would recognize as markup are instead treated as literal text. See
+ * also the method Element.setAttribute()
.
+ *
Some specialized implementations, such as some [SVG 1.1]
+ * implementations, may do normalization automatically, even after
+ * mutation; in such case, the value on retrieval may differ from the
+ * value on setting.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
+ */
+ public void setValue(String value)
+ throws DOMException;
+
+ /**
+ * The Element
node this attribute is attached to or
+ * null
if this attribute is not in use.
+ * @since DOM Level 2
+ */
+ public Element getOwnerElement();
+
+ /**
+ * The type information associated with this attribute. While the type
+ * information contained in this attribute is guarantee to be correct
+ * after loading the document or invoking
+ * Document.normalizeDocument()
, schemaTypeInfo
+ * may not be reliable if the node was moved.
+ * @since DOM Level 3
+ */
+ public TypeInfo getSchemaTypeInfo();
+
+ /**
+ * Returns whether this attribute is known to be of type ID (i.e. to
+ * contain an identifier for its owner element) or not. When it is and
+ * its value is unique, the ownerElement
of this attribute
+ * can be retrieved using the method Document.getElementById
+ * . The implementation could use several ways to determine if an
+ * attribute node is known to contain an identifier:
+ *
Document.normalizeDocument()
, the post-schema-validation
+ * infoset contributions (PSVI contributions) values are used to
+ * determine if this attribute is a schema-determined ID attribute using
+ * the
+ * schema-determined ID definition in [XPointer]
+ * .
+ * Document.normalizeDocument()
, the infoset [type definition] value is used to determine if this attribute is a DTD-determined ID
+ * attribute using the
+ * DTD-determined ID definition in [XPointer]
+ * .
+ * Element.setIdAttribute()
,
+ * Element.setIdAttributeNS()
, or
+ * Element.setIdAttributeNode()
, i.e. it is an
+ * user-determined ID attribute;
+ * Note: XPointer framework (see section 3.2 in [XPointer] + * ) consider the DOM user-determined ID attribute as being part of the + * XPointer externally-determined ID definition. + *
Document.normalizeDocument()
, all user-determined ID
+ * attributes are reset and all attribute nodes ID information are then
+ * reevaluated in accordance to the schema used. As a consequence, if
+ * the Attr.schemaTypeInfo
attribute contains an ID type,
+ * isId
will always return true.
+ * @since DOM Level 3
+ */
+ public boolean isId();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/Comment.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/Comment.java
new file mode 100644
index 000000000..b04ed4d0a
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/Comment.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * This interface inherits from CharacterData
and represents the
+ * content of a comment, i.e., all the characters between the starting '
+ * <!--
' and ending '-->
'. Note that this is
+ * the definition of a comment in XML, and, in practice, HTML, although some
+ * HTML tools may implement the full SGML comment structure.
+ * No lexical check is done on the content of a comment and it is
+ * therefore possible to have the character sequence "--"
+ * (double-hyphen) in the content, which is illegal in a comment per section
+ * 2.5 of [XML 1.0]. The
+ * presence of this character sequence must generate a fatal error during
+ * serialization.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public interface Comment extends CharacterData {
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DOMException.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DOMException.java
new file mode 100644
index 000000000..100f25125
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DOMException.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
+ * when an operation is impossible to perform (either for logical reasons,
+ * because data is lost, or because the implementation has become unstable).
+ * In general, DOM methods return specific error values in ordinary
+ * processing situations, such as out-of-bound errors when using
+ * NodeList
.
+ *
Implementations should raise other exceptions under other circumstances.
+ * For example, implementations should raise an implementation-dependent
+ * exception if a null
argument is passed when null
+ * was not expected.
+ *
Some languages and object systems do not support the concept of + * exceptions. For such systems, error conditions may be indicated using + * native error reporting mechanisms. For some bindings, for example, + * methods may return error codes similar to those listed in the + * corresponding method descriptions. + *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public class DOMException extends RuntimeException {
+ public DOMException(short code, String message) {
+ super(message);
+ this.code = code;
+ }
+ public short code;
+ // ExceptionCode
+ /**
+ * If index or size is negative, or greater than the allowed value.
+ */
+ public static final short INDEX_SIZE_ERR = 1;
+ /**
+ * If the specified range of text does not fit into a
+ * DOMString
.
+ */
+ public static final short DOMSTRING_SIZE_ERR = 2;
+ /**
+ * If any Node
is inserted somewhere it doesn't belong.
+ */
+ public static final short HIERARCHY_REQUEST_ERR = 3;
+ /**
+ * If a Node
is used in a different document than the one
+ * that created it (that doesn't support it).
+ */
+ public static final short WRONG_DOCUMENT_ERR = 4;
+ /**
+ * If an invalid or illegal character is specified, such as in an XML name.
+ */
+ public static final short INVALID_CHARACTER_ERR = 5;
+ /**
+ * If data is specified for a Node
which does not support
+ * data.
+ */
+ public static final short NO_DATA_ALLOWED_ERR = 6;
+ /**
+ * If an attempt is made to modify an object where modifications are not
+ * allowed.
+ */
+ public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
+ /**
+ * If an attempt is made to reference a Node
in a context
+ * where it does not exist.
+ */
+ public static final short NOT_FOUND_ERR = 8;
+ /**
+ * If the implementation does not support the requested type of object or
+ * operation.
+ */
+ public static final short NOT_SUPPORTED_ERR = 9;
+ /**
+ * If an attempt is made to add an attribute that is already in use
+ * elsewhere.
+ */
+ public static final short INUSE_ATTRIBUTE_ERR = 10;
+ /**
+ * If an attempt is made to use an object that is not, or is no longer,
+ * usable.
+ * @since DOM Level 2
+ */
+ public static final short INVALID_STATE_ERR = 11;
+ /**
+ * If an invalid or illegal string is specified.
+ * @since DOM Level 2
+ */
+ public static final short SYNTAX_ERR = 12;
+ /**
+ * If an attempt is made to modify the type of the underlying object.
+ * @since DOM Level 2
+ */
+ public static final short INVALID_MODIFICATION_ERR = 13;
+ /**
+ * If an attempt is made to create or change an object in a way which is
+ * incorrect with regard to namespaces.
+ * @since DOM Level 2
+ */
+ public static final short NAMESPACE_ERR = 14;
+ /**
+ * If a parameter or an operation is not supported by the underlying
+ * object.
+ * @since DOM Level 2
+ */
+ public static final short INVALID_ACCESS_ERR = 15;
+ /**
+ * If a call to a method such as insertBefore
or
+ * removeChild
would make the Node
invalid
+ * with respect to "partial validity", this exception would be raised
+ * and the operation would not be done. This code is used in [DOM Level 3 Validation]
+ * . Refer to this specification for further information.
+ * @since DOM Level 3
+ */
+ public static final short VALIDATION_ERR = 16;
+ /**
+ * If the type of an object is incompatible with the expected type of the
+ * parameter associated to the object.
+ * @since DOM Level 3
+ */
+ public static final short TYPE_MISMATCH_ERR = 17;
+
+ // Added serialVersionUID to preserve binary compatibility
+ static final long serialVersionUID = 6627732366795969916L;
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DOMImplementation.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DOMImplementation.java
new file mode 100644
index 000000000..5bb71e263
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DOMImplementation.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The DOMImplementation
interface provides a number of methods
+ * for performing operations that are independent of any particular instance
+ * of the document object model.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public interface DOMImplementation {
+ /**
+ * Test if the DOM implementation implements a specific feature and
+ * version, as specified in .
+ * @param feature The name of the feature to test.
+ * @param version This is the version number of the feature to test.
+ * @return true
if the feature is implemented in the
+ * specified version, false
otherwise.
+ */
+ public boolean hasFeature(String feature,
+ String version);
+
+ /**
+ * Creates an empty DocumentType
node. Entity declarations
+ * and notations are not made available. Entity reference expansions and
+ * default attribute additions do not occur..
+ * @param qualifiedName The qualified name of the document type to be
+ * created.
+ * @param publicId The external subset public identifier.
+ * @param systemId The external subset system identifier.
+ * @return A new DocumentType
node with
+ * Node.ownerDocument
set to null
.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
+ * an XML name according to [XML 1.0].
+ *
NAMESPACE_ERR: Raised if the qualifiedName
is
+ * malformed.
+ *
NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature "XML" and the language exposed through the
+ * Document does not support XML Namespaces (such as [HTML 4.01]).
+ * @since DOM Level 2
+ */
+ public DocumentType createDocumentType(String qualifiedName,
+ String publicId,
+ String systemId)
+ throws DOMException;
+
+ /**
+ * Creates a DOM Document object of the specified type with its document
+ * element.
+ *
Note that based on the DocumentType
given to create
+ * the document, the implementation may instantiate specialized
+ * Document
objects that support additional features than
+ * the "Core", such as "HTML" [DOM Level 2 HTML]
+ * . On the other hand, setting the DocumentType
after the
+ * document was created makes this very unlikely to happen.
+ * Alternatively, specialized Document
creation methods,
+ * such as createHTMLDocument
[DOM Level 2 HTML]
+ * , can be used to obtain specific types of Document
+ * objects.
+ * @param namespaceURI The namespace URI of the document element to
+ * create or null
.
+ * @param qualifiedName The qualified name of the document element to be
+ * created or null
.
+ * @param doctype The type of document to be created or null
.
+ * When doctype
is not null
, its
+ * Node.ownerDocument
attribute is set to the document
+ * being created.
+ * @return A new Document
object with its document element.
+ * If the NamespaceURI
, qualifiedName
, and
+ * doctype
are null
, the returned
+ * Document
is empty with no document element.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
+ * an XML name according to [XML 1.0].
+ *
NAMESPACE_ERR: Raised if the qualifiedName
is
+ * malformed, if the qualifiedName
has a prefix and the
+ * namespaceURI
is null
, or if the
+ * qualifiedName
is null
and the
+ * namespaceURI
is different from null
, or
+ * if the qualifiedName
has a prefix that is "xml" and
+ * the namespaceURI
is different from "
+ * http://www.w3.org/XML/1998/namespace" [XML Namespaces]
+ * , or if the DOM implementation does not support the
+ * "XML"
feature but a non-null namespace URI was
+ * provided, since namespaces were defined by XML.
+ *
WRONG_DOCUMENT_ERR: Raised if doctype
has already
+ * been used with a different document or was created from a different
+ * implementation.
+ *
NOT_SUPPORTED_ERR: May be raised if the implementation does not
+ * support the feature "XML" and the language exposed through the
+ * Document does not support XML Namespaces (such as [HTML 4.01]).
+ * @since DOM Level 2
+ */
+ public Document createDocument(String namespaceURI,
+ String qualifiedName,
+ DocumentType doctype)
+ throws DOMException;
+
+ /**
+ * This method returns a specialized object which implements the
+ * specialized APIs of the specified feature and version, as specified
+ * in . The specialized object may also be obtained by using
+ * binding-specific casting methods but is not necessarily expected to,
+ * as discussed in . This method also allow the implementation to
+ * provide specialized objects which do not support the
+ * DOMImplementation
interface.
+ * @param feature The name of the feature requested. Note that any plus
+ * sign "+" prepended to the name of the feature will be ignored since
+ * it is not significant in the context of this method.
+ * @param version This is the version number of the feature to test.
+ * @return Returns an object which implements the specialized APIs of
+ * the specified feature and version, if any, or null
if
+ * there is no object which implements interfaces associated with that
+ * feature. If the DOMObject
returned by this method
+ * implements the DOMImplementation
interface, it must
+ * delegate to the primary core DOMImplementation
and not
+ * return results inconsistent with the primary core
+ * DOMImplementation
such as hasFeature
,
+ * getFeature
, etc.
+ * @since DOM Level 3
+ */
+ public Object getFeature(String feature,
+ String version);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DocumentFragment.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DocumentFragment.java
new file mode 100644
index 000000000..8c4531eff
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DocumentFragment.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * DocumentFragment
is a "lightweight" or "minimal"
+ * Document
object. It is very common to want to be able to
+ * extract a portion of a document's tree or to create a new fragment of a
+ * document. Imagine implementing a user command like cut or rearranging a
+ * document by moving fragments around. It is desirable to have an object
+ * which can hold such fragments and it is quite natural to use a Node for
+ * this purpose. While it is true that a Document
object could
+ * fulfill this role, a Document
object can potentially be a
+ * heavyweight object, depending on the underlying implementation. What is
+ * really needed for this is a very lightweight object.
+ * DocumentFragment
is such an object.
+ *
Furthermore, various operations -- such as inserting nodes as children
+ * of another Node
-- may take DocumentFragment
+ * objects as arguments; this results in all the child nodes of the
+ * DocumentFragment
being moved to the child list of this node.
+ *
The children of a DocumentFragment
node are zero or more
+ * nodes representing the tops of any sub-trees defining the structure of
+ * the document. DocumentFragment
nodes do not need to be
+ * well-formed XML documents (although they do need to follow the rules
+ * imposed upon well-formed XML parsed entities, which can have multiple top
+ * nodes). For example, a DocumentFragment
might have only one
+ * child and that child node could be a Text
node. Such a
+ * structure model represents neither an HTML document nor a well-formed XML
+ * document.
+ *
When a DocumentFragment
is inserted into a
+ * Document
(or indeed any other Node
that may
+ * take children) the children of the DocumentFragment
and not
+ * the DocumentFragment
itself are inserted into the
+ * Node
. This makes the DocumentFragment
very
+ * useful when the user wishes to create nodes that are siblings; the
+ * DocumentFragment
acts as the parent of these nodes so that
+ * the user can use the standard methods from the Node
+ * interface, such as Node.insertBefore
and
+ * Node.appendChild
.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public interface DocumentFragment extends Node {
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DocumentType.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DocumentType.java
new file mode 100644
index 000000000..6221c7b5e
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/DocumentType.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * Each Document
has a doctype
attribute whose value
+ * is either null
or a DocumentType
object. The
+ * DocumentType
interface in the DOM Core provides an interface
+ * to the list of entities that are defined for the document, and little
+ * else because the effect of namespaces and the various XML schema efforts
+ * on DTD representation are not clearly understood as of this writing.
+ *
DOM Level 3 doesn't support editing DocumentType
nodes.
+ * DocumentType
nodes are read-only.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public interface DocumentType extends Node {
+ /**
+ * The name of DTD; i.e., the name immediately following the
+ * DOCTYPE
keyword.
+ */
+ public String getName();
+
+ /**
+ * A NamedNodeMap
containing the general entities, both
+ * external and internal, declared in the DTD. Parameter entities are
+ * not contained. Duplicates are discarded. For example in:
+ *
<!DOCTYPE + * ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar + * "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> + * ]> <ex/>+ * the interface provides access to
foo
+ * and the first declaration of bar
but not the second
+ * declaration of bar
or baz
. Every node in
+ * this map also implements the Entity
interface.
+ * entities
cannot be altered in any way.
+ */
+ public NamedNodeMap getEntities();
+
+ /**
+ * A NamedNodeMap
containing the notations declared in the
+ * DTD. Duplicates are discarded. Every node in this map also implements
+ * the Notation
interface.
+ * notations
cannot be altered in any way.
+ */
+ public NamedNodeMap getNotations();
+
+ /**
+ * The public identifier of the external subset.
+ * @since DOM Level 2
+ */
+ public String getPublicId();
+
+ /**
+ * The system identifier of the external subset. This may be an absolute
+ * URI or not.
+ * @since DOM Level 2
+ */
+ public String getSystemId();
+
+ /**
+ * The internal subset as a string, or null
if there is none.
+ * This is does not contain the delimiting square brackets.
+ * Note: The actual content returned depends on how much
+ * information is available to the implementation. This may vary
+ * depending on various parameters, including the XML processor used to
+ * build the document.
+ * @since DOM Level 2
+ */
+ public String getInternalSubset();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ElementTraversal.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ElementTraversal.java
new file mode 100644
index 000000000..16406b532
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ElementTraversal.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2009 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The ElementTraversal
interface is a set of read-only attributes
+ * which allow an author to easily navigate between elements in a document.
+ *
In conforming implementations of Element Traversal, all objects that
+ * implement {@link Element} must also implement the
+ * ElementTraversal
interface. Four of the methods,
+ * {@link #getFirstElementChild}, {@link #getLastElementChild},
+ * {@link #getPreviousElementSibling}, and {@link #getNextElementSibling},
+ * each return a live reference to another element with the defined
+ * relationship to the current element, if the related element exists. The
+ * fifth method, {@link #getChildElementCount}, exposes the number of child
+ * elements of an element, for preprocessing before navigation.
+ *
See also the
+ * Element Traversal Specification.
+ */
+public interface ElementTraversal {
+
+ /**
+ * Returns the first child element node of this element. null
+ * if this element has no child elements.
+ */
+ Element getFirstElementChild();
+
+ /**
+ * Returns the last child element node of this element. null
+ * if this element has no child elements.
+ */
+ Element getLastElementChild();
+
+ /**
+ * Returns the previous sibling element node of this element.
+ * null
if this element has no element sibling nodes that
+ * come before this one in the document tree.
+ */
+ Element getPreviousElementSibling();
+
+ /**
+ * Returns the next sibling element node of this element.
+ * null
if this element has no element sibling nodes that
+ * come after this one in the document tree.
+ */
+ Element getNextElementSibling();
+
+ /**
+ * Returns the current number of element nodes that are children of this
+ * element. 0
if this element has no child nodes that are of
+ * nodeType
1
.
+ */
+ int getChildElementCount();
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/EntityReference.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/EntityReference.java
new file mode 100644
index 000000000..b42b0913b
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/EntityReference.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * EntityReference
nodes may be used to represent an entity
+ * reference in the tree. Note that character references and references to
+ * predefined entities are considered to be expanded by the HTML or XML
+ * processor so that characters are represented by their Unicode equivalent
+ * rather than by an entity reference. Moreover, the XML processor may
+ * completely expand references to entities while building the
+ * Document
, instead of providing EntityReference
+ * nodes. If it does provide such nodes, then for an
+ * EntityReference
node that represents a reference to a known
+ * entity an Entity
exists, and the subtree of the
+ * EntityReference
node is a copy of the Entity
+ * node subtree. However, the latter may not be true when an entity contains
+ * an unbound namespace prefix. In such a case, because the namespace prefix
+ * resolution depends on where the entity reference is, the descendants of
+ * the EntityReference
node may be bound to different namespace
+ * URIs. When an EntityReference
node represents a reference to
+ * an unknown entity, the node has no children and its replacement value,
+ * when used by Attr.value
for example, is empty.
+ *
As for Entity
nodes, EntityReference
nodes and
+ * all their descendants are readonly.
+ *
Note: EntityReference
nodes may cause element
+ * content and attribute value normalization problems when, such as in XML
+ * 1.0 and XML Schema, the normalization is performed after entity reference
+ * are expanded.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public interface EntityReference extends Node {
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/NameList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/NameList.java
new file mode 100644
index 000000000..10caa90f6
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/NameList.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The NameList
interface provides the abstraction of an ordered
+ * collection of parallel pairs of name and namespace values (which could be
+ * null values), without defining or constraining how this collection is
+ * implemented. The items in the NameList
are accessible via an
+ * integral index, starting from 0.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ * @since DOM Level 3
+ */
+public interface NameList {
+ /**
+ * Returns the index
th name item in the collection.
+ * @param index Index into the collection.
+ * @return The name at the index
th position in the
+ * NameList
, or null
if there is no name for
+ * the specified index or if the index is out of range.
+ */
+ public String getName(int index);
+
+ /**
+ * Returns the index
th namespaceURI item in the collection.
+ * @param index Index into the collection.
+ * @return The namespace URI at the index
th position in the
+ * NameList
, or null
if there is no name for
+ * the specified index or if the index is out of range.
+ */
+ public String getNamespaceURI(int index);
+
+ /**
+ * The number of pairs (name and namespaceURI) in the list. The range of
+ * valid child node indices is 0 to length-1
inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Test if a name is part of this NameList
.
+ * @param str The name to look for.
+ * @return true
if the name has been found,
+ * false
otherwise.
+ */
+ public boolean contains(String str);
+
+ /**
+ * Test if the pair namespaceURI/name is part of this
+ * NameList
.
+ * @param namespaceURI The namespace URI to look for.
+ * @param name The name to look for.
+ * @return true
if the pair namespaceURI/name has been
+ * found, false
otherwise.
+ */
+ public boolean containsNS(String namespaceURI,
+ String name);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/NodeList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/NodeList.java
new file mode 100644
index 000000000..e4204ec97
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/NodeList.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * The NodeList
interface provides the abstraction of an ordered
+ * collection of nodes, without defining or constraining how this collection
+ * is implemented. NodeList
objects in the DOM are live.
+ *
The items in the NodeList
are accessible via an integral
+ * index, starting from 0.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public interface NodeList {
+ /**
+ * Returns the index
th item in the collection. If
+ * index
is greater than or equal to the number of nodes in
+ * the list, this returns null
.
+ * @param index Index into the collection.
+ * @return The node at the index
th position in the
+ * NodeList
, or null
if that is not a valid
+ * index.
+ */
+ public Node item(int index);
+
+ /**
+ * The number of nodes in the list. The range of valid child node indices
+ * is 0 to length-1
inclusive.
+ */
+ public int getLength();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/Notation.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/Notation.java
new file mode 100644
index 000000000..3739f9284
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/Notation.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * This interface represents a notation declared in the DTD. A notation either
+ * declares, by name, the format of an unparsed entity (see section 4.7 of the XML 1.0 specification [XML 1.0]), or is
+ * used for formal declaration of processing instruction targets (see section 2.6 of the XML 1.0 specification [XML 1.0]). The
+ * nodeName
attribute inherited from Node
is set
+ * to the declared name of the notation.
+ *
The DOM Core does not support editing Notation
nodes; they
+ * are therefore readonly.
+ *
A Notation
node does not have any parent.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ */
+public interface Notation extends Node {
+ /**
+ * The public identifier of this notation. If the public identifier was
+ * not specified, this is null
.
+ */
+ public String getPublicId();
+
+ /**
+ * The system identifier of this notation. If the system identifier was
+ * not specified, this is null
. This may be an absolute URI
+ * or not.
+ */
+ public String getSystemId();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/UserDataHandler.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/UserDataHandler.java
new file mode 100644
index 000000000..a16ea7308
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/UserDataHandler.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom;
+
+/**
+ * When associating an object to a key on a node using
+ * Node.setUserData()
the application can provide a handler
+ * that gets called when the node the object is associated to is being
+ * cloned, imported, or renamed. This can be used by the application to
+ * implement various behaviors regarding the data it associates to the DOM
+ * nodes. This interface defines that handler.
+ *
See also the Document Object Model (DOM) Level 3 Core Specification.
+ * @since DOM Level 3
+ */
+public interface UserDataHandler {
+ // OperationType
+ /**
+ * The node is cloned, using Node.cloneNode()
.
+ */
+ public static final short NODE_CLONED = 1;
+ /**
+ * The node is imported, using Document.importNode()
.
+ */
+ public static final short NODE_IMPORTED = 2;
+ /**
+ * The node is deleted.
+ *
Note: This may not be supported or may not be reliable in
+ * certain environments, such as Java, where the implementation has no
+ * real control over when objects are actually deleted.
+ */
+ public static final short NODE_DELETED = 3;
+ /**
+ * The node is renamed, using Document.renameNode()
.
+ */
+ public static final short NODE_RENAMED = 4;
+ /**
+ * The node is adopted, using Document.adoptNode()
.
+ */
+ public static final short NODE_ADOPTED = 5;
+
+ /**
+ * This method is called whenever the node for which this handler is
+ * registered is imported or cloned.
+ *
DOM applications must not raise exceptions in a
+ * UserDataHandler
. The effect of throwing exceptions from
+ * the handler is DOM implementation dependent.
+ * @param operation Specifies the type of operation that is being
+ * performed on the node.
+ * @param key Specifies the key for which this handler is being called.
+ * @param data Specifies the data for which this handler is being called.
+ * @param src Specifies the node being cloned, adopted, imported, or
+ * renamed. This is null
when the node is being deleted.
+ * @param dst Specifies the node newly created if any, or
+ * null
.
+ */
+ public void handle(short operation,
+ String key,
+ Object data,
+ Node src,
+ Node dst);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/bootstrap/DOMImplementationRegistry.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
new file mode 100644
index 000000000..17af38dc4
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/bootstrap/DOMImplementationRegistry.java
@@ -0,0 +1,397 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+
+package org.w3c.dom.bootstrap;
+
+import java.util.StringTokenizer;
+import java.util.Vector;
+import org.w3c.dom.DOMImplementationSource;
+import org.w3c.dom.DOMImplementationList;
+import org.w3c.dom.DOMImplementation;
+import java.io.InputStream;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * A factory that enables applications to obtain instances of
+ * DOMImplementation
.
+ *
+ *
+ * Example: + *
+ * + *+ * // get an instance of the DOMImplementation registry + * DOMImplementationRegistry registry = + * DOMImplementationRegistry.newInstance(); + * // get a DOM implementation the Level 3 XML module + * DOMImplementation domImpl = + * registry.getDOMImplementation("XML 3.0"); + *+ * + *
+ * This provides an application with an implementation-independent starting + * point. DOM implementations may modify this class to meet new security + * standards or to provide *additional* fallbacks for the list of + * DOMImplementationSources. + *
+ * + * @see DOMImplementation + * @see DOMImplementationSource + * @since DOM Level 3 + */ +public final class DOMImplementationRegistry { + /** + * The system property to specify the + * DOMImplementationSource class names. + */ + public static final String PROPERTY = + "org.w3c.dom.DOMImplementationSourceList"; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + + /** + * Default DOMImplementationSource. + */ + private static final String DEFAULT_DOM_IMPLEMENTATION_SOURCE = "org.apache.xerces.dom.DOMXSImplementationSourceImpl"; + + /** + * The list of DOMImplementationSources. + */ + private Vector sources; + + /** + * Private constructor. + * @param srcs Vector List of DOMImplementationSources + */ + private DOMImplementationRegistry(final Vector srcs) { + sources = srcs; + } + + /** + * Obtain a new instance of aDOMImplementationRegistry
.
+ *
+
+ * The DOMImplementationRegistry
is initialized by the
+ * application or the implementation, depending on the context, by
+ * first checking the value of the Java system property
+ * org.w3c.dom.DOMImplementationSourceList
and
+ * the the service provider whose contents are at
+ * "META-INF/services/org.w3c.dom.DOMImplementationSourceList
"
+ * The value of this property is a white-space separated list of
+ * names of availables classes implementing the
+ * DOMImplementationSource
interface. Each class listed
+ * in the class name list is instantiated and any exceptions
+ * encountered are thrown to the application.
+ *
+ * @return an initialized instance of DOMImplementationRegistry
+ * @throws ClassNotFoundException
+ * If any specified class can not be found
+ * @throws InstantiationException
+ * If any specified class is an interface or abstract class
+ * @throws IllegalAccessException
+ * If the default constructor of a specified class is not accessible
+ * @throws ClassCastException
+ * If any specified class does not implement
+ * DOMImplementationSource
+ */
+ public static DOMImplementationRegistry newInstance()
+ throws
+ ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException,
+ ClassCastException {
+ Vector sources = new Vector();
+
+ ClassLoader classLoader = getClassLoader();
+ // fetch system property:
+ String p = getSystemProperty(PROPERTY);
+
+ //
+ // if property is not specified then use contents of
+ // META-INF/org.w3c.dom.DOMImplementationSourceList from classpath
+ if (p == null || p.length() == 0) {
+ p = getServiceValue(classLoader);
+ }
+ if (p == null) {
+ //
+ // DOM Implementations can modify here to add *additional* fallback
+ // mechanisms to access a list of default DOMImplementationSources.
+ p = DEFAULT_DOM_IMPLEMENTATION_SOURCE;
+ }
+ if (p != null) {
+ StringTokenizer st = new StringTokenizer(p);
+ while (st.hasMoreTokens()) {
+ String sourceName = st.nextToken();
+ // Use context class loader, falling back to Class.forName
+ // if and only if this fails...
+ Class sourceClass = null;
+ if (classLoader != null) {
+ sourceClass = classLoader.loadClass(sourceName);
+ } else {
+ sourceClass = Class.forName(sourceName);
+ }
+ DOMImplementationSource source =
+ (DOMImplementationSource) sourceClass.newInstance();
+ sources.addElement(source);
+ }
+ }
+ return new DOMImplementationRegistry(sources);
+ }
+
+ /**
+ * Return the first implementation that has the desired
+ * features, or null
if none is found.
+ *
+ * @param features
+ * A string that specifies which features are required. This is
+ * a space separated list in which each feature is specified by
+ * its name optionally followed by a space and a version number.
+ * This is something like: "XML 1.0 Traversal +Events 2.0"
+ * @return An implementation that has the desired features,
+ * or null
if none found.
+ */
+ public DOMImplementation getDOMImplementation(final String features) {
+ int size = sources.size();
+ String name = null;
+ for (int i = 0; i < size; i++) {
+ DOMImplementationSource source =
+ (DOMImplementationSource) sources.elementAt(i);
+ DOMImplementation impl = source.getDOMImplementation(features);
+ if (impl != null) {
+ return impl;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return a list of implementations that support the
+ * desired features.
+ *
+ * @param features
+ * A string that specifies which features are required. This is
+ * a space separated list in which each feature is specified by
+ * its name optionally followed by a space and a version number.
+ * This is something like: "XML 1.0 Traversal +Events 2.0"
+ * @return A list of DOMImplementations that support the desired features.
+ */
+ public DOMImplementationList getDOMImplementationList(final String features) {
+ final Vector implementations = new Vector();
+ int size = sources.size();
+ for (int i = 0; i < size; i++) {
+ DOMImplementationSource source =
+ (DOMImplementationSource) sources.elementAt(i);
+ DOMImplementationList impls =
+ source.getDOMImplementationList(features);
+ for (int j = 0; j < impls.getLength(); j++) {
+ DOMImplementation impl = impls.item(j);
+ implementations.addElement(impl);
+ }
+ }
+ return new DOMImplementationList() {
+ public DOMImplementation item(final int index) {
+ if (index >= 0 && index < implementations.size()) {
+ try {
+ return (DOMImplementation)
+ implementations.elementAt(index);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public int getLength() {
+ return implementations.size();
+ }
+ };
+ }
+
+ /**
+ * Register an implementation.
+ *
+ * @param s The source to be registered, may not be null
+ */
+ public void addSource(final DOMImplementationSource s) {
+ if (s == null) {
+ throw new NullPointerException();
+ }
+ if (!sources.contains(s)) {
+ sources.addElement(s);
+ }
+ }
+
+ /**
+ *
+ * Gets a class loader.
+ *
+ * @return A class loader, possibly null
+ */
+ private static ClassLoader getClassLoader() {
+ try {
+ ClassLoader contextClassLoader = getContextClassLoader();
+
+ if (contextClassLoader != null) {
+ return contextClassLoader;
+ }
+ } catch (Exception e) {
+ // Assume that the DOM application is in a JRE 1.1, use the
+ // current ClassLoader
+ return DOMImplementationRegistry.class.getClassLoader();
+ }
+ return DOMImplementationRegistry.class.getClassLoader();
+ }
+
+ /**
+ * This method attempts to return the first line of the resource
+ * META-INF/services/org.w3c.dom.DOMImplementationSourceList
+ * from the provided ClassLoader.
+ *
+ * @param classLoader classLoader, may not be null
.
+ * @return first line of resource, or null
+ */
+ private static String getServiceValue(final ClassLoader classLoader) {
+ String serviceId = "META-INF/services/" + PROPERTY;
+ // try to find services in CLASSPATH
+ try {
+ InputStream is = getResourceAsStream(classLoader, serviceId);
+
+ if (is != null) {
+ BufferedReader rd;
+ try {
+ rd =
+ new BufferedReader(new InputStreamReader(is, "UTF-8"),
+ DEFAULT_LINE_LENGTH);
+ } catch (java.io.UnsupportedEncodingException e) {
+ rd =
+ new BufferedReader(new InputStreamReader(is),
+ DEFAULT_LINE_LENGTH);
+ }
+ String serviceValue = null;
+ try {
+ serviceValue = rd.readLine();
+ }
+ finally {
+ rd.close();
+ }
+ if (serviceValue != null && serviceValue.length() > 0) {
+ return serviceValue;
+ }
+ }
+ } catch (Exception ex) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * A simple JRE (Java Runtime Environment) 1.1 test
+ *
+ * @return true
if JRE 1.1
+ */
+ private static boolean isJRE11() {
+ try {
+ Class c = Class.forName("java.security.AccessController");
+ // java.security.AccessController existed since 1.2 so, if no
+ // exception was thrown, the DOM application is running in a JRE
+ // 1.2 or higher
+ return false;
+ } catch (Exception ex) {
+ // ignore
+ }
+ return true;
+ }
+
+ /**
+ * This method returns the ContextClassLoader or null
if
+ * running in a JRE 1.1
+ *
+ * @return The Context Classloader
+ */
+ private static ClassLoader getContextClassLoader() {
+ return isJRE11()
+ ? null
+ : (ClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader classLoader = null;
+ try {
+ classLoader =
+ Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return classLoader;
+ }
+ });
+ }
+
+ /**
+ * This method returns the system property indicated by the specified name
+ * after checking access control privileges. For a JRE 1.1, this check is
+ * not done.
+ *
+ * @param name the name of the system property
+ * @return the system property
+ */
+ private static String getSystemProperty(final String name) {
+ return isJRE11()
+ ? (String) System.getProperty(name)
+ : (String) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return System.getProperty(name);
+ }
+ });
+ }
+
+ /**
+ * This method returns an Inputstream for the reading resource
+ * META-INF/services/org.w3c.dom.DOMImplementationSourceList after checking
+ * access control privileges. For a JRE 1.1, this check is not done.
+ *
+ * @param classLoader classLoader
+ * @param name the resource
+ * @return an Inputstream for the resource specified
+ */
+ private static InputStream getResourceAsStream(final ClassLoader classLoader,
+ final String name) {
+ if (isJRE11()) {
+ InputStream ris;
+ if (classLoader == null) {
+ ris = ClassLoader.getSystemResourceAsStream(name);
+ } else {
+ ris = classLoader.getResourceAsStream(name);
+ }
+ return ris;
+ } else {
+ return (InputStream)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ InputStream ris;
+ if (classLoader == null) {
+ ris =
+ ClassLoader.getSystemResourceAsStream(name);
+ } else {
+ ris = classLoader.getResourceAsStream(name);
+ }
+ return ris;
+ }
+ });
+ }
+ }
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSImportRule.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSImportRule.java
new file mode 100644
index 000000000..e18ad569b
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSImportRule.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.stylesheets.MediaList;
+
+/**
+ * The CSSImportRule
interface represents a @import rule within
+ * a CSS style sheet. The @import
rule is used to import style
+ * rules from other style sheets.
+ * See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface CSSImportRule extends CSSRule {
+ /**
+ * The location of the style sheet to be imported. The attribute will not
+ * contain the "url(...)"
specifier around the URI.
+ */
+ public String getHref();
+
+ /**
+ * A list of media types for which this style sheet may be used.
+ */
+ public MediaList getMedia();
+
+ /**
+ * The style sheet referred to by this rule, if it has been loaded. The
+ * value of this attribute is null
if the style sheet has
+ * not yet been loaded or if it will not be loaded (e.g. if the style
+ * sheet is for a media type not supported by the user agent).
+ */
+ public CSSStyleSheet getStyleSheet();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSRule.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSRule.java
new file mode 100644
index 000000000..788f946ec
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSRule.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The CSSRule
interface is the abstract base interface for any
+ * type of CSS statement. This includes both rule sets and at-rules. An
+ * implementation is expected to preserve all rules specified in a CSS style
+ * sheet, even if the rule is not recognized by the parser. Unrecognized
+ * rules are represented using the CSSUnknownRule
interface.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface CSSRule {
+ // RuleType
+ /**
+ * The rule is a CSSUnknownRule
.
+ */
+ public static final short UNKNOWN_RULE = 0;
+ /**
+ * The rule is a CSSStyleRule
.
+ */
+ public static final short STYLE_RULE = 1;
+ /**
+ * The rule is a CSSCharsetRule
.
+ */
+ public static final short CHARSET_RULE = 2;
+ /**
+ * The rule is a CSSImportRule
.
+ */
+ public static final short IMPORT_RULE = 3;
+ /**
+ * The rule is a CSSMediaRule
.
+ */
+ public static final short MEDIA_RULE = 4;
+ /**
+ * The rule is a CSSFontFaceRule
.
+ */
+ public static final short FONT_FACE_RULE = 5;
+ /**
+ * The rule is a CSSPageRule
.
+ */
+ public static final short PAGE_RULE = 6;
+
+ /**
+ * The type of the rule, as defined above. The expectation is that
+ * binding-specific casting methods can be used to cast down from an
+ * instance of the CSSRule
interface to the specific
+ * derived interface implied by the type
.
+ */
+ public short getType();
+
+ /**
+ * The parsable textual representation of the rule. This reflects the
+ * current state of the rule and not its initial value.
+ */
+ public String getCssText();
+ /**
+ * The parsable textual representation of the rule. This reflects the
+ * current state of the rule and not its initial value.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
+ * error and is unparsable.
+ *
INVALID_MODIFICATION_ERR: Raised if the specified CSS string
+ * value represents a different type of rule than the current one.
+ *
HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at
+ * this point in the style sheet.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.
+ */
+ public void setCssText(String cssText)
+ throws DOMException;
+
+ /**
+ * The style sheet that contains this rule.
+ */
+ public CSSStyleSheet getParentStyleSheet();
+
+ /**
+ * If this rule is contained inside another rule (e.g. a style rule
+ * inside an @media block), this is the containing rule. If this rule is
+ * not nested inside any other rules, this returns null
.
+ */
+ public CSSRule getParentRule();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSRuleList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSRuleList.java
new file mode 100644
index 000000000..41c2c6837
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSRuleList.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The CSSRuleList
interface provides the abstraction of an
+ * ordered collection of CSS rules.
+ *
The items in the CSSRuleList
are accessible via an
+ * integral index, starting from 0.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface CSSRuleList {
+ /**
+ * The number of CSSRules
in the list. The range of valid
+ * child rule indices is 0
to length-1
+ * inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Used to retrieve a CSS rule by ordinal index. The order in this
+ * collection represents the order of the rules in the CSS style sheet.
+ * If index is greater than or equal to the number of rules in the list,
+ * this returns null
.
+ * @param index Index into the collection
+ * @return The style rule at the index
position in the
+ * CSSRuleList
, or null
if that is not a
+ * valid index.
+ */
+ public CSSRule item(int index);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSStyleDeclaration.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSStyleDeclaration.java
new file mode 100644
index 000000000..e5e346b0a
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSStyleDeclaration.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The CSSStyleDeclaration
interface represents a single CSS
+ * declaration block. This interface may be used to determine the style
+ * properties currently set in a block or to set style properties explicitly
+ * within the block.
+ *
While an implementation may not recognize all CSS properties within a
+ * CSS declaration block, it is expected to provide access to all specified
+ * properties in the style sheet through the CSSStyleDeclaration
+ * interface. Furthermore, implementations that support a specific level of
+ * CSS should correctly handle CSS shorthand properties for that level. For
+ * a further discussion of shorthand properties, see the
+ * CSS2Properties
interface.
+ *
This interface is also used to provide a read-only access to the
+ * computed values of an element. See also the ViewCSS
+ * interface. The CSS Object Model doesn't provide an access to the
+ * specified or actual values of the CSS cascade.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface CSSStyleDeclaration {
+ /**
+ * The parsable textual representation of the declaration block
+ * (excluding the surrounding curly braces). Setting this attribute will
+ * result in the parsing of the new value and resetting of all the
+ * properties in the declaration block including the removal or addition
+ * of properties.
+ */
+ public String getCssText();
+ /**
+ * The parsable textual representation of the declaration block
+ * (excluding the surrounding curly braces). Setting this attribute will
+ * result in the parsing of the new value and resetting of all the
+ * properties in the declaration block including the removal or addition
+ * of properties.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
+ * error and is unparsable.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
+ * readonly or a property is readonly.
+ */
+ public void setCssText(String cssText)
+ throws DOMException;
+
+ /**
+ * Used to retrieve the value of a CSS property if it has been explicitly
+ * set within this declaration block.
+ * @param propertyName The name of the CSS property. See the CSS
+ * property index.
+ * @return Returns the value of the property if it has been explicitly
+ * set for this declaration block. Returns the empty string if the
+ * property has not been set.
+ */
+ public String getPropertyValue(String propertyName);
+
+ /**
+ * Used to retrieve the object representation of the value of a CSS
+ * property if it has been explicitly set within this declaration block.
+ * This method returns null
if the property is a shorthand
+ * property. Shorthand property values can only be accessed and modified
+ * as strings, using the getPropertyValue
and
+ * setProperty
methods.
+ * @param propertyName The name of the CSS property. See the CSS
+ * property index.
+ * @return Returns the value of the property if it has been explicitly
+ * set for this declaration block. Returns null
if the
+ * property has not been set.
+ */
+ public CSSValue getPropertyCSSValue(String propertyName);
+
+ /**
+ * Used to remove a CSS property if it has been explicitly set within
+ * this declaration block.
+ * @param propertyName The name of the CSS property. See the CSS
+ * property index.
+ * @return Returns the value of the property if it has been explicitly
+ * set for this declaration block. Returns the empty string if the
+ * property has not been set or the property name does not correspond
+ * to a known CSS property.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly
+ * or the property is readonly.
+ */
+ public String removeProperty(String propertyName)
+ throws DOMException;
+
+ /**
+ * Used to retrieve the priority of a CSS property (e.g. the
+ * "important"
qualifier) if the priority has been
+ * explicitly set in this declaration block.
+ * @param propertyName The name of the CSS property. See the CSS
+ * property index.
+ * @return A string representing the priority (e.g.
+ * "important"
) if the property has been explicitly set
+ * in this declaration block and has a priority specified. The empty
+ * string otherwise.
+ */
+ public String getPropertyPriority(String propertyName);
+
+ /**
+ * Used to set a property value and priority within this declaration
+ * block. setProperty
permits to modify a property or add a
+ * new one in the declaration block. Any call to this method may modify
+ * the order of properties in the item
method.
+ * @param propertyName The name of the CSS property. See the CSS
+ * property index.
+ * @param value The new value of the property.
+ * @param priority The new priority of the property (e.g.
+ * "important"
) or the empty string if none.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified value has a syntax error and is
+ * unparsable.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
+ * readonly or the property is readonly.
+ */
+ public void setProperty(String propertyName,
+ String value,
+ String priority)
+ throws DOMException;
+
+ /**
+ * The number of properties that have been explicitly set in this
+ * declaration block. The range of valid indices is 0 to length-1
+ * inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Used to retrieve the properties that have been explicitly set in this
+ * declaration block. The order of the properties retrieved using this
+ * method does not have to be the order in which they were set. This
+ * method can be used to iterate over all properties in this declaration
+ * block.
+ * @param index Index of the property name to retrieve.
+ * @return The name of the property at this ordinal position. The empty
+ * string if no property exists at this position.
+ */
+ public String item(int index);
+
+ /**
+ * The CSS rule that contains this declaration block or null
+ * if this CSSStyleDeclaration
is not attached to a
+ * CSSRule
.
+ */
+ public CSSRule getParentRule();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSValue.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSValue.java
new file mode 100644
index 000000000..0285bcc77
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSValue.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The CSSValue
interface represents a simple or a complex
+ * value. A CSSValue
object only occurs in a context of a CSS
+ * property.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface CSSValue {
+ // UnitTypes
+ /**
+ * The value is inherited and the cssText
contains "inherit".
+ */
+ public static final short CSS_INHERIT = 0;
+ /**
+ * The value is a primitive value and an instance of the
+ * CSSPrimitiveValue
interface can be obtained by using
+ * binding-specific casting methods on this instance of the
+ * CSSValue
interface.
+ */
+ public static final short CSS_PRIMITIVE_VALUE = 1;
+ /**
+ * The value is a CSSValue
list and an instance of the
+ * CSSValueList
interface can be obtained by using
+ * binding-specific casting methods on this instance of the
+ * CSSValue
interface.
+ */
+ public static final short CSS_VALUE_LIST = 2;
+ /**
+ * The value is a custom value.
+ */
+ public static final short CSS_CUSTOM = 3;
+
+ /**
+ * A string representation of the current value.
+ */
+ public String getCssText();
+ /**
+ * A string representation of the current value.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
+ * error (according to the attached property) or is unparsable.
+ *
INVALID_MODIFICATION_ERR: Raised if the specified CSS string
+ * value represents a different type of values than the values allowed
+ * by the CSS property.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this value is readonly.
+ */
+ public void setCssText(String cssText)
+ throws DOMException;
+
+ /**
+ * A code defining the type of the value as defined above.
+ */
+ public short getCssValueType();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSValueList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSValueList.java
new file mode 100644
index 000000000..bf15bb3eb
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/CSSValueList.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The CSSValueList
interface provides the abstraction of an
+ * ordered collection of CSS values.
+ *
Some properties allow an empty list into their syntax. In that case,
+ * these properties take the none
identifier. So, an empty list
+ * means that the property has the value none
.
+ *
The items in the CSSValueList
are accessible via an
+ * integral index, starting from 0.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface CSSValueList extends CSSValue {
+ /**
+ * The number of CSSValues
in the list. The range of valid
+ * values of the indices is 0
to length-1
+ * inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Used to retrieve a CSSValue
by ordinal index. The order in
+ * this collection represents the order of the values in the CSS style
+ * property. If index is greater than or equal to the number of values
+ * in the list, this returns null
.
+ * @param index Index into the collection.
+ * @return The CSSValue
at the index
position
+ * in the CSSValueList
, or null
if that is
+ * not a valid index.
+ */
+ public CSSValue item(int index);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/Counter.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/Counter.java
new file mode 100644
index 000000000..8cd4967b3
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/Counter.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The Counter
interface is used to represent any counter or
+ * counters function value. This interface reflects the values in the
+ * underlying style property.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface Counter {
+ /**
+ * This attribute is used for the identifier of the counter.
+ */
+ public String getIdentifier();
+
+ /**
+ * This attribute is used for the style of the list.
+ */
+ public String getListStyle();
+
+ /**
+ * This attribute is used for the separator of the nested counters.
+ */
+ public String getSeparator();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/DOMImplementationCSS.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/DOMImplementationCSS.java
new file mode 100644
index 000000000..65c97291e
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/DOMImplementationCSS.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.DOMException;
+
+/**
+ * This interface allows the DOM user to create a CSSStyleSheet
+ * outside the context of a document. There is no way to associate the new
+ * CSSStyleSheet
with a document in DOM Level 2.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface DOMImplementationCSS extends DOMImplementation {
+ /**
+ * Creates a new CSSStyleSheet
.
+ * @param title The advisory title. See also the section.
+ * @param media The comma-separated list of media associated with the
+ * new style sheet. See also the section.
+ * @return A new CSS style sheet.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified media string value has a syntax
+ * error and is unparsable.
+ */
+ public CSSStyleSheet createCSSStyleSheet(String title,
+ String media)
+ throws DOMException;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/DocumentCSS.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/DocumentCSS.java
new file mode 100644
index 000000000..8fe93c79a
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/DocumentCSS.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.stylesheets.DocumentStyle;
+
+/**
+ * This interface represents a document with a CSS view.
+ *
The getOverrideStyle
method provides a mechanism through
+ * which a DOM author could effect immediate change to the style of an
+ * element without modifying the explicitly linked style sheets of a
+ * document or the inline style of elements in the style sheets. This style
+ * sheet comes after the author style sheet in the cascade algorithm and is
+ * called override style sheet. The override style sheet takes precedence
+ * over author style sheets. An "!important" declaration still takes
+ * precedence over a normal declaration. Override, author, and user style
+ * sheets all may contain "!important" declarations. User "!important" rules
+ * take precedence over both override and author "!important" rules, and
+ * override "!important" rules take precedence over author "!important"
+ * rules.
+ *
The expectation is that an instance of the DocumentCSS
+ * interface can be obtained by using binding-specific casting methods on an
+ * instance of the Document
interface.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface DocumentCSS extends DocumentStyle {
+ /**
+ * This method is used to retrieve the override style declaration for a
+ * specified element and a specified pseudo-element.
+ * @param elt The element whose style is to be modified. This parameter
+ * cannot be null.
+ * @param pseudoElt The pseudo-element or null
if none.
+ * @return The override style declaration.
+ */
+ public CSSStyleDeclaration getOverrideStyle(Element elt,
+ String pseudoElt);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/ElementCSSInlineStyle.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/ElementCSSInlineStyle.java
new file mode 100644
index 000000000..98b60bf9d
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/ElementCSSInlineStyle.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * Inline style information attached to elements is exposed through the
+ * style
attribute. This represents the contents of the STYLE
+ * attribute for HTML elements (or elements in other schemas or DTDs which
+ * use the STYLE attribute in the same way). The expectation is that an
+ * instance of the ElementCSSInlineStyle interface can be obtained by using
+ * binding-specific casting methods on an instance of the Element interface
+ * when the element supports inline CSS style informations.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface ElementCSSInlineStyle {
+ /**
+ * The style attribute.
+ */
+ public CSSStyleDeclaration getStyle();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/RGBColor.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/RGBColor.java
new file mode 100644
index 000000000..cd5daa567
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/RGBColor.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The RGBColor
interface is used to represent any RGB color
+ * value. This interface reflects the values in the underlying style
+ * property. Hence, modifications made to the CSSPrimitiveValue
+ * objects modify the style property.
+ *
A specified RGB color is not clipped (even if the number is outside the + * range 0-255 or 0%-100%). A computed RGB color is clipped depending on the + * device. + *
Even if a style sheet can only contain an integer for a color value, + * the internal storage of this integer is a float, and this can be used as + * a float in the specified or the computed style. + *
A color percentage value can always be converted to a number and vice + * versa. + *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface RGBColor {
+ /**
+ * This attribute is used for the red value of the RGB color.
+ */
+ public CSSPrimitiveValue getRed();
+
+ /**
+ * This attribute is used for the green value of the RGB color.
+ */
+ public CSSPrimitiveValue getGreen();
+
+ /**
+ * This attribute is used for the blue value of the RGB color.
+ */
+ public CSSPrimitiveValue getBlue();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/Rect.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/Rect.java
new file mode 100644
index 000000000..f5efb1084
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/Rect.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+/**
+ * The Rect
interface is used to represent any rect value. This
+ * interface reflects the values in the underlying style property. Hence,
+ * modifications made to the CSSPrimitiveValue
objects modify
+ * the style property.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface Rect {
+ /**
+ * This attribute is used for the top of the rect.
+ */
+ public CSSPrimitiveValue getTop();
+
+ /**
+ * This attribute is used for the right of the rect.
+ */
+ public CSSPrimitiveValue getRight();
+
+ /**
+ * This attribute is used for the bottom of the rect.
+ */
+ public CSSPrimitiveValue getBottom();
+
+ /**
+ * This attribute is used for the left of the rect.
+ */
+ public CSSPrimitiveValue getLeft();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/ViewCSS.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/ViewCSS.java
new file mode 100644
index 000000000..76b585a54
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/css/ViewCSS.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.css;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.views.AbstractView;
+
+/**
+ * This interface represents a CSS view. The getComputedStyle
+ * method provides a read only access to the computed values of an element.
+ *
The expectation is that an instance of the ViewCSS
+ * interface can be obtained by using binding-specific casting methods on an
+ * instance of the AbstractView
interface.
+ *
Since a computed style is related to an Element
node, if
+ * this element is removed from the document, the associated
+ * CSSStyleDeclaration
and CSSValue
related to
+ * this declaration are no longer valid.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface ViewCSS extends AbstractView {
+ /**
+ * This method is used to get the computed style as it is defined in [CSS2].
+ * @param elt The element whose style is to be computed. This parameter
+ * cannot be null.
+ * @param pseudoElt The pseudo-element or null
if none.
+ * @return The computed style. The CSSStyleDeclaration
is
+ * read-only and contains only absolute values.
+ */
+ public CSSStyleDeclaration getComputedStyle(Element elt,
+ String pseudoElt);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/DocumentEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/DocumentEvent.java
new file mode 100644
index 000000000..76644bc5a
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/DocumentEvent.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.events;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The DocumentEvent
interface provides a mechanism by which the
+ * user can create an Event of a type supported by the implementation. It is
+ * expected that the DocumentEvent
interface will be
+ * implemented on the same object which implements the Document
+ * interface in an implementation which supports the Event model.
+ *
See also the Document Object Model (DOM) Level 2 Events Specification.
+ * @since DOM Level 2
+ */
+public interface DocumentEvent {
+ /**
+ *
+ * @param eventType The eventType
parameter specifies the
+ * type of Event
interface to be created. If the
+ * Event
interface specified is supported by the
+ * implementation this method will return a new Event
of
+ * the interface type requested. If the Event
is to be
+ * dispatched via the dispatchEvent
method the
+ * appropriate event init method must be called after creation in
+ * order to initialize the Event
's values. As an example,
+ * a user wishing to synthesize some kind of UIEvent
+ * would call createEvent
with the parameter "UIEvents".
+ * The initUIEvent
method could then be called on the
+ * newly created UIEvent
to set the specific type of
+ * UIEvent to be dispatched and set its context information.The
+ * createEvent
method is used in creating
+ * Event
s when it is either inconvenient or unnecessary
+ * for the user to create an Event
themselves. In cases
+ * where the implementation provided Event
is
+ * insufficient, users may supply their own Event
+ * implementations for use with the dispatchEvent
method.
+ * @return The newly created Event
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if the implementation does not support the
+ * type of Event
interface requested
+ */
+ public Event createEvent(String eventType)
+ throws DOMException;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/Event.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/Event.java
new file mode 100644
index 000000000..14a9239ed
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/Event.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.events;
+
+/**
+ * The Event
interface is used to provide contextual information
+ * about an event to the handler processing the event. An object which
+ * implements the Event
interface is generally passed as the
+ * first parameter to an event handler. More specific context information is
+ * passed to event handlers by deriving additional interfaces from
+ * Event
which contain information directly relating to the
+ * type of event they accompany. These derived interfaces are also
+ * implemented by the object passed to the event listener.
+ *
See also the Document Object Model (DOM) Level 2 Events Specification.
+ * @since DOM Level 2
+ */
+public interface Event {
+ // PhaseType
+ /**
+ * The current event phase is the capturing phase.
+ */
+ public static final short CAPTURING_PHASE = 1;
+ /**
+ * The event is currently being evaluated at the target
+ * EventTarget
.
+ */
+ public static final short AT_TARGET = 2;
+ /**
+ * The current event phase is the bubbling phase.
+ */
+ public static final short BUBBLING_PHASE = 3;
+
+ /**
+ * The name of the event (case-insensitive). The name must be an XML name.
+ */
+ public String getType();
+
+ /**
+ * Used to indicate the EventTarget
to which the event was
+ * originally dispatched.
+ */
+ public EventTarget getTarget();
+
+ /**
+ * Used to indicate the EventTarget
whose
+ * EventListeners
are currently being processed. This is
+ * particularly useful during capturing and bubbling.
+ */
+ public EventTarget getCurrentTarget();
+
+ /**
+ * Used to indicate which phase of event flow is currently being
+ * evaluated.
+ */
+ public short getEventPhase();
+
+ /**
+ * Used to indicate whether or not an event is a bubbling event. If the
+ * event can bubble the value is true, else the value is false.
+ */
+ public boolean getBubbles();
+
+ /**
+ * Used to indicate whether or not an event can have its default action
+ * prevented. If the default action can be prevented the value is true,
+ * else the value is false.
+ */
+ public boolean getCancelable();
+
+ /**
+ * Used to specify the time (in milliseconds relative to the epoch) at
+ * which the event was created. Due to the fact that some systems may
+ * not provide this information the value of timeStamp
may
+ * be not available for all events. When not available, a value of 0
+ * will be returned. Examples of epoch time are the time of the system
+ * start or 0:0:0 UTC 1st January 1970.
+ */
+ public long getTimeStamp();
+
+ /**
+ * The stopPropagation
method is used prevent further
+ * propagation of an event during event flow. If this method is called
+ * by any EventListener
the event will cease propagating
+ * through the tree. The event will complete dispatch to all listeners
+ * on the current EventTarget
before event flow stops. This
+ * method may be used during any stage of event flow.
+ */
+ public void stopPropagation();
+
+ /**
+ * If an event is cancelable, the preventDefault
method is
+ * used to signify that the event is to be canceled, meaning any default
+ * action normally taken by the implementation as a result of the event
+ * will not occur. If, during any stage of event flow, the
+ * preventDefault
method is called the event is canceled.
+ * Any default action associated with the event will not occur. Calling
+ * this method for a non-cancelable event has no effect. Once
+ * preventDefault
has been called it will remain in effect
+ * throughout the remainder of the event's propagation. This method may
+ * be used during any stage of event flow.
+ */
+ public void preventDefault();
+
+ /**
+ * The initEvent
method is used to initialize the value of an
+ * Event
created through the DocumentEvent
+ * interface. This method may only be called before the
+ * Event
has been dispatched via the
+ * dispatchEvent
method, though it may be called multiple
+ * times during that phase if necessary. If called multiple times the
+ * final invocation takes precedence. If called from a subclass of
+ * Event
interface only the values specified in the
+ * initEvent
method are modified, all other attributes are
+ * left unchanged.
+ * @param eventTypeArg Specifies the event type. This type may be any
+ * event type currently defined in this specification or a new event
+ * type.. The string must be an XML name. Any new event type must not
+ * begin with any upper, lower, or mixed case version of the string
+ * "DOM". This prefix is reserved for future DOM event sets. It is
+ * also strongly recommended that third parties adding their own
+ * events use their own prefix to avoid confusion and lessen the
+ * probability of conflicts with other new events.
+ * @param canBubbleArg Specifies whether or not the event can bubble.
+ * @param cancelableArg Specifies whether or not the event's default
+ * action can be prevented.
+ */
+ public void initEvent(String eventTypeArg,
+ boolean canBubbleArg,
+ boolean cancelableArg);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/EventException.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/EventException.java
new file mode 100644
index 000000000..7a6ff2620
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/EventException.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.events;
+
+/**
+ * Event operations may throw an EventException
as specified in
+ * their method descriptions.
+ *
See also the Document Object Model (DOM) Level 2 Events Specification.
+ * @since DOM Level 2
+ */
+public class EventException extends RuntimeException {
+ public EventException(short code, String message) {
+ super(message);
+ this.code = code;
+ }
+ public short code;
+ // EventExceptionCode
+ /**
+ * If the Event
's type was not specified by initializing the
+ * event before the method was called. Specification of the Event's type
+ * as null
or an empty string will also trigger this
+ * exception.
+ */
+ public static final short UNSPECIFIED_EVENT_TYPE_ERR = 0;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/MouseEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/MouseEvent.java
new file mode 100644
index 000000000..be780357a
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/MouseEvent.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.events;
+
+import org.w3c.dom.views.AbstractView;
+
+/**
+ * The MouseEvent
interface provides specific contextual
+ * information associated with Mouse events.
+ *
The detail
attribute inherited from UIEvent
+ * indicates the number of times a mouse button has been pressed and
+ * released over the same screen location during a user action. The
+ * attribute value is 1 when the user begins this action and increments by 1
+ * for each full sequence of pressing and releasing. If the user moves the
+ * mouse between the mousedown and mouseup the value will be set to 0,
+ * indicating that no click is occurring.
+ *
In the case of nested elements mouse events are always targeted at the + * most deeply nested element. Ancestors of the targeted element may use + * bubbling to obtain notification of mouse events which occur within its + * descendent elements. + *
See also the Document Object Model (DOM) Level 2 Events Specification.
+ * @since DOM Level 2
+ */
+public interface MouseEvent extends UIEvent {
+ /**
+ * The horizontal coordinate at which the event occurred relative to the
+ * origin of the screen coordinate system.
+ */
+ public int getScreenX();
+
+ /**
+ * The vertical coordinate at which the event occurred relative to the
+ * origin of the screen coordinate system.
+ */
+ public int getScreenY();
+
+ /**
+ * The horizontal coordinate at which the event occurred relative to the
+ * DOM implementation's client area.
+ */
+ public int getClientX();
+
+ /**
+ * The vertical coordinate at which the event occurred relative to the DOM
+ * implementation's client area.
+ */
+ public int getClientY();
+
+ /**
+ * Used to indicate whether the 'ctrl' key was depressed during the firing
+ * of the event.
+ */
+ public boolean getCtrlKey();
+
+ /**
+ * Used to indicate whether the 'shift' key was depressed during the
+ * firing of the event.
+ */
+ public boolean getShiftKey();
+
+ /**
+ * Used to indicate whether the 'alt' key was depressed during the firing
+ * of the event. On some platforms this key may map to an alternative
+ * key name.
+ */
+ public boolean getAltKey();
+
+ /**
+ * Used to indicate whether the 'meta' key was depressed during the firing
+ * of the event. On some platforms this key may map to an alternative
+ * key name.
+ */
+ public boolean getMetaKey();
+
+ /**
+ * During mouse events caused by the depression or release of a mouse
+ * button, button
is used to indicate which mouse button
+ * changed state. The values for button
range from zero to
+ * indicate the left button of the mouse, one to indicate the middle
+ * button if present, and two to indicate the right button. For mice
+ * configured for left handed use in which the button actions are
+ * reversed the values are instead read from right to left.
+ */
+ public short getButton();
+
+ /**
+ * Used to identify a secondary EventTarget
related to a UI
+ * event. Currently this attribute is used with the mouseover event to
+ * indicate the EventTarget
which the pointing device
+ * exited and with the mouseout event to indicate the
+ * EventTarget
which the pointing device entered.
+ */
+ public EventTarget getRelatedTarget();
+
+ /**
+ * The initMouseEvent
method is used to initialize the value
+ * of a MouseEvent
created through the
+ * DocumentEvent
interface. This method may only be called
+ * before the MouseEvent
has been dispatched via the
+ * dispatchEvent
method, though it may be called multiple
+ * times during that phase if necessary. If called multiple times, the
+ * final invocation takes precedence.
+ * @param typeArg Specifies the event type.
+ * @param canBubbleArg Specifies whether or not the event can bubble.
+ * @param cancelableArg Specifies whether or not the event's default
+ * action can be prevented.
+ * @param viewArg Specifies the Event
's
+ * AbstractView
.
+ * @param detailArg Specifies the Event
's mouse click count.
+ * @param screenXArg Specifies the Event
's screen x
+ * coordinate
+ * @param screenYArg Specifies the Event
's screen y
+ * coordinate
+ * @param clientXArg Specifies the Event
's client x
+ * coordinate
+ * @param clientYArg Specifies the Event
's client y
+ * coordinate
+ * @param ctrlKeyArg Specifies whether or not control key was depressed
+ * during the Event
.
+ * @param altKeyArg Specifies whether or not alt key was depressed during
+ * the Event
.
+ * @param shiftKeyArg Specifies whether or not shift key was depressed
+ * during the Event
.
+ * @param metaKeyArg Specifies whether or not meta key was depressed
+ * during the Event
.
+ * @param buttonArg Specifies the Event
's mouse button.
+ * @param relatedTargetArg Specifies the Event
's related
+ * EventTarget
.
+ */
+ public void initMouseEvent(String typeArg,
+ boolean canBubbleArg,
+ boolean cancelableArg,
+ AbstractView viewArg,
+ int detailArg,
+ int screenXArg,
+ int screenYArg,
+ int clientXArg,
+ int clientYArg,
+ boolean ctrlKeyArg,
+ boolean altKeyArg,
+ boolean shiftKeyArg,
+ boolean metaKeyArg,
+ short buttonArg,
+ EventTarget relatedTargetArg);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/MutationEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/MutationEvent.java
new file mode 100644
index 000000000..3db40038e
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/MutationEvent.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.events;
+
+import org.w3c.dom.Node;
+
+/**
+ * The MutationEvent
interface provides specific contextual
+ * information associated with Mutation events.
+ *
See also the Document Object Model (DOM) Level 2 Events Specification.
+ * @since DOM Level 2
+ */
+public interface MutationEvent extends Event {
+ // attrChangeType
+ /**
+ * The Attr
was modified in place.
+ */
+ public static final short MODIFICATION = 1;
+ /**
+ * The Attr
was just added.
+ */
+ public static final short ADDITION = 2;
+ /**
+ * The Attr
was just removed.
+ */
+ public static final short REMOVAL = 3;
+
+ /**
+ * relatedNode
is used to identify a secondary node related
+ * to a mutation event. For example, if a mutation event is dispatched
+ * to a node indicating that its parent has changed, the
+ * relatedNode
is the changed parent. If an event is
+ * instead dispatched to a subtree indicating a node was changed within
+ * it, the relatedNode
is the changed node. In the case of
+ * the DOMAttrModified event it indicates the Attr
node
+ * which was modified, added, or removed.
+ */
+ public Node getRelatedNode();
+
+ /**
+ * prevValue
indicates the previous value of the
+ * Attr
node in DOMAttrModified events, and of the
+ * CharacterData
node in DOMCharacterDataModified events.
+ */
+ public String getPrevValue();
+
+ /**
+ * newValue
indicates the new value of the Attr
+ * node in DOMAttrModified events, and of the CharacterData
+ * node in DOMCharacterDataModified events.
+ */
+ public String getNewValue();
+
+ /**
+ * attrName
indicates the name of the changed
+ * Attr
node in a DOMAttrModified event.
+ */
+ public String getAttrName();
+
+ /**
+ * attrChange
indicates the type of change which triggered
+ * the DOMAttrModified event. The values can be MODIFICATION
+ * , ADDITION
, or REMOVAL
.
+ */
+ public short getAttrChange();
+
+ /**
+ * The initMutationEvent
method is used to initialize the
+ * value of a MutationEvent
created through the
+ * DocumentEvent
interface. This method may only be called
+ * before the MutationEvent
has been dispatched via the
+ * dispatchEvent
method, though it may be called multiple
+ * times during that phase if necessary. If called multiple times, the
+ * final invocation takes precedence.
+ * @param typeArg Specifies the event type.
+ * @param canBubbleArg Specifies whether or not the event can bubble.
+ * @param cancelableArg Specifies whether or not the event's default
+ * action can be prevented.
+ * @param relatedNodeArg Specifies the Event
's related Node.
+ * @param prevValueArg Specifies the Event
's
+ * prevValue
attribute. This value may be null.
+ * @param newValueArg Specifies the Event
's
+ * newValue
attribute. This value may be null.
+ * @param attrNameArg Specifies the Event
's
+ * attrName
attribute. This value may be null.
+ * @param attrChangeArg Specifies the Event
's
+ * attrChange
attribute
+ */
+ public void initMutationEvent(String typeArg,
+ boolean canBubbleArg,
+ boolean cancelableArg,
+ Node relatedNodeArg,
+ String prevValueArg,
+ String newValueArg,
+ String attrNameArg,
+ short attrChangeArg);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/UIEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/UIEvent.java
new file mode 100644
index 000000000..15affe879
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/events/UIEvent.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.events;
+
+import org.w3c.dom.views.AbstractView;
+
+/**
+ * The UIEvent
interface provides specific contextual information
+ * associated with User Interface events.
+ *
See also the Document Object Model (DOM) Level 2 Events Specification.
+ * @since DOM Level 2
+ */
+public interface UIEvent extends Event {
+ /**
+ * The view
attribute identifies the AbstractView
+ * from which the event was generated.
+ */
+ public AbstractView getView();
+
+ /**
+ * Specifies some detail information about the Event
,
+ * depending on the type of event.
+ */
+ public int getDetail();
+
+ /**
+ * The initUIEvent
method is used to initialize the value of
+ * a UIEvent
created through the DocumentEvent
+ * interface. This method may only be called before the
+ * UIEvent
has been dispatched via the
+ * dispatchEvent
method, though it may be called multiple
+ * times during that phase if necessary. If called multiple times, the
+ * final invocation takes precedence.
+ * @param typeArg Specifies the event type.
+ * @param canBubbleArg Specifies whether or not the event can bubble.
+ * @param cancelableArg Specifies whether or not the event's default
+ * action can be prevented.
+ * @param viewArg Specifies the Event
's
+ * AbstractView
.
+ * @param detailArg Specifies the Event
's detail.
+ */
+ public void initUIEvent(String typeArg,
+ boolean canBubbleArg,
+ boolean cancelableArg,
+ AbstractView viewArg,
+ int detailArg);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLAnchorElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLAnchorElement.java
new file mode 100644
index 000000000..38fbf186f
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLAnchorElement.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * The anchor element. See the A element definition in HTML 4.0.
+ */
+public interface HTMLAnchorElement extends HTMLElement {
+ /**
+ * A single character access key to give access to the form control. See the
+ * accesskey attribute definition in HTML 4.0.
+ */
+ public String getAccessKey();
+ public void setAccessKey(String accessKey);
+ /**
+ * The character encoding of the linked resource. See the charset attribute
+ * definition in HTML 4.0.
+ */
+ public String getCharset();
+ public void setCharset(String charset);
+ /**
+ * Comma-separated list of lengths, defining an active region geometry.See
+ * also shape
for the shape of the region. See the coords
+ * attribute definition in HTML 4.0.
+ */
+ public String getCoords();
+ public void setCoords(String coords);
+ /**
+ * The URI of the linked resource. See the href attribute definition in HTML
+ * 4.0.
+ */
+ public String getHref();
+ public void setHref(String href);
+ /**
+ * Language code of the linked resource. See the hreflang attribute
+ * definition in HTML 4.0.
+ */
+ public String getHreflang();
+ public void setHreflang(String hreflang);
+ /**
+ * Anchor name. See the name attribute definition in HTML 4.0.
+ */
+ public String getName();
+ public void setName(String name);
+ /**
+ * Forward link type. See the rel attribute definition in HTML 4.0.
+ */
+ public String getRel();
+ public void setRel(String rel);
+ /**
+ * Reverse link type. See the rev attribute definition in HTML 4.0.
+ */
+ public String getRev();
+ public void setRev(String rev);
+ /**
+ * The shape of the active area. The coordinates are givenby
+ * coords
. See the shape attribute definition in HTML 4.0.
+ */
+ public String getShape();
+ public void setShape(String shape);
+ /**
+ * Index that represents the element's position in the tabbing order. See
+ * the tabindex attribute definition in HTML 4.0.
+ */
+ public int getTabIndex();
+ public void setTabIndex(int tabIndex);
+ /**
+ * Frame to render the resource in. See the target attribute definition in
+ * HTML 4.0.
+ */
+ public String getTarget();
+ public void setTarget(String target);
+ /**
+ * Advisory content type. See the type attribute definition in HTML 4.0.
+ */
+ public String getType();
+ public void setType(String type);
+ /**
+ * Removes keyboard focus from this element.
+ */
+ public void blur();
+ /**
+ * Gives keyboard focus to this element.
+ */
+ public void focus();
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLAreaElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLAreaElement.java
new file mode 100644
index 000000000..e909b6487
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLAreaElement.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Client-side image map area definition. See the AREA element definition in
+ * HTML 4.0.
+ */
+public interface HTMLAreaElement extends HTMLElement {
+ /**
+ * A single character access key to give access to the form control. See the
+ * accesskey attribute definition in HTML 4.0.
+ */
+ public String getAccessKey();
+ public void setAccessKey(String accessKey);
+ /**
+ * Alternate text for user agents not rendering the normal contentof this
+ * element. See the alt attribute definition in HTML 4.0.
+ */
+ public String getAlt();
+ public void setAlt(String alt);
+ /**
+ * Comma-separated list of lengths, defining an active region geometry.See
+ * also shape
for the shape of the region. See the coords
+ * attribute definition in HTML 4.0.
+ */
+ public String getCoords();
+ public void setCoords(String coords);
+ /**
+ * The URI of the linked resource. See the href attribute definition in HTML
+ * 4.0.
+ */
+ public String getHref();
+ public void setHref(String href);
+ /**
+ * Specifies that this area is inactive, i.e., has no associated action. See
+ * the nohref attribute definition in HTML 4.0.
+ */
+ public boolean getNoHref();
+ public void setNoHref(boolean noHref);
+ /**
+ * The shape of the active area. The coordinates are givenby
+ * coords
. See the shape attribute definition in HTML 4.0.
+ */
+ public String getShape();
+ public void setShape(String shape);
+ /**
+ * Index that represents the element's position in the tabbing order. See
+ * the tabindex attribute definition in HTML 4.0.
+ */
+ public int getTabIndex();
+ public void setTabIndex(int tabIndex);
+ /**
+ * Frame to render the resource in. See the target attribute definition in
+ * HTML 4.0.
+ */
+ public String getTarget();
+ public void setTarget(String target);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLBRElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLBRElement.java
new file mode 100644
index 000000000..a1c4af5cf
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLBRElement.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Force a line break. See the BR element definition in HTML 4.0.
+ */
+public interface HTMLBRElement extends HTMLElement {
+ /**
+ * Control flow of text around floats. See the clear attribute definition in
+ * HTML 4.0. This attribute is deprecated in HTML 4.0.
+ */
+ public String getClear();
+ public void setClear(String clear);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLBaseElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLBaseElement.java
new file mode 100644
index 000000000..3b4fada05
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLBaseElement.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Document base URI. See the BASE element definition in HTML 4.0.
+ */
+public interface HTMLBaseElement extends HTMLElement {
+ /**
+ * The base URI See the href attribute definition in HTML 4.0.
+ */
+ public String getHref();
+ public void setHref(String href);
+ /**
+ * The default target frame. See the target attribute definition in HTML 4.0.
+ */
+ public String getTarget();
+ public void setTarget(String target);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLButtonElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLButtonElement.java
new file mode 100644
index 000000000..79aac0d94
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLButtonElement.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Push button. See the BUTTON element definition in HTML 4.0.
+ */
+public interface HTMLButtonElement extends HTMLElement {
+ /**
+ * Returns the FORM
element containing this control.Returns
+ * null if this control is not within the context of a form.
+ */
+ public HTMLFormElement getForm();
+ /**
+ * A single character access key to give access to the form control. See the
+ * accesskey attribute definition in HTML 4.0.
+ */
+ public String getAccessKey();
+ public void setAccessKey(String accessKey);
+ /**
+ * The control is unavailable in this context. See the disabled attribute
+ * definition in HTML 4.0.
+ */
+ public boolean getDisabled();
+ public void setDisabled(boolean disabled);
+ /**
+ * Form control or object name when submitted with a form. See the name
+ * attribute definition in HTML 4.0.
+ */
+ public String getName();
+ public void setName(String name);
+ /**
+ * Index that represents the element's position in the tabbing order. See
+ * the tabindex attribute definition in HTML 4.0.
+ */
+ public int getTabIndex();
+ public void setTabIndex(int tabIndex);
+ /**
+ * The type of button. See the type attribute definition in HTML 4.0.
+ */
+ public String getType();
+ /**
+ * The current form control value. See the value attribute definition in
+ * HTML 4.0.
+ */
+ public String getValue();
+ public void setValue(String value);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLDirectoryElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLDirectoryElement.java
new file mode 100644
index 000000000..47a4ad9b6
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLDirectoryElement.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Directory list. See the DIR element definition in HTML 4.0. This element is
+ * deprecated in HTML 4.0.
+ */
+public interface HTMLDirectoryElement extends HTMLElement {
+ /**
+ * Reduce spacing between list items. See the compact attribute definition
+ * in HTML 4.0. This attribute is deprecated in HTML 4.0.
+ */
+ public boolean getCompact();
+ public void setCompact(boolean compact);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLDocument.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLDocument.java
new file mode 100644
index 000000000..9e58eebe5
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLDocument.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * An HTMLDocument
is the root of the HTML hierarchy andholds the
+ * entire content. Beside providing access to the hierarchy, italso provides
+ * some convenience methods for accessing certain sets ofinformation from the
+ * document.
+ *
The following properties have been deprecated in favor of the
+ * corresponding ones for the BODY element:alinkColorbackgroundbgColorfgColor
+ * linkColorvlinkColor
+ *
+ */
+public interface HTMLDocument extends Document {
+ /**
+ * The title of a document as specified by the TITLE
element in
+ * the head of the document.
+ */
+ public String getTitle();
+ public void setTitle(String title);
+ /**
+ * Returns the URI of the page that linked to this page. The value isan
+ * empty string if the user navigated to the page directly (notthrough a
+ * link, but, for example, via a bookmark).
+ */
+ public String getReferrer();
+ /**
+ * The domain name of the server that served the document, or a nullstring
+ * if the server cannot be identified by a domain name.
+ */
+ public String getDomain();
+ /**
+ * The complete URI of the document.
+ */
+ public String getURL();
+ /**
+ * The element that contains the content for the document. In documentswith
+ * BODY
contents, returns the BODY
element, and in
+ * frameset documents, this returns the outermostFRAMESET
+ * element.
+ */
+ public HTMLElement getBody();
+ public void setBody(HTMLElement body);
+ /**
+ * A collection of all the IMG
elements in a document.The
+ * behavior is limited to IMG
elements forbackwards
+ * compatibility.
+ */
+ public HTMLCollection getImages();
+ /**
+ * A collection of all the OBJECT
elements that includeapplets
+ * and APPLET
(deprecated) elements ina document.
+ */
+ public HTMLCollection getApplets();
+ /**
+ * A collection of all AREA
elements andanchor (A
)
+ * elements in a documentwith a value for the href
attribute.
+ */
+ public HTMLCollection getLinks();
+ /**
+ * A collection of all the forms of a document.
+ */
+ public HTMLCollection getForms();
+ /**
+ * A collection of all the anchor (A
) elements in a document
+ * with a value for the name
attribute.Note. For reasons of
+ * backwardscompatibility, the returned set of anchors only contains those
+ * anchors created with the name
attribute, not those created
+ * with the id
attribute.
+ */
+ public HTMLCollection getAnchors();
+ /**
+ * The cookies associated with this document. If there are none, thevalue is
+ * an empty string. Otherwise, the value is a string: asemicolon-delimited
+ * list of "name, value" pairs for all the cookiesassociated with the page.
+ * For example, name=value;expires=date
.
+ */
+ public String getCookie();
+ public void setCookie(String cookie);
+ /**
+ * Note.This method and the ones following allow a user to add to or replace
+ * the structuremodel of a document using strings of unparsed HTML. At the
+ * time of writing alternate methods for providing similar functionality
+ * for both HTML and XML documents were being considered. The following
+ * methodsmay be deprecated at some point in the future in favor of a more
+ * general-purpose mechanism.
+ *
Open a document stream for writing. If a document exists in the
+ * target, this method clears it.
+ */
+ public void open();
+ /**
+ * Closes a document stream opened by open()
and forces
+ * rendering.
+ */
+ public void close();
+ /**
+ * Write a string of text to a document stream opened byopen()
.
+ * The text is parsed into the document's structuremodel.
+ * @param text The string to be parsed into some structure in the document
+ * structuremodel.
+ */
+ public void write(String text);
+ /**
+ * Write a string of text followed by a newline character to a document
+ * stream opened by open()
. The text is parsed into the
+ * document's structure model.
+ * @param text The string to be parsed into some structure in the document
+ * structuremodel.
+ */
+ public void writeln(String text);
+ /**
+ * Returns the Element whose id
is given by elementId. If no
+ * such element exists, returns null
. Behavior is not defined
+ * if more than one element has this id
.
+ * @param elementId The unique id
value for an element.
+ * @return The matching element.
+ */
+ public Element getElementById(String elementId);
+ /**
+ * Returns the (possibly empty) collection of elements whosename
+ * value is given by elementName
.
+ * @param elementName The name
attribute value for an element.
+ * @return The matching elements.
+ */
+ public NodeList getElementsByName(String elementName);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLFieldSetElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLFieldSetElement.java
new file mode 100644
index 000000000..254219469
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLFieldSetElement.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Organizes form controls into logical groups. See the FIELDSET element
+ * definition in HTML 4.0.
+ */
+public interface HTMLFieldSetElement extends HTMLElement {
+ /**
+ * Returns the FORM
element containing this control.Returns
+ * null if this control is not within the context of a form.
+ */
+ public HTMLFormElement getForm();
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLHeadingElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLHeadingElement.java
new file mode 100644
index 000000000..e63e22397
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLHeadingElement.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * For the H1
to H6
elements. See the H1 element
+ * definition in HTML 4.0.
+ */
+public interface HTMLHeadingElement extends HTMLElement {
+ /**
+ * Horizontal text alignment. See the align attribute definition in HTML
+ * 4.0. This attribute is deprecated in HTML 4.0.
+ */
+ public String getAlign();
+ public void setAlign(String align);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLIFrameElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLIFrameElement.java
new file mode 100644
index 000000000..34299e9d3
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLIFrameElement.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Inline subwindows. See the IFRAME element definition in HTML 4.0.
+ */
+public interface HTMLIFrameElement extends HTMLElement {
+ /**
+ * Aligns this object (vertically or horizontally) with respect to its
+ * surrounding text. See the align attribute definition in HTML 4.0. This
+ * attribute is deprecated in HTML 4.0.
+ */
+ public String getAlign();
+ public void setAlign(String align);
+ /**
+ * Request frame borders. See the frameborder attribute definition in HTML
+ * 4.0.
+ */
+ public String getFrameBorder();
+ public void setFrameBorder(String frameBorder);
+ /**
+ * Frame height. See the height attribute definition in HTML 4.0.
+ */
+ public String getHeight();
+ public void setHeight(String height);
+ /**
+ * URI designating a long description of this image or frame. See the
+ * longdesc attribute definition in HTML 4.0.
+ */
+ public String getLongDesc();
+ public void setLongDesc(String longDesc);
+ /**
+ * Frame margin height, in pixels. See the marginheight attribute definition
+ * in HTML 4.0.
+ */
+ public String getMarginHeight();
+ public void setMarginHeight(String marginHeight);
+ /**
+ * Frame margin width, in pixels. See the marginwidth attribute definition
+ * in HTML 4.0.
+ */
+ public String getMarginWidth();
+ public void setMarginWidth(String marginWidth);
+ /**
+ * The frame name (object of the target
attribute). See the
+ * name attribute definition in HTML 4.0.
+ */
+ public String getName();
+ public void setName(String name);
+ /**
+ * Specify whether or not the frame should have scrollbars. See the
+ * scrolling attribute definition in HTML 4.0.
+ */
+ public String getScrolling();
+ public void setScrolling(String scrolling);
+ /**
+ * A URI designating the initial frame contents. See the src attribute
+ * definition in HTML 4.0.
+ */
+ public String getSrc();
+ public void setSrc(String src);
+ /**
+ * Frame width. See the width attribute definition in HTML 4.0.
+ */
+ public String getWidth();
+ public void setWidth(String width);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLabelElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLabelElement.java
new file mode 100644
index 000000000..856d65744
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLabelElement.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Form field label text. See the LABEL element definition in HTML 4.0.
+ */
+public interface HTMLLabelElement extends HTMLElement {
+ /**
+ * Returns the FORM
element containing this control.Returns
+ * null if this control is not within the context of a form.
+ */
+ public HTMLFormElement getForm();
+ /**
+ * A single character access key to give access to the form control. See the
+ * accesskey attribute definition in HTML 4.0.
+ */
+ public String getAccessKey();
+ public void setAccessKey(String accessKey);
+ /**
+ * This attribute links this label with another form controlby
+ * id
attribute. See the for attribute definition in HTML 4.0.
+ */
+ public String getHtmlFor();
+ public void setHtmlFor(String htmlFor);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLegendElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLegendElement.java
new file mode 100644
index 000000000..5727b0016
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLegendElement.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Provides a caption for a FIELDSET
grouping. See the LEGEND
+ * element definition in HTML 4.0.
+ */
+public interface HTMLLegendElement extends HTMLElement {
+ /**
+ * Returns the FORM
element containing this control.Returns
+ * null if this control is not within the context of a form.
+ */
+ public HTMLFormElement getForm();
+ /**
+ * A single character access key to give access to the form control. See the
+ * accesskey attribute definition in HTML 4.0.
+ */
+ public String getAccessKey();
+ public void setAccessKey(String accessKey);
+ /**
+ * Text alignment relative to FIELDSET
. See the align attribute
+ * definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
+ */
+ public String getAlign();
+ public void setAlign(String align);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLinkElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLinkElement.java
new file mode 100644
index 000000000..17039b7ae
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLLinkElement.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * The LINK
element specifies a link to an externalresource, and
+ * defines this document's relationship to that resource(or vice versa). See
+ * the LINK element definition in HTML 4.0.
+ */
+public interface HTMLLinkElement extends HTMLElement {
+ /**
+ * Enables/disables the link. This is currently only used for style sheet
+ * links, and may be used to activate or deactivate style sheets.
+ */
+ public boolean getDisabled();
+ public void setDisabled(boolean disabled);
+ /**
+ * The character encoding of the resource being linked to. See the charset
+ * attribute definition in HTML 4.0.
+ */
+ public String getCharset();
+ public void setCharset(String charset);
+ /**
+ * The URI of the linked resource. See the href attribute definition in HTML
+ * 4.0.
+ */
+ public String getHref();
+ public void setHref(String href);
+ /**
+ * Language code of the linked resource. See the hreflang attribute
+ * definition in HTML 4.0.
+ */
+ public String getHreflang();
+ public void setHreflang(String hreflang);
+ /**
+ * Designed for use with one or more target media. See the media attribute
+ * definition in HTML 4.0.
+ */
+ public String getMedia();
+ public void setMedia(String media);
+ /**
+ * Forward link type. See the rel attribute definition in HTML 4.0.
+ */
+ public String getRel();
+ public void setRel(String rel);
+ /**
+ * Reverse link type. See the rev attribute definition in HTML 4.0.
+ */
+ public String getRev();
+ public void setRev(String rev);
+ /**
+ * Frame to render the resource in. See the target attribute definition in
+ * HTML 4.0.
+ */
+ public String getTarget();
+ public void setTarget(String target);
+ /**
+ * Advisory content type. See the type attribute definition in HTML 4.0.
+ */
+ public String getType();
+ public void setType(String type);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLMenuElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLMenuElement.java
new file mode 100644
index 000000000..e2d1ff38d
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLMenuElement.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Menu list. See the MENU element definition in HTML 4.0. This element is
+ * deprecated in HTML 4.0.
+ */
+public interface HTMLMenuElement extends HTMLElement {
+ /**
+ * Reduce spacing between list items. See the compact attribute definition
+ * in HTML 4.0. This attribute is deprecated in HTML 4.0.
+ */
+ public boolean getCompact();
+ public void setCompact(boolean compact);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLMetaElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLMetaElement.java
new file mode 100644
index 000000000..5fc4fa536
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLMetaElement.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * This contains generic meta-information about the document. See the META
+ * element definition in HTML 4.0.
+ */
+public interface HTMLMetaElement extends HTMLElement {
+ /**
+ * Associated information. See the content attribute definition in HTML 4.0.
+ */
+ public String getContent();
+ public void setContent(String content);
+ /**
+ * HTTP response header name. See the http-equiv attribute definition in
+ * HTML 4.0.
+ */
+ public String getHttpEquiv();
+ public void setHttpEquiv(String httpEquiv);
+ /**
+ * Meta information name. See the name attribute definition in HTML 4.0.
+ */
+ public String getName();
+ public void setName(String name);
+ /**
+ * Select form of content. See the scheme attribute definition in HTML 4.0.
+ */
+ public String getScheme();
+ public void setScheme(String scheme);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLObjectElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLObjectElement.java
new file mode 100644
index 000000000..ed2db9bd2
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLObjectElement.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Generic embedded object. Note. In principle, allproperties on the object
+ * element are read-write but in someenvironments some properties may be
+ * read-only once the underlyingobject is instantiated. See the OBJECT
+ * element definition in HTML 4.0.
+ */
+public interface HTMLObjectElement extends HTMLElement {
+ /**
+ * Returns the FORM
element containing this control.Returns
+ * null if this control is not within the context of a form.
+ */
+ public HTMLFormElement getForm();
+ /**
+ * Applet class file. See the code
attribute for
+ * HTMLAppletElement.
+ */
+ public String getCode();
+ public void setCode(String code);
+ /**
+ * Aligns this object (vertically or horizontally) with respect to its
+ * surrounding text. See the align attribute definition in HTML 4.0. This
+ * attribute is deprecated in HTML 4.0.
+ */
+ public String getAlign();
+ public void setAlign(String align);
+ /**
+ * Space-separated list of archives. See the archive attribute definition in
+ * HTML 4.0.
+ */
+ public String getArchive();
+ public void setArchive(String archive);
+ /**
+ * Width of border around the object. See the border attribute definition in
+ * HTML 4.0. This attribute is deprecated in HTML 4.0.
+ */
+ public String getBorder();
+ public void setBorder(String border);
+ /**
+ * Base URI for classid
, data
, and
+ * archive
attributes. See the codebase attribute definition
+ * in HTML 4.0.
+ */
+ public String getCodeBase();
+ public void setCodeBase(String codeBase);
+ /**
+ * Content type for data downloaded via classid
attribute. See
+ * the codetype attribute definition in HTML 4.0.
+ */
+ public String getCodeType();
+ public void setCodeType(String codeType);
+ /**
+ * A URI specifying the location of the object's data. See the data
+ * attribute definition in HTML 4.0.
+ */
+ public String getData();
+ public void setData(String data);
+ /**
+ * Declare (for future reference), but do not instantiate, thisobject. See
+ * the declare attribute definition in HTML 4.0.
+ */
+ public boolean getDeclare();
+ public void setDeclare(boolean declare);
+ /**
+ * Override height. See the height attribute definition in HTML 4.0.
+ */
+ public String getHeight();
+ public void setHeight(String height);
+ /**
+ * Horizontal space to the left and right of this image, applet, or object.
+ * See the hspace attribute definition in HTML 4.0. This attribute is
+ * deprecated in HTML 4.0.
+ */
+ public String getHspace();
+ public void setHspace(String hspace);
+ /**
+ * Form control or object name when submitted with a form. See the name
+ * attribute definition in HTML 4.0.
+ */
+ public String getName();
+ public void setName(String name);
+ /**
+ * Message to render while loading the object. See the standby attribute
+ * definition in HTML 4.0.
+ */
+ public String getStandby();
+ public void setStandby(String standby);
+ /**
+ * Index that represents the element's position in the tabbing order. See
+ * the tabindex attribute definition in HTML 4.0.
+ */
+ public int getTabIndex();
+ public void setTabIndex(int tabIndex);
+ /**
+ * Content type for data downloaded via data
attribute. See the
+ * type attribute definition in HTML 4.0.
+ */
+ public String getType();
+ public void setType(String type);
+ /**
+ * Use client-side image map. See the usemap attribute definition in HTML
+ * 4.0.
+ */
+ public String getUseMap();
+ public void setUseMap(String useMap);
+ /**
+ * Vertical space above and below this image, applet, or object. See the
+ * vspace attribute definition in HTML 4.0. This attribute is deprecated in
+ * HTML 4.0.
+ */
+ public String getVspace();
+ public void setVspace(String vspace);
+ /**
+ * Override width. See the width attribute definition in HTML 4.0.
+ */
+ public String getWidth();
+ public void setWidth(String width);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLOptGroupElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLOptGroupElement.java
new file mode 100644
index 000000000..8e0c70c7d
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLOptGroupElement.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Group options together in logical subdivisions. See the OPTGROUP element
+ * definition in HTML 4.0.
+ */
+public interface HTMLOptGroupElement extends HTMLElement {
+ /**
+ * The control is unavailable in this context. See the disabled attribute
+ * definition in HTML 4.0.
+ */
+ public boolean getDisabled();
+ public void setDisabled(boolean disabled);
+ /**
+ * Assigns a label to this option group. See the label attribute definition
+ * in HTML 4.0.
+ */
+ public String getLabel();
+ public void setLabel(String label);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLParagraphElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLParagraphElement.java
new file mode 100644
index 000000000..ade807d13
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLParagraphElement.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Paragraphs. See the P element definition in HTML 4.0.
+ */
+public interface HTMLParagraphElement extends HTMLElement {
+ /**
+ * Horizontal text alignment. See the align attribute definition in HTML
+ * 4.0. This attribute is deprecated in HTML 4.0.
+ */
+ public String getAlign();
+ public void setAlign(String align);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLParamElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLParamElement.java
new file mode 100644
index 000000000..37f4d7414
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLParamElement.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Parameters fed to the OBJECT
element. See the PARAM element
+ * definition in HTML 4.0.
+ */
+public interface HTMLParamElement extends HTMLElement {
+ /**
+ * The name of a run-time parameter. See the name attribute definition in
+ * HTML 4.0.
+ */
+ public String getName();
+ public void setName(String name);
+ /**
+ * Content type for the value
attribute when
+ * valuetype
has the value "ref". See the type attribute
+ * definition in HTML 4.0.
+ */
+ public String getType();
+ public void setType(String type);
+ /**
+ * The value of a run-time parameter. See the value attribute definition in
+ * HTML 4.0.
+ */
+ public String getValue();
+ public void setValue(String value);
+ /**
+ * Information about the meaning of the value
attributevalue.
+ * See the valuetype attribute definition in HTML 4.0.
+ */
+ public String getValueType();
+ public void setValueType(String valueType);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLPreElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLPreElement.java
new file mode 100644
index 000000000..f69ca12d0
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLPreElement.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Preformatted text. See the PRE element definition in HTML 4.0.
+ */
+public interface HTMLPreElement extends HTMLElement {
+ /**
+ * Fixed width for content. See the width attribute definition in HTML 4.0.
+ * This attribute is deprecated in HTML 4.0.
+ */
+ public int getWidth();
+ public void setWidth(int width);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLQuoteElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLQuoteElement.java
new file mode 100644
index 000000000..d66521299
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLQuoteElement.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * For the Q
and BLOCKQUOTE
elements. See the Q
+ * element definition in HTML 4.0.
+ */
+public interface HTMLQuoteElement extends HTMLElement {
+ /**
+ * A URI designating a document that designates a source document or
+ * message. See the cite attribute definition in HTML 4.0.
+ */
+ public String getCite();
+ public void setCite(String cite);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableColElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableColElement.java
new file mode 100644
index 000000000..4d4eee5cd
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableColElement.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Regroups the COL
and COLGROUP
elements. See the
+ * COL element definition in HTML 4.0.
+ */
+public interface HTMLTableColElement extends HTMLElement {
+ /**
+ * Horizontal alignment of cell data in column. See the align attribute
+ * definition in HTML 4.0.
+ */
+ public String getAlign();
+ public void setAlign(String align);
+ /**
+ * Alignment character for cells in a column. See the char attribute
+ * definition in HTML 4.0.
+ */
+ public String getCh();
+ public void setCh(String ch);
+ /**
+ * Offset of alignment character. See the charoff attribute definition in
+ * HTML 4.0.
+ */
+ public String getChOff();
+ public void setChOff(String chOff);
+ /**
+ * Indicates the number of columns in a group or affected by a grouping. See
+ * the span attribute definition in HTML 4.0.
+ */
+ public int getSpan();
+ public void setSpan(int span);
+ /**
+ * Vertical alignment of cell data in column. See the valign attribute
+ * definition in HTML 4.0.
+ */
+ public String getVAlign();
+ public void setVAlign(String vAlign);
+ /**
+ * Default column width. See the width attribute definition in HTML 4.0.
+ */
+ public String getWidth();
+ public void setWidth(String width);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableElement.java
new file mode 100644
index 000000000..dbb3cfadd
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableElement.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * The create* and delete* methods on the table allow authors to constructand
+ * modify tables. HTML 4.0 specifies that only one of each of the
+ * CAPTION
, THEAD
, and TFOOT
elements
+ * may exist in a table. Therefore, if one exists, and thecreateTHead() or
+ * createTFoot() method is called, the method returnsthe existing THead or
+ * TFoot element. See the TABLE element definition in HTML 4.0.
+ */
+public interface HTMLTableElement extends HTMLElement {
+ /**
+ * Returns the table's CAPTION
, or void if none exists.
+ */
+ public HTMLTableCaptionElement getCaption();
+ public void setCaption(HTMLTableCaptionElement caption);
+ /**
+ * Returns the table's THEAD
, or null
if none
+ * exists.
+ */
+ public HTMLTableSectionElement getTHead();
+ public void setTHead(HTMLTableSectionElement tHead);
+ /**
+ * Returns the table's TFOOT
, or null
if none
+ * exists.
+ */
+ public HTMLTableSectionElement getTFoot();
+ public void setTFoot(HTMLTableSectionElement tFoot);
+ /**
+ * Returns a collection of all the rows in the table, including all in
+ * THEAD
, TFOOT
, all TBODY
elements.
+ */
+ public HTMLCollection getRows();
+ /**
+ * Returns a collection of the defined table bodies.
+ */
+ public HTMLCollection getTBodies();
+ /**
+ * Specifies the table's position with respect to the rest of the document.
+ * See the align attribute definition in HTML 4.0. This attribute is
+ * deprecated in HTML 4.0.
+ */
+ public String getAlign();
+ public void setAlign(String align);
+ /**
+ * Cell background color. See the bgcolor attribute definition in HTML 4.0.
+ * This attribute is deprecated in HTML 4.0.
+ */
+ public String getBgColor();
+ public void setBgColor(String bgColor);
+ /**
+ * The width of the border around the table. See the border attribute
+ * definition in HTML 4.0.
+ */
+ public String getBorder();
+ public void setBorder(String border);
+ /**
+ * Specifies the horizontal and vertical space between cell content andcell
+ * borders. See the cellpadding attribute definition in HTML 4.0.
+ */
+ public String getCellPadding();
+ public void setCellPadding(String cellPadding);
+ /**
+ * Specifies the horizontal and vertical separation between cells. See the
+ * cellspacing attribute definition in HTML 4.0.
+ */
+ public String getCellSpacing();
+ public void setCellSpacing(String cellSpacing);
+ /**
+ * Specifies which external table borders to render. See the frame attribute
+ * definition in HTML 4.0.
+ */
+ public String getFrame();
+ public void setFrame(String frame);
+ /**
+ * Specifies which internal table borders to render. See the rules attribute
+ * definition in HTML 4.0.
+ */
+ public String getRules();
+ public void setRules(String rules);
+ /**
+ * Supplementary description about the purpose or structureof a table. See
+ * the summary attribute definition in HTML 4.0.
+ */
+ public String getSummary();
+ public void setSummary(String summary);
+ /**
+ * Specifies the desired table width. See the width attribute definition in
+ * HTML 4.0.
+ */
+ public String getWidth();
+ public void setWidth(String width);
+ /**
+ * Create a table header row or return an existing one.
+ * @return A new table header element (THEAD
).
+ */
+ public HTMLElement createTHead();
+ /**
+ * Delete the header from the table, if one exists.
+ */
+ public void deleteTHead();
+ /**
+ * Create a table footer row or return an existing one.
+ * @return A footer element (TFOOT
).
+ */
+ public HTMLElement createTFoot();
+ /**
+ * Delete the footer from the table, if one exists.
+ */
+ public void deleteTFoot();
+ /**
+ * Create a new table caption object or return an existing one.
+ * @return A CAPTION
element.
+ */
+ public HTMLElement createCaption();
+ /**
+ * Delete the table caption, if one exists.
+ */
+ public void deleteCaption();
+ /**
+ * Insert a new empty row in the table.Note. A table row cannot be empty
+ * according to HTML 4.0 Recommendation.
+ * @param index The row number where to insert a new row.
+ * @return The newly created row.
+ */
+ public HTMLElement insertRow(int index);
+ /**
+ * Delete a table row.
+ * @param index The index of the row to be deleted.
+ */
+ public void deleteRow(int index);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableRowElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableRowElement.java
new file mode 100644
index 000000000..223054de4
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTableRowElement.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * A row in a table. See the TR element definition in HTML 4.0.
+ */
+public interface HTMLTableRowElement extends HTMLElement {
+ /**
+ * The index of this row, relative to the entire table.
+ */
+ public int getRowIndex();
+ public void setRowIndex(int rowIndex);
+ /**
+ * The index of this row, relative to the current section(THEAD
+ * , TFOOT
, or TBODY
).
+ */
+ public int getSectionRowIndex();
+ public void setSectionRowIndex(int sectionRowIndex);
+ /**
+ * The collection of cells in this row.
+ */
+ public HTMLCollection getCells();
+ public void setCells(HTMLCollection cells);
+ /**
+ * Horizontal alignment of data within cells of this row. See the align
+ * attribute definition in HTML 4.0.
+ */
+ public String getAlign();
+ public void setAlign(String align);
+ /**
+ * Background color for rows. See the bgcolor attribute definition in HTML
+ * 4.0. This attribute is deprecated in HTML 4.0.
+ */
+ public String getBgColor();
+ public void setBgColor(String bgColor);
+ /**
+ * Alignment character for cells in a column. See the char attribute
+ * definition in HTML 4.0.
+ */
+ public String getCh();
+ public void setCh(String ch);
+ /**
+ * Offset of alignment character. See the charoff attribute definition in
+ * HTML 4.0.
+ */
+ public String getChOff();
+ public void setChOff(String chOff);
+ /**
+ * Vertical alignment of data within cells of this row. See the valign
+ * attribute definition in HTML 4.0.
+ */
+ public String getVAlign();
+ public void setVAlign(String vAlign);
+ /**
+ * Insert an empty TD
cell into this row.
+ * @param index The place to insert the cell.
+ * @return The newly created cell.
+ */
+ public HTMLElement insertCell(int index);
+ /**
+ * Delete a cell from the current row.
+ * @param index The index of the cell to delete.
+ */
+ public void deleteCell(int index);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTextAreaElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTextAreaElement.java
new file mode 100644
index 000000000..0f2dcbc8e
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTextAreaElement.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * Multi-line text field. See the TEXTAREA element definition in HTML 4.0.
+ */
+public interface HTMLTextAreaElement extends HTMLElement {
+ /**
+ * Stores the initial control value (i.e., the initial value of
+ * value
).
+ */
+ public String getDefaultValue();
+ public void setDefaultValue(String defaultValue);
+ /**
+ * Returns the FORM
element containing this control.Returns
+ * null if this control is not within the context of a form.
+ */
+ public HTMLFormElement getForm();
+ /**
+ * A single character access key to give access to the form control. See the
+ * accesskey attribute definition in HTML 4.0.
+ */
+ public String getAccessKey();
+ public void setAccessKey(String accessKey);
+ /**
+ * Width of control (in characters). See the cols attribute definition in
+ * HTML 4.0.
+ */
+ public int getCols();
+ public void setCols(int cols);
+ /**
+ * The control is unavailable in this context. See the disabled attribute
+ * definition in HTML 4.0.
+ */
+ public boolean getDisabled();
+ public void setDisabled(boolean disabled);
+ /**
+ * Form control or object name when submitted with a form. See the name
+ * attribute definition in HTML 4.0.
+ */
+ public String getName();
+ public void setName(String name);
+ /**
+ * This control is read-only. See the readonly attribute definition in HTML
+ * 4.0.
+ */
+ public boolean getReadOnly();
+ public void setReadOnly(boolean readOnly);
+ /**
+ * Number of text rows. See the rows attribute definition in HTML 4.0.
+ */
+ public int getRows();
+ public void setRows(int rows);
+ /**
+ * Index that represents the element's position in the tabbing order. See
+ * the tabindex attribute definition in HTML 4.0.
+ */
+ public int getTabIndex();
+ public void setTabIndex(int tabIndex);
+ /**
+ * The type of this form control.
+ */
+ public String getType();
+ /**
+ * The current textual content of the multi-line text field. If the entirety
+ * of the data can not fit into a single wstring, the implementation may
+ * truncate the data.
+ */
+ public String getValue();
+ public void setValue(String value);
+ /**
+ * Removes keyboard focus from this element.
+ */
+ public void blur();
+ /**
+ * Gives keyboard focus to this element.
+ */
+ public void focus();
+ /**
+ * Select the contents of the TEXTAREA
.
+ */
+ public void select();
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTitleElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTitleElement.java
new file mode 100644
index 000000000..43298b751
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/html/HTMLTitleElement.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
+ * Technology, Institut National de Recherche en Informatique et en
+ * Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ */
+
+package org.w3c.dom.html;
+
+import org.w3c.dom.*;
+
+/**
+ * The document title. See the TITLE element definition in HTML 4.0.
+ */
+public interface HTMLTitleElement extends HTMLElement {
+ /**
+ * The specified title as a string.
+ */
+ public String getText();
+ public void setText(String text);
+}
+
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSException.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSException.java
new file mode 100644
index 000000000..65a83f0de
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSException.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.ls;
+
+/**
+ * Parser or write operations may throw an LSException
if the
+ * processing is stopped. The processing can be stopped due to a
+ * DOMError
with a severity of
+ * DOMError.SEVERITY_FATAL_ERROR
or a non recovered
+ * DOMError.SEVERITY_ERROR
, or if
+ * DOMErrorHandler.handleError()
returned false
.
+ *
Note: As suggested in the definition of the constants in the
+ * DOMError
interface, a DOM implementation may choose to
+ * continue after a fatal error, but the resulting DOM tree is then
+ * implementation dependent.
+ *
See also the Document Object Model (DOM) Level 3 Load
+and Save Specification.
+ */
+public class LSException extends RuntimeException {
+ public LSException(short code, String message) {
+ super(message);
+ this.code = code;
+ }
+ public short code;
+ // LSExceptionCode
+ /**
+ * If an attempt was made to load a document, or an XML Fragment, using
+ * LSParser
and the processing has been stopped.
+ */
+ public static final short PARSE_ERR = 81;
+ /**
+ * If an attempt was made to serialize a Node
using
+ * LSSerializer
and the processing has been stopped.
+ */
+ public static final short SERIALIZE_ERR = 82;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSLoadEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSLoadEvent.java
new file mode 100644
index 000000000..601a5be11
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSLoadEvent.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.ls;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.events.Event;
+
+/**
+ * This interface represents a load event object that signals the completion
+ * of a document load.
+ *
See also the Document Object Model (DOM) Level 3 Load +and Save Specification. + */ +public interface LSLoadEvent extends Event { + /** + * The document that finished loading. + */ + public Document getNewDocument(); + + /** + * The input source that was parsed. + */ + public LSInput getInput(); + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSParser.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSParser.java new file mode 100644 index 000000000..ee918e0dc --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSParser.java @@ -0,0 +1,466 @@ +/* + * Copyright (c) 2004 World Wide Web Consortium, + * + * (Massachusetts Institute of Technology, European Research Consortium for + * Informatics and Mathematics, Keio University). All Rights Reserved. This + * work is distributed under the W3C(r) Software License [1] in the hope that + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + */ + +package org.w3c.dom.ls; + +import org.w3c.dom.Document; +import org.w3c.dom.DOMConfiguration; +import org.w3c.dom.Node; +import org.w3c.dom.DOMException; + +/** + * An interface to an object that is able to build, or augment, a DOM tree + * from various input sources. + *
LSParser
provides an API for parsing XML and building the
+ * corresponding DOM document structure. A LSParser
instance
+ * can be obtained by invoking the
+ * DOMImplementationLS.createLSParser()
method.
+ *
As specified in [DOM Level 3 Core] + * , when a document is first made available via the LSParser: + *
value
and
+ * nodeValue
attributes of an Attr
node initially
+ * return the XML 1.0
+ * normalized value. However, if the parameters "
+ * validate-if-schema" and "
+ * datatype-normalization" are set to true
, depending on the attribute normalization
+ * used, the attribute values may differ from the ones obtained by the XML
+ * 1.0 attribute normalization. If the parameters "
+ * datatype-normalization" is set to false
, the XML 1.0 attribute normalization is
+ * guaranteed to occur, and if the attributes list does not contain
+ * namespace declarations, the attributes
attribute on
+ * Element
node represents the property [attributes] defined in [XML Information Set]
+ * .
+ * Asynchronous LSParser
objects are expected to also
+ * implement the events::EventTarget
interface so that event
+ * listeners can be registered on asynchronous LSParser
+ * objects.
+ *
Events supported by asynchronous LSParser
objects are:
+ *
LSParser
finishes to load the document. See also the
+ * definition of the LSLoadEvent
interface. LSParser
signals progress as data is parsed. This
+ * specification does not attempt to define exactly when progress events
+ * should be dispatched. That is intentionally left as
+ * implementation-dependent. Here is one example of how an application might
+ * dispatch progress events: Once the parser starts receiving data, a
+ * progress event is dispatched to indicate that the parsing starts. From
+ * there on, a progress event is dispatched for every 4096 bytes of data
+ * that is received and processed. This is only one example, though, and
+ * implementations can choose to dispatch progress events at any time while
+ * parsing, or not dispatch them at all. See also the definition of the
+ * LSProgressEvent
interface. Note: All events defined in this specification use the
+ * namespace URI "http://www.w3.org/2002/DOMLS"
.
+ *
While parsing an input source, errors are reported to the application
+ * through the error handler (LSParser.domConfig
's "
+ * error-handler" parameter). This specification does in no way try to define all possible
+ * errors that can occur while parsing XML, or any other markup, but some
+ * common error cases are defined. The types (DOMError.type
) of
+ * errors and warnings defined by this specification are:
+ *
"check-character-normalization-failure" [error]
"doctype-not-allowed" [fatal]
true
+ * and a doctype is encountered. "no-input-specified" [fatal]
LSInput
object. "pi-base-uri-not-preserved" [warning]
false
and the following XML file is parsed:
+ * + * <!DOCTYPE root [ <!ENTITY e SYSTEM 'subdir/myentity.ent' ]> + * <root> &e; </root>+ * And
subdir/myentity.ent
+ * contains:
+ * <one> <two/> </one> <?pi 3.14159?> + * <more/>+ *
"unbound-prefix-in-entity" [warning]
true
and an unbound namespace prefix is
+ * encountered in an entity's replacement text. Raising this warning is not
+ * enforced since some existing parsers may not recognize unbound namespace
+ * prefixes in the replacement text of entities. "unknown-character-denormalization" [fatal]
false
and a character is encountered for which the
+ * processor cannot determine the normalization properties. "unsupported-encoding" [fatal]
"unsupported-media-type" [fatal]
true
and an unsupported media type is encountered. In addition to raising the defined errors and warnings, implementations + * are expected to raise implementation specific errors and warnings for any + * other error and warning cases such as IO errors (file not found, + * permission denied,...), XML well-formedness errors, and so on. + *
See also the Document Object Model (DOM) Level 3 Load
+and Save Specification.
+ */
+public interface LSParser {
+ /**
+ * The DOMConfiguration
object used when parsing an input
+ * source. This DOMConfiguration
is specific to the parse
+ * operation. No parameter values from this DOMConfiguration
+ * object are passed automatically to the DOMConfiguration
+ * object on the Document
that is created, or used, by the
+ * parse operation. The DOM application is responsible for passing any
+ * needed parameter values from this DOMConfiguration
+ * object to the DOMConfiguration
object referenced by the
+ * Document
object.
+ *
In addition to the parameters recognized in on the
+ * DOMConfiguration interface defined in [DOM Level 3 Core]
+ * , the DOMConfiguration
objects for LSParser
+ * add or modify the following parameters:
+ *
"charset-overrides-xml-encoding"
true
LSInput
overrides
+ * any encoding from the protocol. false
"disallow-doctype"
true
false
"ignore-unknown-character-denormalizations"
true
false
"infoset"
DOMConfiguration
for a description of
+ * this parameter. Unlike in [DOM Level 3 Core]
+ * , this parameter will default to true
for
+ * LSParser
. "namespaces"
true
false
"resource-resolver"
LSResourceResolver
object, or null. If
+ * the value of this parameter is not null when an external resource
+ * (such as an external XML entity or an XML schema location) is
+ * encountered, the implementation will request that the
+ * LSResourceResolver
referenced in this parameter resolves
+ * the resource. "supported-media-types-only"
true
false
"validate"
DOMConfiguration
for a description of this parameter.
+ * Unlike in [DOM Level 3 Core]
+ * , the processing of the internal subset is always accomplished, even
+ * if this parameter is set to false
. "validate-if-schema"
DOMConfiguration
for a description of this parameter.
+ * Unlike in [DOM Level 3 Core]
+ * , the processing of the internal subset is always accomplished, even
+ * if this parameter is set to false
. "well-formed"
DOMConfiguration
for a description of this parameter.
+ * Unlike in [DOM Level 3 Core]
+ * , this parameter cannot be set to false
. DOMConfiguration
parameters have been applied. For
+ * example, if "
+ * validate" is set to true
, the validation is done before invoking the
+ * filter.
+ */
+ public LSParserFilter getFilter();
+ /**
+ * When a filter is provided, the implementation will call out to the
+ * filter as it is constructing the DOM tree structure. The filter can
+ * choose to remove elements from the document being constructed, or to
+ * terminate the parsing early.
+ * DOMConfiguration
parameters have been applied. For
+ * example, if "
+ * validate" is set to true
, the validation is done before invoking the
+ * filter.
+ */
+ public void setFilter(LSParserFilter filter);
+
+ /**
+ * true
if the LSParser
is asynchronous,
+ * false
if it is synchronous.
+ */
+ public boolean getAsync();
+
+ /**
+ * true
if the LSParser
is currently busy
+ * loading a document, otherwise false
.
+ */
+ public boolean getBusy();
+
+ /**
+ * Parse an XML document from a resource identified by a
+ * LSInput
.
+ * @param input The LSInput
from which the source of the
+ * document is to be read.
+ * @return If the LSParser
is a synchronous
+ * LSParser
, the newly created and populated
+ * Document
is returned. If the LSParser
is
+ * asynchronous, null
is returned since the document
+ * object may not yet be constructed when this method returns.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if the LSParser
's
+ * LSParser.busy
attribute is true
.
+ * @exception LSException
+ * PARSE_ERR: Raised if the LSParser
was unable to load
+ * the XML document. DOM applications should attach a
+ * DOMErrorHandler
using the parameter "
+ * error-handler" if they wish to get details on the error.
+ */
+ public Document parse(LSInput input)
+ throws DOMException, LSException;
+
+ /**
+ * Parse an XML document from a location identified by a URI reference [IETF RFC 2396]. If the URI
+ * contains a fragment identifier (see section 4.1 in [IETF RFC 2396]), the
+ * behavior is not defined by this specification, future versions of
+ * this specification may define the behavior.
+ * @param uri The location of the XML document to be read.
+ * @return If the LSParser
is a synchronous
+ * LSParser
, the newly created and populated
+ * Document
is returned, or null
if an error
+ * occured. If the LSParser
is asynchronous,
+ * null
is returned since the document object may not yet
+ * be constructed when this method returns.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if the LSParser.busy
+ * attribute is true
.
+ * @exception LSException
+ * PARSE_ERR: Raised if the LSParser
was unable to load
+ * the XML document. DOM applications should attach a
+ * DOMErrorHandler
using the parameter "
+ * error-handler" if they wish to get details on the error.
+ */
+ public Document parseURI(String uri)
+ throws DOMException, LSException;
+
+ // ACTION_TYPES
+ /**
+ * Append the result of the parse operation as children of the context
+ * node. For this action to work, the context node must be an
+ * Element
or a DocumentFragment
.
+ */
+ public static final short ACTION_APPEND_AS_CHILDREN = 1;
+ /**
+ * Replace all the children of the context node with the result of the
+ * parse operation. For this action to work, the context node must be an
+ * Element
, a Document
, or a
+ * DocumentFragment
.
+ */
+ public static final short ACTION_REPLACE_CHILDREN = 2;
+ /**
+ * Insert the result of the parse operation as the immediately preceding
+ * sibling of the context node. For this action to work the context
+ * node's parent must be an Element
or a
+ * DocumentFragment
.
+ */
+ public static final short ACTION_INSERT_BEFORE = 3;
+ /**
+ * Insert the result of the parse operation as the immediately following
+ * sibling of the context node. For this action to work the context
+ * node's parent must be an Element
or a
+ * DocumentFragment
.
+ */
+ public static final short ACTION_INSERT_AFTER = 4;
+ /**
+ * Replace the context node with the result of the parse operation. For
+ * this action to work, the context node must have a parent, and the
+ * parent must be an Element
or a
+ * DocumentFragment
.
+ */
+ public static final short ACTION_REPLACE = 5;
+
+ /**
+ * Parse an XML fragment from a resource identified by a
+ * LSInput
and insert the content into an existing document
+ * at the position specified with the context
and
+ * action
arguments. When parsing the input stream, the
+ * context node (or its parent, depending on where the result will be
+ * inserted) is used for resolving unbound namespace prefixes. The
+ * context node's ownerDocument
node (or the node itself if
+ * the node of type DOCUMENT_NODE
) is used to resolve
+ * default attributes and entity references.
+ * Document
node and the action
+ * is ACTION_REPLACE_CHILDREN
, then the document that is
+ * passed as the context node will be changed such that its
+ * xmlEncoding
, documentURI
,
+ * xmlVersion
, inputEncoding
,
+ * xmlStandalone
, and all other such attributes are set to
+ * what they would be set to if the input source was parsed using
+ * LSParser.parse()
.
+ * LSParser
is asynchronous (LSParser.async
is
+ * true
).
+ * ErrorHandler
instance associated with the "
+ * error-handler" parameter of the DOMConfiguration
.
+ * parseWithContext
, the values of the
+ * following configuration parameters will be ignored and their default
+ * values will always be used instead: "
+ * validate", "
+ * validate-if-schema", and "
+ * element-content-whitespace". Other parameters will be treated normally, and the parser is expected
+ * to call the LSParserFilter
just as if a whole document
+ * was parsed.
+ * @param input The LSInput
from which the source document
+ * is to be read. The source document must be an XML fragment, i.e.
+ * anything except a complete XML document (except in the case where
+ * the context node of type DOCUMENT_NODE
, and the action
+ * is ACTION_REPLACE_CHILDREN
), a DOCTYPE (internal
+ * subset), entity declaration(s), notation declaration(s), or XML or
+ * text declaration(s).
+ * @param contextArg The node that is used as the context for the data
+ * that is being parsed. This node must be a Document
+ * node, a DocumentFragment
node, or a node of a type
+ * that is allowed as a child of an Element
node, e.g. it
+ * cannot be an Attribute
node.
+ * @param action This parameter describes which action should be taken
+ * between the new set of nodes being inserted and the existing
+ * children of the context node. The set of possible actions is
+ * defined in ACTION_TYPES
above.
+ * @return Return the node that is the result of the parse operation. If
+ * the result is more than one top-level node, the first one is
+ * returned.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be
+ * inserted before, after, or as a child of the context node (see also
+ * Node.insertBefore
or Node.replaceChild
in [DOM Level 3 Core]
+ * ).
+ * LSParser
doesn't
+ * support this method, or if the context node is of type
+ * Document
and the DOM implementation doesn't support
+ * the replacement of the DocumentType
child or
+ * Element
child.
+ * LSParser.busy
+ * attribute is true
.
+ * @exception LSException
+ * PARSE_ERR: Raised if the LSParser
was unable to load
+ * the XML fragment. DOM applications should attach a
+ * DOMErrorHandler
using the parameter "
+ * error-handler" if they wish to get details on the error.
+ */
+ public Node parseWithContext(LSInput input,
+ Node contextArg,
+ short action)
+ throws DOMException, LSException;
+
+ /**
+ * Abort the loading of the document that is currently being loaded by
+ * the LSParser
. If the LSParser
is currently
+ * not busy, a call to this method does nothing.
+ */
+ public void abort();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSProgressEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSProgressEvent.java
new file mode 100644
index 000000000..da98e14ad
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSProgressEvent.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.ls;
+
+import org.w3c.dom.events.Event;
+
+/**
+ * This interface represents a progress event object that notifies the
+ * application about progress as a document is parsed. It extends the
+ * Event
interface defined in [DOM Level 3 Events]
+ * .
+ * The units used for the attributes position
and
+ * totalSize
are not specified and can be implementation and
+ * input dependent.
+ *
See also the Document Object Model (DOM) Level 3 Load
+and Save Specification.
+ */
+public interface LSProgressEvent extends Event {
+ /**
+ * The input source that is being parsed.
+ */
+ public LSInput getInput();
+
+ /**
+ * The current position in the input source, including all external
+ * entities and other resources that have been read.
+ */
+ public int getPosition();
+
+ /**
+ * The total size of the document including all external resources, this
+ * number might change as a document is being parsed if references to
+ * more external resources are seen. A value of 0
is
+ * returned if the total size cannot be determined or estimated.
+ */
+ public int getTotalSize();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSSerializer.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSSerializer.java
new file mode 100644
index 000000000..e7b6350d3
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ls/LSSerializer.java
@@ -0,0 +1,436 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.ls;
+
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+/**
+ * A LSSerializer
provides an API for serializing (writing) a
+ * DOM document out into XML. The XML data is written to a string or an
+ * output stream. Any changes or fixups made during the serialization affect
+ * only the serialized data. The Document
object and its
+ * children are never altered by the serialization operation.
+ *
During serialization of XML data, namespace fixup is done as defined in [DOM Level 3 Core]
+ * , Appendix B. [DOM Level 2 Core]
+ * allows empty strings as a real namespace URI. If the
+ * namespaceURI
of a Node
is empty string, the
+ * serialization will treat them as null
, ignoring the prefix
+ * if any.
+ *
LSSerializer
accepts any node type for serialization. For
+ * nodes of type Document
or Entity
, well-formed
+ * XML will be created when possible (well-formedness is guaranteed if the
+ * document or entity comes from a parse operation and is unchanged since it
+ * was created). The serialized output for these node types is either as a
+ * XML document or an External XML Entity, respectively, and is acceptable
+ * input for an XML parser. For all other types of nodes the serialized form
+ * is implementation dependent.
+ *
Within a Document
, DocumentFragment
, or
+ * Entity
being serialized, Nodes
are processed as
+ * follows
+ *
Document
nodes are written, including the XML
+ * declaration (unless the parameter "xml-declaration" is set to
+ * false
) and a DTD subset, if one exists in the DOM. Writing a
+ * Document
node serializes the entire document.
+ * Entity
nodes, when written directly by
+ * LSSerializer.write
, outputs the entity expansion but no
+ * namespace fixup is done. The resulting output will be valid as an
+ * external entity.
+ * true
, EntityReference
nodes are
+ * serialized as an entity reference of the form "
+ * &entityName;
" in the output. Child nodes (the expansion)
+ * of the entity reference are ignored. If the parameter "
+ * entities" is set to false
, only the children of the entity reference
+ * are serialized. EntityReference
nodes with no children (no
+ * corresponding Entity
node or the corresponding
+ * Entity
nodes have no children) are always serialized.
+ * CDATAsections
containing content characters that cannot be
+ * represented in the specified output encoding are handled according to the
+ * "
+ * split-cdata-sections" parameter. If the parameter is set to true
,
+ * CDATAsections
are split, and the unrepresentable characters
+ * are serialized as numeric character references in ordinary content. The
+ * exact position and number of splits is not specified. If the parameter
+ * is set to false
, unrepresentable characters in a
+ * CDATAsection
are reported as
+ * "wf-invalid-character"
errors if the parameter "
+ * well-formed" is set to true
. The error is not recoverable - there is no
+ * mechanism for supplying alternative characters and continuing with the
+ * serialization.
+ * DocumentFragment
nodes are serialized by
+ * serializing the children of the document fragment in the order they
+ * appear in the document fragment.
+ * Note: The serialization of a Node
does not always
+ * generate a well-formed XML document, i.e. a LSParser
might
+ * throw fatal errors when parsing the resulting serialization.
+ *
Within the character data of a document (outside of markup), any + * characters that cannot be represented directly are replaced with + * character references. Occurrences of '<' and '&' are replaced by + * the predefined entities < and &. The other predefined + * entities (>, ', and ") might not be used, except + * where needed (e.g. using > in cases such as ']]>'). Any + * characters that cannot be represented directly in the output character + * encoding are serialized as numeric character references (and since + * character encoding standards commonly use hexadecimal representations of + * characters, using the hexadecimal representation when serializing + * character references is encouraged). + *
To allow attribute values to contain both single and double quotes, the + * apostrophe or single-quote character (') may be represented as + * "'", and the double-quote character (") as """. New + * line characters and other characters that cannot be represented directly + * in attribute values in the output character encoding are serialized as a + * numeric character reference. + *
Within markup, but outside of attributes, any occurrence of a character
+ * that cannot be represented in the output character encoding is reported
+ * as a DOMError
fatal error. An example would be serializing
+ * the element <LaCa\u00f1ada/> with encoding="us-ascii"
.
+ * This will result with a generation of a DOMError
+ * "wf-invalid-character-in-node-name" (as proposed in "
+ * well-formed").
+ *
When requested by setting the parameter "
+ * normalize-characters" on LSSerializer
to true, character normalization is
+ * performed according to the definition of fully
+ * normalized characters included in appendix E of [XML 1.1] on all
+ * data to be serialized, both markup and character data. The character
+ * normalization process affects only the data as it is being written; it
+ * does not alter the DOM's view of the document after serialization has
+ * completed.
+ *
Implementations are required to support the encodings "UTF-8",
+ * "UTF-16", "UTF-16BE", and "UTF-16LE" to guarantee that data is
+ * serializable in all encodings that are required to be supported by all
+ * XML parsers. When the encoding is UTF-8, whether or not a byte order mark
+ * is serialized, or if the output is big-endian or little-endian, is
+ * implementation dependent. When the encoding is UTF-16, whether or not the
+ * output is big-endian or little-endian is implementation dependent, but a
+ * Byte Order Mark must be generated for non-character outputs, such as
+ * LSOutput.byteStream
or LSOutput.systemId
. If
+ * the Byte Order Mark is not generated, a "byte-order-mark-needed" warning
+ * is reported. When the encoding is UTF-16LE or UTF-16BE, the output is
+ * big-endian (UTF-16BE) or little-endian (UTF-16LE) and the Byte Order Mark
+ * is not be generated. In all cases, the encoding declaration, if
+ * generated, will correspond to the encoding used during the serialization
+ * (e.g. encoding="UTF-16"
will appear if UTF-16 was
+ * requested).
+ *
Namespaces are fixed up during serialization, the serialization process + * will verify that namespace declarations, namespace prefixes and the + * namespace URI associated with elements and attributes are consistent. If + * inconsistencies are found, the serialized form of the document will be + * altered to remove them. The method used for doing the namespace fixup + * while serializing a document is the algorithm defined in Appendix B.1, + * "Namespace normalization", of [DOM Level 3 Core] + * . + *
While serializing a document, the parameter "discard-default-content" + * controls whether or not non-specified data is serialized. + *
While serializing, errors and warnings are reported to the application
+ * through the error handler (LSSerializer.domConfig
's "
+ * error-handler" parameter). This specification does in no way try to define all possible
+ * errors and warnings that can occur while serializing a DOM node, but some
+ * common error and warning cases are defined. The types (
+ * DOMError.type
) of errors and warnings defined by this
+ * specification are:
+ *
"no-output-specified" [fatal]
LSOutput
if no output is specified in the
+ * LSOutput
. "unbound-prefix-in-entity-reference" [fatal]
true
and an entity whose replacement text
+ * contains unbound namespace prefixes is referenced in a location where
+ * there are no bindings for the namespace prefixes. "unsupported-encoding" [fatal]
In addition to raising the defined errors and warnings, implementations + * are expected to raise implementation specific errors and warnings for any + * other error and warning cases such as IO errors (file not found, + * permission denied,...) and so on. + *
See also the Document Object Model (DOM) Level 3 Load
+and Save Specification.
+ */
+public interface LSSerializer {
+ /**
+ * The DOMConfiguration
object used by the
+ * LSSerializer
when serializing a DOM node.
+ *
In addition to the parameters recognized by the
+ * DOMConfiguration interface defined in [DOM Level 3 Core]
+ * , the DOMConfiguration
objects for
+ * LSSerializer
adds, or modifies, the following
+ * parameters:
+ *
"canonical-form"
true
true
will set the parameters
+ * "format-pretty-print", "discard-default-content", and "xml-declaration
+ * ", to false
. Setting one of those parameters to
+ * true
will set this parameter to false
.
+ * Serializing an XML 1.1 document when "canonical-form" is
+ * true
will generate a fatal error. false
"discard-default-content"
true
Attr.specified
attribute to decide what attributes
+ * should be discarded. Note that some implementations might use
+ * whatever information available to the implementation (i.e. XML
+ * schema, DTD, the Attr.specified
attribute, and so on) to
+ * determine what attributes and content to discard if this parameter is
+ * set to true
. false
"format-pretty-print"
true
false
"ignore-unknown-character-denormalizations"
true
"unknown-character-denormalization"
warning (instead of
+ * raising an error, if this parameter is not set) and ignore any
+ * possible denormalizations caused by these characters. false
"normalize-characters"
DOMConfiguration
in [DOM Level 3 Core]
+ * . Unlike in the Core, the default value for this parameter is
+ * true
. While DOM implementations are not required to
+ * support fully
+ * normalizing the characters in the document according to appendix E of [XML 1.1], this
+ * parameter must be activated by default if supported. "xml-declaration"
true
Document
, Element
, or Entity
+ * node is serialized, the XML declaration, or text declaration, should
+ * be included. The version (Document.xmlVersion
if the
+ * document is a Level 3 document and the version is non-null, otherwise
+ * use the value "1.0"), and the output encoding (see
+ * LSSerializer.write
for details on how to find the output
+ * encoding) are specified in the serialized XML declaration. false
"xml-declaration-needed"
warning if this will cause
+ * problems (i.e. the serialized data is of an XML version other than [XML 1.0], or an
+ * encoding would be needed to be able to re-parse the serialized data). null
will reset its
+ * value to the default value.
+ * null
will reset its
+ * value to the default value.
+ * DOMConfiguration
parameters have been applied. For
+ * example, CDATA sections won't be passed to the filter if "
+ * cdata-sections" is set to false
.
+ */
+ public LSSerializerFilter getFilter();
+ /**
+ * When the application provides a filter, the serializer will call out
+ * to the filter before serializing each Node. The filter implementation
+ * can choose to remove the node from the stream or to terminate the
+ * serialization early.
+ * DOMConfiguration
parameters have been applied. For
+ * example, CDATA sections won't be passed to the filter if "
+ * cdata-sections" is set to false
.
+ */
+ public void setFilter(LSSerializerFilter filter);
+
+ /**
+ * Serialize the specified node as described above in the general
+ * description of the LSSerializer
interface. The output is
+ * written to the supplied LSOutput
.
+ * LSOutput
, the encoding is found by
+ * looking at the encoding information that is reachable through the
+ * LSOutput
and the item to be written (or its owner
+ * document) in this order:
+ * LSOutput.encoding
,
+ * Document.inputEncoding
,
+ * Document.xmlEncoding
.
+ * LSOutput
, a
+ * "no-output-specified" fatal error is raised.
+ * true
if node
was
+ * successfully serialized. Return false
in case the
+ * normal processing stopped but the implementation kept serializing
+ * the document; the result of the serialization being implementation
+ * dependent then.
+ * @exception LSException
+ * SERIALIZE_ERR: Raised if the LSSerializer
was unable to
+ * serialize the node. DOM applications should attach a
+ * DOMErrorHandler
using the parameter "
+ * error-handler" if they wish to get details on the error.
+ */
+ public boolean write(Node nodeArg,
+ LSOutput destination)
+ throws LSException;
+
+ /**
+ * A convenience method that acts as if LSSerializer.write
+ * was called with a LSOutput
with no encoding specified
+ * and LSOutput.systemId
set to the uri
+ * argument.
+ * @param nodeArg The node to serialize.
+ * @param uri The URI to write to.
+ * @return Returns true
if node
was
+ * successfully serialized. Return false
in case the
+ * normal processing stopped but the implementation kept serializing
+ * the document; the result of the serialization being implementation
+ * dependent then.
+ * @exception LSException
+ * SERIALIZE_ERR: Raised if the LSSerializer
was unable to
+ * serialize the node. DOM applications should attach a
+ * DOMErrorHandler
using the parameter "
+ * error-handler" if they wish to get details on the error.
+ */
+ public boolean writeToURI(Node nodeArg,
+ String uri)
+ throws LSException;
+
+ /**
+ * Serialize the specified node as described above in the general
+ * description of the LSSerializer
interface. The output is
+ * written to a DOMString
that is returned to the caller.
+ * The encoding used is the encoding of the DOMString
type,
+ * i.e. UTF-16. Note that no Byte Order Mark is generated in a
+ * DOMString
object.
+ * @param nodeArg The node to serialize.
+ * @return Returns the serialized data.
+ * @exception DOMException
+ * DOMSTRING_SIZE_ERR: Raised if the resulting string is too long to
+ * fit in a DOMString
.
+ * @exception LSException
+ * SERIALIZE_ERR: Raised if the LSSerializer
was unable to
+ * serialize the node. DOM applications should attach a
+ * DOMErrorHandler
using the parameter "
+ * error-handler" if they wish to get details on the error.
+ */
+ public String writeToString(Node nodeArg)
+ throws DOMException, LSException;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ranges/DocumentRange.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ranges/DocumentRange.java
new file mode 100644
index 000000000..6b522670e
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/ranges/DocumentRange.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.ranges;
+
+/**
+ * See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ * @since DOM Level 2
+ */
+public interface DocumentRange {
+ /**
+ * This interface can be obtained from the object implementing the
+ * Document
interface using binding-specific casting
+ * methods.
+ * @return The initial state of the Range returned from this method is
+ * such that both of its boundary-points are positioned at the
+ * beginning of the corresponding Document, before any content. The
+ * Range returned can only be used to select content associated with
+ * this Document, or with DocumentFragments and Attrs for which this
+ * Document is the ownerDocument
.
+ */
+ public Range createRange();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/smil/ElementTimeControl.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/smil/ElementTimeControl.java
new file mode 100644
index 000000000..fe6ae4ee1
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/smil/ElementTimeControl.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2001 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ */
+package org.w3c.dom.smil;
+
+import org.w3c.dom.DOMException;
+
+/**
+ *
SMILAnimation
+ * supports several methods for controlling the behavior of animation:
+ * beginElement()
and endElement()
, et al. These
+ * methods are used to begin and end an animation that has declared the timing
+ * to respond to the DOM, using the following syntax:
<animate begin="indefinite" end="indefinite" .../>+ * + *
Note that only one of begin
or end
need be
+ * specified - either or both can be used. The beginElement()
+ * and beginElementAt()
methods must do nothing if the animation
+ * is not explicitly set with the begin="indefinite"
syntax
+ * above. The endElement()
and endElementAt()
+ * methods must do nothing if the animation is not explicitly set with the
+ * end
="indefinite"
syntax above.
Calling beginElement()
causes the animation to begin in much
+ * the same way that an animation with event-based begin timing begins. The
+ * effective begin time is the current presentation time at the time of the DOM
+ * method call. Note that beginElement()
is subject to the
+ * restart
attribute in the same manner that event-based begin
+ * timing is. If an animation is specified to disallow restarting at a given
+ * point, beginElement()
methods calls must fail. Refer also to
+ * the section Restarting
+ * animations.
Calling beginElementAt()
has the same effect as
+ * beginElement()
, except that the effective begin time is offset
+ * from the current presentation time by an amount specified as a parameter.
+ * Passing a negative value for the offset causes the element to begin as for
+ * beginElement()
, but has the effect that the element begins at
+ * the specified offset into its active duration. The
+ * beginElementAt()
method must also respect the
+ * restart
attribute. The restart semantics for a
+ * beginElementAt()
method call are evaluated at the time of the
+ * method call, and not at the effective begin time specified by the offset
+ * parameter.
Calling endElement()
causes an animation to end the active
+ * duration, just as end
does. Depending upon the value of the
+ * fill
attribute, the animation effect may no longer be applied,
+ * or it may be frozen at the current effect. Refer also to the section Freezing animations. If an animation is not currently
+ * active (i.e. if it has not yet begun or if it is frozen), the
+ * endElement()
method will fail.
Calling endElementAt()
causes an animation to end the active
+ * duration, just as endElement()
does, but allows the caller to
+ * specify a positive offset, to cause the element to end at a point in the
+ * future. Other than delaying when the end actually happens, the semantics are
+ * identical to those for endElement()
. If
+ * endElementAt()
is called more than once while an element is
+ * active, the end time specified by the last method call will determine the
+ * end behavior.
The expectation of the following interface is that an instance of the
+ * ElementTimeControl interface can be obtained by using binding-specific
+ * casting methods on an instance of an animate element. A DOM application can
+ * use the hasFeature
method of the DOMImplementation
+ * interface to determine whether the ElementTimeControl
interface is
+ * supported or not. The feature string for this interface is
+ * "TimeControl"
.
true
if the method call was successful and the
+ * element was begun. false
if the method call
+ * failed. Possible reasons for failure include:
+ * beginElement
+ * method. The begin
attribute is not set to
+ * "indefinite"
.restart
attribute is set to
+ * "whenNotActive"
.restart
attribute is set to
+ * "never"
.SYNTAX_ERR
: The element was not defined
+ * with the appropriate syntax to allow beginElement
calls.
+ */
+ public boolean beginElement()
+ throws DOMException;
+
+ /**
+ * Causes this element to begin the local timeline (subject to restart
+ * constraints), at the passed offset from the current time when the method
+ * is called. If the offset is >= 0, the semantics are equivalent to an
+ * event-base begin with the specified offset. If the offset is < 0, the
+ * semantics are equivalent to beginElement(), but the element active
+ * duration is evaluated as though the element had begun at the passed
+ * (negative) offset from the current time when the method is called.
+ *
+ * @param offset The offset in seconds at which to begin the element.
+ * @return true
if the method call was successful and the element was begun.
+ * false
if the method call failed.
+ * Possible reasons for failure include:
+ * beginElementAt
method. The
+ * begin
attribute is not set to
+ * "indefinite"
.restart
attribute is set to
+ * "whenNotActive"
.restart
+ * attribute is set to "never"
.beginElementAt
calls.
+ */
+ public boolean beginElementAt(float offset)
+ throws DOMException;
+
+ /**
+ * Causes this element to end the local timeline.
+ *
+ * @return true
if the method call was
+ * successful and the element was ended.
+ * false
if method call failed. Possible
+ * reasons for failure include:
+ * endElement
method. The
+ * end
attribute is not set to
+ * "indefinite"
.endElement
+ * calls.
+ */
+ public boolean endElement()
+ throws DOMException;
+
+ /**
+ * Causes this element to end the local timeline at the specified offset
+ * from the current time when the method is called
+ *
+ * @param offset The offset in seconds at which to end the element.
+ * Must be >= 0
.
+ * @return true
if the method call was
+ * successful and the element was ended.
+ * false
if method call failed. Possible
+ * reasons for failure include:
+ * endElementAt
method. The
+ * end
attribute is not set to
+ * "indefinite"
.endElementAt
calls.
+ */
+ public boolean endElementAt(float offset)
+ throws DOMException;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/smil/TimeEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/smil/TimeEvent.java
new file mode 100644
index 000000000..739a2c84e
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/smil/TimeEvent.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2001 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+package org.w3c.dom.smil;
+
+import org.w3c.dom.events.Event;
+import org.w3c.dom.views.AbstractView;
+
+/**
+ * The TimeEvent
interface provides specific contextual
+ * information associated with Time events.
+ *
+ * @see SMIL Animation.
+ */
+public interface TimeEvent extends Event {
+
+ /**
+ * The view
attribute identifies the AbstractView
+ * from which the event was generated.
+ */
+ public AbstractView getView();
+
+ /**
+ * Specifies some detail information about the Event
,
+ * depending on the type of event.
+ */
+ public int getDetail();
+
+ /**
+ * The initTimeEvent
method is used to initialize the value of
+ * a TimeEvent
created through the DocumentEvent
+ * interface. This method may only be called before the
+ * TimeEvent
has been dispatched via the
+ * dispatchEvent
method, though it may be called multiple
+ * times during that phase if necessary. If called multiple times, the
+ * final invocation takes precedence.
+ *
+ * The different types of events that can occur are:
+ * + *
+ * beginElement()
or beginElementAt()
methods. Note
+ * that if an element is restarted while it is currently playing, the
+ * element will raise an end event and another begin event, as the element
+ * restarts.
+ * endElement()
or
+ * endElementAt()
methods. Note that if an element is restarted
+ * while it is currently playing, the element will raise an end event and
+ * another begin event, as the element restarts.
+ * Event
's
+ * AbstractView
.
+ * @param detailArg Specifies the Event
's detail. */
+ public void initTimeEvent(String typeArg,
+ AbstractView viewArg,
+ int detailArg);
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/stylesheets/DocumentStyle.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/stylesheets/DocumentStyle.java
new file mode 100644
index 000000000..612a56113
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/stylesheets/DocumentStyle.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.stylesheets;
+
+/**
+ * The DocumentStyle
interface provides a mechanism by which the
+ * style sheets embedded in a document can be retrieved. The expectation is
+ * that an instance of the DocumentStyle
interface can be
+ * obtained by using binding-specific casting methods on an instance of the
+ * Document
interface.
+ * See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface DocumentStyle {
+ /**
+ * A list containing all the style sheets explicitly linked into or
+ * embedded in a document. For HTML documents, this includes external
+ * style sheets, included via the HTML LINK element, and inline STYLE
+ * elements. In XML, this includes external style sheets, included via
+ * style sheet processing instructions (see [XML StyleSheet]).
+ */
+ public StyleSheetList getStyleSheets();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/stylesheets/MediaList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/stylesheets/MediaList.java
new file mode 100644
index 000000000..f83d5f13d
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/stylesheets/MediaList.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.stylesheets;
+
+import org.w3c.dom.DOMException;
+
+/**
+ * The MediaList
interface provides the abstraction of an
+ * ordered collection of media, without defining or constraining how this
+ * collection is implemented. An empty list is the same as a list that
+ * contains the medium "all"
.
+ *
The items in the MediaList
are accessible via an integral
+ * index, starting from 0.
+ *
See also the Document Object Model (DOM) Level 2 Style Specification.
+ * @since DOM Level 2
+ */
+public interface MediaList {
+ /**
+ * The parsable textual representation of the media list. This is a
+ * comma-separated list of media.
+ */
+ public String getMediaText();
+ /**
+ * The parsable textual representation of the media list. This is a
+ * comma-separated list of media.
+ * @exception DOMException
+ * SYNTAX_ERR: Raised if the specified string value has a syntax error
+ * and is unparsable.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is
+ * readonly.
+ */
+ public void setMediaText(String mediaText)
+ throws DOMException;
+
+ /**
+ * The number of media in the list. The range of valid media is
+ * 0
to length-1
inclusive.
+ */
+ public int getLength();
+
+ /**
+ * Returns the index
th in the list. If index
is
+ * greater than or equal to the number of media in the list, this
+ * returns null
.
+ * @param index Index into the collection.
+ * @return The medium at the index
th position in the
+ * MediaList
, or null
if that is not a valid
+ * index.
+ */
+ public String item(int index);
+
+ /**
+ * Deletes the medium indicated by oldMedium
from the list.
+ * @param oldMedium The medium to delete in the media list.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
+ *
NOT_FOUND_ERR: Raised if oldMedium
is not in the
+ * list.
+ */
+ public void deleteMedium(String oldMedium)
+ throws DOMException;
+
+ /**
+ * Adds the medium newMedium
to the end of the list. If the
+ * newMedium
is already used, it is first removed.
+ * @param newMedium The new medium to add.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: If the medium contains characters that are
+ * invalid in the underlying style language.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
+ */
+ public void appendMedium(String newMedium)
+ throws DOMException;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/EventListenerInitializer.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/EventListenerInitializer.java
new file mode 100644
index 000000000..8f95cdc52
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/EventListenerInitializer.java
@@ -0,0 +1,45 @@
+/*
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+package org.w3c.dom.svg;
+
+/**
+ * This interface must be implemented in order to call Java code from
+ * an SVG document.
+ *
+ * A EventListenerInitializer
instance is called when
+ * a 'script' element's 'type' attribute value is 'application/java-archive' and when
+ * the manifest of the jar file referenced by the 'xlink:href' attribute contains
+ * a 'SVG-Handler-Class' entry. The value of this entry must be the classname of the
+ * EventListenerInitializer
to call.
+ *
+ * This classes implementing this interface must have a default
+ * constructor.
+ *
+ * @version $Id: EventListenerInitializer.java 477018 2006-11-20 03:24:32Z mrglavas $
+ */
+public interface EventListenerInitializer {
+
+ /**
+ * This method is called by the SVG viewer
+ * when the scripts are loaded to register
+ * the listener needed.
+ * @param doc The current document.
+ */
+ public void initializeEventListeners(SVGDocument doc);
+}
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/GetSVGDocument.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/GetSVGDocument.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/GetSVGDocument.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/GetSVGDocument.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAltGlyphDefElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAltGlyphDefElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAltGlyphDefElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAltGlyphDefElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAltGlyphElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAltGlyphElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAltGlyphElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAltGlyphElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAltGlyphItemElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAltGlyphItemElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAltGlyphItemElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAltGlyphItemElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAngle.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAngle.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAngle.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAngle.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimateColorElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimateColorElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimateColorElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimateColorElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimateElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimateElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimateElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimateElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimateMotionElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimateMotionElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimateMotionElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimateMotionElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimateTransformElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimateTransformElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimateTransformElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimateTransformElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedAngle.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedAngle.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedAngle.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedAngle.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedBoolean.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedBoolean.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedBoolean.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedBoolean.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedEnumeration.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedEnumeration.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedEnumeration.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedEnumeration.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedInteger.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedInteger.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedInteger.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedInteger.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedLength.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedLength.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedLength.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedLength.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedLengthList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedLengthList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedLengthList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedLengthList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedNumber.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedNumber.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedNumber.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedNumber.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedNumberList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedNumberList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedNumberList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedNumberList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedPathData.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedPathData.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedPathData.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedPathData.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedPoints.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedPoints.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedPoints.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedPoints.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedPreserveAspectRatio.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedPreserveAspectRatio.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedPreserveAspectRatio.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedPreserveAspectRatio.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedRect.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedRect.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedRect.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedRect.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedString.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedString.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedString.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedString.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedTransformList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedTransformList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimatedTransformList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimatedTransformList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimationElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimationElement.java
similarity index 91%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimationElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimationElement.java
index 3d318a6e6..f299c2b94 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGAnimationElement.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGAnimationElement.java
@@ -5,7 +5,7 @@ import org.w3c.dom.DOMException;
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.smil.ElementTimeControl;
-public interface SVGAnimationElement extends
+public interface SVGAnimationElement extends
SVGElement,
SVGTests,
SVGExternalResourcesRequired,
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGCSSRule.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGCSSRule.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGCSSRule.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGCSSRule.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGCircleElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGCircleElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGCircleElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGCircleElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGClipPathElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGClipPathElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGClipPathElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGClipPathElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGColor.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGColor.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGColor.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGColor.java
index 27e942ac8..b66ccaf43 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGColor.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGColor.java
@@ -1,8 +1,8 @@
package org.w3c.dom.svg;
-import org.w3c.dom.css.RGBColor;
import org.w3c.dom.css.CSSValue;
+import org.w3c.dom.css.RGBColor;
public interface SVGColor extends
CSSValue {
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGColorProfileElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGColorProfileElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGColorProfileElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGColorProfileElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGColorProfileRule.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGColorProfileRule.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGColorProfileRule.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGColorProfileRule.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGComponentTransferFunctionElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGComponentTransferFunctionElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGComponentTransferFunctionElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGComponentTransferFunctionElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGCursorElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGCursorElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGCursorElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGCursorElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGDefinitionSrcElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGDefinitionSrcElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGDefinitionSrcElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGDefinitionSrcElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGDefsElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGDefsElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGDefsElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGDefsElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGDescElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGDescElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGDescElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGDescElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGDocument.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGDocument.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGDocument.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGDocument.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGElementInstance.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGElementInstance.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGElementInstance.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGElementInstance.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGElementInstanceList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGElementInstanceList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGElementInstanceList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGElementInstanceList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGEllipseElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGEllipseElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGEllipseElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGEllipseElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGEvent.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGEvent.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGEvent.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGException.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGException.java
similarity index 85%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGException.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGException.java
index 64f3743e1..557ce43a1 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGException.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGException.java
@@ -1,6 +1,6 @@
package org.w3c.dom.svg;
-public class SVGException extends RuntimeException {
+public abstract class SVGException extends RuntimeException {
public SVGException(short code, String message) {
super(message);
this.code = code;
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGExternalResourcesRequired.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGExternalResourcesRequired.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGExternalResourcesRequired.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGExternalResourcesRequired.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEBlendElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEBlendElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEBlendElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEBlendElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEColorMatrixElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEColorMatrixElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEColorMatrixElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEColorMatrixElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEComponentTransferElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEComponentTransferElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEComponentTransferElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEComponentTransferElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFECompositeElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFECompositeElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFECompositeElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFECompositeElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEConvolveMatrixElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEConvolveMatrixElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEConvolveMatrixElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEConvolveMatrixElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEDiffuseLightingElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEDiffuseLightingElement.java
similarity index 99%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEDiffuseLightingElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEDiffuseLightingElement.java
index e5c01e87c..af98cc45c 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEDiffuseLightingElement.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEDiffuseLightingElement.java
@@ -1,4 +1,3 @@
-
package org.w3c.dom.svg;
public interface SVGFEDiffuseLightingElement extends
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEDisplacementMapElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEDisplacementMapElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEDisplacementMapElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEDisplacementMapElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEDistantLightElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEDistantLightElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEDistantLightElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEDistantLightElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFloodElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFloodElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFloodElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFloodElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFuncAElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFuncAElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFuncAElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFuncAElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFuncBElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFuncBElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFuncBElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFuncBElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFuncGElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFuncGElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFuncGElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFuncGElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFuncRElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFuncRElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEFuncRElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEFuncRElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEGaussianBlurElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEGaussianBlurElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEGaussianBlurElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEGaussianBlurElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEImageElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEImageElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEImageElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEImageElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEMergeElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEMergeElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEMergeElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEMergeElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEMergeNodeElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEMergeNodeElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEMergeNodeElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEMergeNodeElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEMorphologyElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEMorphologyElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEMorphologyElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEMorphologyElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEOffsetElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEOffsetElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEOffsetElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEOffsetElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEPointLightElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEPointLightElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFEPointLightElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFEPointLightElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFESpecularLightingElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFESpecularLightingElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFESpecularLightingElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFESpecularLightingElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFESpotLightElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFESpotLightElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFESpotLightElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFESpotLightElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFETileElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFETileElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFETileElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFETileElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFETurbulenceElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFETurbulenceElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFETurbulenceElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFETurbulenceElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFilterElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFilterElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFilterElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFilterElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFilterPrimitiveStandardAttributes.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFilterPrimitiveStandardAttributes.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFilterPrimitiveStandardAttributes.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFilterPrimitiveStandardAttributes.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFitToViewBox.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFitToViewBox.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFitToViewBox.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFitToViewBox.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceFormatElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceFormatElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceFormatElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceFormatElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceNameElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceNameElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceNameElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceNameElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceSrcElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceSrcElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceSrcElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceSrcElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceUriElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceUriElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGFontFaceUriElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGFontFaceUriElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGForeignObjectElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGForeignObjectElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGForeignObjectElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGForeignObjectElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGGElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGGElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGGElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGGElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGGlyphElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGGlyphElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGGlyphElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGGlyphElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGGlyphRefElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGGlyphRefElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGGlyphRefElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGGlyphRefElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGGradientElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGGradientElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGGradientElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGGradientElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGHKernElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGHKernElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGHKernElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGHKernElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGICCColor.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGICCColor.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGICCColor.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGICCColor.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGImageElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGImageElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGImageElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGImageElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLangSpace.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLangSpace.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLangSpace.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLangSpace.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLength.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLength.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLength.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLength.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLengthList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLengthList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLengthList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLengthList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLineElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLineElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLineElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLineElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLinearGradientElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLinearGradientElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLinearGradientElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLinearGradientElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLocatable.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLocatable.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGLocatable.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGLocatable.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMPathElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMPathElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMPathElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMPathElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMarkerElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMarkerElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMarkerElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMarkerElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMaskElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMaskElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMaskElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMaskElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMatrix.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMatrix.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMatrix.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMatrix.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMetadataElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMetadataElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMetadataElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMetadataElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMissingGlyphElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMissingGlyphElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGMissingGlyphElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGMissingGlyphElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGNumber.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGNumber.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGNumber.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGNumber.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGNumberList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGNumberList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGNumberList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGNumberList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPaint.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPaint.java
similarity index 96%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPaint.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPaint.java
index 66d54c668..385ec173c 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPaint.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPaint.java
@@ -1,7 +1,6 @@
package org.w3c.dom.svg;
-import org.w3c.dom.css.RGBColor;
public interface SVGPaint extends
SVGColor {
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSeg.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSeg.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSeg.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSeg.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegArcAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegArcAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegArcAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegArcAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegArcRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegArcRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegArcRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegArcRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegClosePath.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegClosePath.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegClosePath.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegClosePath.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicSmoothAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicSmoothAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicSmoothAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicSmoothAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicSmoothRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicSmoothRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicSmoothRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoCubicSmoothRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticSmoothAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticSmoothAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticSmoothAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticSmoothAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticSmoothRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticSmoothRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticSmoothRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegCurvetoQuadraticSmoothRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoHorizontalAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoHorizontalAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoHorizontalAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoHorizontalAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoHorizontalRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoHorizontalRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoHorizontalRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoHorizontalRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoVerticalAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoVerticalAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoVerticalAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoVerticalAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoVerticalRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoVerticalRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoVerticalRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegLinetoVerticalRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegMovetoAbs.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegMovetoAbs.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegMovetoAbs.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegMovetoAbs.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegMovetoRel.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegMovetoRel.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPathSegMovetoRel.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPathSegMovetoRel.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPatternElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPatternElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPatternElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPatternElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPoint.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPoint.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPoint.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPoint.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPointList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPointList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPointList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPointList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPolygonElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPolygonElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPolygonElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPolygonElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPolylineElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPolylineElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPolylineElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPolylineElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPreserveAspectRatio.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPreserveAspectRatio.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGPreserveAspectRatio.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGPreserveAspectRatio.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGRadialGradientElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGRadialGradientElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGRadialGradientElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGRadialGradientElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGRect.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGRect.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGRect.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGRect.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGRectElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGRectElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGRectElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGRectElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGRenderingIntent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGRenderingIntent.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGRenderingIntent.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGRenderingIntent.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSVGElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSVGElement.java
similarity index 98%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSVGElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSVGElement.java
index 6507a1304..28f94c0bd 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSVGElement.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSVGElement.java
@@ -1,14 +1,13 @@
package org.w3c.dom.svg;
-import org.w3c.dom.events.DocumentEvent;
-import org.w3c.dom.events.EventTarget;
import org.w3c.dom.DOMException;
-import org.w3c.dom.NodeList;
import org.w3c.dom.Element;
-import org.w3c.dom.css.ViewCSS;
+import org.w3c.dom.NodeList;
import org.w3c.dom.css.DocumentCSS;
-import org.w3c.dom.css.RGBColor;
+import org.w3c.dom.css.ViewCSS;
+import org.w3c.dom.events.DocumentEvent;
+import org.w3c.dom.events.EventTarget;
public interface SVGSVGElement extends
SVGElement,
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGScriptElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGScriptElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGScriptElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGScriptElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSetElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSetElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSetElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSetElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGStopElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGStopElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGStopElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGStopElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGStringList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGStringList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGStringList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGStringList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGStylable.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGStylable.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGStylable.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGStylable.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGStyleElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGStyleElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGStyleElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGStyleElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSwitchElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSwitchElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSwitchElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSwitchElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSymbolElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSymbolElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGSymbolElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGSymbolElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTRefElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTRefElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTRefElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTRefElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTSpanElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTSpanElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTSpanElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTSpanElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTests.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTests.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTests.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTests.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextContentElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextContentElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextContentElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextContentElement.java
index c7c212961..e32345a78 100644
--- a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextContentElement.java
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextContentElement.java
@@ -1,8 +1,8 @@
package org.w3c.dom.svg;
-import org.w3c.dom.events.EventTarget;
import org.w3c.dom.DOMException;
+import org.w3c.dom.events.EventTarget;
public interface SVGTextContentElement extends
SVGElement,
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextPathElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextPathElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextPathElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextPathElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextPositioningElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextPositioningElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTextPositioningElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTextPositioningElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTitleElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTitleElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTitleElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTitleElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTransform.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTransform.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTransform.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTransform.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTransformList.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTransformList.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTransformList.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTransformList.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTransformable.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTransformable.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGTransformable.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGTransformable.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGURIReference.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGURIReference.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGURIReference.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGURIReference.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGUnitTypes.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGUnitTypes.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGUnitTypes.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGUnitTypes.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGUseElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGUseElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGUseElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGUseElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGVKernElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGVKernElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGVKernElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGVKernElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGViewElement.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGViewElement.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGViewElement.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGViewElement.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGViewSpec.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGViewSpec.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGViewSpec.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGViewSpec.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGZoomAndPan.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGZoomAndPan.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGZoomAndPan.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGZoomAndPan.java
diff --git a/fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGZoomEvent.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGZoomEvent.java
similarity index 100%
rename from fine-third-default/fine-org-w3c/src/main/java/org/w3c/dom/svg/SVGZoomEvent.java
rename to fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/svg/SVGZoomEvent.java
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/traversal/TreeWalker.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/traversal/TreeWalker.java
new file mode 100644
index 000000000..f5fff86be
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/traversal/TreeWalker.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.traversal;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+/**
+ * TreeWalker
objects are used to navigate a document tree or
+ * subtree using the view of the document defined by their
+ * whatToShow
flags and filter (if any). Any function which
+ * performs navigation using a TreeWalker
will automatically
+ * support any view defined by a TreeWalker
.
+ *
Omitting nodes from the logical view of a subtree can result in a
+ * structure that is substantially different from the same subtree in the
+ * complete, unfiltered document. Nodes that are siblings in the
+ * TreeWalker
view may be children of different, widely
+ * separated nodes in the original view. For instance, consider a
+ * NodeFilter
that skips all nodes except for Text nodes and
+ * the root node of a document. In the logical view that results, all text
+ * nodes will be siblings and appear as direct children of the root node, no
+ * matter how deeply nested the structure of the original document.
+ *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ * @since DOM Level 2
+ */
+public interface TreeWalker {
+ /**
+ * The root
node of the TreeWalker
, as specified
+ * when it was created.
+ */
+ public Node getRoot();
+
+ /**
+ * This attribute determines which node types are presented via the
+ * TreeWalker
. The available set of constants is defined in
+ * the NodeFilter
interface. Nodes not accepted by
+ * whatToShow
will be skipped, but their children may still
+ * be considered. Note that this skip takes precedence over the filter,
+ * if any.
+ */
+ public int getWhatToShow();
+
+ /**
+ * The filter used to screen nodes.
+ */
+ public NodeFilter getFilter();
+
+ /**
+ * The value of this flag determines whether the children of entity
+ * reference nodes are visible to the TreeWalker
. If false,
+ * these children and their descendants will be rejected. Note that
+ * this rejection takes precedence over whatToShow
and the
+ * filter, if any.
+ *
To produce a view of the document that has entity references
+ * expanded and does not expose the entity reference node itself, use
+ * the whatToShow
flags to hide the entity reference node
+ * and set expandEntityReferences
to true when creating the
+ * TreeWalker
. To produce a view of the document that has
+ * entity reference nodes but no entity expansion, use the
+ * whatToShow
flags to show the entity reference node and
+ * set expandEntityReferences
to false.
+ */
+ public boolean getExpandEntityReferences();
+
+ /**
+ * The node at which the TreeWalker
is currently positioned.
+ *
Alterations to the DOM tree may cause the current node to no longer
+ * be accepted by the TreeWalker
's associated filter.
+ * currentNode
may also be explicitly set to any node,
+ * whether or not it is within the subtree specified by the
+ * root
node or would be accepted by the filter and
+ * whatToShow
flags. Further traversal occurs relative to
+ * currentNode
even if it is not part of the current view,
+ * by applying the filters in the requested direction; if no traversal
+ * is possible, currentNode
is not changed.
+ */
+ public Node getCurrentNode();
+ /**
+ * The node at which the TreeWalker
is currently positioned.
+ *
Alterations to the DOM tree may cause the current node to no longer
+ * be accepted by the TreeWalker
's associated filter.
+ * currentNode
may also be explicitly set to any node,
+ * whether or not it is within the subtree specified by the
+ * root
node or would be accepted by the filter and
+ * whatToShow
flags. Further traversal occurs relative to
+ * currentNode
even if it is not part of the current view,
+ * by applying the filters in the requested direction; if no traversal
+ * is possible, currentNode
is not changed.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if an attempt is made to set
+ * currentNode
to null
.
+ */
+ public void setCurrentNode(Node currentNode)
+ throws DOMException;
+
+ /**
+ * Moves to and returns the closest visible ancestor node of the current
+ * node. If the search for parentNode
attempts to step
+ * upward from the TreeWalker
's root
node, or
+ * if it fails to find a visible ancestor node, this method retains the
+ * current position and returns null
.
+ * @return The new parent node, or null
if the current node
+ * has no parent in the TreeWalker
's logical view.
+ */
+ public Node parentNode();
+
+ /**
+ * Moves the TreeWalker
to the first visible child of the
+ * current node, and returns the new node. If the current node has no
+ * visible children, returns null
, and retains the current
+ * node.
+ * @return The new node, or null
if the current node has no
+ * visible children in the TreeWalker
's logical view.
+ */
+ public Node firstChild();
+
+ /**
+ * Moves the TreeWalker
to the last visible child of the
+ * current node, and returns the new node. If the current node has no
+ * visible children, returns null
, and retains the current
+ * node.
+ * @return The new node, or null
if the current node has no
+ * children in the TreeWalker
's logical view.
+ */
+ public Node lastChild();
+
+ /**
+ * Moves the TreeWalker
to the previous sibling of the
+ * current node, and returns the new node. If the current node has no
+ * visible previous sibling, returns null
, and retains the
+ * current node.
+ * @return The new node, or null
if the current node has no
+ * previous sibling. in the TreeWalker
's logical view.
+ */
+ public Node previousSibling();
+
+ /**
+ * Moves the TreeWalker
to the next sibling of the current
+ * node, and returns the new node. If the current node has no visible
+ * next sibling, returns null
, and retains the current node.
+ * @return The new node, or null
if the current node has no
+ * next sibling. in the TreeWalker
's logical view.
+ */
+ public Node nextSibling();
+
+ /**
+ * Moves the TreeWalker
to the previous visible node in
+ * document order relative to the current node, and returns the new
+ * node. If the current node has no previous node, or if the search for
+ * previousNode
attempts to step upward from the
+ * TreeWalker
's root
node, returns
+ * null
, and retains the current node.
+ * @return The new node, or null
if the current node has no
+ * previous node in the TreeWalker
's logical view.
+ */
+ public Node previousNode();
+
+ /**
+ * Moves the TreeWalker
to the next visible node in document
+ * order relative to the current node, and returns the new node. If the
+ * current node has no next node, or if the search for nextNode attempts
+ * to step upward from the TreeWalker
's root
+ * node, returns null
, and retains the current node.
+ * @return The new node, or null
if the current node has no
+ * next node in the TreeWalker
's logical view.
+ */
+ public Node nextNode();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/views/AbstractView.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/views/AbstractView.java
new file mode 100644
index 000000000..97e8f0e2b
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/views/AbstractView.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.views;
+
+/**
+ * A base interface that all views shall derive from.
+ *
See also the Document Object Model (DOM) Level 2 Views Specification.
+ * @since DOM Level 2
+ */
+public interface AbstractView {
+ /**
+ * The source DocumentView
of which this is an
+ * AbstractView
.
+ */
+ public DocumentView getDocument();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/views/DocumentView.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/views/DocumentView.java
new file mode 100644
index 000000000..2cb9eebb8
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/views/DocumentView.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+
+package org.w3c.dom.views;
+
+/**
+ * The DocumentView
interface is implemented by
+ * Document
objects in DOM implementations supporting DOM
+ * Views. It provides an attribute to retrieve the default view of a
+ * document.
+ *
See also the Document Object Model (DOM) Level 2 Views Specification.
+ * @since DOM Level 2
+ */
+public interface DocumentView {
+ /**
+ * The default AbstractView
for this Document
,
+ * or null
if none available.
+ */
+ public AbstractView getDefaultView();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathEvaluator.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathEvaluator.java
new file mode 100644
index 000000000..a85c0e811
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathEvaluator.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+/**
+ * The evaluation of XPath expressions is provided by
+ * XPathEvaluator
. In a DOM implementation which supports the
+ * XPath 3.0 feature, as described above, the XPathEvaluator
+ * interface will be implemented on the same object which implements the
+ * Document
interface permitting it to be obtained by the usual
+ * binding-specific method such as casting or by using the DOM Level 3
+ * getInterface method. In this case the implementation obtained from the
+ * Document supports the XPath DOM module and is compatible with the XPath
+ * 1.0 specification.
+ *
Evaluation of expressions with specialized extension functions or
+ * variables may not work in all implementations and is, therefore, not
+ * portable. XPathEvaluator
implementations may be available
+ * from other sources that could provide specific support for specialized
+ * extension functions or variables as would be defined by other
+ * specifications.
+ *
See also the Document Object Model (DOM) Level 3 XPath Specification.
+ */
+public interface XPathEvaluator {
+ /**
+ * Creates a parsed XPath expression with resolved namespaces. This is
+ * useful when an expression will be reused in an application since it
+ * makes it possible to compile the expression string into a more
+ * efficient internal form and preresolve all namespace prefixes which
+ * occur within the expression.
+ * @param expression The XPath expression string to be parsed.
+ * @param resolver The resolver
permits translation of all
+ * prefixes, including the xml
namespace prefix, within
+ * the XPath expression into appropriate namespace URIs. If this is
+ * specified as null
, any namespace prefix within the
+ * expression will result in DOMException
being thrown
+ * with the code NAMESPACE_ERR
.
+ * @return The compiled form of the XPath expression.
+ * @exception XPathException
+ * INVALID_EXPRESSION_ERR: Raised if the expression is not legal
+ * according to the rules of the XPathEvaluator
.
+ * @exception DOMException
+ * NAMESPACE_ERR: Raised if the expression contains namespace prefixes
+ * which cannot be resolved by the specified
+ * XPathNSResolver
.
+ */
+ public XPathExpression createExpression(String expression,
+ XPathNSResolver resolver)
+ throws XPathException, DOMException;
+
+ /**
+ * Adapts any DOM node to resolve namespaces so that an XPath expression
+ * can be easily evaluated relative to the context of the node where it
+ * appeared within the document. This adapter works like the DOM Level 3
+ * method lookupNamespaceURI
on nodes in resolving the
+ * namespaceURI from a given prefix using the current information
+ * available in the node's hierarchy at the time lookupNamespaceURI is
+ * called. also correctly resolving the implicit xml prefix.
+ * @param nodeResolver The node to be used as a context for namespace
+ * resolution.
+ * @return XPathNSResolver
which resolves namespaces with
+ * respect to the definitions in scope for a specified node.
+ */
+ public XPathNSResolver createNSResolver(Node nodeResolver);
+
+ /**
+ * Evaluates an XPath expression string and returns a result of the
+ * specified type if possible.
+ * @param expression The XPath expression string to be parsed and
+ * evaluated.
+ * @param contextNode The context
is context node for the
+ * evaluation of this XPath expression. If the XPathEvaluator was
+ * obtained by casting the Document
then this must be
+ * owned by the same document and must be a Document
,
+ * Element
, Attribute
, Text
,
+ * CDATASection
, Comment
,
+ * ProcessingInstruction
, or XPathNamespace
+ * node. If the context node is a Text
or a
+ * CDATASection
, then the context is interpreted as the
+ * whole logical text node as seen by XPath, unless the node is empty
+ * in which case it may not serve as the XPath context.
+ * @param resolver The resolver
permits translation of all
+ * prefixes, including the xml
namespace prefix, within
+ * the XPath expression into appropriate namespace URIs. If this is
+ * specified as null
, any namespace prefix within the
+ * expression will result in DOMException
being thrown
+ * with the code NAMESPACE_ERR
.
+ * @param type If a specific type
is specified, then the
+ * result will be returned as the corresponding type.For XPath 1.0
+ * results, this must be one of the codes of the
+ * XPathResult
interface.
+ * @param result The result
specifies a specific result
+ * object which may be reused and returned by this method. If this is
+ * specified as null
or the implementation does not reuse
+ * the specified result, a new result object will be constructed and
+ * returned.For XPath 1.0 results, this object will be of type
+ * XPathResult
.
+ * @return The result of the evaluation of the XPath expression.For XPath
+ * 1.0 results, this object will be of type XPathResult
.
+ * @exception XPathException
+ * INVALID_EXPRESSION_ERR: Raised if the expression is not legal
+ * according to the rules of the XPathEvaluator
i
+ *
TYPE_ERR: Raised if the result cannot be converted to return the
+ * specified type.
+ * @exception DOMException
+ * NAMESPACE_ERR: Raised if the expression contains namespace prefixes
+ * which cannot be resolved by the specified
+ * XPathNSResolver
.
+ *
WRONG_DOCUMENT_ERR: The Node is from a document that is not
+ * supported by this XPathEvaluator
.
+ *
NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
+ * context node or the request type is not permitted by this
+ * XPathEvaluator
.
+ */
+ public Object evaluate(String expression,
+ Node contextNode,
+ XPathNSResolver resolver,
+ short type,
+ Object result)
+ throws XPathException, DOMException;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathException.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathException.java
new file mode 100644
index 000000000..deb1bd783
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathException.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+/**
+ * A new exception has been created for exceptions specific to these XPath
+ * interfaces.
+ *
See also the Document Object Model (DOM) Level 3 XPath Specification.
+ */
+public class XPathException extends RuntimeException {
+ public XPathException(short code, String message) {
+ super(message);
+ this.code = code;
+ }
+ public short code;
+ // XPathExceptionCode
+ /**
+ * If the expression has a syntax error or otherwise is not a legal
+ * expression according to the rules of the specific
+ * XPathEvaluator
or contains specialized extension
+ * functions or variables not supported by this implementation.
+ */
+ public static final short INVALID_EXPRESSION_ERR = 51;
+ /**
+ * If the expression cannot be converted to return the specified type.
+ */
+ public static final short TYPE_ERR = 52;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathExpression.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathExpression.java
new file mode 100644
index 000000000..e97253254
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathExpression.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+/**
+ * The XPathExpression
interface represents a parsed and resolved
+ * XPath expression.
+ *
See also the Document Object Model (DOM) Level 3 XPath Specification.
+ */
+public interface XPathExpression {
+ /**
+ * Evaluates this XPath expression and returns a result.
+ * @param contextNode The context
is context node for the
+ * evaluation of this XPath expression.If the XPathEvaluator was
+ * obtained by casting the Document
then this must be
+ * owned by the same document and must be a Document
,
+ * Element
, Attribute
, Text
,
+ * CDATASection
, Comment
,
+ * ProcessingInstruction
, or XPathNamespace
+ * node.If the context node is a Text
or a
+ * CDATASection
, then the context is interpreted as the
+ * whole logical text node as seen by XPath, unless the node is empty
+ * in which case it may not serve as the XPath context.
+ * @param type If a specific type
is specified, then the
+ * result will be coerced to return the specified type relying on
+ * XPath conversions and fail if the desired coercion is not possible.
+ * This must be one of the type codes of XPathResult
.
+ * @param result The result
specifies a specific result
+ * object which may be reused and returned by this method. If this is
+ * specified as null
or the implementation does not reuse
+ * the specified result, a new result object will be constructed and
+ * returned.For XPath 1.0 results, this object will be of type
+ * XPathResult
.
+ * @return The result of the evaluation of the XPath expression.For XPath
+ * 1.0 results, this object will be of type XPathResult
.
+ * @exception XPathException
+ * TYPE_ERR: Raised if the result cannot be converted to return the
+ * specified type.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: The Node is from a document that is not supported
+ * by the XPathEvaluator that created this XPathExpression
+ * .
+ *
NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
+ * context node or the request type is not permitted by this
+ * XPathExpression
.
+ */
+ public Object evaluate(Node contextNode,
+ short type,
+ Object result)
+ throws XPathException, DOMException;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathNSResolver.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathNSResolver.java
new file mode 100644
index 000000000..b8f052138
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathNSResolver.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+/**
+ * The XPathNSResolver
interface permit prefix
+ * strings in the expression to be properly bound to
+ * namespaceURI
strings. XPathEvaluator
can
+ * construct an implementation of XPathNSResolver
from a node,
+ * or the interface may be implemented by any application.
+ *
See also the Document Object Model (DOM) Level 3 XPath Specification.
+ */
+public interface XPathNSResolver {
+ /**
+ * Look up the namespace URI associated to the given namespace prefix. The
+ * XPath evaluator must never call this with a null
or
+ * empty argument, because the result of doing this is undefined.
+ * @param prefix The prefix to look for.
+ * @return Returns the associated namespace URI or null
if
+ * none is found.
+ */
+ public String lookupNamespaceURI(String prefix);
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathNamespace.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathNamespace.java
new file mode 100644
index 000000000..9f15481d5
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathNamespace.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * The XPathNamespace
interface is returned by
+ * XPathResult
interfaces to represent the XPath namespace node
+ * type that DOM lacks. There is no public constructor for this node type.
+ * Attempts to place it into a hierarchy or a NamedNodeMap result in a
+ * DOMException
with the code HIERARCHY_REQUEST_ERR
+ * . This node is read only, so methods or setting of attributes that would
+ * mutate the node result in a DOMException with the code
+ * NO_MODIFICATION_ALLOWED_ERR
.
+ *
The core specification describes attributes of the Node
+ * interface that are different for different node types but does not
+ * describe XPATH_NAMESPACE_NODE
, so here is a description of
+ * those attributes for this node type. All attributes of Node
+ * not described in this section have a null
or
+ * false
value.
+ *
ownerDocument
matches the ownerDocument
of the
+ * ownerElement
even if the element is later adopted.
+ *
nodeName
is always the string "#namespace
".
+ *
prefix
is the prefix of the namespace represented by the
+ * node.
+ *
localName
is the same as prefix
.
+ *
nodeType
is equal to XPATH_NAMESPACE_NODE
.
+ *
namespaceURI
is the namespace URI of the namespace
+ * represented by the node.
+ *
nodeValue
is the same as namespaceURI
.
+ *
adoptNode
, cloneNode
, and
+ * importNode
fail on this node type by raising a
+ * DOMException
with the code NOT_SUPPORTED_ERR
.
+ *
Note: In future versions of the XPath specification, the + * definition of a namespace node may be changed incomatibly, in which case + * incompatible changes to field values may be required to implement + * versions beyond XPath 1.0. + *
See also the Document Object Model (DOM) Level 3 XPath Specification.
+ */
+public interface XPathNamespace extends Node {
+ // XPathNodeType
+ /**
+ * The node is a Namespace
.
+ */
+ public static final short XPATH_NAMESPACE_NODE = 13;
+
+ /**
+ * The Element
on which the namespace was in scope when it
+ * was requested. This does not change on a returned namespace node even
+ * if the document changes such that the namespace goes out of scope on
+ * that element and this node is no longer found there by XPath.
+ */
+ public Element getOwnerElement();
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathResult.java b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathResult.java
new file mode 100644
index 000000000..56064b90e
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/w3c/dom/xpath/XPathResult.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+/**
+ * The XPathResult
interface represents the result of the
+ * evaluation of an XPath 1.0 expression within the context of a particular
+ * node. Since evaluation of an XPath expression can result in various
+ * result types, this object makes it possible to discover and manipulate
+ * the type and value of the result.
+ *
See also the Document Object Model (DOM) Level 3 XPath Specification.
+ */
+public interface XPathResult {
+ // XPathResultType
+ /**
+ * This code does not represent a specific type. An evaluation of an XPath
+ * expression will never produce this type. If this type is requested,
+ * then the evaluation returns whatever type naturally results from
+ * evaluation of the expression.
+ *
If the natural result is a node set when ANY_TYPE
was
+ * requested, then UNORDERED_NODE_ITERATOR_TYPE
is always
+ * the resulting type. Any other representation of a node set must be
+ * explicitly requested.
+ */
+ public static final short ANY_TYPE = 0;
+ /**
+ * The result is a number as defined by [XPath 1.0].
+ * Document modification does not invalidate the number, but may mean
+ * that reevaluation would not yield the same number.
+ */
+ public static final short NUMBER_TYPE = 1;
+ /**
+ * The result is a string as defined by [XPath 1.0].
+ * Document modification does not invalidate the string, but may mean
+ * that the string no longer corresponds to the current document.
+ */
+ public static final short STRING_TYPE = 2;
+ /**
+ * The result is a boolean as defined by [XPath 1.0].
+ * Document modification does not invalidate the boolean, but may mean
+ * that reevaluation would not yield the same boolean.
+ */
+ public static final short BOOLEAN_TYPE = 3;
+ /**
+ * The result is a node set as defined by [XPath 1.0] that
+ * will be accessed iteratively, which may not produce nodes in a
+ * particular order. Document modification invalidates the iteration.
+ *
This is the default type returned if the result is a node set and
+ * ANY_TYPE
is requested.
+ */
+ public static final short UNORDERED_NODE_ITERATOR_TYPE = 4;
+ /**
+ * The result is a node set as defined by [XPath 1.0] that
+ * will be accessed iteratively, which will produce document-ordered
+ * nodes. Document modification invalidates the iteration.
+ */
+ public static final short ORDERED_NODE_ITERATOR_TYPE = 5;
+ /**
+ * The result is a node set as defined by [XPath 1.0] that
+ * will be accessed as a snapshot list of nodes that may not be in a
+ * particular order. Document modification does not invalidate the
+ * snapshot but may mean that reevaluation would not yield the same
+ * snapshot and nodes in the snapshot may have been altered, moved, or
+ * removed from the document.
+ */
+ public static final short UNORDERED_NODE_SNAPSHOT_TYPE = 6;
+ /**
+ * The result is a node set as defined by [XPath 1.0] that
+ * will be accessed as a snapshot list of nodes that will be in original
+ * document order. Document modification does not invalidate the
+ * snapshot but may mean that reevaluation would not yield the same
+ * snapshot and nodes in the snapshot may have been altered, moved, or
+ * removed from the document.
+ */
+ public static final short ORDERED_NODE_SNAPSHOT_TYPE = 7;
+ /**
+ * The result is a node set as defined by [XPath 1.0] and
+ * will be accessed as a single node, which may be null
if
+ * the node set is empty. Document modification does not invalidate the
+ * node, but may mean that the result node no longer corresponds to the
+ * current document. This is a convenience that permits optimization
+ * since the implementation can stop once any node in the resulting set
+ * has been found.
+ *
If there is more than one node in the actual result, the single
+ * node returned might not be the first in document order.
+ */
+ public static final short ANY_UNORDERED_NODE_TYPE = 8;
+ /**
+ * The result is a node set as defined by [XPath 1.0] and
+ * will be accessed as a single node, which may be null
if
+ * the node set is empty. Document modification does not invalidate the
+ * node, but may mean that the result node no longer corresponds to the
+ * current document. This is a convenience that permits optimization
+ * since the implementation can stop once the first node in document
+ * order of the resulting set has been found.
+ *
If there are more than one node in the actual result, the single
+ * node returned will be the first in document order.
+ */
+ public static final short FIRST_ORDERED_NODE_TYPE = 9;
+
+ /**
+ * A code representing the type of this result, as defined by the type
+ * constants.
+ */
+ public short getResultType();
+
+ /**
+ * The value of this number result. If the native double type of the DOM
+ * binding does not directly support the exact IEEE 754 result of the
+ * XPath expression, then it is up to the definition of the binding to
+ * specify how the XPath number is converted to the native binding
+ * number.
+ * @exception XPathException
+ * TYPE_ERR: raised if resultType
is not
+ * NUMBER_TYPE
.
+ */
+ public double getNumberValue()
+ throws XPathException;
+
+ /**
+ * The value of this string result.
+ * @exception XPathException
+ * TYPE_ERR: raised if resultType
is not
+ * STRING_TYPE
.
+ */
+ public String getStringValue()
+ throws XPathException;
+
+ /**
+ * The value of this boolean result.
+ * @exception XPathException
+ * TYPE_ERR: raised if resultType
is not
+ * BOOLEAN_TYPE
.
+ */
+ public boolean getBooleanValue()
+ throws XPathException;
+
+ /**
+ * The value of this single node result, which may be null
.
+ * @exception XPathException
+ * TYPE_ERR: raised if resultType
is not
+ * ANY_UNORDERED_NODE_TYPE
or
+ * FIRST_ORDERED_NODE_TYPE
.
+ */
+ public Node getSingleNodeValue()
+ throws XPathException;
+
+ /**
+ * Signifies that the iterator has become invalid. True if
+ * resultType
is UNORDERED_NODE_ITERATOR_TYPE
+ * or ORDERED_NODE_ITERATOR_TYPE
and the document has been
+ * modified since this result was returned.
+ */
+ public boolean getInvalidIteratorState();
+
+ /**
+ * The number of nodes in the result snapshot. Valid values for
+ * snapshotItem indices are 0
to
+ * snapshotLength-1
inclusive.
+ * @exception XPathException
+ * TYPE_ERR: raised if resultType
is not
+ * UNORDERED_NODE_SNAPSHOT_TYPE
or
+ * ORDERED_NODE_SNAPSHOT_TYPE
.
+ */
+ public int getSnapshotLength()
+ throws XPathException;
+
+ /**
+ * Iterates and returns the next node from the node set or
+ * null
if there are no more nodes.
+ * @return Returns the next node.
+ * @exception XPathException
+ * TYPE_ERR: raised if resultType
is not
+ * UNORDERED_NODE_ITERATOR_TYPE
or
+ * ORDERED_NODE_ITERATOR_TYPE
.
+ * @exception DOMException
+ * INVALID_STATE_ERR: The document has been mutated since the result was
+ * returned.
+ */
+ public Node iterateNext()
+ throws XPathException, DOMException;
+
+ /**
+ * Returns the index
th item in the snapshot collection. If
+ * index
is greater than or equal to the number of nodes in
+ * the list, this method returns null
. Unlike the iterator
+ * result, the snapshot does not become invalid, but may not correspond
+ * to the current document if it is mutated.
+ * @param index Index into the snapshot collection.
+ * @return The node at the index
th position in the
+ * NodeList
, or null
if that is not a valid
+ * index.
+ * @exception XPathException
+ * TYPE_ERR: raised if resultType
is not
+ * UNORDERED_NODE_SNAPSHOT_TYPE
or
+ * ORDERED_NODE_SNAPSHOT_TYPE
.
+ */
+ public Node snapshotItem(int index)
+ throws XPathException;
+
+}
diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/Attributes.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/Attributes.java
new file mode 100644
index 000000000..c8dd40e4f
--- /dev/null
+++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/Attributes.java
@@ -0,0 +1,257 @@
+// Attributes.java - attribute list with Namespace support
+// http://www.saxproject.org
+// Written by David Megginson
+// NO WARRANTY! This class is in the public domain.
+// $Id: Attributes.java 226184 2005-04-08 10:53:24Z neeraj $
+
+package org.xml.sax;
+
+
+/**
+ * Interface for a list of XML attributes.
+ *
+ *
+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This interface allows access to a list of attributes in + * three different ways:
+ * + *The list will not contain attributes that were declared
+ * #IMPLIED but not specified in the start tag. It will also not
+ * contain attributes used as Namespace declarations (xmlns*) unless
+ * the http://xml.org/sax/features/namespace-prefixes
+ * feature is set to true (it is false by
+ * default).
+ * Because SAX2 conforms to the original "Namespaces in XML"
+ * recommendation, it normally does not
+ * give namespace declaration attributes a namespace URI.
+ *
Some SAX2 parsers may support using an optional feature flag
+ * (http://xml.org/sax/features/xmlns-uris
) to request
+ * that those attributes be given URIs, conforming to a later
+ * backwards-incompatible revision of that recommendation. (The
+ * attribute's "local name" will be the prefix, or "xmlns" when
+ * defining a default element namespace.) For portability, handler
+ * code should always resolve that conflict, rather than requiring
+ * parsers that can change the setting of that feature flag.
If the namespace-prefixes feature (see above) is
+ * false, access by qualified name may not be available; if
+ * the http://xml.org/sax/features/namespaces
feature is
+ * false, access by Namespace-qualified names may not be
+ * available.
This interface replaces the now-deprecated SAX1 {@link + * org.xml.sax.AttributeList AttributeList} interface, which does not + * contain Namespace support. In addition to Namespace support, it + * adds the getIndex methods (below).
+ * + *The order of attributes in the list is unspecified, and will + * vary from implementation to implementation.
+ * + * @since SAX 2.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.helpers.AttributesImpl + * @see org.xml.sax.ext.DeclHandler#attributeDecl + */ +public interface Attributes +{ + + + //////////////////////////////////////////////////////////////////// + // Indexed access. + //////////////////////////////////////////////////////////////////// + + + /** + * Return the number of attributes in the list. + * + *Once you know the number of attributes, you can iterate + * through the list.
+ * + * @return The number of attributes in the list. + * @see #getURI(int) + * @see #getLocalName(int) + * @see #getQName(int) + * @see #getType(int) + * @see #getValue(int) + */ + public abstract int getLength (); + + + /** + * Look up an attribute's Namespace URI by index. + * + * @param index The attribute index (zero-based). + * @return The Namespace URI, or the empty string if none + * is available, or null if the index is out of + * range. + * @see #getLength + */ + public abstract String getURI (int index); + + + /** + * Look up an attribute's local name by index. + * + * @param index The attribute index (zero-based). + * @return The local name, or the empty string if Namespace + * processing is not being performed, or null + * if the index is out of range. + * @see #getLength + */ + public abstract String getLocalName (int index); + + + /** + * Look up an attribute's XML qualified (prefixed) name by index. + * + * @param index The attribute index (zero-based). + * @return The XML qualified name, or the empty string + * if none is available, or null if the index + * is out of range. + * @see #getLength + */ + public abstract String getQName (int index); + + + /** + * Look up an attribute's type by index. + * + *The attribute type is one of the strings "CDATA", "ID", + * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", + * or "NOTATION" (always in upper case).
+ * + *If the parser has not read a declaration for the attribute, + * or if the parser does not report attribute types, then it must + * return the value "CDATA" as stated in the XML 1.0 Recommendation + * (clause 3.3.3, "Attribute-Value Normalization").
+ * + *For an enumerated attribute that is not a notation, the + * parser will report the type as "NMTOKEN".
+ * + * @param index The attribute index (zero-based). + * @return The attribute's type as a string, or null if the + * index is out of range. + * @see #getLength + */ + public abstract String getType (int index); + + + /** + * Look up an attribute's value by index. + * + *If the attribute value is a list of tokens (IDREFS, + * ENTITIES, or NMTOKENS), the tokens will be concatenated + * into a single string with each token separated by a + * single space.
+ * + * @param index The attribute index (zero-based). + * @return The attribute's value as a string, or null if the + * index is out of range. + * @see #getLength + */ + public abstract String getValue (int index); + + + + //////////////////////////////////////////////////////////////////// + // Name-based query. + //////////////////////////////////////////////////////////////////// + + + /** + * Look up the index of an attribute by Namespace name. + * + * @param uri The Namespace URI, or the empty string if + * the name has no Namespace URI. + * @param localName The attribute's local name. + * @return The index of the attribute, or -1 if it does not + * appear in the list. + */ + public int getIndex (String uri, String localName); + + + /** + * Look up the index of an attribute by XML qualified (prefixed) name. + * + * @param qName The qualified (prefixed) name. + * @return The index of the attribute, or -1 if it does not + * appear in the list. + */ + public int getIndex (String qName); + + + /** + * Look up an attribute's type by Namespace name. + * + *See {@link #getType(int) getType(int)} for a description + * of the possible types.
+ * + * @param uri The Namespace URI, or the empty String if the + * name has no Namespace URI. + * @param localName The local name of the attribute. + * @return The attribute type as a string, or null if the + * attribute is not in the list or if Namespace + * processing is not being performed. + */ + public abstract String getType (String uri, String localName); + + + /** + * Look up an attribute's type by XML qualified (prefixed) name. + * + *See {@link #getType(int) getType(int)} for a description + * of the possible types.
+ * + * @param qName The XML qualified name. + * @return The attribute type as a string, or null if the + * attribute is not in the list or if qualified names + * are not available. + */ + public abstract String getType (String qName); + + + /** + * Look up an attribute's value by Namespace name. + * + *See {@link #getValue(int) getValue(int)} for a description + * of the possible values.
+ * + * @param uri The Namespace URI, or the empty String if the + * name has no Namespace URI. + * @param localName The local name of the attribute. + * @return The attribute value as a string, or null if the + * attribute is not in the list. + */ + public abstract String getValue (String uri, String localName); + + + /** + * Look up an attribute's value by XML qualified (prefixed) name. + * + *See {@link #getValue(int) getValue(int)} for a description + * of the possible values.
+ * + * @param qName The XML qualified name. + * @return The attribute value as a string, or null if the + * attribute is not in the list or if qualified names + * are not available. + */ + public abstract String getValue (String qName); + +} + +// end of Attributes.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ContentHandler.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ContentHandler.java new file mode 100644 index 000000000..9360c9266 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ContentHandler.java @@ -0,0 +1,419 @@ +// ContentHandler.java - handle main document content. +// http://www.saxproject.org +// Written by David Megginson +// NO WARRANTY! This class is in the public domain. +// $Id: ContentHandler.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + + +/** + * Receive notification of the logical content of a document. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This is the main interface that most SAX applications + * implement: if the application needs to be informed of basic parsing + * events, it implements this interface and registers an instance with + * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler + * setContentHandler} method. The parser uses the instance to report + * basic document-related events like the start and end of elements + * and character data.
+ * + *The order of events in this interface is very important, and + * mirrors the order of information in the document itself. For + * example, all of an element's content (character data, processing + * instructions, and/or subelements) will appear, in order, between + * the startElement event and the corresponding endElement event.
+ * + *This interface is similar to the now-deprecated SAX 1.0 + * DocumentHandler interface, but it adds support for Namespaces + * and for reporting skipped entities (in non-validating XML + * processors).
+ * + *Implementors should note that there is also a
+ * ContentHandler
class in the java.net
+ * package; that means that it's probably a bad idea to do
import java.net.*; + * import org.xml.sax.*; + *+ * + *
In fact, "import ...*" is usually a sign of sloppy programming + * anyway, so the user should consider this a feature rather than a + * bug.
+ * + * @since SAX 2.0 + * @author David Megginson + * @version 2.0.1+ (sax2r3pre1) + * @see org.xml.sax.XMLReader + * @see org.xml.sax.DTDHandler + * @see org.xml.sax.ErrorHandler + */ +public interface ContentHandler +{ + + /** + * Receive an object for locating the origin of SAX document events. + * + *SAX parsers are strongly encouraged (though not absolutely + * required) to supply a locator: if it does so, it must supply + * the locator to the application by invoking this method before + * invoking any of the other methods in the ContentHandler + * interface.
+ * + *The locator allows the application to determine the end + * position of any document-related event, even if the parser is + * not reporting an error. Typically, the application will + * use this information for reporting its own errors (such as + * character content that does not match an application's + * business rules). The information returned by the locator + * is probably not sufficient for use with a search engine.
+ * + *Note that the locator will return correct information only + * during the invocation SAX event callbacks after + * {@link #startDocument startDocument} returns and before + * {@link #endDocument endDocument} is called. The + * application should not attempt to use it at any other time.
+ * + * @param locator an object that can return the location of + * any SAX document event + * @see org.xml.sax.Locator + */ + public void setDocumentLocator (Locator locator); + + + /** + * Receive notification of the beginning of a document. + * + *The SAX parser will invoke this method only once, before any + * other event callbacks (except for {@link #setDocumentLocator + * setDocumentLocator}).
+ * + * @throws org.xml.sax.SAXException any SAX exception, possibly + * wrapping another exception + * @see #endDocument + */ + public void startDocument () + throws SAXException; + + + /** + * Receive notification of the end of a document. + * + *There is an apparent contradiction between the + * documentation for this method and the documentation for {@link + * org.xml.sax.ErrorHandler#fatalError}. Until this ambiguity is + * resolved in a future major release, clients should make no + * assumptions about whether endDocument() will or will not be + * invoked when the parser has reported a fatalError() or thrown + * an exception.
+ * + *The SAX parser will invoke this method only once, and it will + * be the last method invoked during the parse. The parser shall + * not invoke this method until it has either abandoned parsing + * (because of an unrecoverable error) or reached the end of + * input.
+ * + * @throws org.xml.sax.SAXException any SAX exception, possibly + * wrapping another exception + * @see #startDocument + */ + public void endDocument() + throws SAXException; + + + /** + * Begin the scope of a prefix-URI Namespace mapping. + * + *The information from this event is not necessary for
+ * normal Namespace processing: the SAX XML reader will
+ * automatically replace prefixes for element and attribute
+ * names when the http://xml.org/sax/features/namespaces
+ * feature is true (the default).
There are cases, however, when applications need to + * use prefixes in character data or in attribute values, + * where they cannot safely be expanded automatically; the + * start/endPrefixMapping event supplies the information + * to the application to expand prefixes in those contexts + * itself, if necessary.
+ * + *Note that start/endPrefixMapping events are not + * guaranteed to be properly nested relative to each other: + * all startPrefixMapping events will occur immediately before the + * corresponding {@link #startElement startElement} event, + * and all {@link #endPrefixMapping endPrefixMapping} + * events will occur immediately after the corresponding + * {@link #endElement endElement} event, + * but their order is not otherwise + * guaranteed.
+ * + *There should never be start/endPrefixMapping events for the + * "xml" prefix, since it is predeclared and immutable.
+ * + * @param prefix the Namespace prefix being declared. + * An empty string is used for the default element namespace, + * which has no prefix. + * @param uri the Namespace URI the prefix is mapped to + * @throws org.xml.sax.SAXException the client may throw + * an exception during processing + * @see #endPrefixMapping + * @see #startElement + */ + public void startPrefixMapping (String prefix, String uri) + throws SAXException; + + + /** + * End the scope of a prefix-URI mapping. + * + *See {@link #startPrefixMapping startPrefixMapping} for + * details. These events will always occur immediately after the + * corresponding {@link #endElement endElement} event, but the order of + * {@link #endPrefixMapping endPrefixMapping} events is not otherwise + * guaranteed.
+ * + * @param prefix the prefix that was being mapped. + * This is the empty string when a default mapping scope ends. + * @throws org.xml.sax.SAXException the client may throw + * an exception during processing + * @see #startPrefixMapping + * @see #endElement + */ + public void endPrefixMapping (String prefix) + throws SAXException; + + + /** + * Receive notification of the beginning of an element. + * + *The Parser will invoke this method at the beginning of every + * element in the XML document; there will be a corresponding + * {@link #endElement endElement} event for every startElement event + * (even when the element is empty). All of the element's content will be + * reported, in order, before the corresponding endElement + * event.
+ * + *This event allows up to three name components for each + * element:
+ * + *Any or all of these may be provided, depending on the + * values of the http://xml.org/sax/features/namespaces + * and the http://xml.org/sax/features/namespace-prefixes + * properties:
+ * + *Note that the attribute list provided will contain only
+ * attributes with explicit values (specified or defaulted):
+ * #IMPLIED attributes will be omitted. The attribute list
+ * will contain attributes used for Namespace declarations
+ * (xmlns* attributes) only if the
+ * http://xml.org/sax/features/namespace-prefixes
+ * property is true (it is false by default, and support for a
+ * true value is optional).
Like {@link #characters characters()}, attribute values may have
+ * characters that need more than one char
value.
The SAX parser will invoke this method at the end of every + * element in the XML document; there will be a corresponding + * {@link #startElement startElement} event for every endElement + * event (even when the element is empty).
+ * + *For information on the names, see startElement.
+ * + * @param uri the Namespace URI, or the empty string if the + * element has no Namespace URI or if Namespace + * processing is not being performed + * @param localName the local name (without prefix), or the + * empty string if Namespace processing is not being + * performed + * @param qName the qualified XML name (with prefix), or the + * empty string if qualified names are not available + * @throws org.xml.sax.SAXException any SAX exception, possibly + * wrapping another exception + */ + public void endElement (String uri, String localName, + String qName) + throws SAXException; + + + /** + * Receive notification of character data. + * + *The Parser will call this method to report each chunk of + * character data. SAX parsers may return all contiguous character + * data in a single chunk, or they may split it into several + * chunks; however, all of the characters in any single event + * must come from the same external entity so that the Locator + * provides useful information.
+ * + *The application must not attempt to read from the array + * outside of the specified range.
+ * + *Individual characters may consist of more than one Java
+ * char
value. There are two important cases where this
+ * happens, because characters can't be represented in just sixteen bits.
+ * In one case, characters are represented in a Surrogate Pair,
+ * using two special Unicode values. Such characters are in the so-called
+ * "Astral Planes", with a code point above U+FFFF. A second case involves
+ * composite characters, such as a base character combining with one or
+ * more accent characters.
Your code should not assume that algorithms using
+ * char
-at-a-time idioms will be working in character
+ * units; in some cases they will split characters. This is relevant
+ * wherever XML permits arbitrary characters, such as attribute values,
+ * processing instruction data, and comments as well as in data reported
+ * from this method. It's also generally relevant whenever Java code
+ * manipulates internationalized text; the issue isn't unique to XML.
Note that some parsers will report whitespace in element + * content using the {@link #ignorableWhitespace ignorableWhitespace} + * method rather than this one (validating parsers must + * do so).
+ * + * @param ch the characters from the XML document + * @param start the start position in the array + * @param length the number of characters to read from the array + * @throws org.xml.sax.SAXException any SAX exception, possibly + * wrapping another exception + * @see #ignorableWhitespace + * @see org.xml.sax.Locator + */ + public void characters (char ch[], int start, int length) + throws SAXException; + + + /** + * Receive notification of ignorable whitespace in element content. + * + *Validating Parsers must use this method to report each chunk + * of whitespace in element content (see the W3C XML 1.0 + * recommendation, section 2.10): non-validating parsers may also + * use this method if they are capable of parsing and using + * content models.
+ * + *SAX parsers may return all contiguous whitespace in a single + * chunk, or they may split it into several chunks; however, all of + * the characters in any single event must come from the same + * external entity, so that the Locator provides useful + * information.
+ * + *The application must not attempt to read from the array + * outside of the specified range.
+ * + * @param ch the characters from the XML document + * @param start the start position in the array + * @param length the number of characters to read from the array + * @throws org.xml.sax.SAXException any SAX exception, possibly + * wrapping another exception + * @see #characters + */ + public void ignorableWhitespace (char ch[], int start, int length) + throws SAXException; + + + /** + * Receive notification of a processing instruction. + * + *The Parser will invoke this method once for each processing + * instruction found: note that processing instructions may occur + * before or after the main document element.
+ * + *A SAX parser must never report an XML declaration (XML 1.0, + * section 2.8) or a text declaration (XML 1.0, section 4.3.1) + * using this method.
+ * + *Like {@link #characters characters()}, processing instruction
+ * data may have characters that need more than one char
+ * value.
The Parser will invoke this method each time the entity is
+ * skipped. Non-validating processors may skip entities if they
+ * have not seen the declarations (because, for example, the
+ * entity was declared in an external DTD subset). All processors
+ * may skip external entities, depending on the values of the
+ * http://xml.org/sax/features/external-general-entities
+ * and the
+ * http://xml.org/sax/features/external-parameter-entities
+ * properties.
+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
If a SAX application needs information about notations and + * unparsed entities, then the application implements this + * interface and registers an instance with the SAX parser using + * the parser's setDTDHandler method. The parser uses the + * instance to report notation and unparsed entity declarations to + * the application.
+ * + *Note that this interface includes only those DTD events that + * the XML recommendation requires processors to report: + * notation and unparsed entity declarations.
+ * + *The SAX parser may report these events in any order, regardless + * of the order in which the notations and unparsed entities were + * declared; however, all DTD events must be reported after the + * document handler's startDocument event, and before the first + * startElement event. + * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is + * used, these events must also be reported before the endDTD event.) + *
+ * + *It is up to the application to store the information for + * future use (perhaps in a hash table or object tree). + * If the application encounters attributes of type "NOTATION", + * "ENTITY", or "ENTITIES", it can use the information that it + * obtained through this interface to find the entity and/or + * notation corresponding with the attribute value.
+ * + * @since SAX 1.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.XMLReader#setDTDHandler + */ +public interface DTDHandler { + + + /** + * Receive notification of a notation declaration event. + * + *It is up to the application to record the notation for later + * reference, if necessary; + * notations may appear as attribute values and in unparsed entity + * declarations, and are sometime used with processing instruction + * target names.
+ * + *At least one of publicId and systemId must be non-null. + * If a system identifier is present, and it is a URL, the SAX + * parser must resolve it fully before passing it to the + * application through this event.
+ * + *There is no guarantee that the notation declaration will be + * reported before any unparsed entities that use it.
+ * + * @param name The notation name. + * @param publicId The notation's public identifier, or null if + * none was given. + * @param systemId The notation's system identifier, or null if + * none was given. + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #unparsedEntityDecl + * @see org.xml.sax.Attributes + */ + public abstract void notationDecl (String name, + String publicId, + String systemId) + throws SAXException; + + + /** + * Receive notification of an unparsed entity declaration event. + * + *Note that the notation name corresponds to a notation + * reported by the {@link #notationDecl notationDecl} event. + * It is up to the application to record the entity for later + * reference, if necessary; + * unparsed entities may appear as attribute values. + *
+ * + *If the system identifier is a URL, the parser must resolve it + * fully before passing it to the application.
+ * + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + * @param name The unparsed entity's name. + * @param publicId The entity's public identifier, or null if none + * was given. + * @param systemId The entity's system identifier. + * @param notationName The name of the associated notation. + * @see #notationDecl + * @see org.xml.sax.Attributes + */ + public abstract void unparsedEntityDecl (String name, + String publicId, + String systemId, + String notationName) + throws SAXException; + +} + +// end of DTDHandler.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/DocumentHandler.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/DocumentHandler.java new file mode 100644 index 000000000..bfe0db7e0 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/DocumentHandler.java @@ -0,0 +1,232 @@ +// SAX document handler. +// http://www.saxproject.org +// No warranty; no copyright -- use this as you will. +// $Id: DocumentHandler.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + +/** + * Receive notification of general document events. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This was the main event-handling interface for SAX1; in + * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler + * ContentHandler}, which provides Namespace support and reporting + * of skipped entities. This interface is included in SAX2 only + * to support legacy SAX1 applications.
+ * + *The order of events in this interface is very important, and + * mirrors the order of information in the document itself. For + * example, all of an element's content (character data, processing + * instructions, and/or subelements) will appear, in order, between + * the startElement event and the corresponding endElement event.
+ * + *Application writers who do not want to implement the entire + * interface can derive a class from HandlerBase, which implements + * the default functionality; parser writers can instantiate + * HandlerBase to obtain a default handler. The application can find + * the location of any document event using the Locator interface + * supplied by the Parser through the setDocumentLocator method.
+ * + * @deprecated This interface has been replaced by the SAX2 + * {@link org.xml.sax.ContentHandler ContentHandler} + * interface, which includes Namespace support. + * @since SAX 1.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.Parser#setDocumentHandler + * @see org.xml.sax.Locator + * @see org.xml.sax.HandlerBase + */ +public interface DocumentHandler { + + + /** + * Receive an object for locating the origin of SAX document events. + * + *SAX parsers are strongly encouraged (though not absolutely + * required) to supply a locator: if it does so, it must supply + * the locator to the application by invoking this method before + * invoking any of the other methods in the DocumentHandler + * interface.
+ * + *The locator allows the application to determine the end + * position of any document-related event, even if the parser is + * not reporting an error. Typically, the application will + * use this information for reporting its own errors (such as + * character content that does not match an application's + * business rules). The information returned by the locator + * is probably not sufficient for use with a search engine.
+ * + *Note that the locator will return correct information only + * during the invocation of the events in this interface. The + * application should not attempt to use it at any other time.
+ * + * @param locator An object that can return the location of + * any SAX document event. + * @see org.xml.sax.Locator + */ + public abstract void setDocumentLocator (Locator locator); + + + /** + * Receive notification of the beginning of a document. + * + *The SAX parser will invoke this method only once, before any + * other methods in this interface or in DTDHandler (except for + * setDocumentLocator).
+ * + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + */ + public abstract void startDocument () + throws SAXException; + + + /** + * Receive notification of the end of a document. + * + *The SAX parser will invoke this method only once, and it will + * be the last method invoked during the parse. The parser shall + * not invoke this method until it has either abandoned parsing + * (because of an unrecoverable error) or reached the end of + * input.
+ * + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + */ + public abstract void endDocument () + throws SAXException; + + + /** + * Receive notification of the beginning of an element. + * + *The Parser will invoke this method at the beginning of every + * element in the XML document; there will be a corresponding + * endElement() event for every startElement() event (even when the + * element is empty). All of the element's content will be + * reported, in order, before the corresponding endElement() + * event.
+ * + *If the element name has a namespace prefix, the prefix will + * still be attached. Note that the attribute list provided will + * contain only attributes with explicit values (specified or + * defaulted): #IMPLIED attributes will be omitted.
+ * + * @param name The element type name. + * @param atts The attributes attached to the element, if any. + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #endElement + * @see org.xml.sax.AttributeList + */ + public abstract void startElement (String name, AttributeList atts) + throws SAXException; + + + /** + * Receive notification of the end of an element. + * + *The SAX parser will invoke this method at the end of every + * element in the XML document; there will be a corresponding + * startElement() event for every endElement() event (even when the + * element is empty).
+ * + *If the element name has a namespace prefix, the prefix will + * still be attached to the name.
+ * + * @param name The element type name + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + */ + public abstract void endElement (String name) + throws SAXException; + + + /** + * Receive notification of character data. + * + *The Parser will call this method to report each chunk of + * character data. SAX parsers may return all contiguous character + * data in a single chunk, or they may split it into several + * chunks; however, all of the characters in any single event + * must come from the same external entity, so that the Locator + * provides useful information.
+ * + *The application must not attempt to read from the array + * outside of the specified range.
+ * + *Note that some parsers will report whitespace using the + * ignorableWhitespace() method rather than this one (validating + * parsers must do so).
+ * + * @param ch The characters from the XML document. + * @param start The start position in the array. + * @param length The number of characters to read from the array. + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #ignorableWhitespace + * @see org.xml.sax.Locator + */ + public abstract void characters (char ch[], int start, int length) + throws SAXException; + + + /** + * Receive notification of ignorable whitespace in element content. + * + *Validating Parsers must use this method to report each chunk + * of ignorable whitespace (see the W3C XML 1.0 recommendation, + * section 2.10): non-validating parsers may also use this method + * if they are capable of parsing and using content models.
+ * + *SAX parsers may return all contiguous whitespace in a single + * chunk, or they may split it into several chunks; however, all of + * the characters in any single event must come from the same + * external entity, so that the Locator provides useful + * information.
+ * + *The application must not attempt to read from the array + * outside of the specified range.
+ * + * @param ch The characters from the XML document. + * @param start The start position in the array. + * @param length The number of characters to read from the array. + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + * @see #characters + */ + public abstract void ignorableWhitespace (char ch[], int start, int length) + throws SAXException; + + + /** + * Receive notification of a processing instruction. + * + *The Parser will invoke this method once for each processing + * instruction found: note that processing instructions may occur + * before or after the main document element.
+ * + *A SAX parser should never report an XML declaration (XML 1.0, + * section 2.8) or a text declaration (XML 1.0, section 4.3.1) + * using this method.
+ * + * @param target The processing instruction target. + * @param data The processing instruction data, or null if + * none was supplied. + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + */ + public abstract void processingInstruction (String target, String data) + throws SAXException; + +} + +// end of DocumentHandler.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/EntityResolver.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/EntityResolver.java new file mode 100644 index 000000000..ecddec671 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/EntityResolver.java @@ -0,0 +1,119 @@ +// SAX entity resolver. +// http://www.saxproject.org +// No warranty; no copyright -- use this as you will. +// $Id: EntityResolver.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + +import java.io.IOException; + + +/** + * Basic interface for resolving entities. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
If a SAX application needs to implement customized handling + * for external entities, it must implement this interface and + * register an instance with the SAX driver using the + * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver} + * method.
+ * + *The XML reader will then allow the application to intercept any + * external entities (including the external DTD subset and external + * parameter entities, if any) before including them.
+ * + *Many SAX applications will not need to implement this interface, + * but it will be especially useful for applications that build + * XML documents from databases or other specialised input sources, + * or for applications that use URI types other than URLs.
+ * + *The following resolver would provide the application + * with a special character stream for the entity with the system + * identifier "http://www.myhost.com/today":
+ * + *+ * import org.xml.sax.EntityResolver; + * import org.xml.sax.InputSource; + * + * public class MyResolver implements EntityResolver { + * public InputSource resolveEntity (String publicId, String systemId) + * { + * if (systemId.equals("http://www.myhost.com/today")) { + * // return a special input source + * MyReader reader = new MyReader(); + * return new InputSource(reader); + * } else { + * // use the default behaviour + * return null; + * } + * } + * } + *+ * + *
The application can also use this interface to redirect system + * identifiers to local URIs or to look up replacements in a catalog + * (possibly by using the public identifier).
+ * + * @since SAX 1.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.XMLReader#setEntityResolver + * @see org.xml.sax.InputSource + */ +public interface EntityResolver { + + + /** + * Allow the application to resolve external entities. + * + *The parser will call this method before opening any external + * entity except the top-level document entity. Such entities include + * the external DTD subset and external parameter entities referenced + * within the DTD (in either case, only if the parser reads external + * parameter entities), and external general entities referenced + * within the document element (if the parser reads external general + * entities). The application may request that the parser locate + * the entity itself, that it use an alternative URI, or that it + * use data provided by the application (as a character or byte + * input stream).
+ * + *Application writers can use this method to redirect external + * system identifiers to secure and/or local URIs, to look up + * public identifiers in a catalogue, or to read an entity from a + * database or other input source (including, for example, a dialog + * box). Neither XML nor SAX specifies a preferred policy for using + * public or system IDs to resolve resources. However, SAX specifies + * how to interpret any InputSource returned by this method, and that + * if none is returned, then the system ID will be dereferenced as + * a URL.
+ * + *If the system identifier is a URL, the SAX parser must + * resolve it fully before reporting it to the application.
+ * + * @param publicId The public identifier of the external entity + * being referenced, or null if none was supplied. + * @param systemId The system identifier of the external entity + * being referenced. + * @return An InputSource object describing the new input source, + * or null to request that the parser open a regular + * URI connection to the system identifier. + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception java.io.IOException A Java-specific IO exception, + * possibly the result of creating a new InputStream + * or Reader for the InputSource. + * @see org.xml.sax.InputSource + */ + public abstract InputSource resolveEntity (String publicId, + String systemId) + throws SAXException, IOException; + +} + +// end of EntityResolver.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXException.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXException.java new file mode 100644 index 000000000..dcd08495a --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXException.java @@ -0,0 +1,155 @@ +// SAX exception class. +// http://www.saxproject.org +// No warranty; no copyright -- use this as you will. +// $Id: SAXException.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + +/** + * Encapsulate a general SAX error or warning. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This class can contain basic error or warning information from + * either the XML parser or the application: a parser writer or + * application writer can subclass it to provide additional + * functionality. SAX handlers may throw this exception or + * any exception subclassed from it.
+ * + *If the application needs to pass through other types of + * exceptions, it must wrap those exceptions in a SAXException + * or an exception derived from a SAXException.
+ * + *If the parser or application needs to include information about a + * specific location in an XML document, it should use the + * {@link org.xml.sax.SAXParseException SAXParseException} subclass.
+ * + * @since SAX 1.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.SAXParseException + */ +public class SAXException extends Exception { + + + /** + * Create a new SAXException. + */ + public SAXException () + { + super(); + this.exception = null; + } + + + /** + * Create a new SAXException. + * + * @param message The error or warning message. + */ + public SAXException (String message) { + super(message); + this.exception = null; + } + + + /** + * Create a new SAXException wrapping an existing exception. + * + *The existing exception will be embedded in the new + * one, and its message will become the default message for + * the SAXException.
+ * + * @param e The exception to be wrapped in a SAXException. + */ + public SAXException (Exception e) + { + super(); + this.exception = e; + } + + + /** + * Create a new SAXException from an existing exception. + * + *The existing exception will be embedded in the new + * one, but the new exception will have its own message.
+ * + * @param message The detail message. + * @param e The exception to be wrapped in a SAXException. + */ + public SAXException (String message, Exception e) + { + super(message); + this.exception = e; + } + + + /** + * Return a detail message for this exception. + * + *If there is an embedded exception, and if the SAXException + * has no detail message of its own, this method will return + * the detail message from the embedded exception.
+ * + * @return The error or warning message. + */ + public String getMessage () + { + String message = super.getMessage(); + + if (message == null && exception != null) { + return exception.getMessage(); + } else { + return message; + } + } + + + /** + * Return the embedded exception, if any. + * + * @return The embedded exception, or null if there is none. + */ + public Exception getException () + { + return exception; + } + + + /** + * Override toString to pick up any embedded exception. + * + * @return A string representation of this exception. + */ + public String toString () + { + if (exception != null) { + return exception.toString(); + } else { + return super.toString(); + } + } + + + + ////////////////////////////////////////////////////////////////////// + // Internal state. + ////////////////////////////////////////////////////////////////////// + + + /** + * @serial The embedded exception if tunnelling, or null. + */ + private Exception exception; + + // Added serialVersionUID to preserve binary compatibility + static final long serialVersionUID = 583241635256073760L; +} + +// end of SAXException.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXNotRecognizedException.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXNotRecognizedException.java new file mode 100644 index 000000000..830537f60 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXNotRecognizedException.java @@ -0,0 +1,55 @@ +// SAXNotRecognizedException.java - unrecognized feature or value. +// http://www.saxproject.org +// Written by David Megginson +// NO WARRANTY! This class is in the Public Domain. +// $Id: SAXNotRecognizedException.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + + +/** + * Exception class for an unrecognized identifier. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
An XMLReader will throw this exception when it finds an + * unrecognized feature or property identifier; SAX applications and + * extensions may use this class for other, similar purposes.
+ * + * @since SAX 2.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.SAXNotSupportedException + */ +public class SAXNotRecognizedException extends SAXException +{ + + /** + * Default constructor. + */ + public SAXNotRecognizedException () + { + super(); + } + + + /** + * Construct a new exception with the given message. + * + * @param message The text message of the exception. + */ + public SAXNotRecognizedException (String message) + { + super(message); + } + + // Added serialVersionUID to preserve binary compatibility + static final long serialVersionUID = 5440506620509557213L; +} + +// end of SAXNotRecognizedException.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXNotSupportedException.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXNotSupportedException.java new file mode 100644 index 000000000..d1e5b5a95 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXNotSupportedException.java @@ -0,0 +1,55 @@ +// SAXNotSupportedException.java - unsupported feature or value. +// http://www.saxproject.org +// Written by David Megginson +// NO WARRANTY! This class is in the Public Domain. +// $Id: SAXNotSupportedException.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + +/** + * Exception class for an unsupported operation. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
An XMLReader will throw this exception when it recognizes a + * feature or property identifier, but cannot perform the requested + * operation (setting a state or value). Other SAX2 applications and + * extensions may use this class for similar purposes.
+ * + * @since SAX 2.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.SAXNotRecognizedException + */ +public class SAXNotSupportedException extends SAXException +{ + + /** + * Construct a new exception with no message. + */ + public SAXNotSupportedException () + { + super(); + } + + + /** + * Construct a new exception with the given message. + * + * @param message The text message of the exception. + */ + public SAXNotSupportedException (String message) + { + super(message); + } + + // Added serialVersionUID to preserve binary compatibility + static final long serialVersionUID = -1422818934641823846L; +} + +// end of SAXNotSupportedException.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXParseException.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXParseException.java new file mode 100644 index 000000000..45a0a0c39 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/SAXParseException.java @@ -0,0 +1,271 @@ +// SAX exception class. +// http://www.saxproject.org +// No warranty; no copyright -- use this as you will. +// $Id: SAXParseException.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + +/** + * Encapsulate an XML parse error or warning. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This exception may include information for locating the error + * in the original XML document, as if it came from a {@link Locator} + * object. Note that although the application + * will receive a SAXParseException as the argument to the handlers + * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface, + * the application is not actually required to throw the exception; + * instead, it can simply read the information in it and take a + * different action.
+ * + *Since this exception is a subclass of {@link org.xml.sax.SAXException + * SAXException}, it inherits the ability to wrap another exception.
+ * + * @since SAX 1.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.SAXException + * @see org.xml.sax.Locator + * @see org.xml.sax.ErrorHandler + */ +public class SAXParseException extends SAXException { + + + ////////////////////////////////////////////////////////////////////// + // Constructors. + ////////////////////////////////////////////////////////////////////// + + + /** + * Create a new SAXParseException from a message and a Locator. + * + *This constructor is especially useful when an application is + * creating its own exception from within a {@link org.xml.sax.ContentHandler + * ContentHandler} callback.
+ * + * @param message The error or warning message. + * @param locator The locator object for the error or warning (may be + * null). + * @see org.xml.sax.Locator + */ + public SAXParseException (String message, Locator locator) { + super(message); + if (locator != null) { + init(locator.getPublicId(), locator.getSystemId(), + locator.getLineNumber(), locator.getColumnNumber()); + } else { + init(null, null, -1, -1); + } + } + + + /** + * Wrap an existing exception in a SAXParseException. + * + *This constructor is especially useful when an application is + * creating its own exception from within a {@link org.xml.sax.ContentHandler + * ContentHandler} callback, and needs to wrap an existing exception that is not a + * subclass of {@link org.xml.sax.SAXException SAXException}.
+ * + * @param message The error or warning message, or null to + * use the message from the embedded exception. + * @param locator The locator object for the error or warning (may be + * null). + * @param e Any exception. + * @see org.xml.sax.Locator + */ + public SAXParseException (String message, Locator locator, + Exception e) { + super(message, e); + if (locator != null) { + init(locator.getPublicId(), locator.getSystemId(), + locator.getLineNumber(), locator.getColumnNumber()); + } else { + init(null, null, -1, -1); + } + } + + + /** + * Create a new SAXParseException. + * + *This constructor is most useful for parser writers.
+ * + *All parameters except the message are as if + * they were provided by a {@link Locator}. For example, if the + * system identifier is a URL (including relative filename), the + * caller must resolve it fully before creating the exception.
+ * + * + * @param message The error or warning message. + * @param publicId The public identifier of the entity that generated + * the error or warning. + * @param systemId The system identifier of the entity that generated + * the error or warning. + * @param lineNumber The line number of the end of the text that + * caused the error or warning. + * @param columnNumber The column number of the end of the text that + * cause the error or warning. + */ + public SAXParseException (String message, String publicId, String systemId, + int lineNumber, int columnNumber) + { + super(message); + init(publicId, systemId, lineNumber, columnNumber); + } + + + /** + * Create a new SAXParseException with an embedded exception. + * + *This constructor is most useful for parser writers who + * need to wrap an exception that is not a subclass of + * {@link org.xml.sax.SAXException SAXException}.
+ * + *All parameters except the message and exception are as if + * they were provided by a {@link Locator}. For example, if the + * system identifier is a URL (including relative filename), the + * caller must resolve it fully before creating the exception.
+ * + * @param message The error or warning message, or null to use + * the message from the embedded exception. + * @param publicId The public identifier of the entity that generated + * the error or warning. + * @param systemId The system identifier of the entity that generated + * the error or warning. + * @param lineNumber The line number of the end of the text that + * caused the error or warning. + * @param columnNumber The column number of the end of the text that + * cause the error or warning. + * @param e Another exception to embed in this one. + */ + public SAXParseException (String message, String publicId, String systemId, + int lineNumber, int columnNumber, Exception e) + { + super(message, e); + init(publicId, systemId, lineNumber, columnNumber); + } + + + /** + * Internal initialization method. + * + * @param publicId The public identifier of the entity which generated the exception, + * or null. + * @param systemId The system identifier of the entity which generated the exception, + * or null. + * @param lineNumber The line number of the error, or -1. + * @param columnNumber The column number of the error, or -1. + */ + private void init (String publicId, String systemId, + int lineNumber, int columnNumber) + { + this.publicId = publicId; + this.systemId = systemId; + this.lineNumber = lineNumber; + this.columnNumber = columnNumber; + } + + + /** + * Get the public identifier of the entity where the exception occurred. + * + * @return A string containing the public identifier, or null + * if none is available. + * @see org.xml.sax.Locator#getPublicId + */ + public String getPublicId () + { + return this.publicId; + } + + + /** + * Get the system identifier of the entity where the exception occurred. + * + *If the system identifier is a URL, it will have been resolved + * fully.
+ * + * @return A string containing the system identifier, or null + * if none is available. + * @see org.xml.sax.Locator#getSystemId + */ + public String getSystemId () + { + return this.systemId; + } + + + /** + * The line number of the end of the text where the exception occurred. + * + *The first line is line 1.
+ * + * @return An integer representing the line number, or -1 + * if none is available. + * @see org.xml.sax.Locator#getLineNumber + */ + public int getLineNumber () + { + return this.lineNumber; + } + + + /** + * The column number of the end of the text where the exception occurred. + * + *The first column in a line is position 1.
+ * + * @return An integer representing the column number, or -1 + * if none is available. + * @see org.xml.sax.Locator#getColumnNumber + */ + public int getColumnNumber () + { + return this.columnNumber; + } + + + ////////////////////////////////////////////////////////////////////// + // Internal state. + ////////////////////////////////////////////////////////////////////// + + + /** + * @serial The public identifier, or null. + * @see #getPublicId + */ + private String publicId; + + + /** + * @serial The system identifier, or null. + * @see #getSystemId + */ + private String systemId; + + + /** + * @serial The line number, or -1. + * @see #getLineNumber + */ + private int lineNumber; + + + /** + * @serial The column number, or -1. + * @see #getColumnNumber + */ + private int columnNumber; + + // Added serialVersionUID to preserve binary compatibility + static final long serialVersionUID = -5651165872476709336L; +} + +// end of SAXParseException.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/XMLFilter.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/XMLFilter.java new file mode 100644 index 000000000..110794670 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/XMLFilter.java @@ -0,0 +1,65 @@ +// XMLFilter.java - filter SAX2 events. +// http://www.saxproject.org +// Written by David Megginson +// NO WARRANTY! This class is in the Public Domain. +// $Id: XMLFilter.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + + +/** + * Interface for an XML filter. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
An XML filter is like an XML reader, except that it obtains its + * events from another XML reader rather than a primary source like + * an XML document or database. Filters can modify a stream of + * events as they pass on to the final application.
+ * + *The XMLFilterImpl helper class provides a convenient base + * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver + * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler}, + * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler + * ErrorHandler} events automatically.
+ * + * @since SAX 2.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.helpers.XMLFilterImpl + */ +public interface XMLFilter extends XMLReader +{ + + /** + * Set the parent reader. + * + *This method allows the application to link the filter to + * a parent reader (which may be another filter). The argument + * may not be null.
+ * + * @param parent The parent reader. + */ + public abstract void setParent (XMLReader parent); + + + /** + * Get the parent reader. + * + *This method allows the application to query the parent + * reader (which may be another filter). It is generally a + * bad idea to perform any operations on the parent reader + * directly: they should all pass through this filter.
+ * + * @return The parent filter, or null if none has been set. + */ + public abstract XMLReader getParent (); + +} + +// end of XMLFilter.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/XMLReader.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/XMLReader.java new file mode 100644 index 000000000..d29bcac27 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/XMLReader.java @@ -0,0 +1,404 @@ +// XMLReader.java - read an XML document. +// http://www.saxproject.org +// Written by David Megginson +// NO WARRANTY! This class is in the Public Domain. +// $Id: XMLReader.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax; + +import java.io.IOException; + + +/** + * Interface for reading an XML document using callbacks. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
Note: despite its name, this interface does + * not extend the standard Java {@link java.io.Reader Reader} + * interface, because reading XML is a fundamentally different activity + * than reading character data.
+ * + *XMLReader is the interface that an XML parser's SAX2 driver must + * implement. This interface allows an application to set and + * query features and properties in the parser, to register + * event handlers for document processing, and to initiate + * a document parse.
+ * + *All SAX interfaces are assumed to be synchronous: the + * {@link #parse parse} methods must not return until parsing + * is complete, and readers must wait for an event-handler callback + * to return before reporting the next event.
+ * + *This interface replaces the (now deprecated) SAX 1.0 {@link + * org.xml.sax.Parser Parser} interface. The XMLReader interface + * contains two important enhancements over the old Parser + * interface (as well as some minor ones):
+ * + *There are adapters available to convert a SAX1 Parser to + * a SAX2 XMLReader and vice-versa.
+ * + * @since SAX 2.0 + * @author David Megginson + * @version 2.0.1+ (sax2r3pre1) + * @see org.xml.sax.XMLFilter + * @see org.xml.sax.helpers.ParserAdapter + * @see org.xml.sax.helpers.XMLReaderAdapter + */ +public interface XMLReader +{ + + + //////////////////////////////////////////////////////////////////// + // Configuration. + //////////////////////////////////////////////////////////////////// + + + /** + * Look up the value of a feature flag. + * + *The feature name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a feature name but + * temporarily be unable to return its value. + * Some feature values may be available only in specific + * contexts, such as before, during, or after a parse. + * Also, some feature values may not be programmatically accessible. + * (In the case of an adapter for SAX1 {@link Parser}, there is no + * implementation-independent way to expose whether the underlying + * parser is performing validation, expanding external entities, + * and so forth.)
+ * + *All XMLReaders are required to recognize the + * http://xml.org/sax/features/namespaces and the + * http://xml.org/sax/features/namespace-prefixes feature names.
+ * + *Typical usage is something like this:
+ * + *+ * XMLReader r = new MySAXDriver(); + * + * // try to activate validation + * try { + * r.setFeature("http://xml.org/sax/features/validation", true); + * } catch (SAXException e) { + * System.err.println("Cannot activate validation."); + * } + * + * // register event handlers + * r.setContentHandler(new MyContentHandler()); + * r.setErrorHandler(new MyErrorHandler()); + * + * // parse the first document + * try { + * r.parse("http://www.foo.com/mydoc.xml"); + * } catch (IOException e) { + * System.err.println("I/O exception reading XML document"); + * } catch (SAXException e) { + * System.err.println("XML exception reading document."); + * } + *+ * + *
Implementors are free (and encouraged) to invent their own features, + * using names built on their own URIs.
+ * + * @param name The feature name, which is a fully-qualified URI. + * @return The current value of the feature (true or false). + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * XMLReader recognizes the feature name but + * cannot determine its value at this time. + * @see #setFeature + */ + public boolean getFeature (String name) + throws SAXNotRecognizedException, SAXNotSupportedException; + + + /** + * Set the value of a feature flag. + * + *The feature name is any fully-qualified URI. It is + * possible for an XMLReader to expose a feature value but + * to be unable to change the current value. + * Some feature values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a parse.
+ * + *All XMLReaders are required to support setting + * http://xml.org/sax/features/namespaces to true and + * http://xml.org/sax/features/namespace-prefixes to false.
+ * + * @param name The feature name, which is a fully-qualified URI. + * @param value The requested value of the feature (true or false). + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * XMLReader recognizes the feature name but + * cannot set the requested value. + * @see #getFeature + */ + public void setFeature (String name, boolean value) + throws SAXNotRecognizedException, SAXNotSupportedException; + + + /** + * Look up the value of a property. + * + *The property name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a property name but + * temporarily be unable to return its value. + * Some property values may be available only in specific + * contexts, such as before, during, or after a parse.
+ * + *XMLReaders are not required to recognize any specific + * property names, though an initial core set is documented for + * SAX2.
+ * + *Implementors are free (and encouraged) to invent their own properties, + * using names built on their own URIs.
+ * + * @param name The property name, which is a fully-qualified URI. + * @return The current value of the property. + * @exception org.xml.sax.SAXNotRecognizedException If the property + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot determine its value at this time. + * @see #setProperty + */ + public Object getProperty (String name) + throws SAXNotRecognizedException, SAXNotSupportedException; + + + /** + * Set the value of a property. + * + *The property name is any fully-qualified URI. It is + * possible for an XMLReader to recognize a property name but + * to be unable to change the current value. + * Some property values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a parse.
+ * + *XMLReaders are not required to recognize setting + * any specific property names, though a core set is defined by + * SAX2.
+ * + *This method is also the standard mechanism for setting + * extended handlers.
+ * + * @param name The property name, which is a fully-qualified URI. + * @param value The requested value for the property. + * @exception org.xml.sax.SAXNotRecognizedException If the property + * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotSupportedException When the + * XMLReader recognizes the property name but + * cannot set the requested value. + */ + public void setProperty (String name, Object value) + throws SAXNotRecognizedException, SAXNotSupportedException; + + + + //////////////////////////////////////////////////////////////////// + // Event handlers. + //////////////////////////////////////////////////////////////////// + + + /** + * Allow an application to register an entity resolver. + * + *If the application does not register an entity resolver, + * the XMLReader will perform its own default resolution.
+ * + *Applications may register a new or different resolver in the + * middle of a parse, and the SAX parser must begin using the new + * resolver immediately.
+ * + * @param resolver The entity resolver. + * @see #getEntityResolver + */ + public void setEntityResolver (EntityResolver resolver); + + + /** + * Return the current entity resolver. + * + * @return The current entity resolver, or null if none + * has been registered. + * @see #setEntityResolver + */ + public EntityResolver getEntityResolver (); + + + /** + * Allow an application to register a DTD event handler. + * + *If the application does not register a DTD handler, all DTD + * events reported by the SAX parser will be silently ignored.
+ * + *Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.
+ * + * @param handler The DTD handler. + * @see #getDTDHandler + */ + public void setDTDHandler (DTDHandler handler); + + + /** + * Return the current DTD handler. + * + * @return The current DTD handler, or null if none + * has been registered. + * @see #setDTDHandler + */ + public DTDHandler getDTDHandler (); + + + /** + * Allow an application to register a content event handler. + * + *If the application does not register a content handler, all + * content events reported by the SAX parser will be silently + * ignored.
+ * + *Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.
+ * + * @param handler The content handler. + * @see #getContentHandler + */ + public void setContentHandler (ContentHandler handler); + + + /** + * Return the current content handler. + * + * @return The current content handler, or null if none + * has been registered. + * @see #setContentHandler + */ + public ContentHandler getContentHandler (); + + + /** + * Allow an application to register an error event handler. + * + *If the application does not register an error handler, all + * error events reported by the SAX parser will be silently + * ignored; however, normal processing may not continue. It is + * highly recommended that all SAX applications implement an + * error handler to avoid unexpected bugs.
+ * + *Applications may register a new or different handler in the + * middle of a parse, and the SAX parser must begin using the new + * handler immediately.
+ * + * @param handler The error handler. + * @see #getErrorHandler + */ + public void setErrorHandler (ErrorHandler handler); + + + /** + * Return the current error handler. + * + * @return The current error handler, or null if none + * has been registered. + * @see #setErrorHandler + */ + public ErrorHandler getErrorHandler (); + + + + //////////////////////////////////////////////////////////////////// + // Parsing. + //////////////////////////////////////////////////////////////////// + + /** + * Parse an XML document. + * + *The application can use this method to instruct the XML + * reader to begin parsing an XML document from any valid input + * source (a character stream, a byte stream, or a URI).
+ * + *Applications may not invoke this method while a parse is in + * progress (they should create a new XMLReader instead for each + * nested XML document). Once a parse is complete, an + * application may reuse the same XMLReader object, possibly with a + * different input source. + * Configuration of the XMLReader object (such as handler bindings and + * values established for feature flags and properties) is unchanged + * by completion of a parse, unless the definition of that aspect of + * the configuration explicitly specifies other behavior. + * (For example, feature flags or properties exposing + * characteristics of the document being parsed.) + *
+ * + *During the parse, the XMLReader will provide information + * about the XML document through the registered event + * handlers.
+ * + *This method is synchronous: it will not return until parsing + * has ended. If a client application wants to terminate + * parsing early, it should throw an exception.
+ * + * @param input The input source for the top-level of the + * XML document. + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception java.io.IOException An IO exception from the parser, + * possibly from a byte stream or character stream + * supplied by the application. + * @see org.xml.sax.InputSource + * @see #parse(java.lang.String) + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setContentHandler + * @see #setErrorHandler + */ + public void parse (InputSource input) + throws IOException, SAXException; + + + /** + * Parse an XML document from a system identifier (URI). + * + *This method is a shortcut for the common case of reading a + * document from a system identifier. It is the exact + * equivalent of the following:
+ * + *+ * parse(new InputSource(systemId)); + *+ * + *
If the system identifier is a URL, it must be fully resolved + * by the application before it is passed to the parser.
+ * + * @param systemId The system identifier (URI). + * @exception org.xml.sax.SAXException Any SAX exception, possibly + * wrapping another exception. + * @exception java.io.IOException An IO exception from the parser, + * possibly from a byte stream or character stream + * supplied by the application. + * @see #parse(org.xml.sax.InputSource) + */ + public void parse (String systemId) + throws IOException, SAXException; + +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Attributes2.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Attributes2.java new file mode 100644 index 000000000..bfd10bb61 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Attributes2.java @@ -0,0 +1,132 @@ +// Attributes2.java - extended Attributes +// http://www.saxproject.org +// Public Domain: no warranty. +// $Id: Attributes2.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.ext; + +import org.xml.sax.Attributes; + + +/** + * SAX2 extension to augment the per-attribute information + * provided though {@link Attributes}. + * If an implementation supports this extension, the attributes + * provided in {@link org.xml.sax.ContentHandler#startElement + * ContentHandler.startElement() } will implement this interface, + * and the http://xml.org/sax/features/use-attributes2 + * feature flag will have the value true. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + *+ * + *
XMLReader implementations are not required to support this + * information, and it is not part of core-only SAX2 distributions.
+ * + *Note that if an attribute was defaulted (!isSpecified()) + * it will of necessity also have been declared (isDeclared()) + * in the DTD. + * Similarly if an attribute's type is anything except CDATA, then it + * must have been declared. + *
+ * + * @since SAX 2.0 (extensions 1.1 alpha) + * @author David Brownell + * @version TBS + */ +public interface Attributes2 extends Attributes +{ + /** + * Returns false unless the attribute was declared in the DTD. + * This helps distinguish two kinds of attributes that SAX reports + * as CDATA: ones that were declared (and hence are usually valid), + * and those that were not (and which are never valid). + * + * @param index The attribute index (zero-based). + * @return true if the attribute was declared in the DTD, + * false otherwise. + * @exception java.lang.ArrayIndexOutOfBoundsException When the + * supplied index does not identify an attribute. + */ + public boolean isDeclared (int index); + + /** + * Returns false unless the attribute was declared in the DTD. + * This helps distinguish two kinds of attributes that SAX reports + * as CDATA: ones that were declared (and hence are usually valid), + * and those that were not (and which are never valid). + * + * @param qName The XML qualified (prefixed) name. + * @return true if the attribute was declared in the DTD, + * false otherwise. + * @exception java.lang.IllegalArgumentException When the + * supplied name does not identify an attribute. + */ + public boolean isDeclared (String qName); + + /** + * Returns false unless the attribute was declared in the DTD. + * This helps distinguish two kinds of attributes that SAX reports + * as CDATA: ones that were declared (and hence are usually valid), + * and those that were not (and which are never valid). + * + *Remember that since DTDs do not "understand" namespaces, the + * namespace URI associated with an attribute may not have come from + * the DTD. The declaration will have applied to the attribute's + * qName. + * + * @param uri The Namespace URI, or the empty string if + * the name has no Namespace URI. + * @param localName The attribute's local name. + * @return true if the attribute was declared in the DTD, + * false otherwise. + * @exception java.lang.IllegalArgumentException When the + * supplied names do not identify an attribute. + */ + public boolean isDeclared (String uri, String localName); + + /** + * Returns true unless the attribute value was provided + * by DTD defaulting. + * + * @param index The attribute index (zero-based). + * @return true if the value was found in the XML text, + * false if the value was provided by DTD defaulting. + * @exception java.lang.ArrayIndexOutOfBoundsException When the + * supplied index does not identify an attribute. + */ + public boolean isSpecified (int index); + + /** + * Returns true unless the attribute value was provided + * by DTD defaulting. + * + *
Remember that since DTDs do not "understand" namespaces, the + * namespace URI associated with an attribute may not have come from + * the DTD. The declaration will have applied to the attribute's + * qName. + * + * @param uri The Namespace URI, or the empty string if + * the name has no Namespace URI. + * @param localName The attribute's local name. + * @return true if the value was found in the XML text, + * false if the value was provided by DTD defaulting. + * @exception java.lang.IllegalArgumentException When the + * supplied names do not identify an attribute. + */ + public boolean isSpecified (String uri, String localName); + + /** + * Returns true unless the attribute value was provided + * by DTD defaulting. + * + * @param qName The XML qualified (prefixed) name. + * @return true if the value was found in the XML text, + * false if the value was provided by DTD defaulting. + * @exception java.lang.IllegalArgumentException When the + * supplied name does not identify an attribute. + */ + public boolean isSpecified (String qName); +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Attributes2Impl.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Attributes2Impl.java new file mode 100644 index 000000000..1da81fa30 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Attributes2Impl.java @@ -0,0 +1,301 @@ +// Attributes2Impl.java - extended AttributesImpl +// http://www.saxproject.org +// Public Domain: no warranty. +// $Id: Attributes2Impl.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.ext; + +import org.xml.sax.Attributes; +import org.xml.sax.helpers.AttributesImpl; + + +/** + * SAX2 extension helper for additional Attributes information, + * implementing the {@link Attributes2} interface. + * + *
+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + *+ * + *
This is not part of core-only SAX2 distributions.
+ * + *The specified flag for each attribute will always + * be true, unless it has been set to false in the copy constructor + * or using {@link #setSpecified}. + * Similarly, the declared flag for each attribute will + * always be false, except for defaulted attributes (specified + * is false), non-CDATA attributes, or when it is set to true using + * {@link #setDeclared}. + * If you change an attribute's type by hand, you may need to modify + * its declared flag to match. + *
+ * + * @since SAX 2.0 (extensions 1.1 alpha) + * @author David Brownell + * @version TBS + */ +public class Attributes2Impl extends AttributesImpl implements Attributes2 +{ + private boolean declared []; + private boolean specified []; + + + /** + * Construct a new, empty Attributes2Impl object. + */ + public Attributes2Impl () { } + + + /** + * Copy an existing Attributes or Attributes2 object. + * If the object implements Attributes2, values of the + * specified and declared flags for each + * attribute are copied. + * Otherwise the flag values are defaulted to assume no DTD was used, + * unless there is evidence to the contrary (such as attributes with + * type other than CDATA, which must have been declared). + * + *This constructor is especially useful inside a + * {@link org.xml.sax.ContentHandler#startElement startElement} event.
+ * + * @param atts The existing Attributes object. + */ + public Attributes2Impl (Attributes atts) + { + super (atts); + } + + + //////////////////////////////////////////////////////////////////// + // Implementation of Attributes2 + //////////////////////////////////////////////////////////////////// + + + /** + * Returns the current value of the attribute's "declared" flag. + */ + // javadoc mostly from interface + public boolean isDeclared (int index) + { + if (index < 0 || index >= getLength ()) + throw new ArrayIndexOutOfBoundsException ( + "No attribute at index: " + index); + return declared [index]; + } + + + /** + * Returns the current value of the attribute's "declared" flag. + */ + // javadoc mostly from interface + public boolean isDeclared (String uri, String localName) + { + int index = getIndex (uri, localName); + + if (index < 0) + throw new IllegalArgumentException ( + "No such attribute: local=" + localName + + ", namespace=" + uri); + return declared [index]; + } + + + /** + * Returns the current value of the attribute's "declared" flag. + */ + // javadoc mostly from interface + public boolean isDeclared (String qName) + { + int index = getIndex (qName); + + if (index < 0) + throw new IllegalArgumentException ( + "No such attribute: " + qName); + return declared [index]; + } + + + /** + * Returns the current value of an attribute's "specified" flag. + * + * @param index The attribute index (zero-based). + * @return current flag value + * @exception java.lang.ArrayIndexOutOfBoundsException When the + * supplied index does not identify an attribute. + */ + public boolean isSpecified (int index) + { + if (index < 0 || index >= getLength ()) + throw new ArrayIndexOutOfBoundsException ( + "No attribute at index: " + index); + return specified [index]; + } + + + /** + * Returns the current value of an attribute's "specified" flag. + * + * @param uri The Namespace URI, or the empty string if + * the name has no Namespace URI. + * @param localName The attribute's local name. + * @return current flag value + * @exception java.lang.IllegalArgumentException When the + * supplied names do not identify an attribute. + */ + public boolean isSpecified (String uri, String localName) + { + int index = getIndex (uri, localName); + + if (index < 0) + throw new IllegalArgumentException ( + "No such attribute: local=" + localName + + ", namespace=" + uri); + return specified [index]; + } + + + /** + * Returns the current value of an attribute's "specified" flag. + * + * @param qName The XML qualified (prefixed) name. + * @return current flag value + * @exception java.lang.IllegalArgumentException When the + * supplied name does not identify an attribute. + */ + public boolean isSpecified (String qName) + { + int index = getIndex (qName); + + if (index < 0) + throw new IllegalArgumentException ( + "No such attribute: " + qName); + return specified [index]; + } + + + //////////////////////////////////////////////////////////////////// + // Manipulators + //////////////////////////////////////////////////////////////////// + + + /** + * Copy an entire Attributes object. The "specified" flags are + * assigned as true, and "declared" flags as false (except when + * an attribute's type is not CDATA), + * unless the object is an Attributes2 object. + * In that case those flag values are all copied. + * + * @see AttributesImpl#setAttributes + */ + public void setAttributes (Attributes atts) + { + int length = atts.getLength (); + + super.setAttributes (atts); + declared = new boolean [length]; + specified = new boolean [length]; + + if (atts instanceof Attributes2) { + Attributes2 a2 = (Attributes2) atts; + for (int i = 0; i < length; i++) { + declared [i] = a2.isDeclared (i); + specified [i] = a2.isSpecified (i); + } + } else { + for (int i = 0; i < length; i++) { + declared [i] = !"CDATA".equals (atts.getType (i)); + specified [i] = true; + } + } + } + + + /** + * Add an attribute to the end of the list, setting its + * "specified" flag to true. To set that flag's value + * to false, use {@link #setSpecified}. + * + *Unless the attribute type is CDATA, this attribute + * is marked as being declared in the DTD. To set that flag's value + * to true for CDATA attributes, use {@link #setDeclared}. + * + * @see AttributesImpl#addAttribute + */ + public void addAttribute (String uri, String localName, String qName, + String type, String value) + { + super.addAttribute (uri, localName, qName, type, value); + + int length = getLength (); + + if (length < specified.length) { + boolean newFlags []; + + newFlags = new boolean [length]; + System.arraycopy (declared, 0, newFlags, 0, declared.length); + declared = newFlags; + + newFlags = new boolean [length]; + System.arraycopy (specified, 0, newFlags, 0, specified.length); + specified = newFlags; + } + + specified [length - 1] = true; + declared [length - 1] = !"CDATA".equals (type); + } + + + // javadoc entirely from superclass + public void removeAttribute (int index) + { + int origMax = getLength () - 1; + + super.removeAttribute (index); + if (index != origMax) { + System.arraycopy (declared, index + 1, declared, index, + origMax - index); + System.arraycopy (specified, index + 1, specified, index, + origMax - index); + } + } + + + /** + * Assign a value to the "declared" flag of a specific attribute. + * This is normally needed only for attributes of type CDATA, + * including attributes whose type is changed to or from CDATA. + * + * @param index The index of the attribute (zero-based). + * @param value The desired flag value. + * @exception java.lang.ArrayIndexOutOfBoundsException When the + * supplied index does not identify an attribute. + * @see #setType + */ + public void setDeclared (int index, boolean value) + { + if (index < 0 || index >= getLength ()) + throw new ArrayIndexOutOfBoundsException ( + "No attribute at index: " + index); + declared [index] = value; + } + + + /** + * Assign a value to the "specified" flag of a specific attribute. + * This is the only way this flag can be cleared, except clearing + * by initialization with the copy constructor. + * + * @param index The index of the attribute (zero-based). + * @param value The desired flag value. + * @exception java.lang.ArrayIndexOutOfBoundsException When the + * supplied index does not identify an attribute. + */ + public void setSpecified (int index, boolean value) + { + if (index < 0 || index >= getLength ()) + throw new ArrayIndexOutOfBoundsException ( + "No attribute at index: " + index); + specified [index] = value; + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/DeclHandler.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/DeclHandler.java new file mode 100644 index 000000000..68cd5a5b7 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/DeclHandler.java @@ -0,0 +1,146 @@ +// DeclHandler.java - Optional handler for DTD declaration events. +// http://www.saxproject.org +// Public Domain: no warranty. +// $Id: DeclHandler.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.ext; + +import org.xml.sax.SAXException; + + +/** + * SAX2 extension handler for DTD declaration events. + * + *
+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This is an optional extension handler for SAX2 to provide more + * complete information about DTD declarations in an XML document. + * XML readers are not required to recognize this handler, and it + * is not part of core-only SAX2 distributions.
+ * + *Note that data-related DTD declarations (unparsed entities and + * notations) are already reported through the {@link + * org.xml.sax.DTDHandler DTDHandler} interface.
+ * + *If you are using the declaration handler together with a lexical + * handler, all of the events will occur between the + * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the + * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events.
+ * + *To set the DeclHandler for an XML reader, use the
+ * {@link org.xml.sax.XMLReader#setProperty setProperty} method
+ * with the property name
+ * http://xml.org/sax/properties/declaration-handler
+ * and an object implementing this interface (or null) as the value.
+ * If the reader does not report declaration events, it will throw a
+ * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
+ * when you attempt to register the handler.
The content model will consist of the string "EMPTY", the + * string "ANY", or a parenthesised group, optionally followed + * by an occurrence indicator. The model will be normalized so + * that all parameter entities are fully resolved and all whitespace + * is removed,and will include the enclosing parentheses. Other + * normalization (such as removing redundant parentheses or + * simplifying occurrence indicators) is at the discretion of the + * parser.
+ * + * @param name The element type name. + * @param model The content model as a normalized string. + * @exception SAXException The application may raise an exception. + */ + public abstract void elementDecl (String name, String model) + throws SAXException; + + + /** + * Report an attribute type declaration. + * + *Only the effective (first) declaration for an attribute will + * be reported. The type will be one of the strings "CDATA", + * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", + * "ENTITIES", a parenthesized token group with + * the separator "|" and all whitespace removed, or the word + * "NOTATION" followed by a space followed by a parenthesized + * token group with all whitespace removed.
+ * + *The value will be the value as reported to applications, + * appropriately normalized and with entity and character + * references expanded.
+ * + * @param eName The name of the associated element. + * @param aName The name of the attribute. + * @param type A string representing the attribute type. + * @param mode A string representing the attribute defaulting mode + * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if + * none of these applies. + * @param value A string representing the attribute's default value, + * or null if there is none. + * @exception SAXException The application may raise an exception. + */ + public abstract void attributeDecl (String eName, + String aName, + String type, + String mode, + String value) + throws SAXException; + + + /** + * Report an internal entity declaration. + * + *Only the effective (first) declaration for each entity + * will be reported. All parameter entities in the value + * will be expanded, but general entities will not.
+ * + * @param name The name of the entity. If it is a parameter + * entity, the name will begin with '%'. + * @param value The replacement text of the entity. + * @exception SAXException The application may raise an exception. + * @see #externalEntityDecl + * @see org.xml.sax.DTDHandler#unparsedEntityDecl + */ + public abstract void internalEntityDecl (String name, String value) + throws SAXException; + + + /** + * Report a parsed external entity declaration. + * + *Only the effective (first) declaration for each entity + * will be reported.
+ * + *If the system identifier is a URL, the parser must resolve it + * fully before passing it to the application.
+ * + * @param name The name of the entity. If it is a parameter + * entity, the name will begin with '%'. + * @param publicId The entity's public identifier, or null if none + * was given. + * @param systemId The entity's system identifier. + * @exception SAXException The application may raise an exception. + * @see #internalEntityDecl + * @see org.xml.sax.DTDHandler#unparsedEntityDecl + */ + public abstract void externalEntityDecl (String name, String publicId, + String systemId) + throws SAXException; + +} + +// end of DeclHandler.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/EntityResolver2.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/EntityResolver2.java new file mode 100644 index 000000000..4fd3e8d7e --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/EntityResolver2.java @@ -0,0 +1,197 @@ +// EntityResolver2.java - Extended SAX entity resolver. +// http://www.saxproject.org +// No warranty; no copyright -- use this as you will. +// $Id: EntityResolver2.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.ext; + +import java.io.IOException; + +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; +import org.xml.sax.SAXException; + + +/** + * Extended interface for mapping external entity references to input + * sources, or providing a missing external subset. The + * {@link XMLReader#setEntityResolver XMLReader.setEntityResolver()} method + * is used to provide implementations of this interface to parsers. + * When a parser uses the methods in this interface, the + * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()} + * method (in this interface) is used instead of the older (SAX 1.0) + * {@link EntityResolver#resolveEntity EntityResolver.resolveEntity()} method. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + *+ * + *
If a SAX application requires the customized handling which this + * interface defines for external entities, it must ensure that it uses + * an XMLReader with the + * http://xml.org/sax/features/use-entity-resolver2 feature flag + * set to true (which is its default value when the feature is + * recognized). If that flag is unrecognized, or its value is false, + * or the resolver does not implement this interface, then only the + * {@link EntityResolver} method will be used. + *
+ * + *That supports three categories of application that modify entity + * resolution. Old Style applications won't know about this interface; + * they will provide an EntityResolver. + * Transitional Mode provide an EntityResolver2 and automatically + * get the benefit of its methods in any systems (parsers or other tools) + * supporting it, due to polymorphism. + * Both Old Style and Transitional Mode applications will + * work with any SAX2 parser. + * New style applications will fail to run except on SAX2 parsers + * that support this particular feature. + * They will insist that feature flag have a value of "true", and the + * EntityResolver2 implementation they provide might throw an exception + * if the original SAX 1.0 style entity resolution method is invoked. + *
+ * + * @see org.xml.sax.XMLReader#setEntityResolver + * + * @since SAX 2.0 (extensions 1.1 alpha) + * @author David Brownell + * @version TBD + */ +public interface EntityResolver2 extends EntityResolver +{ + /** + * Allows applications to provide an external subset for documents + * that don't explicitly define one. Documents with DOCTYPE declarations + * that omit an external subset can thus augment the declarations + * available for validation, entity processing, and attribute processing + * (normalization, defaulting, and reporting types including ID). + * This augmentation is reported + * through the {@link LexicalHandler#startDTD startDTD()} method as if + * the document text had originally included the external subset; + * this callback is made before any internal subset data or errors + * are reported. + * + *This method can also be used with documents that have no DOCTYPE + * declaration. When the root element is encountered, + * but no DOCTYPE declaration has been seen, this method is + * invoked. If it returns a value for the external subset, that root + * element is declared to be the root element, giving the effect of + * splicing a DOCTYPE declaration at the end the prolog of a document + * that could not otherwise be valid. The sequence of parser callbacks + * in that case logically resembles this:
+ * + *+ * ... comments and PIs from the prolog (as usual) + * startDTD ("rootName", source.getPublicId (), source.getSystemId ()); + * startEntity ("[dtd]"); + * ... declarations, comments, and PIs from the external subset + * endEntity ("[dtd]"); + * endDTD (); + * ... then the rest of the document (as usual) + * startElement (..., "rootName", ...); + *+ * + *
Note that the InputSource gets no further resolution. + * Implementations of this method may wish to invoke + * {@link #resolveEntity resolveEntity()} to gain benefits such as use + * of local caches of DTD entities. Also, this method will never be + * used by a (non-validating) processor that is not including external + * parameter entities.
+ * + *Uses for this method include facilitating data validation when + * interoperating with XML processors that would always require + * undesirable network accesses for external entities, or which for + * other reasons adopt a "no DTDs" policy. + * Non-validation motives include forcing documents to include DTDs so + * that attributes are handled consistently. + * For example, an XPath processor needs to know which attibutes have + * type "ID" before it can process a widely used type of reference.
+ * + *Warning: Returning an external subset modifies + * the input document. By providing definitions for general entities, + * it can make a malformed document appear to be well formed. + *
+ * + * @param name Identifies the document root element. This name comes + * from a DOCTYPE declaration (where available) or from the actual + * root element. + * @param baseURI The document's base URI, serving as an additional + * hint for selecting the external subset. This is always an absolute + * URI, unless it is null because the XMLReader was given an InputSource + * without one. + * + * @return An InputSource object describing the new external subset + * to be used by the parser, or null to indicate that no external + * subset is provided. + * + * @exception SAXException Any SAX exception, possibly wrapping + * another exception. + * @exception IOException Probably indicating a failure to create + * a new InputStream or Reader, or an illegal URL. + */ + public InputSource getExternalSubset (String name, String baseURI) + throws SAXException, IOException; + + /** + * Allows applications to map references to external entities into input + * sources, or tell the parser it should use conventional URI resolution. + * This method is only called for external entities which have been + * properly declared. + * This method provides more flexibility than the {@link EntityResolver} + * interface, supporting implementations of more complex catalogue + * schemes such as the one defined by the OASIS XML Catalogs specification. + * + *Parsers configured to use this resolver method will call it + * to determine the input source to use for any external entity + * being included because of a reference in the XML text. + * That excludes the document entity, and any external entity returned + * by {@link #getExternalSubset getExternalSubset()}. + * When a (non-validating) processor is configured not to include + * a class of entities (parameter or general) through use of feature + * flags, this method is not invoked for such entities.
+ * + *Note that the entity naming scheme used here is the same one + * used in the {@link LexicalHandler}, or in the {@link + org.xml.sax.ContentHandler#skippedEntity + ContentHandler.skippedEntity()} + * method.
+ * + * @param name Identifies the external entity being resolved. + * Either "[dtd]" for the external subset, or a name starting + * with "%" to indicate a parameter entity, or else the name of + * a general entity. This is never null when invoked by a SAX2 + * parser. + * @param publicId The public identifier of the external entity being + * referenced (normalized as required by the XML specification), or + * null if none was supplied. + * @param baseURI The URI with respect to which relative systemIDs + * are interpreted. This is always an absolute URI, unless it is + * null (likely because the XMLReader was given an InputSource without + * one). This URI is defined by the XML specification to be the one + * associated with the "<" starting the relevant declaration. + * @param systemId The system identifier of the external entity + * being referenced; either a relative or absolute URI. + * This is never null when invoked by a SAX2 parser; only declared + * entities, and any external subset, are resolved by such parsers. + * + * @return An InputSource object describing the new input source to + * be used by the parser. Returning null directs the parser to + * resolve the system ID against the base URI and open a connection + * to resulting URI. + * + * @exception SAXException Any SAX exception, possibly wrapping + * another exception. + * @exception IOException Probably indicating a failure to create + * a new InputStream or Reader, or an illegal URL. + */ + public InputSource resolveEntity ( + String name, + String publicId, + String baseURI, + String systemId + ) throws SAXException, IOException; +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/LexicalHandler.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/LexicalHandler.java new file mode 100644 index 000000000..4e01b06f6 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/LexicalHandler.java @@ -0,0 +1,212 @@ +// LexicalHandler.java - optional handler for lexical parse events. +// http://www.saxproject.org +// Public Domain: no warranty. +// $Id: LexicalHandler.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.ext; + +import org.xml.sax.SAXException; + +/** + * SAX2 extension handler for lexical events. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This is an optional extension handler for SAX2 to provide + * lexical information about an XML document, such as comments + * and CDATA section boundaries. + * XML readers are not required to recognize this handler, and it + * is not part of core-only SAX2 distributions.
+ * + *The events in the lexical handler apply to the entire document, + * not just to the document element, and all lexical handler events + * must appear between the content handler's startDocument and + * endDocument events.
+ * + *To set the LexicalHandler for an XML reader, use the
+ * {@link org.xml.sax.XMLReader#setProperty setProperty} method
+ * with the property name
+ * http://xml.org/sax/properties/lexical-handler
+ * and an object implementing this interface (or null) as the value.
+ * If the reader does not report lexical events, it will throw a
+ * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
+ * when you attempt to register the handler.
This method is intended to report the beginning of the + * DOCTYPE declaration; if the document has no DOCTYPE declaration, + * this method will not be invoked.
+ * + *All declarations reported through + * {@link org.xml.sax.DTDHandler DTDHandler} or + * {@link org.xml.sax.ext.DeclHandler DeclHandler} events must appear + * between the startDTD and {@link #endDTD endDTD} events. + * Declarations are assumed to belong to the internal DTD subset + * unless they appear between {@link #startEntity startEntity} + * and {@link #endEntity endEntity} events. Comments and + * processing instructions from the DTD should also be reported + * between the startDTD and endDTD events, in their original + * order of (logical) occurrence; they are not required to + * appear in their correct locations relative to DTDHandler + * or DeclHandler events, however.
+ * + *Note that the start/endDTD events will appear within + * the start/endDocument events from ContentHandler and + * before the first + * {@link org.xml.sax.ContentHandler#startElement startElement} + * event.
+ * + * @param name The document type name. + * @param publicId The declared public identifier for the + * external DTD subset, or null if none was declared. + * @param systemId The declared system identifier for the + * external DTD subset, or null if none was declared. + * (Note that this is not resolved against the document + * base URI.) + * @exception SAXException The application may raise an + * exception. + * @see #endDTD + * @see #startEntity + */ + public abstract void startDTD (String name, String publicId, + String systemId) + throws SAXException; + + + /** + * Report the end of DTD declarations. + * + *This method is intended to report the end of the + * DOCTYPE declaration; if the document has no DOCTYPE declaration, + * this method will not be invoked.
+ * + * @exception SAXException The application may raise an exception. + * @see #startDTD + */ + public abstract void endDTD () + throws SAXException; + + + /** + * Report the beginning of some internal and external XML entities. + * + *The reporting of parameter entities (including
+ * the external DTD subset) is optional, and SAX2 drivers that
+ * report LexicalHandler events may not implement it; you can use the
+ * http://xml.org/sax/features/lexical-handler/parameter-entities
+ * feature to query or control the reporting of parameter entities.
General entities are reported with their regular names, + * parameter entities have '%' prepended to their names, and + * the external DTD subset has the pseudo-entity name "[dtd]".
+ * + *When a SAX2 driver is providing these events, all other + * events must be properly nested within start/end entity + * events. There is no additional requirement that events from + * {@link org.xml.sax.ext.DeclHandler DeclHandler} or + * {@link org.xml.sax.DTDHandler DTDHandler} be properly ordered.
+ * + *Note that skipped entities will be reported through the + * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity} + * event, which is part of the ContentHandler interface.
+ * + *Because of the streaming event model that SAX uses, some + * entity boundaries cannot be reported under any + * circumstances:
+ * + *These will be silently expanded, with no indication of where + * the original entity boundaries were.
+ * + *Note also that the boundaries of character references (which + * are not really entities anyway) are not reported.
+ * + *All start/endEntity events must be properly nested. + * + * @param name The name of the entity. If it is a parameter + * entity, the name will begin with '%', and if it is the + * external DTD subset, it will be "[dtd]". + * @exception SAXException The application may raise an exception. + * @see #endEntity + * @see org.xml.sax.ext.DeclHandler#internalEntityDecl + * @see org.xml.sax.ext.DeclHandler#externalEntityDecl + */ + public abstract void startEntity (String name) + throws SAXException; + + + /** + * Report the end of an entity. + * + * @param name The name of the entity that is ending. + * @exception SAXException The application may raise an exception. + * @see #startEntity + */ + public abstract void endEntity (String name) + throws SAXException; + + + /** + * Report the start of a CDATA section. + * + *
The contents of the CDATA section will be reported through + * the regular {@link org.xml.sax.ContentHandler#characters + * characters} event; this event is intended only to report + * the boundary.
+ * + * @exception SAXException The application may raise an exception. + * @see #endCDATA + */ + public abstract void startCDATA () + throws SAXException; + + + /** + * Report the end of a CDATA section. + * + * @exception SAXException The application may raise an exception. + * @see #startCDATA + */ + public abstract void endCDATA () + throws SAXException; + + + /** + * Report an XML comment anywhere in the document. + * + *This callback will be used for comments inside or outside the + * document element, including comments in the external DTD + * subset (if read). Comments in the DTD must be properly + * nested inside start/endDTD and start/endEntity events (if + * used).
+ * + * @param ch An array holding the characters in the comment. + * @param start The starting position in the array. + * @param length The number of characters to use from the array. + * @exception SAXException The application may raise an exception. + */ + public abstract void comment (char ch[], int start, int length) + throws SAXException; + +} + +// end of LexicalHandler.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Locator2Impl.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Locator2Impl.java new file mode 100644 index 000000000..e6f7c560c --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/Locator2Impl.java @@ -0,0 +1,101 @@ +// Locator2Impl.java - extended LocatorImpl +// http://www.saxproject.org +// Public Domain: no warranty. +// $Id: Locator2Impl.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.ext; + +import org.xml.sax.Locator; +import org.xml.sax.helpers.LocatorImpl; + + +/** + * SAX2 extension helper for holding additional Entity information, + * implementing the {@link Locator2} interface. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + *+ * + *
This is not part of core-only SAX2 distributions.
+ * + * @since SAX 2.0.2 + * @author David Brownell + * @version TBS + */ +public class Locator2Impl extends LocatorImpl implements Locator2 +{ + private String encoding; + private String version; + + + /** + * Construct a new, empty Locator2Impl object. + * This will not normally be useful, since the main purpose + * of this class is to make a snapshot of an existing Locator. + */ + public Locator2Impl () { } + + /** + * Copy an existing Locator or Locator2 object. + * If the object implements Locator2, values of the + * encoding and versionstrings are copied, + * otherwise they set to null. + * + * @param locator The existing Locator object. + */ + public Locator2Impl (Locator locator) + { + super (locator); + if (locator instanceof Locator2) { + Locator2 l2 = (Locator2) locator; + + version = l2.getXMLVersion (); + encoding = l2.getEncoding (); + } + } + + //////////////////////////////////////////////////////////////////// + // Locator2 method implementations + //////////////////////////////////////////////////////////////////// + + /** + * Returns the current value of the version property. + * + * @see #setXMLVersion + */ + public String getXMLVersion () + { return version; } + + /** + * Returns the current value of the encoding property. + * + * @see #setEncoding + */ + public String getEncoding () + { return encoding; } + + + //////////////////////////////////////////////////////////////////// + // Setters + //////////////////////////////////////////////////////////////////// + + /** + * Assigns the current value of the version property. + * + * @param version the new "version" value + * @see #getXMLVersion + */ + public void setXMLVersion (String version) + { this.version = version; } + + /** + * Assigns the current value of the encoding property. + * + * @param encoding the new "encoding" value + * @see #getEncoding + */ + public void setEncoding (String encoding) + { this.encoding = encoding; } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/package.html b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/package.html new file mode 100644 index 000000000..016ac3df7 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/ext/package.html @@ -0,0 +1,46 @@ + + + + ++This package contains interfaces to SAX2 facilities that +conformant SAX drivers won't necessarily support. + +
See http://www.saxproject.org +for more information about SAX.
+ +This package is independent of the SAX2 core, though the functionality +exposed generally needs to be implemented within a parser core. +That independence has several consequences:
+ +org.xml.sax.helpers.DefaultHandler
or
+org.xml.sax.helpers.XMLFilterImpl
classes.
+You can subclass these if you need such behavior, or
+use the helper classes found here.This package, SAX2-ext, is a standardized extension to SAX2. It is +designed both to allow SAX parsers to pass certain types of information +to applications, and to serve as a simple model for other SAX2 parser +extension packages. Not all such extension packages should need to +be recognized directly by parsers, however. +As an example, most validation systems can be cleanly layered on top +of parsers supporting the standardized SAX2 interfaces.
+ + diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/AttributeListImpl.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/AttributeListImpl.java new file mode 100644 index 000000000..f915165e3 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/AttributeListImpl.java @@ -0,0 +1,312 @@ +// SAX default implementation for AttributeList. +// http://www.saxproject.org +// No warranty; no copyright -- use this as you will. +// $Id: AttributeListImpl.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.helpers; + +import org.xml.sax.AttributeList; + +import java.util.Vector; + + +/** + * Default implementation for AttributeList. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
AttributeList implements the deprecated SAX1 {@link + * org.xml.sax.AttributeList AttributeList} interface, and has been + * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl + * AttributesImpl} interface.
+ * + *This class provides a convenience implementation of the SAX + * {@link org.xml.sax.AttributeList AttributeList} interface. This + * implementation is useful both for SAX parser writers, who can use + * it to provide attributes to the application, and for SAX application + * writers, who can use it to create a persistent copy of an element's + * attribute specifications:
+ * + *+ * private AttributeList myatts; + * + * public void startElement (String name, AttributeList atts) + * { + * // create a persistent copy of the attribute list + * // for use outside this method + * myatts = new AttributeListImpl(atts); + * [...] + * } + *+ * + *
Please note that SAX parsers are not required to use this + * class to provide an implementation of AttributeList; it is + * supplied only as an optional convenience. In particular, + * parser writers are encouraged to invent more efficient + * implementations.
+ * + * @deprecated This class implements a deprecated interface, + * {@link org.xml.sax.AttributeList AttributeList}; + * that interface has been replaced by + * {@link org.xml.sax.Attributes Attributes}, + * which is implemented in the + * {@link org.xml.sax.helpers.AttributesImpl + * AttributesImpl} helper class. + * @since SAX 1.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.AttributeList + * @see org.xml.sax.DocumentHandler#startElement + */ +public class AttributeListImpl implements AttributeList +{ + + /** + * Create an empty attribute list. + * + *This constructor is most useful for parser writers, who + * will use it to create a single, reusable attribute list that + * can be reset with the clear method between elements.
+ * + * @see #addAttribute + * @see #clear + */ + public AttributeListImpl () + { + } + + + /** + * Construct a persistent copy of an existing attribute list. + * + *This constructor is most useful for application writers, + * who will use it to create a persistent copy of an existing + * attribute list.
+ * + * @param atts The attribute list to copy + * @see org.xml.sax.DocumentHandler#startElement + */ + public AttributeListImpl (AttributeList atts) + { + setAttributeList(atts); + } + + + + //////////////////////////////////////////////////////////////////// + // Methods specific to this class. + //////////////////////////////////////////////////////////////////// + + + /** + * Set the attribute list, discarding previous contents. + * + *This method allows an application writer to reuse an + * attribute list easily.
+ * + * @param atts The attribute list to copy. + */ + public void setAttributeList (AttributeList atts) + { + int count = atts.getLength(); + + clear(); + + for (int i = 0; i < count; i++) { + addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i)); + } + } + + + /** + * Add an attribute to an attribute list. + * + *This method is provided for SAX parser writers, to allow them + * to build up an attribute list incrementally before delivering + * it to the application.
+ * + * @param name The attribute name. + * @param type The attribute type ("NMTOKEN" for an enumeration). + * @param value The attribute value (must not be null). + * @see #removeAttribute + * @see org.xml.sax.DocumentHandler#startElement + */ + public void addAttribute (String name, String type, String value) + { + names.addElement(name); + types.addElement(type); + values.addElement(value); + } + + + /** + * Remove an attribute from the list. + * + *SAX application writers can use this method to filter an + * attribute out of an AttributeList. Note that invoking this + * method will change the length of the attribute list and + * some of the attribute's indices.
+ * + *If the requested attribute is not in the list, this is + * a no-op.
+ * + * @param name The attribute name. + * @see #addAttribute + */ + public void removeAttribute (String name) + { + int i = names.indexOf(name); + + if (i >= 0) { + names.removeElementAt(i); + types.removeElementAt(i); + values.removeElementAt(i); + } + } + + + /** + * Clear the attribute list. + * + *SAX parser writers can use this method to reset the attribute + * list between DocumentHandler.startElement events. Normally, + * it will make sense to reuse the same AttributeListImpl object + * rather than allocating a new one each time.
+ * + * @see org.xml.sax.DocumentHandler#startElement + */ + public void clear () + { + names.removeAllElements(); + types.removeAllElements(); + values.removeAllElements(); + } + + + + //////////////////////////////////////////////////////////////////// + // Implementation of org.xml.sax.AttributeList + //////////////////////////////////////////////////////////////////// + + + /** + * Return the number of attributes in the list. + * + * @return The number of attributes in the list. + * @see org.xml.sax.AttributeList#getLength + */ + public int getLength () + { + return names.size(); + } + + + /** + * Get the name of an attribute (by position). + * + * @param i The position of the attribute in the list. + * @return The attribute name as a string, or null if there + * is no attribute at that position. + * @see org.xml.sax.AttributeList#getName(int) + */ + public String getName (int i) + { + if (i < 0) { + return null; + } + try { + return (String)names.elementAt(i); + } catch (ArrayIndexOutOfBoundsException e) { + return null; + } + } + + + /** + * Get the type of an attribute (by position). + * + * @param i The position of the attribute in the list. + * @return The attribute type as a string ("NMTOKEN" for an + * enumeration, and "CDATA" if no declaration was + * read), or null if there is no attribute at + * that position. + * @see org.xml.sax.AttributeList#getType(int) + */ + public String getType (int i) + { + if (i < 0) { + return null; + } + try { + return (String)types.elementAt(i); + } catch (ArrayIndexOutOfBoundsException e) { + return null; + } + } + + + /** + * Get the value of an attribute (by position). + * + * @param i The position of the attribute in the list. + * @return The attribute value as a string, or null if + * there is no attribute at that position. + * @see org.xml.sax.AttributeList#getValue(int) + */ + public String getValue (int i) + { + if (i < 0) { + return null; + } + try { + return (String)values.elementAt(i); + } catch (ArrayIndexOutOfBoundsException e) { + return null; + } + } + + + /** + * Get the type of an attribute (by name). + * + * @param name The attribute name. + * @return The attribute type as a string ("NMTOKEN" for an + * enumeration, and "CDATA" if no declaration was + * read). + * @see org.xml.sax.AttributeList#getType(java.lang.String) + */ + public String getType (String name) + { + return getType(names.indexOf(name)); + } + + + /** + * Get the value of an attribute (by name). + * + * @param name The attribute name. + * @see org.xml.sax.AttributeList#getValue(java.lang.String) + */ + public String getValue (String name) + { + return getValue(names.indexOf(name)); + } + + + + //////////////////////////////////////////////////////////////////// + // Internal state. + //////////////////////////////////////////////////////////////////// + + Vector names = new Vector(); + Vector types = new Vector(); + Vector values = new Vector(); + +} + +// end of AttributeListImpl.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/LocatorImpl.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/LocatorImpl.java new file mode 100644 index 000000000..e5963f620 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/LocatorImpl.java @@ -0,0 +1,214 @@ +// SAX default implementation for Locator. +// http://www.saxproject.org +// No warranty; no copyright -- use this as you will. +// $Id: LocatorImpl.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.helpers; + +import org.xml.sax.Locator; + + +/** + * Provide an optional convenience implementation of Locator. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This class is available mainly for application writers, who + * can use it to make a persistent snapshot of a locator at any + * point during a document parse:
+ * + *+ * Locator locator; + * Locator startloc; + * + * public void setLocator (Locator locator) + * { + * // note the locator + * this.locator = locator; + * } + * + * public void startDocument () + * { + * // save the location of the start of the document + * // for future use. + * Locator startloc = new LocatorImpl(locator); + * } + *+ * + *
Normally, parser writers will not use this class, since it + * is more efficient to provide location information only when + * requested, rather than constantly updating a Locator object.
+ * + * @since SAX 1.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + * @see org.xml.sax.Locator Locator + */ +public class LocatorImpl implements Locator +{ + + + /** + * Zero-argument constructor. + * + *This will not normally be useful, since the main purpose + * of this class is to make a snapshot of an existing Locator.
+ */ + public LocatorImpl () + { + } + + + /** + * Copy constructor. + * + *Create a persistent copy of the current state of a locator. + * When the original locator changes, this copy will still keep + * the original values (and it can be used outside the scope of + * DocumentHandler methods).
+ * + * @param locator The locator to copy. + */ + public LocatorImpl (Locator locator) + { + setPublicId(locator.getPublicId()); + setSystemId(locator.getSystemId()); + setLineNumber(locator.getLineNumber()); + setColumnNumber(locator.getColumnNumber()); + } + + + + //////////////////////////////////////////////////////////////////// + // Implementation of org.xml.sax.Locator + //////////////////////////////////////////////////////////////////// + + + /** + * Return the saved public identifier. + * + * @return The public identifier as a string, or null if none + * is available. + * @see org.xml.sax.Locator#getPublicId + * @see #setPublicId + */ + public String getPublicId () + { + return publicId; + } + + + /** + * Return the saved system identifier. + * + * @return The system identifier as a string, or null if none + * is available. + * @see org.xml.sax.Locator#getSystemId + * @see #setSystemId + */ + public String getSystemId () + { + return systemId; + } + + + /** + * Return the saved line number (1-based). + * + * @return The line number as an integer, or -1 if none is available. + * @see org.xml.sax.Locator#getLineNumber + * @see #setLineNumber + */ + public int getLineNumber () + { + return lineNumber; + } + + + /** + * Return the saved column number (1-based). + * + * @return The column number as an integer, or -1 if none is available. + * @see org.xml.sax.Locator#getColumnNumber + * @see #setColumnNumber + */ + public int getColumnNumber () + { + return columnNumber; + } + + + + //////////////////////////////////////////////////////////////////// + // Setters for the properties (not in org.xml.sax.Locator) + //////////////////////////////////////////////////////////////////// + + + /** + * Set the public identifier for this locator. + * + * @param publicId The new public identifier, or null + * if none is available. + * @see #getPublicId + */ + public void setPublicId (String publicId) + { + this.publicId = publicId; + } + + + /** + * Set the system identifier for this locator. + * + * @param systemId The new system identifier, or null + * if none is available. + * @see #getSystemId + */ + public void setSystemId (String systemId) + { + this.systemId = systemId; + } + + + /** + * Set the line number for this locator (1-based). + * + * @param lineNumber The line number, or -1 if none is available. + * @see #getLineNumber + */ + public void setLineNumber (int lineNumber) + { + this.lineNumber = lineNumber; + } + + + /** + * Set the column number for this locator (1-based). + * + * @param columnNumber The column number, or -1 if none is available. + * @see #getColumnNumber + */ + public void setColumnNumber (int columnNumber) + { + this.columnNumber = columnNumber; + } + + + + //////////////////////////////////////////////////////////////////// + // Internal state. + //////////////////////////////////////////////////////////////////// + + private String publicId; + private String systemId; + private int lineNumber; + private int columnNumber; + +} + +// end of LocatorImpl.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/NamespaceSupport.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/NamespaceSupport.java new file mode 100644 index 000000000..405c52d28 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/NamespaceSupport.java @@ -0,0 +1,824 @@ +// NamespaceSupport.java - generic Namespace support for SAX. +// http://www.saxproject.org +// Written by David Megginson +// This class is in the Public Domain. NO WARRANTY! +// $Id: NamespaceSupport.java 226184 2005-04-08 10:53:24Z neeraj $ + +package org.xml.sax.helpers; + +import java.util.EmptyStackException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + + +/** + * Encapsulate Namespace logic for use by applications using SAX, + * or internally by SAX drivers. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This class encapsulates the logic of Namespace processing: it + * tracks the declarations currently in force for each context and + * automatically processes qualified XML names into their Namespace + * parts; it can also be used in reverse for generating XML qnames + * from Namespaces.
+ * + *Namespace support objects are reusable, but the reset method + * must be invoked between each session.
+ * + *Here is a simple session:
+ * + *+ * String parts[] = new String[3]; + * NamespaceSupport support = new NamespaceSupport(); + * + * support.pushContext(); + * support.declarePrefix("", "http://www.w3.org/1999/xhtml"); + * support.declarePrefix("dc", "http://www.purl.org/dc#"); + * + * parts = support.processName("p", parts, false); + * System.out.println("Namespace URI: " + parts[0]); + * System.out.println("Local name: " + parts[1]); + * System.out.println("Raw name: " + parts[2]); + * + * parts = support.processName("dc:title", parts, false); + * System.out.println("Namespace URI: " + parts[0]); + * System.out.println("Local name: " + parts[1]); + * System.out.println("Raw name: " + parts[2]); + * + * support.popContext(); + *+ * + *
Note that this class is optimized for the use case where most + * elements do not contain Namespace declarations: if the same + * prefix/URI mapping is repeated for each context (for example), this + * class will be somewhat less efficient.
+ * + *Although SAX drivers (parsers) may choose to use this class to
+ * implement namespace handling, they are not required to do so.
+ * Applications must track namespace information themselves if they
+ * want to use namespace information.
+ *
+ * @since SAX 2.0
+ * @author David Megginson
+ * @version 2.0.1 (sax2r2)
+ */
+public class NamespaceSupport
+{
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Constants.
+ ////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * The XML Namespace URI as a constant.
+ * The value is http://www.w3.org/XML/1998/namespace
+ * as defined in the "Namespaces in XML" * recommendation.
+ *
+ *
This is the Namespace URI that is automatically mapped + * to the "xml" prefix.
+ */ + public final static String XMLNS = + "http://www.w3.org/XML/1998/namespace"; + + + /** + * The namespace declaration URI as a constant. + * The value ishttp://www.w3.org/xmlns/2000/
, as defined
+ * in a backwards-incompatible erratum to the "Namespaces in XML"
+ * recommendation. Because that erratum postdated SAX2, SAX2 defaults
+ * to the original recommendation, and does not normally use this URI.
+ *
+ *
+ * This is the Namespace URI that is optionally applied to + * xmlns and xmlns:* attributes, which are used to + * declare namespaces.
+ * + * @since SAX 2.1alpha + * @see #setNamespaceDeclUris + * @see #isNamespaceDeclUris + */ + public final static String NSDECL = + "http://www.w3.org/xmlns/2000/"; + + + /** + * An empty enumeration. + */ + private final static Enumeration EMPTY_ENUMERATION = + new Vector().elements(); + + + //////////////////////////////////////////////////////////////////// + // Constructor. + //////////////////////////////////////////////////////////////////// + + + /** + * Create a new Namespace support object. + */ + public NamespaceSupport () + { + reset(); + } + + + + //////////////////////////////////////////////////////////////////// + // Context management. + //////////////////////////////////////////////////////////////////// + + + /** + * Reset this Namespace support object for reuse. + * + *It is necessary to invoke this method before reusing the + * Namespace support object for a new session. If namespace + * declaration URIs are to be supported, that flag must also + * be set to a non-default value. + *
+ * + * @see #setNamespaceDeclUris + */ + public void reset () + { + contexts = new Context[32]; + namespaceDeclUris = false; + contextPos = 0; + contexts[contextPos] = currentContext = new Context(); + currentContext.declarePrefix("xml", XMLNS); + } + + + /** + * Start a new Namespace context. + * The new context will automatically inherit + * the declarations of its parent context, but it will also keep + * track of which declarations were made within this context. + * + *Event callback code should start a new context once per element. + * This means being ready to call this in either of two places. + * For elements that don't include namespace declarations, the + * ContentHandler.startElement() callback is the right place. + * For elements with such a declaration, it'd done in the first + * ContentHandler.startPrefixMapping() callback. + * A boolean flag can be used to + * track whether a context has been started yet. When either of + * those methods is called, it checks the flag to see if a new context + * needs to be started. If so, it starts the context and sets the + * flag. After ContentHandler.startElement() + * does that, it always clears the flag. + * + *
Normally, SAX drivers would push a new context at the beginning + * of each XML element. Then they perform a first pass over the + * attributes to process all namespace declarations, making + * ContentHandler.startPrefixMapping() callbacks. + * Then a second pass is made, to determine the namespace-qualified + * names for all attributes and for the element name. + * Finally all the information for the + * ContentHandler.startElement() callback is available, + * so it can then be made. + * + *
The Namespace support object always starts with a base context + * already in force: in this context, only the "xml" prefix is + * declared.
+ * + * @see org.xml.sax.ContentHandler + * @see #popContext + */ + public void pushContext () + { + int max = contexts.length; + + contextPos++; + + // Extend the array if necessary + if (contextPos >= max) { + Context newContexts[] = new Context[max*2]; + System.arraycopy(contexts, 0, newContexts, 0, max); + max *= 2; + contexts = newContexts; + } + + // Allocate the context if necessary. + currentContext = contexts[contextPos]; + if (currentContext == null) { + contexts[contextPos] = currentContext = new Context(); + } + + // Set the parent, if any. + if (contextPos > 0) { + currentContext.setParent(contexts[contextPos - 1]); + } + } + + + /** + * Revert to the previous Namespace context. + * + *Normally, you should pop the context at the end of each + * XML element. After popping the context, all Namespace prefix + * mappings that were previously in force are restored.
+ * + *You must not attempt to declare additional Namespace + * prefixes after popping a context, unless you push another + * context first.
+ * + * @see #pushContext + */ + public void popContext () + { + contexts[contextPos].clear(); + contextPos--; + if (contextPos < 0) { + throw new EmptyStackException(); + } + currentContext = contexts[contextPos]; + } + + + + //////////////////////////////////////////////////////////////////// + // Operations within a context. + //////////////////////////////////////////////////////////////////// + + + /** + * Declare a Namespace prefix. All prefixes must be declared + * before they are referenced. For example, a SAX driver (parser) + * would scan an element's attributes + * in two passes: first for namespace declarations, + * then a second pass using {@link #processName processName()} to + * interpret prefixes against (potentially redefined) prefixes. + * + *This method declares a prefix in the current Namespace + * context; the prefix will remain in force until this context + * is popped, unless it is shadowed in a descendant context.
+ * + *To declare the default element Namespace, use the empty string as + * the prefix.
+ * + *Note that there is an asymmetry in this library: {@link + * #getPrefix getPrefix} will not return the "" prefix, + * even if you have declared a default element namespace. + * To check for a default namespace, + * you have to look it up explicitly using {@link #getURI getURI}. + * This asymmetry exists to make it easier to look up prefixes + * for attribute names, where the default prefix is not allowed.
+ * + * @param prefix The prefix to declare, or the empty string to + * indicate the default element namespace. This may never have + * the value "xml" or "xmlns". + * @param uri The Namespace URI to associate with the prefix. + * @return true if the prefix was legal, false otherwise + * + * @see #processName + * @see #getURI + * @see #getPrefix + */ + public boolean declarePrefix (String prefix, String uri) + { + if (prefix.equals("xml") || prefix.equals("xmlns")) { + return false; + } else { + currentContext.declarePrefix(prefix, uri); + return true; + } + } + + + /** + * Process a raw XML qualified name, after all declarations in the + * current context have been handled by {@link #declarePrefix + * declarePrefix()}. + * + *This method processes a raw XML qualified name in the + * current context by removing the prefix and looking it up among + * the prefixes currently declared. The return value will be the + * array supplied by the caller, filled in as follows:
+ * + *All of the strings in the array will be internalized. If + * the raw name has a prefix that has not been declared, then + * the return value will be null.
+ * + *Note that attribute names are processed differently than + * element names: an unprefixed element name will receive the + * default Namespace (if any), while an unprefixed attribute name + * will not.
+ * + * @param qName The XML qualified name to be processed. + * @param parts An array supplied by the caller, capable of + * holding at least three members. + * @param isAttribute A flag indicating whether this is an + * attribute name (true) or an element name (false). + * @return The supplied array holding three internalized strings + * representing the Namespace URI (or empty string), the + * local name, and the XML qualified name; or null if there + * is an undeclared prefix. + * @see #declarePrefix + * @see java.lang.String#intern */ + public String [] processName (String qName, String parts[], + boolean isAttribute) + { + String myParts[] = currentContext.processName(qName, isAttribute); + if (myParts == null) { + return null; + } else { + parts[0] = myParts[0]; + parts[1] = myParts[1]; + parts[2] = myParts[2]; + return parts; + } + } + + + /** + * Look up a prefix and get the currently-mapped Namespace URI. + * + *This method looks up the prefix in the current context. + * Use the empty string ("") for the default Namespace.
+ * + * @param prefix The prefix to look up. + * @return The associated Namespace URI, or null if the prefix + * is undeclared in this context. + * @see #getPrefix + * @see #getPrefixes + */ + public String getURI (String prefix) + { + return currentContext.getURI(prefix); + } + + + /** + * Return an enumeration of all prefixes whose declarations are + * active in the current context. + * This includes declarations from parent contexts that have + * not been overridden. + * + *Note: if there is a default prefix, it will not be + * returned in this enumeration; check for the default prefix + * using the {@link #getURI getURI} with an argument of "".
+ * + * @return An enumeration of prefixes (never empty). + * @see #getDeclaredPrefixes + * @see #getURI + */ + public Enumeration getPrefixes () + { + return currentContext.getPrefixes(); + } + + + /** + * Return one of the prefixes mapped to a Namespace URI. + * + *If more than one prefix is currently mapped to the same + * URI, this method will make an arbitrary selection; if you + * want all of the prefixes, use the {@link #getPrefixes} + * method instead.
+ * + *Note: this will never return the empty (default) prefix; + * to check for a default prefix, use the {@link #getURI getURI} + * method with an argument of "".
+ * + * @param uri the namespace URI + * @return one of the prefixes currently mapped to the URI supplied, + * or null if none is mapped or if the URI is assigned to + * the default namespace + * @see #getPrefixes(java.lang.String) + * @see #getURI + */ + public String getPrefix (String uri) + { + return currentContext.getPrefix(uri); + } + + + /** + * Return an enumeration of all prefixes for a given URI whose + * declarations are active in the current context. + * This includes declarations from parent contexts that have + * not been overridden. + * + *This method returns prefixes mapped to a specific Namespace + * URI. The xml: prefix will be included. If you want only one + * prefix that's mapped to the Namespace URI, and you don't care + * which one you get, use the {@link #getPrefix getPrefix} + * method instead.
+ * + *Note: the empty (default) prefix is never included + * in this enumeration; to check for the presence of a default + * Namespace, use the {@link #getURI getURI} method with an + * argument of "".
+ * + * @param uri The Namespace URI. + * @return An enumeration of prefixes (never empty). + * @see #getPrefix + * @see #getDeclaredPrefixes + * @see #getURI + */ + public Enumeration getPrefixes (String uri) + { + Vector prefixes = new Vector(); + Enumeration allPrefixes = getPrefixes(); + while (allPrefixes.hasMoreElements()) { + String prefix = (String)allPrefixes.nextElement(); + if (uri.equals(getURI(prefix))) { + prefixes.addElement(prefix); + } + } + return prefixes.elements(); + } + + + /** + * Return an enumeration of all prefixes declared in this context. + * + *The empty (default) prefix will be included in this + * enumeration; note that this behaviour differs from that of + * {@link #getPrefix} and {@link #getPrefixes}.
+ * + * @return An enumeration of all prefixes declared in this + * context. + * @see #getPrefixes + * @see #getURI + */ + public Enumeration getDeclaredPrefixes () + { + return currentContext.getDeclaredPrefixes(); + } + + /** + * Controls whether namespace declaration attributes are placed + * into the {@link #NSDECL NSDECL} namespace + * by {@link #processName processName()}. This may only be + * changed before any contexts have been pushed. + * + * @since SAX 2.1alpha + * + * @exception IllegalStateException when attempting to set this + * after any context has been pushed. + */ + public void setNamespaceDeclUris (boolean value) + { + if (contextPos != 0) + throw new IllegalStateException (); + if (value == namespaceDeclUris) + return; + namespaceDeclUris = value; + if (value) + currentContext.declarePrefix ("xmlns", NSDECL); + else { + contexts[contextPos] = currentContext = new Context(); + currentContext.declarePrefix("xml", XMLNS); + } + } + + /** + * Returns true if namespace declaration attributes are placed into + * a namespace. This behavior is not the default. + * + * @since SAX 2.1alpha + */ + public boolean isNamespaceDeclUris () + { return namespaceDeclUris; } + + + + //////////////////////////////////////////////////////////////////// + // Internal state. + //////////////////////////////////////////////////////////////////// + + private Context contexts[]; + private Context currentContext; + private int contextPos; + private boolean namespaceDeclUris; + + + //////////////////////////////////////////////////////////////////// + // Internal classes. + //////////////////////////////////////////////////////////////////// + + /** + * Internal class for a single Namespace context. + * + *This module caches and reuses Namespace contexts, + * so the number allocated + * will be equal to the element depth of the document, not to the total + * number of elements (i.e. 5-10 rather than tens of thousands). + * Also, data structures used to represent contexts are shared when + * possible (child contexts without declarations) to further reduce + * the amount of memory that's consumed. + *
+ */ + final class Context { + + /** + * Create the root-level Namespace context. + */ + Context () + { + copyTables(); + } + + + /** + * (Re)set the parent of this Namespace context. + * The context must either have been freshly constructed, + * or must have been cleared. + * + * @param context The parent Namespace context object. + */ + void setParent (Context parent) + { + this.parent = parent; + declarations = null; + prefixTable = parent.prefixTable; + uriTable = parent.uriTable; + elementNameTable = parent.elementNameTable; + attributeNameTable = parent.attributeNameTable; + defaultNS = parent.defaultNS; + declSeen = false; + } + + /** + * Makes associated state become collectible, + * invalidating this context. + * {@link #setParent} must be called before + * this context may be used again. + */ + void clear () + { + parent = null; + prefixTable = null; + uriTable = null; + elementNameTable = null; + attributeNameTable = null; + defaultNS = null; + } + + + /** + * Declare a Namespace prefix for this context. + * + * @param prefix The prefix to declare. + * @param uri The associated Namespace URI. + * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix + */ + void declarePrefix (String prefix, String uri) + { + // Lazy processing... +// if (!declsOK) +// throw new IllegalStateException ( +// "can't declare any more prefixes in this context"); + if (!declSeen) { + copyTables(); + } + if (declarations == null) { + declarations = new Vector(); + } + + prefix = prefix.intern(); + uri = uri.intern(); + if ("".equals(prefix)) { + if ("".equals(uri)) { + defaultNS = null; + } else { + defaultNS = uri; + } + } else { + prefixTable.put(prefix, uri); + uriTable.put(uri, prefix); // may wipe out another prefix + } + declarations.addElement(prefix); + } + + + /** + * Process an XML qualified name in this context. + * + * @param qName The XML qualified name. + * @param isAttribute true if this is an attribute name. + * @return An array of three strings containing the + * URI part (or empty string), the local part, + * and the raw name, all internalized, or null + * if there is an undeclared prefix. + * @see org.xml.sax.helpers.NamespaceSupport#processName + */ + String [] processName (String qName, boolean isAttribute) + { + String name[]; + Hashtable table; + + // Select the appropriate table. + if (isAttribute) { + table = attributeNameTable; + } else { + table = elementNameTable; + } + + // Start by looking in the cache, and + // return immediately if the name + // is already known in this content + name = (String[])table.get(qName); + if (name != null) { + return name; + } + + // We haven't seen this name in this + // context before. Maybe in the parent + // context, but we can't assume prefix + // bindings are the same. + name = new String[3]; + name[2] = qName.intern(); + int index = qName.indexOf(':'); + + + // No prefix. + if (index == -1) { + if (isAttribute) { + if (qName == "xmlns" && namespaceDeclUris) + name[0] = NSDECL; + else + name[0] = ""; + } else if (defaultNS == null) { + name[0] = ""; + } else { + name[0] = defaultNS; + } + name[1] = name[2]; + } + + // Prefix + else { + String prefix = qName.substring(0, index); + String local = qName.substring(index+1); + String uri; + if ("".equals(prefix)) { + uri = defaultNS; + } else { + uri = (String)prefixTable.get(prefix); + } + if (uri == null + || (!isAttribute && "xmlns".equals (prefix))) { + return null; + } + name[0] = uri; + name[1] = local.intern(); + } + + // Save in the cache for future use. + // (Could be shared with parent context...) + table.put(name[2], name); + return name; + } + + + /** + * Look up the URI associated with a prefix in this context. + * + * @param prefix The prefix to look up. + * @return The associated Namespace URI, or null if none is + * declared. + * @see org.xml.sax.helpers.NamespaceSupport#getURI + */ + String getURI (String prefix) + { + if ("".equals(prefix)) { + return defaultNS; + } else if (prefixTable == null) { + return null; + } else { + return (String)prefixTable.get(prefix); + } + } + + + /** + * Look up one of the prefixes associated with a URI in this context. + * + *Since many prefixes may be mapped to the same URI, + * the return value may be unreliable.
+ * + * @param uri The URI to look up. + * @return The associated prefix, or null if none is declared. + * @see org.xml.sax.helpers.NamespaceSupport#getPrefix + */ + String getPrefix (String uri) + { + if (uriTable == null) { + return null; + } else { + return (String)uriTable.get(uri); + } + } + + + /** + * Return an enumeration of prefixes declared in this context. + * + * @return An enumeration of prefixes (possibly empty). + * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes + */ + Enumeration getDeclaredPrefixes () + { + if (declarations == null) { + return EMPTY_ENUMERATION; + } else { + return declarations.elements(); + } + } + + + /** + * Return an enumeration of all prefixes currently in force. + * + *The default prefix, if in force, is not + * returned, and will have to be checked for separately.
+ * + * @return An enumeration of prefixes (never empty). + * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes + */ + Enumeration getPrefixes () + { + if (prefixTable == null) { + return EMPTY_ENUMERATION; + } else { + return prefixTable.keys(); + } + } + + + + //////////////////////////////////////////////////////////////// + // Internal methods. + //////////////////////////////////////////////////////////////// + + + /** + * Copy on write for the internal tables in this context. + * + *This class is optimized for the normal case where most + * elements do not contain Namespace declarations.
+ */ + private void copyTables () + { + if (prefixTable != null) { + prefixTable = (Hashtable)prefixTable.clone(); + } else { + prefixTable = new Hashtable(); + } + if (uriTable != null) { + uriTable = (Hashtable)uriTable.clone(); + } else { + uriTable = new Hashtable(); + } + elementNameTable = new Hashtable(); + attributeNameTable = new Hashtable(); + declSeen = true; + } + + + + //////////////////////////////////////////////////////////////// + // Protected state. + //////////////////////////////////////////////////////////////// + + Hashtable prefixTable; + Hashtable uriTable; + Hashtable elementNameTable; + Hashtable attributeNameTable; + String defaultNS = null; + + + + //////////////////////////////////////////////////////////////// + // Internal state. + //////////////////////////////////////////////////////////////// + + private Vector declarations = null; + private boolean declSeen = false; + private Context parent = null; + } +} + +// end of NamespaceSupport.java diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/NewInstance.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/NewInstance.java new file mode 100644 index 000000000..89e635810 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/NewInstance.java @@ -0,0 +1,103 @@ +// NewInstance.java - create a new instance of a class by name. +// http://www.saxproject.org +// Written by Edwin Goei, edwingo@apache.org +// and by David Brownell, dbrownell@users.sourceforge.net +// NO WARRANTY! This class is in the Public Domain. +// $Id: NewInstance.java 670295 2008-06-22 01:46:43Z mrglavas $ + +package org.xml.sax.helpers; + +/** + * Create a new instance of a class by name. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This class contains a static method for creating an instance of a + * class from an explicit class name. It tries to use the thread's context + * ClassLoader if possible and falls back to using + * Class.forName(String). It also takes into account JDK 1.2+'s + * AccessController mechanism for performing its actions.
+ * + *This code is designed to compile and run on JDK version 1.1 and later + * including versions of Java 2.
+ * + *This is not the NewInstance accompanying SAX 2.0.2; it + * represents many fixes to that code. + * + * @author Edwin Goei, David Brownell + * @version 2.0.1 (sax2r2) + */ +class NewInstance { + + // constants + + // governs whether, if we fail in finding a class even + // when given a classloader, we'll make a last-ditch attempt + // to use the current classloader. + private static final boolean DO_FALLBACK = true; + + /** + * Creates a new instance of the specified class name + * + * Package private so this code is not exposed at the API level. + */ + static Object newInstance (ClassLoader classLoader, String className) + throws ClassNotFoundException, IllegalAccessException, + InstantiationException + { + Class driverClass; + if (classLoader == null) { + // XXX Use the bootstrap ClassLoader. There is no way to + // load a class using the bootstrap ClassLoader that works + // in both JDK 1.1 and Java 2. However, this should still + // work b/c the following should be true: + // + // (cl == null) iff current ClassLoader == null + // + // Thus Class.forName(String) will use the current + // ClassLoader which will be the bootstrap ClassLoader. + driverClass = Class.forName(className); + } else { + try { + driverClass = classLoader.loadClass(className); + } catch (ClassNotFoundException x) { + if (DO_FALLBACK) { + // Fall back to current classloader + classLoader = NewInstance.class.getClassLoader(); + if (classLoader != null) { + driverClass = classLoader.loadClass(className); + } + else { + driverClass = Class.forName(className); + } + } else { + throw x; + } + } + } + Object instance = driverClass.newInstance(); + return instance; + } + + /** + * Figure out which ClassLoader to use. For JDK 1.2 and later use + * the context ClassLoader. + */ + static ClassLoader getClassLoader () + { + // Figure out which ClassLoader to use for loading the provider + // class. If there is a Context ClassLoader then use it. + ClassLoader cl = SecuritySupport.getContextClassLoader(); + if (cl == null) { + // Assert: we are on JDK 1.1 or we have no Context ClassLoader + // so use the current ClassLoader + cl = NewInstance.class.getClassLoader(); + } + return cl; + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/ParserFactory.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/ParserFactory.java new file mode 100644 index 000000000..1be1ca895 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/ParserFactory.java @@ -0,0 +1,122 @@ +//SAX parser factory. +//http://www.saxproject.org +//No warranty; no copyright -- use this as you will. +//$Id: ParserFactory.java 670295 2008-06-22 01:46:43Z mrglavas $ + +package org.xml.sax.helpers; + +import org.xml.sax.Parser; + +/** + * Java-specific class for dynamically loading SAX parsers. + * + *
+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
Note: This class is designed to work with the now-deprecated + * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use + * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.
+ * + *ParserFactory is not part of the platform-independent definition + * of SAX; it is an additional convenience class designed + * specifically for Java XML application writers. SAX applications + * can use the static methods in this class to allocate a SAX parser + * dynamically at run-time based either on the value of the + * `org.xml.sax.parser' system property or on a string containing the class + * name.
+ * + *Note that the application still requires an XML parser that + * implements SAX1.
+ * + * @deprecated This class works with the deprecated + * {@link org.xml.sax.Parser Parser} + * interface. + * @since SAX 1.0 + * @author David Megginson + * @version 2.0.1 (sax2r2) + */ +public class ParserFactory { + + + /** + * Private null constructor. + */ + private ParserFactory () + { + } + + + /** + * Create a new SAX parser using the `org.xml.sax.parser' system property. + * + *The named class must exist and must implement the + * {@link org.xml.sax.Parser Parser} interface.
+ * + * @exception java.lang.NullPointerException There is no value + * for the `org.xml.sax.parser' system property. + * @exception java.lang.ClassNotFoundException The SAX parser + * class was not found (check your CLASSPATH). + * @exception IllegalAccessException The SAX parser class was + * found, but you do not have permission to load + * it. + * @exception InstantiationException The SAX parser class was + * found but could not be instantiated. + * @exception java.lang.ClassCastException The SAX parser class + * was found and instantiated, but does not implement + * org.xml.sax.Parser. + * @see #makeParser(java.lang.String) + * @see org.xml.sax.Parser + */ + public static Parser makeParser () + throws ClassNotFoundException, + IllegalAccessException, + InstantiationException, + NullPointerException, + ClassCastException + { + String className = SecuritySupport.getSystemProperty("org.xml.sax.parser"); + if (className == null) { + throw new NullPointerException("No value for sax.parser property"); + } else { + return makeParser(className); + } + } + + + /** + * Create a new SAX parser object using the class name provided. + * + *The named class must exist and must implement the + * {@link org.xml.sax.Parser Parser} interface.
+ * + * @param className A string containing the name of the + * SAX parser class. + * @exception java.lang.ClassNotFoundException The SAX parser + * class was not found (check your CLASSPATH). + * @exception IllegalAccessException The SAX parser class was + * found, but you do not have permission to load + * it. + * @exception InstantiationException The SAX parser class was + * found but could not be instantiated. + * @exception java.lang.ClassCastException The SAX parser class + * was found and instantiated, but does not implement + * org.xml.sax.Parser. + * @see #makeParser() + * @see org.xml.sax.Parser + */ + public static Parser makeParser (String className) + throws ClassNotFoundException, + IllegalAccessException, + InstantiationException, + ClassCastException + { + return (Parser) NewInstance.newInstance ( + NewInstance.getClassLoader (), className); + } + +} + diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/SecuritySupport.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/SecuritySupport.java new file mode 100644 index 000000000..38767de76 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/SecuritySupport.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.xml.sax.helpers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; + +/** + * This class is duplicated for each JAXP subpackage so keep it in sync. + * It is package private and therefore is not exposed as part of the JAXP + * API. + * + * Security related methods that only work on J2SE 1.2 and newer. + */ +final class SecuritySupport { + + private SecuritySupport() {} + + static ClassLoader getContextClassLoader() { + return (ClassLoader) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + ClassLoader cl = null; + try { + cl = Thread.currentThread().getContextClassLoader(); + } catch (SecurityException ex) { } + return cl; + } + }); + } + + static String getSystemProperty(final String propName) { + return (String) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(propName); + } + }); + } + + static FileInputStream getFileInputStream(final File file) + throws FileNotFoundException + { + try { + return (FileInputStream) + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws FileNotFoundException { + return new FileInputStream(file); + } + }); + } catch (PrivilegedActionException e) { + throw (FileNotFoundException)e.getException(); + } + } + + static InputStream getResourceAsStream(final ClassLoader cl, + final String name) + { + return (InputStream) + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + InputStream ris; + if (cl == null) { + ris = ClassLoader.getSystemResourceAsStream(name); + } else { + ris = cl.getResourceAsStream(name); + } + return ris; + } + }); + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java new file mode 100644 index 000000000..2d3e35473 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/XMLReaderFactory.java @@ -0,0 +1,255 @@ +// XMLReaderFactory.java - factory for creating a new reader. +// http://www.saxproject.org +// Written by David Megginson +// and by David Brownell +// NO WARRANTY! This class is in the Public Domain. +// $Id: XMLReaderFactory.java 670295 2008-06-22 01:46:43Z mrglavas $ + +package org.xml.sax.helpers; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import org.xml.sax.XMLReader; +import org.xml.sax.SAXException; + + +/** + * Factory for creating an XML reader. + * + *+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + * See http://www.saxproject.org + * for further information. + *+ * + *
This class contains static methods for creating an XML reader + * from an explicit class name, or based on runtime defaults:
+ * + *+ * try { + * XMLReader myReader = XMLReaderFactory.createXMLReader(); + * } catch (SAXException e) { + * System.err.println(e.getMessage()); + * } + *+ * + *
Note to Distributions bundled with parsers:
+ * You should modify the implementation of the no-arguments
+ * createXMLReader to handle cases where the external
+ * configuration mechanisms aren't set up. That method should do its
+ * best to return a parser when one is in the class path, even when
+ * nothing bound its class name to org.xml.sax.driver
so
+ * those configuration mechanisms would see it.
This constructor prevents the class from being instantiated.
+ */ + private XMLReaderFactory () + { + } + + private static final String property = "org.xml.sax.driver"; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + + /** + * Attempt to create an XMLReader from system defaults. + * In environments which can support it, the name of the XMLReader + * class is determined by trying each these options in order, and + * using the first one which succeeds:org.xml.sax.driver
+ * has a value, that is used as an XMLReader class name. org.xml.sax.parser
system
+ * property will often be usable.) In environments such as small embedded systems, which can not + * support that flexibility, other mechanisms to determine the default + * may be used.
+ * + *Note that many Java environments allow system properties to be + * initialized on a command line. This means that in most cases + * setting a good value for that property ensures that calls to this + * method will succeed, except when security policies intervene. + * This will also maximize application portability to older SAX + * environments, with less robust implementations of this method. + *
+ * + * @return A new XMLReader. + * @exception org.xml.sax.SAXException If no default XMLReader class + * can be identified and instantiated. + * @see #createXMLReader(java.lang.String) + */ + public static XMLReader createXMLReader () + throws SAXException + { + String className = null; + ClassLoader loader = NewInstance.getClassLoader (); + + // 1. try the JVM-instance-wide system property + try { className = SecuritySupport.getSystemProperty (property); } + catch (Exception e) { /* normally fails for applets */ } + + // 2. if that fails, try META-INF/services/ + if (className == null || className.length() == 0) { + String service = "META-INF/services/" + property; + + InputStream is = null; + className = null; + + // First try the Context ClassLoader + ClassLoader cl = SecuritySupport.getContextClassLoader(); + if (cl != null) { + is = SecuritySupport.getResourceAsStream(cl, service); + + // If no provider found then try the current ClassLoader + if (is == null) { + cl = XMLReaderFactory.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, service); + } + } else { + // No Context ClassLoader or JDK 1.1 so try the current + // ClassLoader + cl = XMLReaderFactory.class.getClassLoader(); + is = SecuritySupport.getResourceAsStream(cl, service); + } + + if (is != null) { + + // Read the service provider name in UTF-8 as specified in + // the jar spec. Unfortunately this fails in Microsoft + // VJ++, which does not implement the UTF-8 + // encoding. Theoretically, we should simply let it fail in + // that case, since the JVM is obviously broken if it + // doesn't support such a basic standard. But since there + // are still some users attempting to use VJ++ for + // development, we have dropped in a fallback which makes a + // second attempt using the platform's default encoding. In + // VJ++ this is apparently ASCII, which is a subset of + // UTF-8... and since the strings we'll be reading here are + // also primarily limited to the 7-bit ASCII range (at + // least, in English versions), this should work well + // enough to keep us on the air until we're ready to + // officially decommit from VJ++. [Edited comment from + // jkesselm] + BufferedReader rd; + try { + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); + } catch (java.io.UnsupportedEncodingException e) { + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); + } + + try { + // XXX Does not handle all possible input as specified by the + // Jar Service Provider specification + className = rd.readLine(); + } + catch (Exception x) { + // No provider found + } + finally { + try { + // try to close the reader. + rd.close(); + } + // Ignore the exception. + catch (IOException exc) {} + } + } + } + + // 3. Distro-specific fallback + if (className == null) { + // BEGIN DISTRIBUTION-SPECIFIC + + // EXAMPLE: + // className = "com.example.sax.XmlReader"; + // or a $JAVA_HOME/jre/lib/*properties setting... + className = "org.apache.xerces.parsers.SAXParser"; + + // END DISTRIBUTION-SPECIFIC + } + + // do we know the XMLReader implementation class yet? + if (className != null) + return loadClass (loader, className); + + // 4. panic -- adapt any SAX1 parser + try { + return new ParserAdapter (ParserFactory.makeParser ()); + } catch (Exception e) { + throw new SAXException ("Can't create default XMLReader; " + + "is system property org.xml.sax.driver set?"); + } + } + + + /** + * Attempt to create an XML reader from a class name. + * + *Given a class name, this method attempts to load + * and instantiate the class as an XML reader.
+ * + *Note that this method will not be usable in environments where + * the caller (perhaps an applet) is not permitted to load classes + * dynamically.
+ * + * @return A new XML reader. + * @exception org.xml.sax.SAXException If the class cannot be + * loaded, instantiated, and cast to XMLReader. + * @see #createXMLReader() + */ + public static XMLReader createXMLReader (String className) + throws SAXException + { + return loadClass (NewInstance.getClassLoader (), className); + } + + private static XMLReader loadClass (ClassLoader loader, String className) + throws SAXException + { + try { + return (XMLReader) NewInstance.newInstance (loader, className); + } catch (ClassNotFoundException e1) { + throw new SAXException("SAX2 driver class " + className + + " not found", e1); + } catch (IllegalAccessException e2) { + throw new SAXException("SAX2 driver class " + className + + " found but cannot be loaded", e2); + } catch (InstantiationException e3) { + throw new SAXException("SAX2 driver class " + className + + " loaded but cannot be instantiated (no empty public constructor?)", + e3); + } catch (ClassCastException e4) { + throw new SAXException("SAX2 driver class " + className + + " does not implement XMLReader", e4); + } + } +} diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/package.html b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/package.html new file mode 100644 index 000000000..489a83007 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/helpers/package.html @@ -0,0 +1,11 @@ + + + + +This package contains "helper" classes, including +support for bootstrapping SAX-based applications. + +
See http://www.saxproject.org +for more information about SAX.
+ + diff --git a/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/package.html b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/package.html new file mode 100644 index 000000000..eafad19d7 --- /dev/null +++ b/fine-third-jdk8/xml-apis/src/main/java/org/xml/sax/package.html @@ -0,0 +1,297 @@ + + + + +This package provides the core SAX APIs. +Some SAX1 APIs are deprecated to encourage integration of +namespace-awareness into designs of new applications +and into maintenance of existing infrastructure.
+ +See http://www.saxproject.org +for more information about SAX.
+ + + One of the essential characteristics of SAX2 is that it added
+feature flags which can be used to examine and perhaps modify
+parser modes, in particular modes such as validation.
+Since features are identified by (absolute) URIs, anyone
+can define such features.
+Currently defined standard feature URIs have the prefix
+http://xml.org/sax/features/
before an identifier such as
+validation
. Turn features on or off using
+setFeature. Those standard identifiers are:
Feature ID | +Access | +Default | +Description | +
---|---|---|---|
external-general-entities | +read/write | +unspecified | +Reports whether this parser processes external + general entities; always true if validating. + | +
external-parameter-entities | +read/write | +unspecified | +Reports whether this parser processes external + parameter entities; always true if validating. + | +
is-standalone | +(parsing) read-only, (not parsing) none | +not applicable | +May be examined only during a parse, after the + startDocument() callback has been completed; read-only. + The value is true if the document specified standalone="yes" in + its XML declaration, and otherwise is false. + | +
lexical-handler/parameter-entities | +read/write | +unspecified | +A value of "true" indicates that the LexicalHandler will report + the beginning and end of parameter entities. + | +
namespaces | +read/write | +true | +A value of "true" indicates namespace URIs and unprefixed local names + for element and attribute names will be available. + | +
namespace-prefixes | +read/write | +false | +A value of "true" indicates that XML qualified names (with prefixes) and + attributes (including xmlns* attributes) will be available. + | +
resolve-dtd-uris | +read/write | +true | + A value of "true" indicates that system IDs in declarations will
+ be absolutized (relative to their base URIs) before reporting.
+ (That is the default behavior for all SAX2 XML parsers.)
+ A value of "false" indicates those IDs will not be absolutized;
+ parsers will provide the base URI from
+ Locator.getSystemId().
+ This applies to system IDs passed in
|
+
string-interning | +read/write | +unspecified | +Has a value of "true" if all XML names (for elements, prefixes, + attributes, entities, notations, and local names), + as well as Namespace URIs, will have been interned + using java.lang.String.intern. This supports fast + testing of equality/inequality against string constants, + rather than forcing slower calls to String.equals(). + | +
unicode-normalization-checking | +read/write | +false | +Controls whether the parser reports Unicode normalization + errors as described in section 2.13 and Appendix B of the + XML 1.1 Recommendation. If true, Unicode normalization + errors are reported using the ErrorHandler.error() callback. + Such errors are not fatal in themselves (though, obviously, + other Unicode-related encoding errors may be). + | +
use-attributes2 | +read-only | +not applicable | +Returns "true" if the Attributes objects passed by + this parser in ContentHandler.startElement() + implement the org.xml.sax.ext.Attributes2 interface. + That interface exposes additional DTD-related information, + such as whether the attribute was specified in the + source text rather than defaulted. + | +
use-locator2 | +read-only | +not applicable | +Returns "true" if the Locator objects passed by + this parser in ContentHandler.setDocumentLocator() + implement the org.xml.sax.ext.Locator2 interface. + That interface exposes additional entity information, + such as the character encoding and XML version used. + | +
use-entity-resolver2 | +read/write | +true | +Returns "true" if, when setEntityResolver is given + an object implementing the org.xml.sax.ext.EntityResolver2 interface, + those new methods will be used. + Returns "false" to indicate that those methods will not be used. + | +
validation | +read/write | +unspecified | +Controls whether the parser is reporting all validity + errors; if true, all external entities will be read. + | +
xmlns-uris | +read/write | +false | +Controls whether, when the namespace-prefixes feature + is set, the parser treats namespace declaration attributes as + being in the http://www.w3.org/2000/xmlns/ namespace. + By default, SAX2 conforms to the original "Namespaces in XML" + Recommendation, which explicitly states that such attributes are + not in any namespace. + Setting this optional flag to "true" makes the SAX2 events conform to + a later backwards-incompatible revision of that recommendation, + placing those attributes in a namespace. + | +
xml-1.1 | +read-only | +not applicable | +Returns "true" if the parser supports both XML 1.1 and XML 1.0. + Returns "false" if the parser supports only XML 1.0. + | +
Support for the default values of the +namespaces and namespace-prefixes +properties is required. +Support for any other feature flags is entirely optional. +
+ +For default values not specified by SAX2, +each XMLReader implementation specifies its default, +or may choose not to expose the feature flag. +Unless otherwise specified here, +implementations may support changing current values +of these standard feature flags, but not while parsing. +
+ + For parser interface characteristics that are described
+as objects, a separate namespace is defined. The
+objects in this namespace are again identified by URI, and
+the standard property URIs have the prefix
+http://xml.org/sax/properties/
before an identifier such as
+lexical-handler
or
+dom-node
. Manage those properties using
+setProperty(). Those identifiers are:
Property ID | +Description | +
---|---|
declaration-handler | +Used to see most DTD declarations except those treated + as lexical ("document element name is ...") or which are + mandatory for all SAX parsers (DTDHandler). + The Object must implement org.xml.sax.ext.DeclHandler. + | +
document-xml-version | +May be examined only during a parse, after the startDocument() + callback has been completed; read-only. This property is a + literal string describing the actual XML version of the document, + such as "1.0" or "1.1". + | +
dom-node | +For "DOM Walker" style parsers, which ignore their + parser.parse() parameters, this is used to + specify the DOM (sub)tree being walked by the parser. + The Object must implement the + org.w3c.dom.Node interface. + | +
lexical-handler | +Used to see some syntax events that are essential in some + applications: comments, CDATA delimiters, selected general + entity inclusions, and the start and end of the DTD + (and declaration of document element name). + The Object must implement org.xml.sax.ext.LexicalHandler. + | +
xml-string | +Readable only during a parser callback, this exposes a TBS + chunk of characters responsible for the current event. | +
All of these standard properties are optional; +XMLReader implementations need not support them. +
+ + \ No newline at end of file