Search in sources :

Example 36 with OMAttribute

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

the class TestHasNameWithNamespace method runTest.

@Override
protected void runTest() throws Throwable {
    String localName = "attr";
    String uri = "urn:test";
    OMFactory fac = metaFactory.getOMFactory();
    OMNamespace ns = fac.createOMNamespace(uri, "p");
    OMAttribute attr = fac.createOMAttribute(localName, ns, "value");
    assertTrue(attr.hasName(new QName(uri, localName, "p")));
    assertTrue(attr.hasName(new QName(uri, localName, "q")));
    assertFalse(attr.hasName(new QName("http://example.org", localName, "p")));
    assertFalse(attr.hasName(new QName(uri, "otherName", "p")));
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMNamespace(org.apache.axiom.om.OMNamespace) QName(javax.xml.namespace.QName) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 37 with OMAttribute

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

the class TestGetNamespaceNormalized method runTest.

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

Example 38 with OMAttribute

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

the class TestGetNamespaceURIWithNamespace method runTest.

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

Example 39 with OMAttribute

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

the class TestGetPrefixWithNamespace method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMAttribute attr = factory.createOMAttribute("name", factory.createOMNamespace("urn:ns", "p"), "value");
    assertEquals("p", attr.getPrefix());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 40 with OMAttribute

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

the class TestCreateOMAttributeInterfaces method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMNamespace ns = factory.createOMNamespace("urn:test", "p");
    OMAttribute attr = factory.createOMAttribute("attr", ns, "value");
    assertFalse(attr instanceof OMSerializable);
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMNamespace(org.apache.axiom.om.OMNamespace) OMSerializable(org.apache.axiom.om.OMSerializable) 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