use of org.apache.axiom.om.OMNamespace in project webservices-axiom by apache.
the class TestCreateOMAttributeWithInvalidNamespace2 method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("urn:test", "");
try {
factory.createOMAttribute("attr", ns, "value");
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("Cannot create an unprefixed attribute with a namespace", ex.getMessage());
}
}
use of org.apache.axiom.om.OMNamespace in project webservices-axiom by apache.
the class TestCreateOMElementWithNonDefaultNamespace method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = variant.createOMElement(factory, parentSupplier.createParent(factory), "test", "urn:ns", "ns");
assertTrue(element.isComplete());
assertEquals("test", element.getLocalName());
OMNamespace ns = factory.createOMNamespace("urn:ns", "ns");
assertEquals(ns, element.getNamespace());
Iterator<OMNamespace> it = element.getAllDeclaredNamespaces();
assertTrue(it.hasNext());
assertEquals(ns, it.next());
assertFalse(it.hasNext());
}
use of org.apache.axiom.om.OMNamespace in project webservices-axiom by apache.
the class TestCreateOMElementWithoutNamespaceNullPrefix method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMElement element = variant.createOMElement(factory, parentSupplier.createParent(factory), "test", "", null);
assertEquals("test", element.getLocalName());
assertNull(element.getNamespace());
Iterator<OMNamespace> it = element.getAllDeclaredNamespaces();
assertFalse(it.hasNext());
}
use of org.apache.axiom.om.OMNamespace in project webservices-axiom by apache.
the class TestGetNamespaceURI method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://www.w3.org/XML/1998/namespace", "xml");
assertEquals("http://www.w3.org/XML/1998/namespace", ns.getNamespaceURI());
}
use of org.apache.axiom.om.OMNamespace in project webservices-axiom by apache.
the class TestGetPrefix method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMNamespace ns = factory.createOMNamespace("http://www.w3.org/XML/1998/namespace", "xml");
assertEquals("xml", ns.getPrefix());
ns = factory.createOMNamespace("", null);
assertNull(ns.getPrefix());
}
Aggregations