001 /* 002 ** 003 ** Licensed to the Apache Software Foundation (ASF) under one 004 ** or more contributor license agreements. See the NOTICE file 005 ** distributed with this work for additional information 006 ** regarding copyright ownership. The ASF licenses this file 007 ** to you under the Apache License, Version 2.0 (the 008 ** "License"); you may not use this file except in compliance 009 ** with the License. You may obtain a copy of the License at 010 ** 011 ** http://www.apache.org/licenses/LICENSE-2.0 012 ** 013 ** Unless required by applicable law or agreed to in writing, 014 ** software distributed under the License is distributed on an 015 ** "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 ** KIND, either express or implied. See the License for the 017 ** specific language governing permissions and limitations 018 ** under the License. 019 */ 020 package javax.xml.stream; 021 022 import java.util.Iterator; 023 024 import javax.xml.namespace.NamespaceContext; 025 import javax.xml.stream.events.ProcessingInstruction; 026 import javax.xml.namespace.QName; 027 import javax.xml.stream.events.Characters; 028 import javax.xml.stream.events.Comment; 029 import javax.xml.stream.events.DTD; 030 import javax.xml.stream.events.EndElement; 031 import javax.xml.stream.events.EntityDeclaration; 032 import javax.xml.stream.events.Namespace; 033 import javax.xml.stream.events.Attribute; 034 import javax.xml.stream.events.EndDocument; 035 import javax.xml.stream.events.EntityReference; 036 import javax.xml.stream.events.StartDocument; 037 import javax.xml.stream.events.StartElement; 038 039 public abstract class XMLEventFactory { 040 041 protected XMLEventFactory() { 042 } 043 044 public static XMLEventFactory newInstance() 045 throws FactoryConfigurationError { 046 return (XMLEventFactory)FactoryLocator.locate("javax.xml.stream.XMLEventFactory", "com.ctc.wstx.stax.WstxEventFactory"); 047 } 048 049 public static XMLEventFactory newInstance(String factoryId, 050 ClassLoader classLoader) throws FactoryConfigurationError { 051 return (XMLEventFactory)FactoryLocator.locate(factoryId, "com.ctc.wstx.stax.WstxEventFactory", classLoader); 052 } 053 054 public abstract void setLocation(Location location); 055 056 public abstract Attribute createAttribute(QName name, String value); 057 058 public abstract Attribute createAttribute(String localName, String value); 059 060 public abstract Attribute createAttribute(String prefix, 061 String namespaceURI, String localName, String value); 062 063 public abstract Namespace createNamespace(String namespaceUri); 064 065 public abstract Namespace createNamespace(String prefix, String namespaceUri); 066 067 public abstract StartElement createStartElement(QName name, 068 Iterator attributes, Iterator namespaces); 069 070 public abstract StartElement createStartElement(String prefix, 071 String namespaceUri, String localName); 072 073 public abstract StartElement createStartElement(String prefix, 074 String namespaceUri, String localName, Iterator attributes, 075 Iterator namespaces); 076 077 public abstract StartElement createStartElement(String prefix, 078 String namespaceUri, String localName, Iterator attributes, 079 Iterator namespaces, NamespaceContext context); 080 081 public abstract EndElement createEndElement(QName name, Iterator namespaces); 082 083 public abstract EndElement createEndElement(String prefix, 084 String namespaceUri, String localName); 085 086 public abstract EndElement createEndElement(String prefix, 087 String namespaceUri, String localName, Iterator namespaces); 088 089 public abstract Characters createCharacters(String content); 090 091 public abstract Characters createCData(String content); 092 093 public abstract Characters createSpace(String content); 094 095 public abstract Characters createIgnorableSpace(String content); 096 097 public abstract StartDocument createStartDocument(); 098 099 public abstract StartDocument createStartDocument(String encoding); 100 101 public abstract StartDocument createStartDocument(String encoding, 102 String version); 103 104 public abstract StartDocument createStartDocument(String encoding, 105 String version, boolean standalone); 106 107 public abstract EndDocument createEndDocument(); 108 109 public abstract EntityReference createEntityReference(String name, 110 EntityDeclaration declaration); 111 112 public abstract Comment createComment(String text); 113 114 public abstract ProcessingInstruction createProcessingInstruction( 115 String target, String data); 116 117 public abstract DTD createDTD(String dtd); 118 }