You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by he...@apache.org on 2004/09/24 11:36:18 UTC
svn commit: rev 47144 - in webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src: java/org/apache/axis/om java/org/apache/axis/om/storage java/org/apache/axis/om/traversal java/org/apache/axis/om/util test-resources test/org/apache/axis/om/storage
Author: hemapani
Date: Fri Sep 24 02:36:18 2004
New Revision: 47144
Added:
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMException.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/StreamingOMBuilder.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/ElementNodeList.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/util/OMException.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/test-resources/testelement.xml
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/test/org/apache/axis/om/storage/
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/test/org/apache/axis/om/storage/TestElementRow.java
Modified:
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMConstants.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMTableModel.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/AttributeRow.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/ElementRow.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/NodeRow.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/NodeTable.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/Row.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/TextRow.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/NodeIterator.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/OmIterator.java
webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/util/Sequence.java
Log:
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMConstants.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMConstants.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMConstants.java Fri Sep 24 02:36:18 2004
@@ -27,4 +27,7 @@
public static final int TYPE_COMMENT = 3;
public static final int TYPE_CDATA = 4;
+ public static final String NODE_ELEMENT = "Element";
+
+
}
Added: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMException.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMException.java Fri Sep 24 02:36:18 2004
@@ -0,0 +1,39 @@
+package org.apache.axis.om;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author Ajith Ranabahu
+ * Date: Sep 16, 2004
+ * Time: 10:29:37 PM
+ */
+public class OMException extends Exception {
+
+
+ public OMException() {
+ }
+
+ public OMException(String message) {
+ super(message);
+ }
+
+ public OMException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public OMException(Throwable cause) {
+ super(cause);
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMTableModel.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMTableModel.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/OMTableModel.java Fri Sep 24 02:36:18 2004
@@ -1,27 +1,7 @@
package org.apache.axis.om;
-import org.apache.axis.om.storage.AttributeRow;
-import org.apache.axis.om.storage.ElementRow;
-import org.apache.axis.om.storage.GlobalRow;
-import org.apache.axis.om.storage.NodeTable;
-import org.apache.axis.om.storage.Row;
-import org.apache.axis.om.storage.Table;
-import org.apache.axis.om.storage.TextRow;
-import org.w3c.dom.Attr;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
+import org.apache.axis.om.storage.*;
+import org.w3c.dom.*;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -41,12 +21,17 @@
* @author Ajith Ranabahu
* Date: Sep 16, 2004
* Time: 6:44:16 PM
- *
- * Note that since the OMTableModel is an abstraction of the XML document, it
- * implements the DOM document interface .
- * At leaset it should, in my opinion!
+ * <p/>
+ * Note that since the OMTableModel is an abstraction of the XML document, it
+ * implements the DOM document interface .
+ * At leaset it should, in my opinion!
+ * <p/>
+ * OMTableModel will store the infoset of the XML being read. This table model itself has separate tables for
+ * different types of xml information items such as Elements, Attributes, etc., Each and every of these tables are implementing
+ * the corresponding DOM interfaces, as this table model will be exposing DOM API for the outside
+ * world.
*/
-public class OMTableModel implements Document{
+public class OMTableModel implements Document {
// private Sequence globalSequence = new Sequence();
// private Sequence elementSequence = new Sequence();
@@ -60,37 +45,40 @@
// a flag that indicates whether the model is
// completed or not
private boolean completed = false;
- private StreamingOmBuilder builder;
+ private StreamingOMBuilder builder;
- public OMTableModel(StreamingOmBuilder builder) {
+ public OMTableModel(StreamingOMBuilder builder) {
this.builder = builder;
}
/**
* Get elements by parent
+ *
* @param parent
* @return
*/
- public Object[] getElementsByParent(Object parent){
- return elementTable.getRowsbyParent(parent);
+ public Object[] getElementsByParent(Object parent) {
+ return elementTable.getRowsByParent(parent);
}
/**
* get the attributes by parent
+ *
* @param parent
* @return
*/
- public Object[] getAttribtByParent(Object parent){
- return attributeTable.getRowsbyParent(parent);
+ public Object[] getAttribtByParent(Object parent) {
+ return attributeTable.getRowsByParent(parent);
}
/**
* Get the text nodes (text,comments and Cdata)
+ *
* @param parent
* @return
*/
- public Object[] getTextByParent(Object parent){
- return textTable.getRowsbyParent(parent);
+ public Object[] getTextByParent(Object parent) {
+ return textTable.getRowsByParent(parent);
}
/**
@@ -99,15 +87,15 @@
* @param prefix
* @param parent
*/
- public Object addElement(String URI, String localName, String prefix, Object parent,StreamingOmBuilder builder) {
+ public Object addElement(String URI, String localName, String prefix, Object parent, StreamingOMBuilder builder) {
- ElementRow eltRow = new ElementRow(builder,this);
+ ElementRow eltRow = new ElementRow(builder, this);
eltRow.setKey(eltRow);//set the object itself as the key
eltRow.setURI(URI);
eltRow.setDone(false);
eltRow.setParent(parent);
eltRow.setLocalName(localName);
- eltRow.setPrefix(prefix);
+ eltRow.setElementPrefix(prefix);
eltRow.setNextSibling(null);
elementTable.addRow(eltRow);
@@ -120,6 +108,15 @@
}
/**
+ *
+ */
+ public void updateElementSibling(Object me, Object nextSibling) {
+ ElementRow row = (ElementRow) elementTable.getRowByKey(me);
+ row.setNextSibling(nextSibling);
+
+ }
+
+ /**
* @param parent
* @param child
*/
@@ -140,24 +137,21 @@
/**
* @param value
* @param parent
- *
*/
public Object addText(String value, Object parent) {
- return addCharacterData(value,OMConstants.TYPE_TEXT,parent);
+ return addCharacterData(value, Node.TEXT_NODE, parent);
}
-
/**
* @param localName
* @param prefix
* @param URI
* @param value
* @param parent
- *
*/
- public Object addAttribute(String localName, String prefix, String URI, String value, Object parent) {
+ public Object addAttribute(String localName, String prefix, String URI, String value, Object parent) {
AttributeRow attRow = new AttributeRow();
@@ -174,12 +168,13 @@
return attRow;
}
- public void updateAttributeSibling(Object myKey,Object siblingKey){
+ public void updateAttributeSibling(Object myKey, Object siblingKey) {
- AttributeRow attrRow = (AttributeRow)attributeTable.getRowByKey(myKey);
+ AttributeRow attrRow = (AttributeRow) attributeTable.getRowByKey(myKey);
attrRow.setNextSibling(siblingKey);
}
+
/**
* @param type
* @param referenceKey
@@ -209,15 +204,15 @@
return elementTable.getRowByIndex(index);
}
- public Object addCData(String value,Object parent){
- return addCharacterData(value,OMConstants.TYPE_CDATA,parent);
+ public Object addCData(String value, Object parent) {
+ return addCharacterData(value, Node.CDATA_SECTION_NODE, parent);
}
- public Object addComment(String value,Object parent){
- return addCharacterData(value,OMConstants.TYPE_COMMENT,parent);
+ public Object addComment(String value, Object parent) {
+ return addCharacterData(value, Node.COMMENT_NODE, parent);
}
- private Object addCharacterData(String value,int type,Object parentKey){
+ private Object addCharacterData(String value, short type, Object parentKey) {
TextRow textRow = new TextRow();
textRow.setKey(textRow);
@@ -231,11 +226,12 @@
return textRow;
}
- private Object getRoot(){
- Object[] rootChildren = elementTable.getRowsbyParent(null);
+ private Object getRoot() {
+ Object[] rootChildren = elementTable.getRowsByParent(null);
- return (rootChildren==null || rootChildren.length==0)?null:rootChildren[0];
+ return (rootChildren == null || rootChildren.length == 0) ? null : rootChildren[0];
}
+
/**
* Debug method
*/
@@ -263,15 +259,15 @@
public Element getDocumentElement() {
//return the first element
- while(getRoot()==null){
+ while (getRoot() == null) {
try {
builder.proceed();
- } catch (OMBuilderException e) {
+ } catch (OMException e) {
e.printStackTrace();
break;
}
}
- return (Element)getRoot();
+ return (Element) getRoot();
}
@@ -457,5 +453,14 @@
public void setCompleted(boolean completed) {
this.completed = completed;
+ }
+
+ public void proceedTheParser(){
+ try {
+ builder.proceed();
+ } catch (OMException e) {
+ //TODO this has to be handled well
+ throw new RuntimeException(e);
+ }
}
}
Added: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/StreamingOMBuilder.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/StreamingOMBuilder.java Fri Sep 24 02:36:18 2004
@@ -0,0 +1,266 @@
+package org.apache.axis.om;
+
+import org.apache.axis.om.storage.ElementRow;
+import org.apache.axis.om.storage.NodeRow;
+import org.w3c.dom.Document;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.util.Stack;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation. <p/>Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0 <p/>Unless required by applicable
+ * law or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ *
+ * @author Ajith Ranabahu Date: Sep 16, 2004 Time: 10:00:16 PM <p/>This class
+ * accepts pull events and generates the OMTableModel
+ */
+public class StreamingOMBuilder {
+
+ private XmlPullParser pullparser;
+
+ private OMTableModel tableModel = null;
+
+ private Stack elementStack = new Stack();
+
+ private Object previousSibling;
+
+
+ /**
+ * @param pullparser
+ */
+ public StreamingOMBuilder(XmlPullParser pullparser) {
+ this.pullparser = pullparser;
+
+ //////////////////////////////////
+ //todo CHECK THIS
+ this.tableModel = new OMTableModel(this); //the parser never seems to
+ // get the
+ //start document event!!!!!!!!!!!!!
+ //////////////////////////////////
+
+ }
+
+ public XmlPullParser getPullparser() {
+ return pullparser;
+ }
+
+ /**
+ * Since this is the entry point to the undelying XML representation this
+ * method contains the only reference to its own proceed method. it parses
+ * the XML until the document is created. In other words it will parse until
+ * the START_DOCUMENT event is generated
+ *
+ * @return
+ */
+ public Document getDocument() {
+ while (tableModel == null) {
+ try {
+ proceed();
+ } catch (OMException e) {
+ e.printStackTrace();
+ break;
+ //just break the loop for now.
+ //todo think of a better way to handle this
+ }
+ }
+ return tableModel;
+ }
+
+ /**
+ * Call the next method once, of pull parser update the Table Model
+ * depending on the pull event recd from pull parser.
+ *
+ * @throws OMException
+ */
+ public void proceed() throws OMException {
+
+ try {
+
+ int eventType = pullparser.next();
+ ;
+ //do the necessary to each type of event
+ if (eventType == XmlPullParser.START_DOCUMENT) {
+ processStartDocument();
+ } else if (eventType == XmlPullParser.END_DOCUMENT) {
+ processEndDocument();
+ } else if (eventType == XmlPullParser.START_TAG) {
+ processStartElement();
+ } else if (eventType == XmlPullParser.END_TAG) {
+ processEndElement();
+ } else if (eventType == XmlPullParser.CDSECT) {
+ processCDATA();
+ } else if (eventType == XmlPullParser.COMMENT) {
+ processComment();
+ } else if (eventType == XmlPullParser.TEXT) {
+ processText();
+ } else {
+ return;//any other events are not interesting :)
+ }
+
+ } catch (XmlPullParserException e) {
+ throw new OMException("parser Exception", e);
+ } catch (IOException e) {
+ throw new OMException("IO Exception", e);
+ } catch (Exception e) {
+ throw new OMException("Unknown process Exception", e);
+ }
+
+ }
+
+ /**
+ * Processing the start tag has some more things to than just inserting an
+ * elemnt. It has to update the parent and set up the attributes for that
+ * particular element
+ */
+ private void processStartElement() {
+
+ //Check the stack for an element. The one at the peek
+ //is this ones parent and this is alwys an element!
+ ElementRow parent = null;
+ if (!elementStack.isEmpty())
+ parent = (ElementRow) elementStack.peek();
+
+ //first insert the elemnt to the model
+
+ Object currentElement = tableModel.addElement(pullparser.getNamespace(), pullparser.getName(), pullparser.getPrefix(), parent, this); //pass this instamce as the builder. It will be
+ // in the current xpp implementation we use here (i.e. lxpp) getNamespace will provide the
+
+ // needed by the
+
+ // now check whether the parent has already the firstChild set or not. If not this element is the first child.
+ checkFirstChild(currentElement, (ElementRow)parent);
+
+ //fill in the set of attributes
+ int attribCount = pullparser.getAttributeCount();
+
+ if (attribCount > 0) {
+ Object previousAttribute = null;
+ Object currentAttribute = null;
+ for (int i = 0; i < attribCount; i++) {
+ currentAttribute = tableModel.addAttribute(
+ pullparser.getAttributeName(i),
+ pullparser.getAttributePrefix(i),
+ pullparser.getAttributeNamespace(i),
+ pullparser.getAttributeValue(i),
+ currentElement); //parent element
+
+ //set the next sibling of the previous attribute
+ if (previousAttribute != null) {
+ tableModel.updateAttributeSibling(previousAttribute,
+ currentAttribute);
+ }
+ //swap the attribute references
+ previousAttribute = currentAttribute;
+ }
+ }
+
+ processSiblings(parent, currentElement);
+
+ // push the current element to the stack
+ //push to the stack for later use
+ elementStack.push(currentElement);
+
+ }
+
+ private void processSiblings(ElementRow parent, Object currentInfoItem) {
+ //update siblings
+ if (previousSibling != null && !parent.equals(previousSibling)) //this is needed to avoid erroneous references
+ ((NodeRow)previousSibling).setNextSibling (currentInfoItem);
+
+ //update prev sibling
+ previousSibling = currentInfoItem;
+ }
+
+ /**
+ * This method will check whether there is a firstChild in the parent. if not
+ * this will set the cuurentElement as the first child
+ * @param currentElement
+ * @param parent
+ */ private void checkFirstChild(Object currentElement, ElementRow parent) {
+ if( parent != null && parent.getFirstChild() == null){
+ parent.setFirstChild(currentElement);
+ }
+ }
+
+ /**
+ * Processsig the end element is simple. Just mark the peek element as
+ * processed and pop it from the stack
+ */
+ private void processEndElement() {
+ Object key = elementStack.pop();
+ previousSibling = key;
+ tableModel.updateElementDone(key);
+ }
+
+ private void processStartDocument() {
+ //since the table model is THE DOCUMENT make it here
+ this.tableModel = new OMTableModel(this);
+ }
+
+ private void processEndDocument() {
+ this.tableModel.setCompleted(true);
+ }
+
+ private void processText() {
+ //Check the stack for an element. The one at the peek
+ //is this ones parent!
+ ElementRow parent = (ElementRow) elementStack.peek();
+ if (parent == null) {
+ //having text without a parent is not correct XML syntax.
+ //ideally this should be taken care of by the parser
+ throw new UnsupportedOperationException("Invlid XML");
+ }
+
+ Object textRow = tableModel.addText(pullparser.getText(), parent);
+
+ checkFirstChild(textRow, (ElementRow)parent);
+
+ processSiblings(parent, textRow);
+
+ }
+
+ private void processCDATA() {
+ //Check the stack for an element. The one at the peek
+ //is this ones parent!
+ ElementRow parent = (ElementRow) elementStack.peek();
+ if (parent == null) {
+ //having text without a parent is not correct XML syntax.
+ //ideally this should be taken care of by the parser
+ throw new UnsupportedOperationException("Invalid XML");
+ }
+
+ Object cdata = tableModel.addCData(pullparser.getText(), parent);
+ checkFirstChild(cdata, (ElementRow) parent);
+ processSiblings(parent, cdata);
+
+
+ }
+
+ private void processComment() {
+ //Check the stack for an element. The one at the peek
+ //is this ones parent!
+ ElementRow parent = (ElementRow) elementStack.peek();
+ if (parent == null) {
+ //having text without a parent is not correct XML syntax.
+ //ideally this should be taken care of by the parser
+ throw new UnsupportedOperationException("Invlid XML");
+ }
+
+ Object commentRow = tableModel.addComment(pullparser.getText(), parent);
+
+ checkFirstChild(commentRow, (ElementRow) parent);
+
+ processSiblings(parent, commentRow);
+
+
+
+ }
+}
\ No newline at end of file
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/AttributeRow.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/AttributeRow.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/AttributeRow.java Fri Sep 24 02:36:18 2004
@@ -1,12 +1,6 @@
package org.apache.axis.om.storage;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import org.w3c.dom.*;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -27,7 +21,7 @@
* Date: Sep 16, 2004
* Time: 6:18:52 PM
*/
-public class AttributeRow extends NodeRow implements Attr{
+public class AttributeRow extends NodeRow implements Attr {
private String URI;
private String Prefix;
@@ -63,9 +57,8 @@
}
-
public Node getNextSibling() {
- return (Node)this.nextSibling;
+ return (Node) this.nextSibling;
}
public void setNextSibling(Object nextSibling) {
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/ElementRow.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/ElementRow.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/ElementRow.java Fri Sep 24 02:36:18 2004
@@ -1,15 +1,10 @@
package org.apache.axis.om.storage;
-import org.apache.axis.om.OMBuilderException;
+import org.apache.axis.om.OMConstants;
import org.apache.axis.om.OMTableModel;
-import org.apache.axis.om.StreamingOmBuilder;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import org.apache.axis.om.StreamingOMBuilder;
+import org.apache.axis.om.traversal.ElementNodeList;
+import org.w3c.dom.*;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -32,20 +27,19 @@
*/
public class ElementRow extends NodeRow implements Element {
- private String URI;
- private String Prefix;
+ private String URI = null;
+ private String elementPrefix;
private String localName;
+ private Object firstChild;
- private Object nextSibling;
- private StreamingOmBuilder builder;
- private Document parentDocument;
- public ElementRow(StreamingOmBuilder builder,Document parentDocument) {
+ private StreamingOMBuilder builder;
+
+ public ElementRow(StreamingOMBuilder builder, Document parentDocument) {
this.builder = builder;
- this.parentDocument = parentDocument ;
+ this.parentDocument = parentDocument;
}
- private boolean done;
public String getURI() {
return URI;
@@ -55,12 +49,36 @@
this.URI = URI;
}
+ public String getElementPrefix() {
+ return elementPrefix;
+ }
+
+ /**
+ * Since setPrefix method is not exposed through DOM API, its exposed through this method
+ * @param prefix
+ */
+ public void setElementPrefix(String prefix) {
+ elementPrefix = prefix;
+ }
+
public String getPrefix() {
- return Prefix;
+ return getElementPrefix();
}
+ /**
+ * This method is currently unsuported due to the foloowing reason.
+ * If one comes and changes the prefix of the element, the URI of the element must also be changed.
+ * But this is not simple, as if someone does this at a later time, the namespace stack may not be available.
+ * Then the getNamespaceURI() may return some erroneous value
+ *
+ * This method is not exposed through the DOM API
+ * Eran Chinthaka on 22-09-2004
+ * @param prefix
+ * @exception UnsupportedOperationException
+ */
public void setPrefix(String prefix) {
- Prefix = prefix;
+ throw new UnsupportedOperationException("this method may lead to wrong outcome for the namespace uri of the element");
+ //elementPrefix = prefix;
}
public String getLocalName() {
@@ -75,28 +93,14 @@
- public void setNextSibling(Object nextSibling) {
- this.nextSibling = nextSibling;
- }
-
- public boolean isDone() {
- return done;
- }
-
- public void setDone(boolean done) {
- this.done = done;
- }
-
-
/* Interface methods */
public String getNodeName() {
- return localName;
+ return OMConstants.NODE_ELEMENT;
}
public String getNodeValue()
throws DOMException {
- return null;
- //todo implement this
+ return Element.ELEMENT_NODE + "";
}
public void setNodeValue(String nodeValue)
@@ -110,35 +114,29 @@
}
public Node getParentNode() {
- return (Node)this.parent;
+ return (Node) this.parent;
}
public NodeList getChildNodes() {
- //implement this
- return null;
+ NodeList nodeList = new ElementNodeList(this);
+ return nodeList;
}
- public Node getFirstChild() {
- OMTableModel omTableModel = (OMTableModel)this.parentDocument;
- Object[] children = omTableModel.getElementsByParent(this);
+ /**
+ * This will return null if there is no child
+ *
+ * @return
+ */ public Node getFirstChild() {
- while(children != null && !this.done){ //todo is this logic right?????
-
- try {
- builder.proceed();
- } catch (OMBuilderException e) {
- break; //just get out of here if the proceeding failed
- }
- //see whether there are children already for this element
- children = omTableModel.getElementsByParent(this);
+ while( (firstChild == null) && (!done)){
+ ((OMTableModel) parentDocument).proceedTheParser();
}
- if ((children==null) ||children.length==0){
- return null;
- }else{
- return (Node)children[0];
- }
+ return (Node) firstChild;
+ }
+ public void setFirstChild(Object firstChild) {
+ this.firstChild = firstChild;
}
public Node getLastChild() {
@@ -149,11 +147,6 @@
return null;
}
- public Node getNextSibling() {
- return null;
- //return ((OMTableModel)this.parentDocument).;
- }
-
public NamedNodeMap getAttributes() {
//todo this needs to be filled
@@ -204,7 +197,7 @@
}
public String getNamespaceURI() {
- return null;
+ return URI;
}
public boolean hasAttributes() {
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/NodeRow.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/NodeRow.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/NodeRow.java Fri Sep 24 02:36:18 2004
@@ -1,24 +1,16 @@
package org.apache.axis.om.storage;
-/** Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+import org.apache.axis.om.OMTableModel;
+import org.w3c.dom.Document;
import org.w3c.dom.Node;
public abstract class NodeRow extends Row implements Node {
protected Object parent;
+ protected short nodeType;
+ private Object nextSibling;
+ protected boolean done;
+ protected Document parentDocument;
+
public Object getParent() {
return parent;
@@ -27,6 +19,29 @@
public void setParent(Object parent) {
this.parent = parent;
}
+
+ public void setNextSibling(Object nextSibling) {
+ this.nextSibling = nextSibling;
+ }
+
+ public Node getNextSibling() {
+
+ while ((nextSibling == null) && (!done)) {
+ ((OMTableModel)parentDocument).proceedTheParser();
+ }
+
+ return (Node) nextSibling;
+ }
+
+ public boolean isDone() {
+ return done;
+ }
+
+ public void setDone(boolean done) {
+ this.done = done;
+ }
+
+
//Anything here ????
}
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/NodeTable.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/NodeTable.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/NodeTable.java Fri Sep 24 02:36:18 2004
@@ -3,7 +3,7 @@
import java.util.ArrayList;
/**
- * * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2004 The Apache Software Foundation.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,31 +18,30 @@
* limitations under the License.
*
* @author Ajith Ranabahu
- * Date: Sep 19, 2004
- * Time: 4:00:48 PM
- *
- * The difference between a simple table and the node table is the specific
- * search mechanism with the parent
+ * Date: Sep 19, 2004
+ * Time: 4:00:48 PM
+ * <p/>
+ * The difference between a simple table and the node table is the specific
+ * search mechanism with the parent
*/
public class NodeTable extends Table {
/**
- *
* @param parentKey
* @return
*/
- public Object[] getRowsbyParent(Object parentKey){
+ public Object[] getRowsByParent(Object parentKey) {
ArrayList list = new ArrayList();
for (int i = 0; i < rowList.size(); i++) {
NodeRow nodeRow = (NodeRow) rowList.get(i);
- if (parentKey==null){
- if (nodeRow.getParent()==parentKey){
+ if (parentKey == null) {
+ if (nodeRow.getParent() == parentKey) {
list.add(nodeRow);
}
- } else{
- if (nodeRow.getParent().equals(parentKey)){
+ } else {
+ if (parentKey.equals(nodeRow.getParent())) {
list.add(nodeRow);
}
}
@@ -52,9 +51,6 @@
return rowObjects;
}
-
-
-
}
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/Row.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/Row.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/Row.java Fri Sep 24 02:36:18 2004
@@ -19,7 +19,7 @@
* Date: Sep 16, 2004
* Time: 6:17:59 PM
*/
-public abstract class Row {
+public abstract class Row {
// TODO sizeof(object) > sizeof(int) ???
/* this key is of type Object, simply because we wanted to make this a unique one.
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/TextRow.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/TextRow.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/storage/TextRow.java Fri Sep 24 02:36:18 2004
@@ -1,14 +1,6 @@
package org.apache.axis.om.storage;
-import org.apache.axis.om.OMConstants;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
+import org.w3c.dom.*;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -29,7 +21,7 @@
* Date: Sep 16, 2004
* Time: 6:29:38 PM
*/
-public class TextRow extends NodeRow implements Text,Comment,CDATASection {
+public class TextRow extends NodeRow implements Text, Comment, CDATASection {
private String value;
@@ -37,7 +29,7 @@
* the same class with a type attribute to say the type of the class
*
*/
- private int type = OMConstants.TYPE_TEXT; //default is type text
+ private short type = Node.TEXT_NODE; //default is type text
public String getValue() {
return value;
@@ -48,15 +40,15 @@
}
- public int getType() {
+ public short getType() {
return type;
}
- public void setType(int type) {
+ public void setType(short type) {
this.type = type;
}
- /* interface methods */
+ /* interface methods */
public String getNodeName() {
return null;
@@ -72,7 +64,7 @@
}
public short getNodeType() {
- return 0;
+ return type;
}
public Node getParentNode() {
@@ -92,10 +84,6 @@
}
public Node getPreviousSibling() {
- return null;
- }
-
- public Node getNextSibling() {
return null;
}
Added: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/ElementNodeList.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/ElementNodeList.java Fri Sep 24 02:36:18 2004
@@ -0,0 +1,83 @@
+package org.apache.axis.om.traversal;
+
+import org.apache.axis.om.storage.ElementRow;
+import org.apache.axis.om.storage.NodeRow;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * <p/>
+ * <p/>
+ * Once a NodeList is returned from the Element implementation of AXIOM, we do not populate and give it to the
+ * requesting party. Rather we put a reference to the Element, whose children being refered inside the NodeList we return and this one
+ * will provide the details required, on the fly.
+ * <p/>
+ * User: Eran Chinthaka - Lanka Software Foundation
+ * Date: Sep 22, 2004
+ * Time: 4:03:03 PM
+ */
+public class ElementNodeList implements NodeList {
+
+ private ElementRow elementRow;
+
+ /**
+ * this will hold the elements that have been refered by the ElementNodeList already.
+ */
+ private List childrenCache;
+
+ public ElementNodeList(ElementRow elementRow) {
+ this.elementRow = elementRow;
+ childrenCache = new LinkedList();
+ childrenCache.add(elementRow.getFirstChild());
+ }
+
+ /**
+ * Use of this method is highly discouraged, as children are not being populated inside this list, and if one asks
+ * the length, we have to access each and every child to provide this info.
+ *
+ * @return
+ */
+ public int getLength() {
+ return 0; //TODO implement this
+ }
+
+ public Node item(int index) {
+ NodeRow nodeRow = null;
+
+ // if the requested children is already available in the cache, get it
+ if (index < childrenCache.size()) {
+ nodeRow = (NodeRow) childrenCache.get(index);
+ } else {
+ // else get the last child available from the childrencache and from that proceed
+ int cacheSize = childrenCache.size();
+ nodeRow = (NodeRow) childrenCache.get(cacheSize-1);
+
+ for (int i = 0; i < index - cacheSize+1; i++) {
+ nodeRow = (NodeRow) nodeRow.getNextSibling();
+ if (nodeRow == null) {
+ return null;
+ } else {
+ childrenCache.add(nodeRow);
+ }
+ }
+
+ }
+ return nodeRow;
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/NodeIterator.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/NodeIterator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/NodeIterator.java Fri Sep 24 02:36:18 2004
@@ -1,10 +1,10 @@
package org.apache.axis.om.traversal;
import org.apache.axis.om.OMTableModel;
-import org.apache.axis.om.StreamingOmBuilder;
+import org.apache.axis.om.StreamingOMBuilder;
/**
- * * Copyright 2001-2004 The Apache Software Foundation.
+ * * Copyright 2001-2004 The Apache Software Foundation.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,18 +19,17 @@
* limitations under the License.
*
* @author Ajith Ranabahu
- * Date: Sep 19, 2004
- * Time: 4:51:45 PM
- *
- * This class is the node iterator for the specific case of
- * elements children
+ * Date: Sep 19, 2004
+ * Time: 4:51:45 PM
+ * <p/>
+ * This class is the node iterator for the specific case of
+ * elements children
*/
-public class NodeIterator extends OmIterator{
+public class NodeIterator extends OmIterator {
- public NodeIterator(OMTableModel model, StreamingOmBuilder builder) {
+ public NodeIterator(OMTableModel model, StreamingOMBuilder builder) {
super(model, builder);
}
-
}
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/OmIterator.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/OmIterator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/traversal/OmIterator.java Fri Sep 24 02:36:18 2004
@@ -1,12 +1,12 @@
package org.apache.axis.om.traversal;
import org.apache.axis.om.OMTableModel;
-import org.apache.axis.om.StreamingOmBuilder;
+import org.apache.axis.om.StreamingOMBuilder;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
- * * Copyright 2001-2004 The Apache Software Foundation.
+ * * Copyright 2001-2004 The Apache Software Foundation.
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,17 +21,17 @@
* limitations under the License.
*
* @author Ajith Ranabahu
- * Date: Sep 19, 2004
- * Time: 3:29:34 PM
- *
- * Serving a list in an iterative manner is REALLY DIFFICULT!!!!!!!!!
+ * Date: Sep 19, 2004
+ * Time: 3:29:34 PM
+ * <p/>
+ * Serving a list in an iterative manner is REALLY DIFFICULT!!!!!!!!!
*/
public abstract class OmIterator implements NodeList {
protected OMTableModel model;
- protected StreamingOmBuilder builder;
+ protected StreamingOMBuilder builder;
- public OmIterator(OMTableModel model, StreamingOmBuilder builder) {
+ public OmIterator(OMTableModel model, StreamingOMBuilder builder) {
this.model = model;
this.builder = builder;
}
Added: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/util/OMException.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/util/OMException.java Fri Sep 24 02:36:18 2004
@@ -0,0 +1,11 @@
+package org.apache.axis.om.util;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Ajith
+ * Date: Sep 24, 2004
+ * Time: 11:13:01 AM
+ * To change this template use Options | File Templates.
+ */
+public class OMException extends Exception {
+}
Modified: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/util/Sequence.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/util/Sequence.java (original)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/java/org/apache/axis/om/util/Sequence.java Fri Sep 24 02:36:18 2004
@@ -18,7 +18,6 @@
* @author Ajith Ranabahu
* Date: Sep 16, 2004
* Time: 6:53:19 PM
- * @deprecated
*/
public class Sequence {
private int sequenceValue = 0;
Added: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/test-resources/testelement.xml
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/test-resources/testelement.xml Fri Sep 24 02:36:18 2004
@@ -0,0 +1,15 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
+ <soapenv:Header>
+ <wsa:MessageID soapenv:mustUnderstand="0">uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+ <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>
+ <wsa:From soapenv:mustUnderstand="0">
+ <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</Address>
+ </wsa:From>
+ </soapenv:Header>
+ <soapenv:Body>
+ <ns1:getBalance soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://localhost:8081/axis/services/BankPort">
+ <accountNo href="#id0"/>
+ </ns1:getBalance>
+ <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1001</multiRef>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Added: webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/test/org/apache/axis/om/storage/TestElementRow.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/ajith_eran_dasarath_deepal/src/test/org/apache/axis/om/storage/TestElementRow.java Fri Sep 24 02:36:18 2004
@@ -0,0 +1,269 @@
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * <p/>
+ * Author: Eran Chinthaka - Lanka Software Foundation
+ * Date: Sep 21, 2004
+ * Time: 11:21:38 AM
+ */
+package org.apache.axis.om.storage;
+
+import junit.framework.TestCase;
+import org.apache.axis.om.StreamingOMBuilder;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+import java.io.FileReader;
+
+
+public class TestElementRow extends TestCase {
+
+ Element ele = null;
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(TestElementRow.class);
+ }
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ //Create the builder
+ XmlPullParser pullparser = XmlPullParserFactory.newInstance().newPullParser();
+ pullparser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
+ pullparser.setInput(new FileReader("./resource/testelement.xml"));
+ StreamingOMBuilder builder = new StreamingOMBuilder(pullparser);
+
+ Document doc = builder.getDocument();
+ ele = doc.getDocumentElement();
+
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testGetURI() {
+ String expectedURI = "http://schemas.xmlsoap.org/soap/envelope/";
+ assertEquals("Problem in handling namespaces in Elements", expectedURI, ele.getNamespaceURI());
+ }
+
+ public void testGetPrefix() {
+ String expectedPrefix = "soapenv";
+ assertEquals("Problem in handling prefixes in Elements", expectedPrefix, ele.getPrefix());
+ }
+
+ public void testSetPrefix() {
+ // this is avoided as this throws a runtime exception
+ }
+
+ public void testGetLocalName() {
+ assertEquals("Problem in handling local names in Elements", "Envelope", ele.getLocalName());
+ }
+
+ public void testSetLocalName() {
+ //TODO Implement setLocalName().
+ }
+
+ public void testSetNextSibling() {
+ //TODO Implement setNextSibling().
+ }
+
+ public void testIsDone() {
+ //TODO Implement isDone().
+ }
+
+ public void testSetDone() {
+ //TODO Implement setDone().
+ }
+
+ public void testGetNodeName() {
+ //TODO Implement getNodeName().
+ }
+
+ public void testGetNodeValue() {
+ //TODO Implement getNodeValue().
+ }
+
+ public void testSetNodeValue() {
+ //TODO Implement setNodeValue().
+ }
+
+ public void testGetNodeType() {
+ //TODO Implement getNodeType().
+ }
+
+ public void testGetParentNode() {
+ //TODO Implement getParentNode().
+ }
+
+ public void testGetChildNodes() {
+ NodeList nodeList = ele.getChildNodes();
+ NodeRow nodeRow = (NodeRow) nodeList.item(1);
+
+ assertEquals("Children retrieval is not working in the ElementNodeList", Node.ELEMENT_NODE, nodeRow.getNodeType());
+
+ nodeList = nodeRow.getChildNodes();
+ nodeRow = (NodeRow) nodeList.item(3);
+ assertEquals("Children retrieval is not working in the ElementNodeList", Node.TEXT_NODE, nodeRow.getNodeType());
+
+
+ }
+
+ public void testGetFirstChild() {
+ //TODO Implement getFirstChild().
+ }
+
+ public void testGetLastChild() {
+ //TODO Implement getLastChild().
+ }
+
+ public void testGetPreviousSibling() {
+ //TODO Implement getPreviousSibling().
+ }
+
+ public void testGetNextSibling() {
+ //TODO Implement getNextSibling().
+ }
+
+ public void testGetAttributes() {
+ //TODO Implement getAttributes().
+ }
+
+ public void testGetOwnerDocument() {
+ //TODO Implement getOwnerDocument().
+ }
+
+ public void testInsertBefore() {
+ //TODO Implement insertBefore().
+ }
+
+ public void testReplaceChild() {
+ //TODO Implement replaceChild().
+ }
+
+ public void testRemoveChild() {
+ //TODO Implement removeChild().
+ }
+
+ public void testAppendChild() {
+ //TODO Implement appendChild().
+ }
+
+ public void testHasChildNodes() {
+ //TODO Implement hasChildNodes().
+ }
+
+ public void testCloneNode() {
+ //TODO Implement cloneNode().
+ }
+
+ public void testNormalize() {
+ //TODO Implement normalize().
+ }
+
+ public void testIsSupported() {
+ //TODO Implement isSupported().
+ }
+
+ public void testGetNamespaceURI() {
+ //TODO Implement getNamespaceURI().
+ }
+
+
+ public void testHasAttributes() {
+ //TODO Implement hasAttributes().
+ }
+
+ public void testGetTagName() {
+ //TODO Implement getTagName().
+ }
+
+ public void testGetAttribute() {
+ }
+
+ public void testSetAttribute() {
+ //TODO Implement setAttribute().
+ }
+
+ public void testRemoveAttribute() {
+ //TODO Implement removeAttribute().
+ }
+
+ public void testGetAttributeNode() {
+ //TODO Implement getAttributeNode().
+ }
+
+ public void testSetAttributeNode() {
+ //TODO Implement setAttributeNode().
+ }
+
+ public void testRemoveAttributeNode() {
+ //TODO Implement removeAttributeNode().
+ }
+
+ public void testGetElementsByTagName() {
+ //TODO Implement getElementsByTagName().
+ }
+
+ public void testGetAttributeNS() {
+ //TODO Implement getAttributeNS().
+ }
+
+ public void testSetAttributeNS() {
+ //TODO Implement setAttributeNS().
+ }
+
+ public void testRemoveAttributeNS() {
+ //TODO Implement removeAttributeNS().
+ }
+
+ public void testGetAttributeNodeNS() {
+ //TODO Implement getAttributeNodeNS().
+ }
+
+ public void testSetAttributeNodeNS() {
+ //TODO Implement setAttributeNodeNS().
+ }
+
+ public void testGetElementsByTagNameNS() {
+ //TODO Implement getElementsByTagNameNS().
+ }
+
+ public void testHasAttribute() {
+ //TODO Implement hasAttribute().
+ }
+
+ public void testHasAttributeNS() {
+ //TODO Implement hasAttributeNS().
+ }
+
+ public void testGetParent() {
+ //TODO Implement getParent().
+ }
+
+ public void testSetParent() {
+ //TODO Implement setParent().
+ }
+
+}