Package javax.xml.stream.events

Examples of javax.xml.stream.events.Attribute


  void parseStartElement()
          throws ThreddsXmlParserException
  {
    StartElement startElement = this.getNextEventIfStartElementIsMine();
    Attribute namingAuthAtt = startElement.getAttributeByName( ThreddsMetadataElementNames.ControlledVocabType_Authority );
    String namingAuth = namingAuthAtt != null ? namingAuthAtt.getValue() : null;

    String name = StaxThreddsXmlParserUtils.getCharacterContent( this.reader,
                                                                 this.elementName );
    this.selfBuilder = this.parentBuilder.addProjectName( namingAuth, name);
  }
View Full Code Here


  public org.dom4j.Attribute readAttribute(XMLEventReader reader)
      throws XMLStreamException {
    XMLEvent event = reader.peek();

    if (event.isAttribute()) {
      Attribute attr = (Attribute) reader.nextEvent();

      return createAttribute(null, attr);
    } else {
      throw new XMLStreamException("Expected Attribute event, found: "
          + event);
View Full Code Here

    Element elem = factory.createElement(elemName);

    // create attributes
    for (Iterator i = startEvent.getAttributes(); i.hasNext();) {
      Attribute attr = (Attribute) i.next();
      elem.addAttribute(createQName(attr.getName()), attr.getValue());
    }

    // create namespaces
    for (Iterator i = startEvent.getNamespaces(); i.hasNext();) {
      Namespace ns = (Namespace) i.next();
View Full Code Here

    private static void printAttributes(XMLStreamReader xmlr){
        if(xmlr.getAttributeCount()>0){
            Iterator ai = com.bea.xml.stream.XMLEventAllocatorBase.getAttributes(xmlr);
            while(ai.hasNext()){
                System.out.print(" ");
                Attribute a = (Attribute) ai.next();
                printAttribute(a);
            }
        }
    }
View Full Code Here

        writeStartElement(name.getPrefix(), name.getLocalPart(),
                          name.getNamespaceURI());
        @SuppressWarnings("unchecked")
        Iterator<Attribute> it = elem.getAttributes();
        while (it.hasNext()) {
            Attribute attr = it.next();
            name = attr.getName();
            writeAttribute(name.getPrefix(), name.getNamespaceURI(),
                           name.getLocalPart(), attr.getValue());
        }
    }
View Full Code Here

        QName name = elem.getName();
        writeStartElement(name.getLocalPart());
        @SuppressWarnings("unchecked")
        Iterator<Attribute> it = elem.getAttributes();
        while (it.hasNext()) {
            Attribute attr = it.next();
            name = attr.getName();
            writeAttribute(name.getLocalPart(), attr.getValue());
        }
    }
View Full Code Here

        // And finally, need to output attributes as well:
        @SuppressWarnings("unchecked")
        Iterator<Attribute> ait = elem.getAttributes();
        while (ait.hasNext()) {
            Attribute attr = ait.next();
            name = attr.getName();
            nsURI = name.getNamespaceURI();
            // In non-default/empty namespace?
            if (nsURI != null && nsURI.length() > 0) {
                writeAttribute(name.getPrefix(), nsURI,
                               name.getLocalPart(), attr.getValue());
            } else {
                writeAttribute(name.getLocalPart(), attr.getValue());
            }
        }
    }
View Full Code Here

        if (attrs == null || !attrs.hasNext()) {
            attrMap = null;
        } else {
            attrMap = new LinkedHashMap<QName,Attribute>();
            do {
                Attribute attr = attrs.next();
                attrMap.put(attr.getName(), attr);
            } while (attrs.hasNext());
        }

        BaseNsContext myCtxt;
        if (ns != null && ns.hasNext()) {
View Full Code Here

            }

            // How about attrs?
            if (mAttrs != null) {
                for (int i = 0, len = mAttrs.size(); i < len; ++i) {
                    Attribute attr = mAttrs.get(i);
                    // No point in adding default attributes?
                    if (attr.isSpecified()) {
                        w.write(' ');
                        attr.writeAsEncodedUnicode(w);
                    }
                }
            }

            w.write('>');
View Full Code Here

        }

        // How about attrs?
        if (mAttrs != null) {
            for (int i = 0, len = mAttrs.size(); i < len; ++i) {
                Attribute attr = mAttrs.get(i);
                // No point in adding default attributes?
                if (attr.isSpecified()) {
                    QName name = attr.getName();
                    sw.writeAttribute(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), attr.getValue());
                }
            }
        }
    }
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.