Author: veithen
Date: Tue Mar 17 09:00:31 2009
New Revision: 755155
URL: http://svn.apache.org/viewvc?rev=755155&view=rev
Log:
Implemented support for processing instructions for completeness.
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMStAXWrapper.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMStAXWrapper.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMStAXWrapper.java?rev=755155&r1=755154&r2=755155&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMStAXWrapper.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMStAXWrapper.java
Tue Mar 17 09:00:31 2009
@@ -42,6 +42,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMProcessingInstruction;
import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLParserWrapper;
@@ -1217,7 +1218,15 @@
* @return Returns String.
*/
public String getPITarget() {
- throw new UnsupportedOperationException();
+ if (parser != null) {
+ return parser.getPIData();
+ } else {
+ if (currentEvent == PROCESSING_INSTRUCTION) {
+ return ((OMProcessingInstruction)getNode()).getTarget();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
}
/**
@@ -1226,7 +1235,15 @@
* @return Returns String.
*/
public String getPIData() {
- throw new UnsupportedOperationException();
+ if (parser != null) {
+ return parser.getPIData();
+ } else {
+ if (currentEvent == PROCESSING_INSTRUCTION) {
+ return ((OMProcessingInstruction)getNode()).getValue();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
}
/*
@@ -1268,6 +1285,9 @@
case OMNode.CDATA_SECTION_NODE:
returnEvent = generateCdataEvents();
break;
+ case OMNode.PI_NODE:
+ returnEvent = PROCESSING_INSTRUCTION;
+ break;
default :
throw new OMStreamingException("Encountered node with unknown
node type "
+ nodeType);