jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
changeset 42802 2a03abb03c06
parent 42390 4083bc2c3b5b
child 44280 d299a23c65e2
equal deleted inserted replaced
42801:b6efd9c4f416 42802:2a03abb03c06
     1 /*
     1 /*
       
     2  * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  *
     4  *
     4  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     5  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    19  *
    20  *
    20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    21  * or visit www.oracle.com if you need additional information or have any
    22  * or visit www.oracle.com if you need additional information or have any
    22  * questions.
    23  * questions.
    23  */
       
    24 
       
    25 /*
       
    26  * Copyright (c) 2009, 2015, by Oracle Corporation. All Rights Reserved.
       
    27  */
    24  */
    28 
    25 
    29 package javax.xml.stream;
    26 package javax.xml.stream;
    30 import com.sun.xml.internal.stream.events.XMLEventFactoryImpl;
    27 import com.sun.xml.internal.stream.events.XMLEventFactoryImpl;
    31 import java.util.Iterator;
    28 import java.util.Iterator;
    51   protected XMLEventFactory(){}
    48   protected XMLEventFactory(){}
    52 
    49 
    53     static final String JAXPFACTORYID = "javax.xml.stream.XMLEventFactory";
    50     static final String JAXPFACTORYID = "javax.xml.stream.XMLEventFactory";
    54     static final String DEFAULIMPL = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl";
    51     static final String DEFAULIMPL = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl";
    55 
    52 
    56 
    53    /**
    57   /**
       
    58    * Creates a new instance of the {@code XMLEventFactory} builtin
    54    * Creates a new instance of the {@code XMLEventFactory} builtin
    59    * system-default implementation.
    55    * system-default implementation.
    60    *
    56    *
    61    * @return A new instance of the {@code XMLEventFactory} builtin
    57    * @return A new instance of the {@code XMLEventFactory} builtin
    62    *         system-default implementation.
    58    *         system-default implementation.
   157    *              All newInstance methods have been replaced with corresponding
   153    *              All newInstance methods have been replaced with corresponding
   158    *              newFactory methods. The replacement {@link
   154    *              newFactory methods. The replacement {@link
   159    *              #newFactory(java.lang.String, java.lang.ClassLoader)}
   155    *              #newFactory(java.lang.String, java.lang.ClassLoader)}
   160    *              method defines no changes in behavior.
   156    *              method defines no changes in behavior.
   161    */
   157    */
       
   158   @Deprecated(since="7")
   162   public static XMLEventFactory newInstance(String factoryId,
   159   public static XMLEventFactory newInstance(String factoryId,
   163           ClassLoader classLoader)
   160           ClassLoader classLoader)
   164           throws FactoryConfigurationError {
   161           throws FactoryConfigurationError {
   165       //do not fallback if given classloader can't find the class, throw exception
   162       //do not fallback if given classloader can't find the class, throw exception
   166       return FactoryFinder.find(XMLEventFactory.class, factoryId, classLoader, null);
   163       return FactoryFinder.find(XMLEventFactory.class, factoryId, classLoader, null);
   305    * @param namespaces an optional unordered set of objects that
   302    * @param namespaces an optional unordered set of objects that
   306    * implement Namespace to add to the new StartElement, may be null
   303    * implement Namespace to add to the new StartElement, may be null
   307    * @return an instance of the requested StartElement
   304    * @return an instance of the requested StartElement
   308    */
   305    */
   309   public abstract StartElement createStartElement(QName name,
   306   public abstract StartElement createStartElement(QName name,
   310                                                   Iterator attributes,
   307                                                   Iterator<? extends Attribute> attributes,
   311                                                   Iterator namespaces);
   308                                                   Iterator<? extends Namespace> namespaces);
   312 
   309 
   313   /**
   310   /**
   314    * Create a new StartElement.  This defaults the NamespaceContext to
   311    * Create a new StartElement.  This defaults the NamespaceContext to
   315    * an empty NamespaceContext.  Querying this event for its namespaces or
   312    * an empty NamespaceContext.  Querying this event for its namespaces or
   316    * attributes will result in an empty iterator being returned.
   313    * attributes will result in an empty iterator being returned.
   339    * @return an instance of the requested StartElement
   336    * @return an instance of the requested StartElement
   340    */
   337    */
   341   public abstract StartElement createStartElement(String prefix,
   338   public abstract StartElement createStartElement(String prefix,
   342                                                   String namespaceUri,
   339                                                   String namespaceUri,
   343                                                   String localName,
   340                                                   String localName,
   344                                                   Iterator attributes,
   341                                                   Iterator<? extends Attribute> attributes,
   345                                                   Iterator namespaces
   342                                                   Iterator<? extends Namespace> namespaces
   346                                                   );
   343                                                   );
   347   /**
   344   /**
   348    * Create a new StartElement.  Namespaces can be added to this StartElement
   345    * Create a new StartElement.  Namespaces can be added to this StartElement
   349    * by passing in an Iterator that walks over a set of Namespace interfaces.
   346    * by passing in an Iterator that walks over a set of Namespace interfaces.
   350    * Attributes can be added to this StartElement by passing an iterator
   347    * Attributes can be added to this StartElement by passing an iterator
   361    * @return an instance of the requested StartElement
   358    * @return an instance of the requested StartElement
   362    */
   359    */
   363   public abstract StartElement createStartElement(String prefix,
   360   public abstract StartElement createStartElement(String prefix,
   364                                                   String namespaceUri,
   361                                                   String namespaceUri,
   365                                                   String localName,
   362                                                   String localName,
   366                                                   Iterator attributes,
   363                                                   Iterator<? extends Attribute> attributes,
   367                                                   Iterator namespaces,
   364                                                   Iterator<? extends Namespace> namespaces,
   368                                                   NamespaceContext context
   365                                                   NamespaceContext context
   369                                                   );
   366                                                   );
   370 
   367 
   371   /**
   368   /**
   372    * Create a new EndElement
   369    * Create a new EndElement
   374    * @param namespaces an optional unordered set of objects that
   371    * @param namespaces an optional unordered set of objects that
   375    * implement Namespace that have gone out of scope, may be null
   372    * implement Namespace that have gone out of scope, may be null
   376    * @return an instance of the requested EndElement
   373    * @return an instance of the requested EndElement
   377    */
   374    */
   378   public abstract EndElement createEndElement(QName name,
   375   public abstract EndElement createEndElement(QName name,
   379                                               Iterator namespaces);
   376                                               Iterator<? extends Namespace> namespaces);
   380 
   377 
   381   /**
   378   /**
   382    * Create a new EndElement
   379    * Create a new EndElement
   383    * @param namespaceUri the uri of the QName of the new StartElement
   380    * @param namespaceUri the uri of the QName of the new StartElement
   384    * @param localName the local name of the QName of the new StartElement
   381    * @param localName the local name of the QName of the new StartElement
   398    * @return an instance of the requested EndElement
   395    * @return an instance of the requested EndElement
   399    */
   396    */
   400   public abstract EndElement createEndElement(String prefix,
   397   public abstract EndElement createEndElement(String prefix,
   401                                               String namespaceUri,
   398                                               String namespaceUri,
   402                                               String localName,
   399                                               String localName,
   403                                               Iterator namespaces);
   400                                               Iterator<? extends Namespace> namespaces);
   404 
   401 
   405   /**
   402   /**
   406    * Create a Characters event, this method does not check if the content
   403    * Create a Characters event, this method does not check if the content
   407    * is all whitespace.  To create a space event use #createSpace(String)
   404    * is all whitespace.  To create a space event use #createSpace(String)
   408    * @param content the string to create
   405    * @param content the string to create