/** * Construct from owning element. * * @param ele * the owning ele */ public Attributes(final OMElement ele) { super(ele.getAllAttributes()); }
/** * Construct from owning element. * * @param ele * the owning ele */ public Attributes(final OMElement ele) { super(ele.getAllAttributes()); }
private void loadAttributes() { if (attributeCount == -1) { attributeCount = 0; for (Iterator it = ((OMElement)lastNode).getAllAttributes(); it.hasNext(); ) { OMAttribute attr = (OMAttribute)it.next(); if (attributeCount == attributes.length) { OMAttribute[] newAttributes = new OMAttribute[attributes.length*2]; System.arraycopy(attributes, 0, newAttributes, 0, attributes.length); attributes = newAttributes; } attributes[attributeCount] = attr; attributeCount++; } } }
public Iterator getAllAttributesAsQNames() { final Iterator attribIter = omTarget.getAllAttributes(); Collection attributesAsQNames = new ArrayList(); Attr attr; QName qname; while (attribIter.hasNext()) { attr = (Attr)attribIter.next(); //Check : attr.getLocalName() | attr.getName() qname = new QName(attr.getNamespaceURI(), attr.getName(), attr.getPrefix()); attributesAsQNames.add(qname); } return attributesAsQNames.iterator(); }
public Iterator getAllAttributesAsQNames() { final Iterator attribIter = omTarget.getAllAttributes(); Collection attributesAsQNames = new ArrayList(); Attr attr; QName qname; while (attribIter.hasNext()) { attr = (Attr)attribIter.next(); //Check : attr.getLocalName() | attr.getName() qname = new QName(attr.getNamespaceURI(), attr.getName(), attr.getPrefix()); attributesAsQNames.add(qname); } return attributesAsQNames.iterator(); }
private void writeAttributes( XMLStreamWriter writer, OMElement elem ) throws XMLStreamException { Iterator<?> attribs = elem.getAllAttributes(); while ( attribs.hasNext() ) { writeAttribute( writer, (OMAttribute) attribs.next() ); } }
/** * @param elt * @param index * @return Returns OMAttribute. */ private OMAttribute getAttribute(OMElement elt, int index) { OMAttribute returnAttrib = null; if (elt != null) { returnAttrib = (OMAttribute) getItemFromIterator(elt .getAllAttributes(), index); } return returnAttrib; }
/** * Retrieves an <code>Iterator</code> matching the <code>attribute</code> XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the attribute axis are not supported by * this object model */ public Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException { if (isElement(contextNode)) { return ((OMElement) contextNode).getAllAttributes(); } else { return JaxenConstants.EMPTY_ITERATOR; } }
@Override public Map<QName,String> getAttributes() { Map<QName,String> attributes = null; for (Iterator it = ((OMElement)node).getAllAttributes(); it.hasNext(); ) { OMAttribute attr = (OMAttribute)it.next(); if (attributes == null) { attributes = new HashMap<QName,String>(); } attributes.put(attr.getQName(), attr.getAttributeValue()); } return attributes; }
/** * Serialize attributes * * @param element * @param writer * @throws XMLStreamException * @deprecated Consider using serializeStartpart instead */ public static void serializeAttributes (OMElement element, XMLStreamWriter writer) throws XMLStreamException { Iterator attributes = element.getAllAttributes(); if (attributes != null && attributes.hasNext()) { while (attributes.hasNext()) { serializeAttribute((OMAttribute) attributes.next(), writer); } } }
HashMap<String, String> getErrorDetails(OMElement registryError) { HashMap<String, String> err = new HashMap<String, String>(); for (Iterator<OMAttribute> it=registryError.getAllAttributes(); it.hasNext(); ) { OMAttribute att = it.next(); String name = att.getLocalName(); String value = att.getAttributeValue(); err.put(name, value); } return err; }
public final Iterator<QName> getAllAttributes() { try { List<QName> results = new ArrayList<QName>(); for (Iterator<?> iterator = getAxiomElement().getAllAttributes(); iterator.hasNext();) { OMAttribute attribute = (OMAttribute) iterator.next(); results.add(attribute.getQName()); } return results.iterator(); } catch (OMException ex) { throw new AxiomSoapElementException(ex); } }
@Override public final Iterator<QName> getAllAttributes() { try { List<QName> results = new ArrayList<QName>(); for (Iterator<?> iterator = getAxiomElement().getAllAttributes(); iterator.hasNext();) { OMAttribute attribute = (OMAttribute) iterator.next(); results.add(attribute.getQName()); } return results.iterator(); } catch (OMException ex) { throw new AxiomSoapElementException(ex); } }
/** * Returns the value of an attribute of an element. Returns null * if the attribute is not found * @param omElement Element whose attrib is looked for * @param attrName name of attribute to look for * @return the attribute value */ public static String getAttribute(OMElement omElement, String attrName) { String val = null; Iterator allAttr = omElement.getAllAttributes(); while(allAttr.hasNext()){ OMAttribute attr = (OMAttribute)allAttr.next(); if (attr.getLocalName().equals(attrName)){ val = attr.getAttributeValue(); } } return val; }
@Override public final Iterator<QName> getAllAttributes() { try { List<QName> results = new ArrayList<QName>(); for (Iterator<?> iterator = getAxiomElement().getAllAttributes(); iterator.hasNext();) { OMAttribute attribute = (OMAttribute) iterator.next(); results.add(attribute.getQName()); } return results.iterator(); } catch (OMException ex) { throw new AxiomSoapElementException(ex); } }
/** * Gets the collection of attributes which are none namespace declarations for an OMElement * * @param element * @return Returns the collection of attributes which are none namespace declarations */ public Collection getAttributesWithoutNS(OMElement element) { SortedMap map = new TreeMap(); Iterator itr = element.getAllAttributes(); while (itr.hasNext()) { OMAttribute attribute = (OMAttribute) itr.next(); if (!(attribute.getLocalName().equals("xmlns") || attribute.getLocalName().startsWith("xmlns:"))) map.put(getExpandedName(attribute), attribute); } return map.values(); }
private Boolean getBoolean(OMElement items) { for (Iterator<OMAttribute> iAttr = items.getAllAttributes(); iAttr.hasNext();) { OMAttribute test = iAttr.next(); String localName = test.getLocalName(); if (localName.equals("nil")) { if (test.getAttributeValue().equals("true")) { return null; } else if (test.getAttributeValue().equals("false")) { return false; } } else { return Boolean.parseBoolean(items.getText()); } } return false; } }
@Override public final Iterator<QName> getAllAttributes() { try { List<QName> results = new ArrayList<QName>(); for (Iterator<?> iterator = getAxiomElement().getAllAttributes(); iterator.hasNext();) { OMAttribute attribute = (OMAttribute) iterator.next(); results.add(attribute.getQName()); } return results.iterator(); } catch (OMException ex) { throw new AxiomSoapElementException(ex); } }
public Map<QName, String> getAttributes(OMElement s) { Map<QName, String> mp = new HashMap<QName, String>(); Iterator<?> it = s.getAllAttributes(); while (it.hasNext()) { OMAttribute attr = (OMAttribute)it.next(); if (attr.getNamespace() == null) { mp.put(new QName("", attr.getLocalName()), attr.getAttributeValue()); } else { mp.put(new QName(attr.getNamespace().getNamespaceURI(), attr.getLocalName()), attr.getAttributeValue()); } } return mp; }
void fix_v2_ns_recursive(OMElement ele, OMNamespace ns) { ele.setNamespace(ns); for (@SuppressWarnings("unchecked") Iterator<OMAttribute> it = ele.getAllAttributes(); it.hasNext();) { OMAttribute a = it.next(); if (a.getLocalName().equals("lang")) a.setOMNamespace(MetadataSupport.xml_namespace); } for (@SuppressWarnings("unchecked") Iterator<OMElement> it = ele.getChildElements(); it.hasNext();) { OMElement child = (OMElement) it.next(); fix_v2_ns_recursive(child, MetadataSupport.ebRIMns2); } }