public QName getQName() { return attr.getQName(); }
/** * Retrieves the namespace URI of the given attribute node. * * @param object the context attribute node * @return Returns the namespace URI of the attribute node. */ public String getAttributeNamespaceUri(Object object) { OMAttribute attr = (OMAttribute) object; return attr.getQName().getNamespaceURI(); }
private String getOMAttributeNsURI() { String nsURI = omattr.getQName().getNamespaceURI(); if (nsURI == null || "".equals(nsURI)) { return null; } return nsURI; }
private String getOMAttributePrefix() { String prefix = omattr.getQName().getPrefix(); if (prefix == null || "".equals(prefix)){ return null; } return prefix; }
private String getOMAttributeName(){ QName qn = omattr.getQName(); if (qn.getPrefix() == null || "".equals(qn.getPrefix())) { return qn.getLocalPart(); } return qn.getPrefix() + ":" + qn.getLocalPart(); }
public List<QName> getAttributes() { List<QName> list = new ArrayList<QName>(); for (Iterator i = getAllAttributes(); i.hasNext();) { OMAttribute attr = (OMAttribute)i.next(); list.add(attr.getQName()); } return Collections.unmodifiableList(list); }
QName getAttributeName(int i) { if (currentEvent == START_ELEMENT) { // TODO: use the core model without loosing the optimization return ((OMAttribute)getAttribute(i)).getQName(); } else { throw new IllegalStateException( "attribute count accessed in illegal event!"); } }
/** * Static method to test whether an <code>OMElement</code> is recognized * as a ServiceName element. If this method returns <code>true</code> then * {@link #fromOM(OMAttribute)} is guaranteed not to throw an exception. * * @param omAttribute the <code>OMElement</code> to test. * @return <code>true</code> if the element is a ServiceName element, * <code>false</code> otherwise. */ public static boolean isWSDLLocationAttribute(OMAttribute omAttribute) { boolean result = false; QName qname = omAttribute.getQName(); if (WSDLI.equals(qname) || FINAL_WSDLI.equals(qname)) result = true; if (log.isDebugEnabled()) { log.debug("isWSDLLocationAttribute: OMAttribute QName = " + qname + ", result = " + result); } return result; } }
QName getAttributeName(int i) { if (currentEvent == START_ELEMENT) { // TODO: use the core model without loosing the optimization return ((OMAttribute)getAttribute(i)).getQName(); } else { throw new IllegalStateException( "attribute count accessed in illegal event!"); } }
/** * Static method to test whether an <code>OMElement</code> is recognized * as a ServiceName element. If this method returns <code>true</code> then * {@link #fromOM(OMAttribute)} is guaranteed not to throw an exception. * * @param omAttribute the <code>OMElement</code> to test. * @return <code>true</code> if the element is a ServiceName element, * <code>false</code> otherwise. */ public static boolean isWSDLLocationAttribute(OMAttribute omAttribute) { boolean result = false; QName qname = omAttribute.getQName(); if (WSDLI.equals(qname) || FINAL_WSDLI.equals(qname)) result = true; if (log.isDebugEnabled()) { log.debug("isWSDLLocationAttribute: OMAttribute QName = " + qname + ", result = " + result); } return result; } }
@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; }
public List<QName> getExtensionAttributes() { List<QName> list = new ArrayList<QName>(); for (Iterator i = getAllAttributes(); i.hasNext();) { OMAttribute attr = (OMAttribute)i.next(); String namespace = (attr.getNamespace() != null) ? attr.getNamespace().getNamespaceURI() : ""; if (!namespace.equals(getNamespace().getNamespaceURI()) && !namespace.equals("")) list.add(attr.getQName()); } return Collections.unmodifiableList(list); }
@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 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); } }
QName qname = omAttribute.getQName(); if (WSDLI.equals(qname) || FINAL_WSDLI.equals(qname)) { String value = omAttribute.getAttributeValue().trim();
@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); } }
@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); } }
/** * @param i * @return Returns QName. * @see javax.xml.stream.XMLStreamReader#getAttributeName */ public QName getAttributeName(int i) { QName returnQName = null; if (parser != null) { returnQName = parser.getAttributeName(i); } else { if (isStartElement() || (currentEvent == ATTRIBUTE)) { returnQName = getAttribute((OMElement) lastNode, i).getQName(); } else { throw new IllegalStateException( "attribute count accessed in illegal event!"); } } return returnQName; }
/** * @param i * @return Returns QName. * @see javax.xml.stream.XMLStreamReader#getAttributeName */ public QName getAttributeName(int i) { QName returnQName = null; if (parser != null) { returnQName = parser.getAttributeName(i); } else { if (isStartElement()) { loadAttributes(); returnQName = attributes[i].getQName(); } else { throw new IllegalStateException( "attribute count accessed in illegal event!"); } } return returnQName; }
protected static void test(Class sbf, Class rbf) throws Exception { XSLTMediator transformMediator = new XSLTMediator(); Value xsltKey = new Value("xslt-key"); transformMediator.setXsltKey(xsltKey); MessageContext mc = new TestMessageContextBuilder() .addEntry("xslt-key", XSLTMediator.class.getResource("identity.xslt")) .setRequireAxis2MessageContext(true).build(); OMFactory factory = OMAbstractFactory.getOMFactory(); OMElement orgRoot = factory.createOMElement(new QName("root")); OMElement orgElement = factory.createOMElement(new QName("urn:mynamespace", "element1")); orgElement.setText("test"); OMAttribute orgAttribute = orgElement.addAttribute("att", "testValue", null); orgRoot.addChild(orgElement); mc.getEnvelope().getBody().addChild(orgRoot); transformMediator.addAttribute(XSLTMediator.SOURCE_BUILDER_FACTORY, sbf.getName()); transformMediator.addAttribute(XSLTMediator.RESULT_BUILDER_FACTORY, rbf.getName()); transformMediator.mediate(mc); OMElement root = mc.getEnvelope().getBody().getFirstElement(); assertEquals(orgRoot.getQName(), root.getQName()); OMElement element = (OMElement)root.getFirstOMChild(); assertEquals(orgElement.getQName(), element.getQName()); assertEquals(orgElement.getText(), element.getText()); assertEquals(orgAttribute, orgElement.getAttribute(orgAttribute.getQName())); assertNull(element.getNextOMSibling()); }