Package javax.xml.stream.events

Examples of javax.xml.stream.events.Attribute


    protected abstract XMLEventReader getChildEventReader();

    public final Iterator<QName> getAllAttributes() {
        List<QName> result = new LinkedList<QName>();
        for (Iterator iterator = getStartElement().getAttributes(); iterator.hasNext();) {
            Attribute attribute = (Attribute) iterator.next();
            result.add(attribute.getName());
        }
        return result.iterator();
    }
View Full Code Here


        }
        return result.iterator();
    }

    public final String getAttributeValue(QName name) {
        Attribute attribute = getStartElement().getAttributeByName(name);
        return attribute != null ? attribute.getValue() : null;
    }
View Full Code Here

    }

    public final void removeAttribute(QName name) {
        List<Attribute> newAttributes = new LinkedList<Attribute>();
        for (Iterator iterator = getStartElement().getAttributes(); iterator.hasNext();) {
            Attribute attribute = (Attribute) iterator.next();
            if (!name.equals(attribute.getName())) {
                newAttributes.add(attribute);
            }
        }
        StartElement oldStartElement = getStartElement();
        this.startElement = getEventFactory().createStartElement(oldStartElement.getName(), newAttributes.iterator(),
View Full Code Here

    }

    public final void addAttribute(QName name, String value) {
        List<Attribute> newAttributes = new LinkedList<Attribute>();
        for (Iterator iterator = getStartElement().getAttributes(); iterator.hasNext();) {
            Attribute attribute = (Attribute) iterator.next();
            newAttributes.add(attribute);
        }
        Attribute newAttribute = getEventFactory().createAttribute(name, value);
        newAttributes.add(newAttribute);
        StartElement oldStartElement = getStartElement();
        this.startElement = getEventFactory().createStartElement(oldStartElement.getName(), newAttributes.iterator(),
                oldStartElement.getNamespaces());
    }
View Full Code Here

        }
    }
    private static void writeAttributeEvent(XMLEvent event, XMLStreamWriter writer)
        throws XMLStreamException {
       
        Attribute attr = (Attribute)event;
        QName name = attr.getName();
        String nsURI = name.getNamespaceURI();
        String localName = name.getLocalPart();
        String prefix = name.getPrefix();
        String value = attr.getValue();

        if (prefix != null) {
            writer.writeAttribute(prefix, nsURI, localName, value);
        } else if (nsURI != null) {
            writer.writeAttribute(nsURI, localName, value);
View Full Code Here

               Map<String, String> attr = new HashMap<String, String>();

               Iterator attributes = startElement.getAttributes();
               while (attributes.hasNext())
               {
                  Attribute attribute = (Attribute)attributes.next();
                  attr.put(attribute.getName().getLocalPart(), attribute.getValue());
               }

               String localName = startElement.getName().getLocalPart();
               if (localName.equals(REFERENCE_ELEMENT))
               {
View Full Code Here

        return false;
      }

      boolean matches = true;
      for (final AttributeEntry entry : tag) {
        Attribute attr = element.getAttributeByName(QName.valueOf(entry.getKey()));
        if (attr == null || !attr.getValue().equals(entry.getValue())) {
          matches = false;
          break;
        }
      }
View Full Code Here

    final Class jaxbTarget;

    final String elementName = event.asStartElement().getName().getLocalPart();

    if ( "entity-mappings".equals( elementName ) ) {
      final Attribute attribute = event.asStartElement().getAttributeByName( ORM_VERSION_ATTRIBUTE_QNAME );
      final String explicitVersion = attribute == null ? null : attribute.getValue();
      validationSchema = resolveSupportedOrmXsd( explicitVersion );
      jaxbTarget = JaxbEntityMappings.class;
    }
    else {
      validationSchema = hbmSchema();
View Full Code Here

        }
    }
    private static void writeAttributeEvent(XMLEvent event, XMLStreamWriter writer)
        throws XMLStreamException {
       
        Attribute attr = (Attribute)event;
        QName name = attr.getName();
        String nsURI = name.getNamespaceURI();
        String localName = name.getLocalPart();
        String prefix = name.getPrefix();
        String value = attr.getValue();

        if (prefix != null) {
            writer.writeAttribute(prefix, nsURI, localName, value);
        } else if (nsURI != null) {
            writer.writeAttribute(nsURI, localName, value);
View Full Code Here

        }
    }
    private static void writeAttributeEvent(XMLEvent event, XMLStreamWriter writer)
        throws XMLStreamException {
       
        Attribute attr = (Attribute)event;
        QName name = attr.getName();
        String nsURI = name.getNamespaceURI();
        String localName = name.getLocalPart();
        String prefix = name.getPrefix();
        String value = attr.getValue();

        if (prefix != null) {
            writer.writeAttribute(prefix, nsURI, localName, value);
        } else if (nsURI != null) {
            writer.writeAttribute(nsURI, localName, value);
View Full Code Here

TOP

Related Classes of javax.xml.stream.events.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.