use of org.apache.axiom.om.ds.StringOMDataSource in project webservices-axiom by apache.
the class TestRemoveChildrenUnexpanded method runTest.
@Override
protected void runTest() throws Throwable {
OMFactory factory = metaFactory.getOMFactory();
OMSourcedElement element = factory.createOMElement(new StringOMDataSource("<element attr='value'><a/></element>"));
element.removeChildren();
// Check that the attribute has been added
Iterator<OMAttribute> it = element.getAllAttributes();
assertTrue(it.hasNext());
OMAttribute attr = it.next();
assertEquals("attr", attr.getLocalName());
assertEquals("value", attr.getAttributeValue());
assertFalse(it.hasNext());
// Check that the element is empty
assertNull(element.getFirstOMChild());
}
Aggregations