use of org.apache.axiom.om.OMNode in project webservices-axiom by apache.
the class WriteProcessingInstruction1Scenario method validate.
@Override
public void validate(OMElement element, boolean dataHandlersPreserved) throws Throwable {
OMNode child = element.getFirstOMChild();
Assert.assertTrue(child instanceof OMProcessingInstruction);
OMProcessingInstruction pi = (OMProcessingInstruction) child;
Assert.assertEquals("target", pi.getTarget());
Assert.assertEquals("", pi.getValue());
}
use of org.apache.axiom.om.OMNode in project webservices-axiom by apache.
the class TestXPathAppliedToSOAPEnvelope method runTest.
@Override
protected void runTest() throws Throwable {
OMElement elem1 = soapFactory.createOMElement("elem1", null);
OMElement elem2 = soapFactory.createOMElement("elem2", null);
OMElement elem3 = soapFactory.createOMElement("elem3", null);
elem2.addChild(elem3);
elem1.addChild(elem2);
SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
envelope.getBody().addChild(elem1);
if (createDocument) {
soapFactory.createOMDocument().addChild(envelope);
}
String XPathString = "//elem1";
AXIOMXPath XPath = new AXIOMXPath(XPathString);
OMNode node = (OMNode) XPath.selectSingleNode(envelope);
assertNotNull(node);
}
use of org.apache.axiom.om.OMNode in project webservices-axiom by apache.
the class OMFilterIterator method next.
@Override
public Object next() {
if (hasNext()) {
OMNode result = nextNode;
nextNode = null;
return result;
} else {
throw new NoSuchElementException();
}
}
use of org.apache.axiom.om.OMNode in project webservices-axiom by apache.
the class OMXMLReader method generateEventsForChildren.
private void generateEventsForChildren(OMContainer parent) throws SAXException {
for (Iterator it = parent.getChildren(); it.hasNext(); ) {
OMNode node = (OMNode) it.next();
switch(node.getType()) {
case OMNode.DTD_NODE:
if (lexicalHandler != null) {
OMDocType doctype = (OMDocType) node;
lexicalHandler.startDTD(doctype.getRootName(), doctype.getPublicId(), doctype.getSystemId());
lexicalHandler.endDTD();
}
break;
case OMNode.ELEMENT_NODE:
generateEvents((OMElement) node);
break;
case OMNode.TEXT_NODE:
generateEvents((OMText) node, false);
break;
case OMNode.SPACE_NODE:
generateEvents((OMText) node, true);
break;
case OMNode.CDATA_SECTION_NODE:
if (lexicalHandler != null) {
lexicalHandler.startCDATA();
}
generateEvents((OMText) node, false);
if (lexicalHandler != null) {
lexicalHandler.endCDATA();
}
break;
case OMNode.COMMENT_NODE:
if (lexicalHandler != null) {
char[] ch = ((OMComment) node).getValue().toCharArray();
lexicalHandler.comment(ch, 0, ch.length);
}
break;
case OMNode.PI_NODE:
OMProcessingInstruction pi = (OMProcessingInstruction) node;
contentHandler.processingInstruction(pi.getTarget(), pi.getValue());
break;
case OMNode.ENTITY_REFERENCE_NODE:
contentHandler.skippedEntity(((OMEntityReference) node).getName());
break;
default:
throw new IllegalStateException("Unrecognized node type " + node.getType());
}
}
}
use of org.apache.axiom.om.OMNode in project webservices-axiom by apache.
the class ElementSerializerTest method testElementSerilizationChild.
public void testElementSerilizationChild() throws Exception {
OMElement elt = builder.getDocumentElement();
OMNode node = elt.getFirstOMChild().getNextOMSibling();
node.serialize(writer);
}
Aggregations