Search in sources :

Example 6 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestCreateOMAttribute method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMAttribute attr = factory.createOMAttribute("attr", null, "value");
    assertTrue(attr instanceof Attr);
    Attr domAttr = (Attr) attr;
    assertNull(domAttr.getOwnerElement());
    assertNotNull(domAttr.getOwnerDocument());
    assertEquals("attr", domAttr.getLocalName());
    assertEquals("value", domAttr.getValue());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMAttribute(org.apache.axiom.om.OMAttribute) Attr(org.w3c.dom.Attr)

Example 7 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestGetAttributeTypeDefault method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMNamespace ns = factory.createOMNamespace("http://www.me.com", "axiom");
    OMAttribute at = factory.createOMAttribute("id", ns, "value");
    assertEquals("CDATA", at.getAttributeType());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMNamespace(org.apache.axiom.om.OMNamespace) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 8 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestGetNamespaceURIWithoutNamespace method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMAttribute attr = factory.createOMAttribute("name", null, "value");
    assertNull(attr.getNamespaceURI());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 9 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestHasNameWithoutNamespace method runTest.

@Override
protected void runTest() throws Throwable {
    OMAttribute attr = metaFactory.getOMFactory().createOMAttribute("name", null, "value");
    assertTrue(attr.hasName(new QName("name")));
    assertFalse(attr.hasName(new QName("urn:test", "name")));
}
Also used : QName(javax.xml.namespace.QName) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 10 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestSetLang method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPFaultText faultText = soapFactory.createSOAPFaultText();
    faultText.setLang("en");
    assertEquals("SOAP Fault Text Test : - After calling setLang method, Lang attribute value mismatch", "en", faultText.getLang());
    OMAttribute langAttribute = faultText.getAllAttributes().next();
    assertEquals("SOAP Fault Text Test : - After calling setLang method, Lang attribute local name mismaatch", SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, langAttribute.getLocalName());
    assertEquals("SOAP Fault Text Test : - After calling setLang method, Lang attribute namespace prefix mismatch", SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX, langAttribute.getNamespace().getPrefix());
    assertEquals("SOAP Fault Text Test : - After calling setLang method, Lang attribute namespace uri mismatch", SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI, langAttribute.getNamespace().getNamespaceURI());
}
Also used : SOAPFaultText(org.apache.axiom.soap.SOAPFaultText) OMAttribute(org.apache.axiom.om.OMAttribute)

Aggregations

OMAttribute (org.apache.axiom.om.OMAttribute)55 OMFactory (org.apache.axiom.om.OMFactory)31 OMElement (org.apache.axiom.om.OMElement)26 OMNamespace (org.apache.axiom.om.OMNamespace)18 QName (javax.xml.namespace.QName)16 OMNode (org.apache.axiom.om.OMNode)4 OMSourcedElement (org.apache.axiom.om.OMSourcedElement)4 SOAPHeaderBlock (org.apache.axiom.soap.SOAPHeaderBlock)4 Attr (org.w3c.dom.Attr)4 StringReader (java.io.StringReader)3 OMException (org.apache.axiom.om.OMException)3 OMXMLParserWrapper (org.apache.axiom.om.OMXMLParserWrapper)3 SOAPFaultText (org.apache.axiom.soap.SOAPFaultText)3 PullOMDataSource (org.apache.axiom.ts.om.sourcedelement.util.PullOMDataSource)3 Element (org.w3c.dom.Element)3 OMDocument (org.apache.axiom.om.OMDocument)2 OMText (org.apache.axiom.om.OMText)2 SOAPBody (org.apache.axiom.soap.SOAPBody)2 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)2 SOAPFault (org.apache.axiom.soap.SOAPFault)2