Package javax.xml.stream.events

Examples of javax.xml.stream.events.Attribute


        String uri = nameIn.getNamespaceURI();
        int len = mAttrs.size();

        boolean notInNs = (uri == null || uri.length() == 0);
        for (int i = 0; i < len; ++i) {
            Attribute attr = mAttrs.get(i);
            QName name = attr.getName();
            if (name.getLocalPart().equals(ln)) {
                String thisUri = name.getNamespaceURI();
                if (notInNs) {
                    if (thisUri == null || thisUri.length() == 0) {
                        return attr;
View Full Code Here


        try {
            StartElement startEl = reader.nextEvent().asStartElement();
            Iterator attrIter = startEl.getAttributes();
            String anySchemaType = null;
            while (attrIter.hasNext()) {
                Attribute attr = (Attribute)attrIter.next();
                QName attrName = attr.getName();
                if (attrName.getNamespaceURI().equals(XSI_NAMESPACE_URI)
                    && attrName.getLocalPart().equals("type")) {
                    anySchemaType = attr.getValue();
                    break;
                }
            }
            Characters charEl = null;
            XMLEvent event = reader.nextEvent();
View Full Code Here

        // createNamespace() doesn't work for some reason.
        // TODO: Revisit this.
        String schemaType = ((CorbaAnyHandler)obj).getSchemaType();
        QName attrName = new QName(XSI_NAMESPACE_URI,
                                   "type", XSI_PREFIX);
        Attribute attr = factory.createAttribute(attrName,
                                                 schemaType);
        QName nsName = new QName(XMLSCHEMA_NAMESPACE_URI,
                                 "namespace", XMLSCHEMA_PREFIX);
        Attribute ns = factory.createAttribute(nsName, "");
        List<Attribute> attributes = new ArrayList<Attribute>();
        attributes.add(attr);
        attributes.add(ns);

        startEl = factory.createStartElement(objName, attributes.iterator(), null);
View Full Code Here

            if (schemaType instanceof XmlSchemaAttribute) {
                QName attrName = name;
                if (!CorbaUtils.isAttributeFormQualified(serviceInfo, attrName.getNamespaceURI())) {
                    attrName = new QName("", attrName.getLocalPart());
                }
                Attribute attr = factory.createAttribute(attrName,
                                                         ((CorbaPrimitiveHandler) value).getDataFromValue());
                writer.add(attr);
            } else {
                writeObjectToStax(value, name, schemaType, writer, factory, true);
            }
        } else {
            StartElement startEl = factory.createStartElement(name, null, null);
            writer.add(startEl);
            QName nilAttr = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil");
            Attribute attr = factory.createAttribute(nilAttr, "true");
            writer.add(attr);
            EndElement endEl = factory.createEndElement(name, null);
            writer.add(endEl);
        }
    }
View Full Code Here

            if (!CorbaUtils.isElementFormQualified(serviceInfo, elName.getNamespaceURI())) {
                name = new QName("", elName.getLocalPart());
            }
            if (el.getName().equals(name)) {
                QName nilAttr = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil");
                Attribute attr = el.getAttributeByName(nilAttr);
                if (attr == null) {                
                    result = false;
                } else if (!attr.getValue().equalsIgnoreCase("true")) {
                    result = false;
                }
            }
        } else {
            throw new CorbaBindingException("Expected a element with nillable attribute: " + elName);
View Full Code Here

            StartElement el = (StartElement) evt;
            QName name = attrName;
            if (!CorbaUtils.isAttributeFormQualified(serviceInfo, attrName.getNamespaceURI())) {
                name = new QName("", attrName.getLocalPart());
            }
            Attribute attr = el.getAttributeByName(name);
            if (attr != null) {
                TypeCode tc = CorbaUtils.getTypeCode(orb, idlType, typeMaps);
                result = new CorbaPrimitiveHandler(new QName("value"), idlType, tc, null);
                result.setValueFromData(attr.getValue());
            }
        }
        return result;
    }
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

        } else {
            actorRole = WSSConstants.ATT_soap12_Role;
        }

        String actor = null;
        Attribute attribute = xmlSecStartElement.getAttributeByName(actorRole);
        if (attribute != null) {
            actor = attribute.getValue();
        }

        if (responsibleActor == null) {
            return actor == null;
        } else {
View Full Code Here

          {
            counter += 1;
            Iterator<Attribute> attributes = startElement.getAttributes();
            while (attributes.hasNext())
            {
              Attribute attribute = attributes.next();
              // if it has a FREQ attribute
              if (attribute.getName().toString().equals("FREQ"))
              {
                freq = attribute.getValue();
                break;
              }
            }
          }
          // if freq is found or in 10 observations we failed to find the FREQ attribute than
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.