< prev index next >

src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventFactoryImpl.java

Print this page




  25 
  26 package com.sun.xml.internal.stream.events;
  27 
  28 import java.util.Iterator;
  29 import javax.xml.namespace.NamespaceContext;
  30 import javax.xml.namespace.QName;
  31 import javax.xml.stream.XMLEventFactory;
  32 import javax.xml.stream.Location;
  33 import javax.xml.stream.events.Attribute;
  34 import javax.xml.stream.events.Characters;
  35 import javax.xml.stream.events.ProcessingInstruction;
  36 import javax.xml.stream.events.Namespace;
  37 import javax.xml.stream.events.EntityDeclaration;
  38 import javax.xml.stream.events.EntityReference;
  39 import javax.xml.stream.events.StartDocument;
  40 import javax.xml.stream.events.StartElement;
  41 
  42 
  43 /**
  44  *
  45  * @author  Neeraj Bajaj, k.venugopal@sun.com
  46  */
  47 public class XMLEventFactoryImpl extends XMLEventFactory {
  48 
  49     Location location = null;
  50     /** Creates a new instance of XMLEventFactory */
  51     public XMLEventFactoryImpl() {
  52     }
  53 
  54     @Override
  55     public Attribute createAttribute(String localName, String value) {
  56         AttributeImpl attr =  new AttributeImpl(localName, value);
  57         if(location != null)attr.setLocation(location);
  58         return attr;
  59     }
  60 
  61     @Override
  62     public Attribute createAttribute(QName name, String value) {
  63         return createAttribute(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), value);
  64     }
  65 




  25 
  26 package com.sun.xml.internal.stream.events;
  27 
  28 import java.util.Iterator;
  29 import javax.xml.namespace.NamespaceContext;
  30 import javax.xml.namespace.QName;
  31 import javax.xml.stream.XMLEventFactory;
  32 import javax.xml.stream.Location;
  33 import javax.xml.stream.events.Attribute;
  34 import javax.xml.stream.events.Characters;
  35 import javax.xml.stream.events.ProcessingInstruction;
  36 import javax.xml.stream.events.Namespace;
  37 import javax.xml.stream.events.EntityDeclaration;
  38 import javax.xml.stream.events.EntityReference;
  39 import javax.xml.stream.events.StartDocument;
  40 import javax.xml.stream.events.StartElement;
  41 
  42 
  43 /**
  44  *
  45  * @author  Neeraj Bajaj, k venugopal
  46  */
  47 public class XMLEventFactoryImpl extends XMLEventFactory {
  48 
  49     Location location = null;
  50     /** Creates a new instance of XMLEventFactory */
  51     public XMLEventFactoryImpl() {
  52     }
  53 
  54     @Override
  55     public Attribute createAttribute(String localName, String value) {
  56         AttributeImpl attr =  new AttributeImpl(localName, value);
  57         if(location != null)attr.setLocation(location);
  58         return attr;
  59     }
  60 
  61     @Override
  62     public Attribute createAttribute(QName name, String value) {
  63         return createAttribute(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), value);
  64     }
  65 


< prev index next >