feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,69 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
import javax.xml.namespace.QName;
/**
* An interface that contains information about an attribute. Attributes are reported
* as a set of events accessible from a StartElement. Other applications may report
* Attributes as first-order events, for example as the results of an XPath expression.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @see StartElement
* @since 1.6
*/
public interface Attribute extends XMLEvent {
/**
* Returns the QName for this attribute
*/
QName getName();
/**
* Gets the normalized value of this attribute
*/
public String getValue();
/**
* Gets the type of this attribute, default is
* the String "CDATA"
* @return the type as a String, default is "CDATA"
*/
public String getDTDType();
/**
* A flag indicating whether this attribute was actually
* specified in the start-tag of its element, or was defaulted from the schema.
* @return returns true if this was specified in the start element
*/
public boolean isSpecified();
}

View File

@@ -0,0 +1,76 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
/**
* This describes the interface to Characters events.
* All text events get reported as Characters events.
* Content, CData and whitespace are all reported as
* Characters events. IgnorableWhitespace, in most cases,
* will be set to false unless an element declaration of element
* content is present for the current element.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface Characters extends XMLEvent {
/**
* Get the character data of this event
*/
public String getData();
/**
* Returns true if this set of Characters
* is all whitespace. Whitespace inside a document
* is reported as CHARACTERS. This method allows
* checking of CHARACTERS events to see if they
* are composed of only whitespace characters
*/
public boolean isWhiteSpace();
/**
* Returns true if this is a CData section. If this
* event is CData its event type will be CDATA
*
* If javax.xml.stream.isCoalescing is set to true CDATA Sections
* that are surrounded by non CDATA characters will be reported
* as a single Characters event. This method will return false
* in this case.
*/
public boolean isCData();
/**
* Return true if this is ignorableWhiteSpace. If
* this event is ignorableWhiteSpace its event type will
* be SPACE.
*/
public boolean isIgnorableWhiteSpace();
}

View File

@@ -0,0 +1,45 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
/**
* An interface for comment events
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface Comment extends XMLEvent {
/**
* Return the string data of the comment, returns empty string if it
* does not exist
*/
public String getText();
}

View File

@@ -0,0 +1,74 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
import java.util.List;
/**
* This is the top level interface for events dealing with DTDs
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface DTD extends XMLEvent {
/**
* Returns the entire Document Type Declaration as a string, including
* the internal DTD subset.
* This may be null if there is not an internal subset.
* If it is not null it must return the entire
* Document Type Declaration which matches the doctypedecl
* production in the XML 1.0 specification
*/
String getDocumentTypeDeclaration();
/**
* Returns an implementation defined representation of the DTD.
* This method may return null if no representation is available.
*/
Object getProcessedDTD();
/**
* Return a List containing the notations declared in the DTD.
* This list must contain NotationDeclaration events.
* @see NotationDeclaration
* @return an unordered list of NotationDeclaration events
*/
List getNotations();
/**
* Return a List containing the general entities,
* both external and internal, declared in the DTD.
* This list must contain EntityDeclaration events.
* @see EntityDeclaration
* @return an unordered list of EntityDeclaration events
*/
List getEntities();
}

View File

@@ -0,0 +1,42 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
/**
* A marker interface for the end of the document
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface EndDocument extends XMLEvent {
/**
* No methods are defined in this interface.
*/
}

View File

@@ -0,0 +1,59 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
import java.util.Iterator;
import javax.xml.namespace.QName;
/**
* An interface for the end element event. An EndElement is reported
* for each End Tag in the document.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @see XMLEvent
* @since 1.6
*/
public interface EndElement extends XMLEvent {
/**
* Get the name of this event
* @return the qualified name of this event
*/
public QName getName();
/**
* Returns an Iterator of namespaces that have gone out
* of scope. Returns an empty iterator if no namespaces have gone
* out of scope.
* @return an Iterator over Namespace interfaces, or an
* empty iterator
*/
public Iterator getNamespaces();
}

View File

@@ -0,0 +1,80 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
/**
* An interface for handling Entity Declarations
*
* This interface is used to record and report unparsed entity declarations.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface EntityDeclaration extends XMLEvent {
/**
* The entity's public identifier, or null if none was given
* @return the public ID for this declaration or null
*/
String getPublicId();
/**
* The entity's system identifier.
* @return the system ID for this declaration or null
*/
String getSystemId();
/**
* The entity's name
* @return the name, may not be null
*/
String getName();
/**
* The name of the associated notation.
* @return the notation name
*/
String getNotationName();
/**
* The replacement text of the entity.
* This method will only return non-null
* if this is an internal entity.
* @return null or the replacment text
*/
String getReplacementText();
/**
* Get the base URI for this reference
* or null if this information is not available
* @return the base URI or null
*/
String getBaseURI();
}

View File

@@ -0,0 +1,62 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
/**
* An interface for handling Entity events.
*
* This event reports entities that have not been resolved
* and reports their replacement text unprocessed (if
* available). This event will be reported if javax.xml.stream.isReplacingEntityReferences
* is set to false. If javax.xml.stream.isReplacingEntityReferences is set to true
* entity references will be resolved transparently.
*
* Entities are handled in two possible ways:
*
* (1) If javax.xml.stream.isReplacingEntityReferences is set to true
* all entity references are resolved and reported as markup transparently.
* (2) If javax.xml.stream.isReplacingEntityReferences is set to false
* Entity references are reported as an EntityReference Event.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface EntityReference extends XMLEvent {
/**
* Return the declaration of this entity.
*/
EntityDeclaration getDeclaration();
/**
* The name of the entity
* @return the entity's name, may not be null
*/
String getName();
}

View File

@@ -0,0 +1,59 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
import javax.xml.namespace.QName;
/**
* An interface that contains information about a namespace.
* Namespaces are accessed from a StartElement.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @see StartElement
* @since 1.6
*/
public interface Namespace extends Attribute {
/**
* Gets the prefix, returns "" if this is a default
* namespace declaration.
*/
public String getPrefix();
/**
* Gets the uri bound to the prefix of this namespace
*/
public String getNamespaceURI();
/**
* returns true if this attribute declares the default namespace
*/
public boolean isDefaultNamespaceDeclaration();
}

View File

@@ -0,0 +1,58 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
/**
* An interface for handling Notation Declarations
*
* Receive notification of a notation declaration event.
* It is up to the application to record the notation for later reference,
* At least one of publicId and systemId must be non-null.
* There is no guarantee that the notation declaration
* will be reported before any unparsed entities that use it.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface NotationDeclaration extends XMLEvent {
/**
* The notation name.
*/
String getName();
/**
* The notation's public identifier, or null if none was given.
*/
String getPublicId();
/**
* The notation's system identifier, or null if none was given.
*/
String getSystemId();
}

View File

@@ -0,0 +1,52 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
/**
* An interface that describes the data found in processing instructions
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface ProcessingInstruction extends XMLEvent {
/**
* The target section of the processing instruction
*
* @return the String value of the PI or null
*/
public String getTarget();
/**
* The data section of the processing instruction
*
* @return the String value of the PI's data or null
*/
public String getData();
}

View File

@@ -0,0 +1,74 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
/**
* An interface for the start document event
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface StartDocument extends XMLEvent {
/**
* Returns the system ID of the XML data
* @return the system ID, defaults to ""
*/
public String getSystemId();
/**
* Returns the encoding style of the XML data
* @return the character encoding, defaults to "UTF-8"
*/
public String getCharacterEncodingScheme();
/**
* Returns true if CharacterEncodingScheme was set in
* the encoding declaration of the document
*/
public boolean encodingSet();
/**
* Returns if this XML is standalone
* @return the standalone state of XML, defaults to "no"
*/
public boolean isStandalone();
/**
* Returns true if the standalone attribute was set in
* the encoding declaration of the document.
*/
public boolean standaloneSet();
/**
* Returns the version of XML of this XML stream
* @return the version of XML, defaults to "1.0"
*/
public String getVersion();
}

View File

@@ -0,0 +1,117 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
import javax.xml.namespace.QName;
import javax.xml.namespace.NamespaceContext;
import java.util.Map;
import java.util.Iterator;
/**
* The StartElement interface provides access to information about
* start elements. A StartElement is reported for each Start Tag
* in the document.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface StartElement extends XMLEvent {
/**
* Get the name of this event
* @return the qualified name of this event
*/
public QName getName();
/**
* Returns an Iterator of non-namespace declared attributes declared on
* this START_ELEMENT,
* returns an empty iterator if there are no attributes. The
* iterator must contain only implementations of the javax.xml.stream.Attribute
* interface. Attributes are fundamentally unordered and may not be reported
* in any order.
*
* @return a readonly Iterator over Attribute interfaces, or an
* empty iterator
*/
public Iterator getAttributes();
/**
* Returns an Iterator of namespaces declared on this element.
* This Iterator does not contain previously declared namespaces
* unless they appear on the current START_ELEMENT.
* Therefore this list may contain redeclared namespaces and duplicate namespace
* declarations. Use the getNamespaceContext() method to get the
* current context of namespace declarations.
*
* <p>The iterator must contain only implementations of the
* javax.xml.stream.Namespace interface.
*
* <p>A Namespace isA Attribute. One
* can iterate over a list of namespaces as a list of attributes.
* However this method returns only the list of namespaces
* declared on this START_ELEMENT and does not
* include the attributes declared on this START_ELEMENT.
*
* Returns an empty iterator if there are no namespaces.
*
* @return a readonly Iterator over Namespace interfaces, or an
* empty iterator
*
*/
public Iterator getNamespaces();
/**
* Returns the attribute referred to by this name
* @param name the qname of the desired name
* @return the attribute corresponding to the name value or null
*/
public Attribute getAttributeByName(QName name);
/**
* Gets a read-only namespace context. If no context is
* available this method will return an empty namespace context.
* The NamespaceContext contains information about all namespaces
* in scope for this StartElement.
*
* @return the current namespace context
*/
public NamespaceContext getNamespaceContext();
/**
* Gets the value that the prefix is bound to in the
* context of this element. Returns null if
* the prefix is not bound in this context
* @param prefix the prefix to lookup
* @return the uri bound to the prefix or null
*/
public String getNamespaceURI(String prefix);
}

View File

@@ -0,0 +1,178 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream.events;
import java.io.Writer;
import javax.xml.namespace.QName;
/**
* This is the base event interface for handling markup events.
* Events are value objects that are used to communicate the
* XML 1.0 InfoSet to the Application. Events may be cached
* and referenced after the parse has completed.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @see javax.xml.stream.XMLEventReader
* @see Characters
* @see ProcessingInstruction
* @see StartElement
* @see EndElement
* @see StartDocument
* @see EndDocument
* @see EntityReference
* @see EntityDeclaration
* @see NotationDeclaration
* @since 1.6
*/
public interface XMLEvent extends javax.xml.stream.XMLStreamConstants {
/**
* Returns an integer code for this event.
* @see #START_ELEMENT
* @see #END_ELEMENT
* @see #CHARACTERS
* @see #ATTRIBUTE
* @see #NAMESPACE
* @see #PROCESSING_INSTRUCTION
* @see #COMMENT
* @see #START_DOCUMENT
* @see #END_DOCUMENT
* @see #DTD
*/
public int getEventType();
/**
* Return the location of this event. The Location
* returned from this method is non-volatile and
* will retain its information.
* @see javax.xml.stream.Location
*/
javax.xml.stream.Location getLocation();
/**
* A utility function to check if this event is a StartElement.
* @see StartElement
*/
public boolean isStartElement();
/**
* A utility function to check if this event is an Attribute.
* @see Attribute
*/
public boolean isAttribute();
/**
* A utility function to check if this event is a Namespace.
* @see Namespace
*/
public boolean isNamespace();
/**
* A utility function to check if this event is a EndElement.
* @see EndElement
*/
public boolean isEndElement();
/**
* A utility function to check if this event is an EntityReference.
* @see EntityReference
*/
public boolean isEntityReference();
/**
* A utility function to check if this event is a ProcessingInstruction.
* @see ProcessingInstruction
*/
public boolean isProcessingInstruction();
/**
* A utility function to check if this event is Characters.
* @see Characters
*/
public boolean isCharacters();
/**
* A utility function to check if this event is a StartDocument.
* @see StartDocument
*/
public boolean isStartDocument();
/**
* A utility function to check if this event is an EndDocument.
* @see EndDocument
*/
public boolean isEndDocument();
/**
* Returns this event as a start element event, may result in
* a class cast exception if this event is not a start element.
*/
public StartElement asStartElement();
/**
* Returns this event as an end element event, may result in
* a class cast exception if this event is not a end element.
*/
public EndElement asEndElement();
/**
* Returns this event as Characters, may result in
* a class cast exception if this event is not Characters.
*/
public Characters asCharacters();
/**
* This method is provided for implementations to provide
* optional type information about the associated event.
* It is optional and will return null if no information
* is available.
*/
public QName getSchemaType();
/**
* This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
* No indentation or whitespace should be outputted.
*
* Any user defined event type SHALL have this method
* called when being written to on an output stream.
* Built in Event types MUST implement this method,
* but implementations MAY choose not call these methods
* for optimizations reasons when writing out built in
* Events to an output stream.
* The output generated MUST be equivalent in terms of the
* infoset expressed.
*
* @param writer The writer that will output the data
* @throws XMLStreamException if there is a fatal error writing the event
*/
public void writeAsEncodedUnicode(Writer writer)
throws javax.xml.stream.XMLStreamException;
}