You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by as...@apache.org on 2004/10/18 10:25:31 UTC
svn commit: rev 54993 - in webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src: java/org/apache/axis java/org/apache/axis/om/impl java/org/apache/axis/om/impl/util test/org/apache/axis/om test/org/apache/axis/om/util
Author: aslom
Date: Mon Oct 18 01:25:29 2004
New Revision: 54993
Modified:
webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/2getChildren-implemented.txt
webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/chinthaka_getChildren_implemented.txt
webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/OMAttributeImpl.java
webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/OMTextImpl.java
webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java
webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/test/org/apache/axis/om/OMElementTest.java
webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/test/org/apache/axis/om/util/OMNodeBuilder.java
Log:
applied Eran Chinthaka patch
Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/2getChildren-implemented.txt
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/2getChildren-implemented.txt (original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/2getChildren-implemented.txt Mon Oct 18 01:25:29 2004
@@ -1,2497 +0,0 @@
-Index: impl/OMAttributeImpl.java
-===================================================================
---- impl/OMAttributeImpl.java (revision 54509)
-+++ impl/OMAttributeImpl.java (working copy)
-@@ -1,75 +1,75 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMAttribute;
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNamespace;
--
--import java.io.PrintStream;
--import java.util.regex.Matcher;
--import java.util.regex.Pattern;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 11:43:23 AM
-- */
--public class OMAttributeImpl extends OMNamedNodeImpl implements OMAttribute {
-- private static String QUOTE_ENTITY = """;
-- private static Matcher matcher = Pattern.compile("\"").matcher(null);
--
-- public OMAttributeImpl(String localName, OMNamespace ns, String value, OMElement parent) {
-- super(localName, ns, parent);
-- setValue(value);
-- }
--
-- public OMAttributeImpl(String localName, OMNamespace ns, String value) {
-- super(localName, ns, null);
-- setValue(value);
-- }
--
-- synchronized static String replaceQuoteWithEntity(String value) {
-- matcher.reset(value);
-- return matcher.replaceAll(QUOTE_ENTITY);
-- }
--
-- public void print(PrintStream s) throws OMException {
-- super.print(s);
-- s.print('=');
-- String v = value;
-- char quote = '"';
-- if (value.indexOf('"') != -1)
-- if (value.indexOf('\'') == -1)
-- quote = '\'';
-- else
-- v = replaceQuoteWithEntity(value);
-- s.print(quote);
-- s.print(v);
-- s.print(quote);
-- }
--
-- public void detach() throws OMException {
-- if (parent == null)
-- throw new OMException();
-- if (getPreviousSibling() == null)
-- parent.setFirstAttribute((OMAttributeImpl) nextSibling);
-- else
-- previousSibling.setNextSibling(nextSibling);
-- if (nextSibling != null)
-- nextSibling.setPreviousSibling(previousSibling);
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMAttribute;
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNamespace;
-+
-+import java.io.PrintStream;
-+import java.util.regex.Matcher;
-+import java.util.regex.Pattern;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 11:43:23 AM
-+ */
-+public class OMAttributeImpl extends OMNamedNodeImpl implements OMAttribute {
-+ private static String QUOTE_ENTITY = """;
-+ private static Matcher matcher = Pattern.compile("\"").matcher(null);
-+
-+ public OMAttributeImpl(String localName, OMNamespace ns, String value, OMElement parent) {
-+ super(localName, ns, parent);
-+ setValue(value);
-+ }
-+
-+ public OMAttributeImpl(String localName, OMNamespace ns, String value) {
-+ super(localName, ns, null);
-+ setValue(value);
-+ }
-+
-+ synchronized static String replaceQuoteWithEntity(String value) {
-+ matcher.reset(value);
-+ return matcher.replaceAll(QUOTE_ENTITY);
-+ }
-+
-+ public void print(PrintStream s) throws OMException {
-+ super.print(s);
-+ s.print('=');
-+ String v = value;
-+ char quote = '"';
-+ if (value.indexOf('"') != -1)
-+ if (value.indexOf('\'') == -1)
-+ quote = '\'';
-+ else
-+ v = replaceQuoteWithEntity(value);
-+ s.print(quote);
-+ s.print(v);
-+ s.print(quote);
-+ }
-+
-+ public void detach() throws OMException {
-+ if (parent == null)
-+ throw new OMException();
-+ if (getPreviousSibling() == null)
-+ parent.setFirstAttribute((OMAttributeImpl) nextSibling);
-+ else
-+ previousSibling.setNextSibling(nextSibling);
-+ if (nextSibling != null)
-+ nextSibling.setPreviousSibling(previousSibling);
-+ }
-+}
-Index: impl/OMTextImpl.java
-===================================================================
---- impl/OMTextImpl.java (revision 54509)
-+++ impl/OMTextImpl.java (working copy)
-@@ -1,69 +1,69 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNode;
--import org.apache.axis.om.OMText;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 1:36:55 PM
-- */
--public class OMTextImpl extends OMNodeImpl implements OMText {
--
-- protected short textType;
--
-- public OMTextImpl(OMElement parent, String text) {
-- super(parent);
-- setValue(text);
-- done = true;
-- }
--
-- public OMTextImpl(String s) {
-- super();
-- setValue(s);
-- }
--
-- /**
-- * We use the OMText class to hold comments, text, characterData, CData, etc.,
-- * The codes are found in OMNode class
-- *
-- * @param type
-- */
-- public void setTextType(short type) {
-- this.textType = type;
-- }
--
-- public short getTextType() {
-- return textType; //TODO implement this
-- }
--
-- public OMNode getFirstChild() throws OMException {
-- throw new OMException();
-- }
--
-- public void setFirstChild(OMNode node) throws OMException {
-- throw new OMException();
-- }
--
-- public void print(PrintStream s) throws OMException {
-- s.print(value);
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNode;
-+import org.apache.axis.om.OMText;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 1:36:55 PM
-+ */
-+public class OMTextImpl extends OMNodeImpl implements OMText {
-+
-+ protected short textType;
-+
-+ public OMTextImpl(OMElement parent, String text) {
-+ super(parent);
-+ setValue(text);
-+ done = true;
-+ }
-+
-+ public OMTextImpl(String s) {
-+ super();
-+ setValue(s);
-+ }
-+
-+ /**
-+ * We use the OMText class to hold comments, text, characterData, CData, etc.,
-+ * The codes are found in OMNode class
-+ *
-+ * @param type
-+ */
-+ public void setTextType(short type) {
-+ this.textType = type;
-+ }
-+
-+ public short getTextType() {
-+ return textType; //TODO implement this
-+ }
-+
-+ public OMNode getFirstChild() throws OMException {
-+ throw new OMException();
-+ }
-+
-+ public void setFirstChild(OMNode node) throws OMException {
-+ throw new OMException();
-+ }
-+
-+ public void print(PrintStream s) throws OMException {
-+ s.print(value);
-+ }
-+}
-Index: impl/OMNodeImpl.java
-===================================================================
---- impl/OMNodeImpl.java (revision 54509)
-+++ impl/OMNodeImpl.java (working copy)
-@@ -1,195 +1,195 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNode;
--import org.apache.axis.om.Printable;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 5, 2004
-- * Time: 12:54:08 PM
-- */
--public class OMNodeImpl implements OMNode, Printable {
-- protected OMElementImpl parent;
-- protected OMNodeImpl nextSibling;
-- protected OMNodeImpl previousSibling;
-- protected String value;
-- protected boolean done;
--
-- public OMNodeImpl() {
-- }
--
-- /**
-- * For a node to exist there must be a parent
-- *
-- * @param parent
-- */
--
--
-- public OMNodeImpl(OMElement parent) {
-- if (parent instanceof OMNodeImpl)
-- this.parent = (OMElementImpl) parent;
-- }
--
-- /**
-- * This method should return the immediate parent of the node.
-- * Parent is always an Element
-- *
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public OMElement getParent() throws OMException {
-- return parent;
-- }
--
-- public void setParent(OMElement element) {
-- if (element instanceof OMNodeImpl)
-- this.parent = (OMElementImpl) element;
-- }
--
-- /**
-- * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-- *
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public OMNode getNextSibling() throws OMException {
-- System.out.println("***********parent = " + parent);
-- System.out.println("++++++++++++nextSibling = " + nextSibling);
-- if (nextSibling == null && !parent.isComplete())
-- parent.buildNext();
-- return nextSibling;
-- }
--
-- public void setNextSibling(OMNode node) {
-- this.nextSibling = (OMNodeImpl) node;
-- }
--
-- /**
-- * This will return the literal value of the node.
-- * OMText --> the text
-- * OMElement --> name of the element as a QName in String format
-- * OMAttribute --> the value of the attribue
-- *
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public String getValue() throws OMException {
-- return value;
-- }
--
-- public void setValue(String value) {
-- this.value = value;
-- }
--
-- /**
-- * this will indicate whether parser has parsed this information item completely or not.
-- * If somethings info are not available in the item, one has to check this attribute to make sure that, this
-- * item has been parsed completely or not.
-- *
-- * @return
-- */
-- public boolean isComplete() {
-- return true;
-- }
--
-- public void setComplete(boolean state) {
-- this.done = state;
-- }
--
-- /**
-- * This will remove this information item and its children, from the model completely
-- *
-- * @throws org.apache.axis.om.OMException
-- */
-- public void detach() throws OMException {
-- if (parent == null)
-- throw new OMException();
-- OMNodeImpl nextSibling = (OMNodeImpl) getNextSibling();
-- if (previousSibling == null)
-- parent.setFirstChild(nextSibling);
-- else
-- previousSibling.setNextSibling(nextSibling);
-- if (nextSibling != null)
-- nextSibling.setPreviousSibling(previousSibling);
--
-- }
--
-- /**
-- * This will insert a sibling just after the current information item.
-- *
-- * @param sibling
-- * @throws org.apache.axis.om.OMException
-- */
-- public void insertSiblingAfter(OMNode sibling) throws OMException {
-- if (parent == null)
-- throw new OMException();
-- sibling.setParent(parent);
--
-- if (sibling instanceof OMNodeImpl) {
-- OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
-- if (nextSibling == null)
-- getNextSibling();
-- siblingImpl.setPreviousSibling(this);
-- if (nextSibling != null)
-- nextSibling.setPreviousSibling(sibling);
-- sibling.setNextSibling(nextSibling);
-- nextSibling = siblingImpl;
-- }
--
-- }
--
-- /**
-- * This will insert a sibling just before the current information item
-- *
-- * @param sibling
-- * @throws org.apache.axis.om.OMException
-- */
-- public void insertSiblingBefore(OMNode sibling) throws OMException {
-- if (parent == null)
-- throw new OMException();
-- sibling.setParent(parent);
--
-- if (sibling instanceof OMNodeImpl) {
-- OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
-- siblingImpl.setPreviousSibling(previousSibling);
-- siblingImpl.setNextSibling(this);
-- if (previousSibling == null)
-- parent.setFirstChild(siblingImpl);
-- else
-- previousSibling.setNextSibling(siblingImpl);
-- previousSibling = siblingImpl;
-- }
-- }
--
-- public OMNode getPreviousSibling() {
-- return previousSibling;
-- }
--
-- public void setPreviousSibling(OMNode previousSibling) {
-- this.previousSibling = (OMNodeImpl) previousSibling;
-- }
--
-- public void print(PrintStream ps) throws OMException {
-- throw new OMException();
-- }
--
--
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNode;
-+import org.apache.axis.om.Printable;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 5, 2004
-+ * Time: 12:54:08 PM
-+ */
-+public class OMNodeImpl implements OMNode, Printable {
-+ protected OMElementImpl parent;
-+ protected OMNodeImpl nextSibling;
-+ protected OMNodeImpl previousSibling;
-+ protected String value;
-+ protected boolean done;
-+
-+ public OMNodeImpl() {
-+ }
-+
-+ /**
-+ * For a node to exist there must be a parent
-+ *
-+ * @param parent
-+ */
-+
-+
-+ public OMNodeImpl(OMElement parent) {
-+ if (parent instanceof OMNodeImpl)
-+ this.parent = (OMElementImpl) parent;
-+ }
-+
-+ /**
-+ * This method should return the immediate parent of the node.
-+ * Parent is always an Element
-+ *
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public OMElement getParent() throws OMException {
-+ return parent;
-+ }
-+
-+ public void setParent(OMElement element) {
-+ if (element instanceof OMNodeImpl)
-+ this.parent = (OMElementImpl) element;
-+ }
-+
-+ /**
-+ * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-+ *
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public OMNode getNextSibling() throws OMException {
-+ System.out.println("***********parent = " + parent);
-+ System.out.println("++++++++++++nextSibling = " + nextSibling);
-+ if (nextSibling == null && !parent.isComplete())
-+ parent.buildNext();
-+ return nextSibling;
-+ }
-+
-+ public void setNextSibling(OMNode node) {
-+ this.nextSibling = (OMNodeImpl) node;
-+ }
-+
-+ /**
-+ * This will return the literal value of the node.
-+ * OMText --> the text
-+ * OMElement --> name of the element as a QName in String format
-+ * OMAttribute --> the value of the attribue
-+ *
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public String getValue() throws OMException {
-+ return value;
-+ }
-+
-+ public void setValue(String value) {
-+ this.value = value;
-+ }
-+
-+ /**
-+ * this will indicate whether parser has parsed this information item completely or not.
-+ * If somethings info are not available in the item, one has to check this attribute to make sure that, this
-+ * item has been parsed completely or not.
-+ *
-+ * @return
-+ */
-+ public boolean isComplete() {
-+ return true;
-+ }
-+
-+ public void setComplete(boolean state) {
-+ this.done = state;
-+ }
-+
-+ /**
-+ * This will remove this information item and its children, from the model completely
-+ *
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public void detach() throws OMException {
-+ if (parent == null)
-+ throw new OMException();
-+ OMNodeImpl nextSibling = (OMNodeImpl) getNextSibling();
-+ if (previousSibling == null)
-+ parent.setFirstChild(nextSibling);
-+ else
-+ previousSibling.setNextSibling(nextSibling);
-+ if (nextSibling != null)
-+ nextSibling.setPreviousSibling(previousSibling);
-+
-+ }
-+
-+ /**
-+ * This will insert a sibling just after the current information item.
-+ *
-+ * @param sibling
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public void insertSiblingAfter(OMNode sibling) throws OMException {
-+ if (parent == null)
-+ throw new OMException();
-+ sibling.setParent(parent);
-+
-+ if (sibling instanceof OMNodeImpl) {
-+ OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
-+ if (nextSibling == null)
-+ getNextSibling();
-+ siblingImpl.setPreviousSibling(this);
-+ if (nextSibling != null)
-+ nextSibling.setPreviousSibling(sibling);
-+ sibling.setNextSibling(nextSibling);
-+ nextSibling = siblingImpl;
-+ }
-+
-+ }
-+
-+ /**
-+ * This will insert a sibling just before the current information item
-+ *
-+ * @param sibling
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public void insertSiblingBefore(OMNode sibling) throws OMException {
-+ if (parent == null)
-+ throw new OMException();
-+ sibling.setParent(parent);
-+
-+ if (sibling instanceof OMNodeImpl) {
-+ OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
-+ siblingImpl.setPreviousSibling(previousSibling);
-+ siblingImpl.setNextSibling(this);
-+ if (previousSibling == null)
-+ parent.setFirstChild(siblingImpl);
-+ else
-+ previousSibling.setNextSibling(siblingImpl);
-+ previousSibling = siblingImpl;
-+ }
-+ }
-+
-+ public OMNode getPreviousSibling() {
-+ return previousSibling;
-+ }
-+
-+ public void setPreviousSibling(OMNode previousSibling) {
-+ this.previousSibling = (OMNodeImpl) previousSibling;
-+ }
-+
-+ public void print(PrintStream ps) throws OMException {
-+ throw new OMException();
-+ }
-+
-+
-+}
-Index: impl/OMNavigator.java
-===================================================================
---- impl/OMNavigator.java (revision 54509)
-+++ impl/OMNavigator.java (working copy)
-@@ -1,78 +1,78 @@
--/*
-- * Copyright 2004 The Apache Software Foundation.
-- *
-- * 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
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * 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.
-- *
-- */
--
--/*
-- * Created on Sep 25, 2004
-- *
-- */
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMNode;
--
--/**
-- * @author Dasarath Weeratunge
-- */
--public class OMNavigator {
-- protected OMNode node;
-- private boolean visited;
-- private OMNode next;
-- private boolean backtracked;
--
-- public OMNavigator() {
-- }
--
-- public OMNavigator(OMNode node) {
-- init(node);
-- }
--
-- public void init(OMNode node) {
-- next = node;
-- backtracked = false;
-- }
--
-- public OMNode next() {
-- if (next == null)
-- return null;
-- node = next;
-- visited = backtracked;
-- backtracked = false;
-- if (next instanceof OMElement && !visited) {
-- OMElementImpl e = (OMElementImpl) next;
-- if (e.getFirstChild() != null)
-- next = e.getFirstChild();
-- else if (e.isComplete())
-- backtracked = true;
-- else
-- next = null;
-- return node;
-- }
-- OMNodeImpl n = (OMNodeImpl) next;
-- if (n.nextSibling != null)
-- next = n.nextSibling;
-- else if (n.parent != null && n.parent.isComplete()) {
-- next = n.parent;
-- backtracked = true;
-- } else
-- next = null;
-- return node;
-- }
--
-- public boolean visited() {
-- return visited;
-- }
--}
-+/*
-+ * Copyright 2004 The Apache Software Foundation.
-+ *
-+ * 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
-+ *
-+ * http://www.apache.org/licenses/LICENSE-2.0
-+ *
-+ * 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.
-+ *
-+ */
-+
-+/*
-+ * Created on Sep 25, 2004
-+ *
-+ */
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMNode;
-+
-+/**
-+ * @author Dasarath Weeratunge
-+ */
-+public class OMNavigator {
-+ protected OMNode node;
-+ private boolean visited;
-+ private OMNode next;
-+ private boolean backtracked;
-+
-+ public OMNavigator() {
-+ }
-+
-+ public OMNavigator(OMNode node) {
-+ init(node);
-+ }
-+
-+ public void init(OMNode node) {
-+ next = node;
-+ backtracked = false;
-+ }
-+
-+ public OMNode next() {
-+ if (next == null)
-+ return null;
-+ node = next;
-+ visited = backtracked;
-+ backtracked = false;
-+ if (next instanceof OMElement && !visited) {
-+ OMElementImpl e = (OMElementImpl) next;
-+ if (e.getFirstChild() != null)
-+ next = e.getFirstChild();
-+ else if (e.isComplete())
-+ backtracked = true;
-+ else
-+ next = null;
-+ return node;
-+ }
-+ OMNodeImpl n = (OMNodeImpl) next;
-+ if (n.nextSibling != null)
-+ next = n.nextSibling;
-+ else if (n.parent != null && n.parent.isComplete()) {
-+ next = n.parent;
-+ backtracked = true;
-+ } else
-+ next = null;
-+ return node;
-+ }
-+
-+ public boolean visited() {
-+ return visited;
-+ }
-+}
-Index: impl/OMXmlPullParserWrapper.java
-===================================================================
---- impl/OMXmlPullParserWrapper.java (revision 54509)
-+++ impl/OMXmlPullParserWrapper.java (working copy)
-@@ -1,333 +1,333 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.*;
--import org.xmlpull.v1.XmlPullParser;
--import org.xmlpull.v1.XmlPullParserException;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 11:42:44 AM
-- */
--public class OMXmlPullParserWrapper {
-- private XmlPullParser parser;
-- // private OMElementImpl root;
-- private OMDocumentImpl document;
-- private OMNodeImpl lastNode;
-- private boolean cache = true;
-- private boolean slip = false;
-- private boolean navigate = false;
-- private boolean done = false;
-- private OMNavigator navigator = new OMNavigator();
--
-- public OMXmlPullParserWrapper(XmlPullParser parser) {
-- this.parser = parser;
-- }
--
--// public OMElementImpl getDocument() throws OMException {
--// if (root == null)
--// next();
--// return root;
--// }
-- public OMDocumentImpl getDocument() throws OMException {
-- document = new OMDocumentImpl(this);
-- return document;
-- }
--
-- private OMNode createOMElement() throws OMException {
-- OMElementImpl node;
-- if (lastNode == null) {
-- node = new OMElementImpl(parser.getName(), null, null, this);
-- document.setRootElement(node);
--// root = new OMElementImpl(parser.getName(), null, null, this);
--// node = root;
-- } else if (lastNode.isComplete()) {
-- node = new OMElementImpl(parser.getName(), null, lastNode.getParent(), this);
-- lastNode.setNextSibling(node);
-- node.setPreviousSibling(lastNode);
-- } else {
-- System.out.println("lastNode = " + lastNode.getClass());
-- OMElementImpl e = (OMElementImpl) lastNode;
-- node = new OMElementImpl(parser.getName(), null, (OMElement) lastNode, this);
-- e.setFirstChild(node);
-- }
--
-- int i, j;
-- try {
-- j = parser.getNamespaceCount(parser.getDepth());
-- i = 0;
-- if (j > 1)
-- i = parser.getNamespaceCount(parser.getDepth() - 1);
-- while (i < j) {
-- node.createNamespace(parser.getNamespaceUri(i), parser.getNamespacePrefix(i));
-- i++;
-- }
-- } catch (XmlPullParserException e) {
-- throw new OMException(e);
-- }
--
-- node.setNamespace(node.resolveNamespace(parser.getNamespace(), parser.getPrefix()));
--
-- j = parser.getAttributeCount();
-- for (i = 0; i < j; i++) {
-- OMNamespace ns = null;
-- String uri = parser.getAttributeNamespace(i);
-- if (uri.hashCode() != 0)
-- ns = node.resolveNamespace(uri, parser.getAttributePrefix(i));
-- node.insertAttribute(new OMAttributeImpl(parser.getAttributeName(i), ns, parser.getAttributeValue(i), node));
-- }
--
-- return node;
-- }
--
-- private OMNode createOMText() throws OMException {
-- if (lastNode == null)
-- throw new OMException();
-- OMNodeImpl node;
-- if (lastNode.isComplete()) {
-- node = new OMTextImpl(lastNode.getParent(), parser.getText());
-- lastNode.setNextSibling(node);
-- node.setPreviousSibling(lastNode);
-- } else {
-- OMElementImpl e = (OMElementImpl) lastNode;
-- node = new OMTextImpl(e, parser.getText());
-- e.setFirstChild(node);
-- }
-- return node;
-- }
--
-- public void reset(OMNode node) throws OMException {
-- navigate = true;
-- lastNode = null;
-- navigator.init(node);
-- }
--
-- // TODO:
-- public int next() throws OMException {
-- try {
-- if (navigate) {
-- OMNodeImpl next = (OMNodeImpl) navigator.next();
-- if (next != null) {
-- lastNode = next;
-- if (lastNode instanceof OMText)
-- return XmlPullParser.TEXT;
-- else if (navigator.visited())
-- return XmlPullParser.END_TAG;
-- else
-- return XmlPullParser.START_TAG;
-- }
-- navigate = false;
-- if (done)
-- return XmlPullParser.END_DOCUMENT;
-- if (slip)
-- throw new OMException();
-- }
--
-- if (done)
-- throw new OMException();
--
-- int token = parser.nextToken();
--
-- if (!cache) {
-- slip = true;
-- return token;
-- }
--
-- switch (token) {
-- case XmlPullParser.START_TAG:
-- lastNode = (OMNodeImpl) createOMElement();
-- break;
--
-- case XmlPullParser.TEXT:
-- lastNode = (OMNodeImpl) createOMText();
-- break;
--
-- case XmlPullParser.END_TAG:
-- if (lastNode.isComplete()) {
-- OMElement parent = lastNode.getParent();
-- parent.setComplete(true);
-- lastNode = (OMNodeImpl) parent;
-- } else {
-- OMElement e = (OMElement) lastNode;
-- e.setComplete(true);
-- }
-- break;
--
-- case XmlPullParser.END_DOCUMENT:
-- done = true;
-- break;
--
-- default :
-- throw new OMException();
-- }
-- return token;
-- } catch (OMException e) {
-- throw e;
-- } catch (Exception e) {
-- e.printStackTrace();
-- throw new OMException(e);
-- }
-- }
--
-- public void discard(OMElementImpl el) throws OMException {
-- if (el.isComplete() || !cache)
-- throw new OMException();
-- try {
-- cache = false;
-- do {
-- while (parser.next() != XmlPullParser.END_TAG) ;
-- // TODO:
-- } while (!parser.getName().equals(el.getLocalName()));
-- lastNode = (OMNodeImpl) el.getPreviousSibling();
-- if (lastNode != null)
-- lastNode.setNextSibling(null);
-- else {
-- OMElementImpl parent = (OMElementImpl) el.getParent();
-- if (parent == null)
-- throw new OMException();
-- parent.setFirstChild(null);
-- lastNode = parent;
-- }
-- slip = false;
-- cache = true;
-- } catch (OMException e) {
-- throw e;
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public void setCache(boolean b) {
-- cache = b;
-- }
--
-- public String getName() throws OMException {
-- if (navigate) {
-- try {
-- OMElement e = (OMElement) lastNode;
-- return e.getLocalName();
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
-- return parser.getName();
-- }
--
-- public String getText() throws OMException {
-- if (navigate) {
-- try {
-- return (String) lastNode.getValue();
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
-- return parser.getText();
-- }
--
-- public String getNamespace() throws OMException {
-- if (navigate) {
-- if (lastNode instanceof OMElement) {
-- OMElement node = (OMElement) lastNode;
-- OMNamespace ns = node.getNamespace();
-- if (ns != null)
-- return ns.getValue();
-- // TODO: else
-- }
-- throw new OMException();
-- }
-- return parser.getNamespace();
-- }
--
-- public int getNamespaceCount(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- try {
-- return parser.getNamespaceCount(arg);
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public String getNamespacePrefix(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- try {
-- return parser.getNamespacePrefix(arg);
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public String getNamespaceUri(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- try {
-- return parser.getNamespaceUri(arg);
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public String getNamespace(String arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- try {
-- return parser.getNamespace(arg);
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public String getPrefix() throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getPrefix();
-- }
--
-- public int getAttributeCount() throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getAttributeCount();
-- }
--
-- public String getAttributeNamespace(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getAttributeNamespace(arg);
-- }
--
-- public String getAttributeName(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getAttributeNamespace(arg);
-- }
--
-- public String getAttributePrefix(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getAttributeNamespace(arg);
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.*;
-+import org.xmlpull.v1.XmlPullParser;
-+import org.xmlpull.v1.XmlPullParserException;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 11:42:44 AM
-+ */
-+public class OMXmlPullParserWrapper {
-+ private XmlPullParser parser;
-+ // private OMElementImpl root;
-+ private OMDocumentImpl document;
-+ private OMNodeImpl lastNode;
-+ private boolean cache = true;
-+ private boolean slip = false;
-+ private boolean navigate = false;
-+ private boolean done = false;
-+ private OMNavigator navigator = new OMNavigator();
-+
-+ public OMXmlPullParserWrapper(XmlPullParser parser) {
-+ this.parser = parser;
-+ }
-+
-+// public OMElementImpl getDocument() throws OMException {
-+// if (root == null)
-+// next();
-+// return root;
-+// }
-+ public OMDocumentImpl getDocument() throws OMException {
-+ document = new OMDocumentImpl(this);
-+ return document;
-+ }
-+
-+ private OMNode createOMElement() throws OMException {
-+ OMElementImpl node;
-+ if (lastNode == null) {
-+ node = new OMElementImpl(parser.getName(), null, null, this);
-+ document.setRootElement(node);
-+// root = new OMElementImpl(parser.getName(), null, null, this);
-+// node = root;
-+ } else if (lastNode.isComplete()) {
-+ node = new OMElementImpl(parser.getName(), null, lastNode.getParent(), this);
-+ lastNode.setNextSibling(node);
-+ node.setPreviousSibling(lastNode);
-+ } else {
-+ System.out.println("lastNode = " + lastNode.getClass());
-+ OMElementImpl e = (OMElementImpl) lastNode;
-+ node = new OMElementImpl(parser.getName(), null, (OMElement) lastNode, this);
-+ e.setFirstChild(node);
-+ }
-+
-+ int i, j;
-+ try {
-+ j = parser.getNamespaceCount(parser.getDepth());
-+ i = 0;
-+ if (j > 1)
-+ i = parser.getNamespaceCount(parser.getDepth() - 1);
-+ while (i < j) {
-+ node.createNamespace(parser.getNamespaceUri(i), parser.getNamespacePrefix(i));
-+ i++;
-+ }
-+ } catch (XmlPullParserException e) {
-+ throw new OMException(e);
-+ }
-+
-+ node.setNamespace(node.resolveNamespace(parser.getNamespace(), parser.getPrefix()));
-+
-+ j = parser.getAttributeCount();
-+ for (i = 0; i < j; i++) {
-+ OMNamespace ns = null;
-+ String uri = parser.getAttributeNamespace(i);
-+ if (uri.hashCode() != 0)
-+ ns = node.resolveNamespace(uri, parser.getAttributePrefix(i));
-+ node.insertAttribute(new OMAttributeImpl(parser.getAttributeName(i), ns, parser.getAttributeValue(i), node));
-+ }
-+
-+ return node;
-+ }
-+
-+ private OMNode createOMText() throws OMException {
-+ if (lastNode == null)
-+ throw new OMException();
-+ OMNodeImpl node;
-+ if (lastNode.isComplete()) {
-+ node = new OMTextImpl(lastNode.getParent(), parser.getText());
-+ lastNode.setNextSibling(node);
-+ node.setPreviousSibling(lastNode);
-+ } else {
-+ OMElementImpl e = (OMElementImpl) lastNode;
-+ node = new OMTextImpl(e, parser.getText());
-+ e.setFirstChild(node);
-+ }
-+ return node;
-+ }
-+
-+ public void reset(OMNode node) throws OMException {
-+ navigate = true;
-+ lastNode = null;
-+ navigator.init(node);
-+ }
-+
-+ // TODO:
-+ public int next() throws OMException {
-+ try {
-+ if (navigate) {
-+ OMNodeImpl next = (OMNodeImpl) navigator.next();
-+ if (next != null) {
-+ lastNode = next;
-+ if (lastNode instanceof OMText)
-+ return XmlPullParser.TEXT;
-+ else if (navigator.visited())
-+ return XmlPullParser.END_TAG;
-+ else
-+ return XmlPullParser.START_TAG;
-+ }
-+ navigate = false;
-+ if (done)
-+ return XmlPullParser.END_DOCUMENT;
-+ if (slip)
-+ throw new OMException();
-+ }
-+
-+ if (done)
-+ throw new OMException();
-+
-+ int token = parser.nextToken();
-+
-+ if (!cache) {
-+ slip = true;
-+ return token;
-+ }
-+
-+ switch (token) {
-+ case XmlPullParser.START_TAG:
-+ lastNode = (OMNodeImpl) createOMElement();
-+ break;
-+
-+ case XmlPullParser.TEXT:
-+ lastNode = (OMNodeImpl) createOMText();
-+ break;
-+
-+ case XmlPullParser.END_TAG:
-+ if (lastNode.isComplete()) {
-+ OMElement parent = lastNode.getParent();
-+ parent.setComplete(true);
-+ lastNode = (OMNodeImpl) parent;
-+ } else {
-+ OMElement e = (OMElement) lastNode;
-+ e.setComplete(true);
-+ }
-+ break;
-+
-+ case XmlPullParser.END_DOCUMENT:
-+ done = true;
-+ break;
-+
-+ default :
-+ throw new OMException();
-+ }
-+ return token;
-+ } catch (OMException e) {
-+ throw e;
-+ } catch (Exception e) {
-+ e.printStackTrace();
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public void discard(OMElementImpl el) throws OMException {
-+ if (el.isComplete() || !cache)
-+ throw new OMException();
-+ try {
-+ cache = false;
-+ do {
-+ while (parser.next() != XmlPullParser.END_TAG) ;
-+ // TODO:
-+ } while (!parser.getName().equals(el.getLocalName()));
-+ lastNode = (OMNodeImpl) el.getPreviousSibling();
-+ if (lastNode != null)
-+ lastNode.setNextSibling(null);
-+ else {
-+ OMElementImpl parent = (OMElementImpl) el.getParent();
-+ if (parent == null)
-+ throw new OMException();
-+ parent.setFirstChild(null);
-+ lastNode = parent;
-+ }
-+ slip = false;
-+ cache = true;
-+ } catch (OMException e) {
-+ throw e;
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public void setCache(boolean b) {
-+ cache = b;
-+ }
-+
-+ public String getName() throws OMException {
-+ if (navigate) {
-+ try {
-+ OMElement e = (OMElement) lastNode;
-+ return e.getLocalName();
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+ return parser.getName();
-+ }
-+
-+ public String getText() throws OMException {
-+ if (navigate) {
-+ try {
-+ return (String) lastNode.getValue();
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+ return parser.getText();
-+ }
-+
-+ public String getNamespace() throws OMException {
-+ if (navigate) {
-+ if (lastNode instanceof OMElement) {
-+ OMElement node = (OMElement) lastNode;
-+ OMNamespace ns = node.getNamespace();
-+ if (ns != null)
-+ return ns.getValue();
-+ // TODO: else
-+ }
-+ throw new OMException();
-+ }
-+ return parser.getNamespace();
-+ }
-+
-+ public int getNamespaceCount(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ try {
-+ return parser.getNamespaceCount(arg);
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public String getNamespacePrefix(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ try {
-+ return parser.getNamespacePrefix(arg);
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public String getNamespaceUri(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ try {
-+ return parser.getNamespaceUri(arg);
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public String getNamespace(String arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ try {
-+ return parser.getNamespace(arg);
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public String getPrefix() throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getPrefix();
-+ }
-+
-+ public int getAttributeCount() throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getAttributeCount();
-+ }
-+
-+ public String getAttributeNamespace(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getAttributeNamespace(arg);
-+ }
-+
-+ public String getAttributeName(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getAttributeNamespace(arg);
-+ }
-+
-+ public String getAttributePrefix(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getAttributeNamespace(arg);
-+ }
-+}
-Index: impl/OMElementImpl.java
-===================================================================
---- impl/OMElementImpl.java (revision 54509)
-+++ impl/OMElementImpl.java (working copy)
-@@ -1,236 +1,236 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.*;
--import org.apache.axis.om.impl.util.OMChildrenIterator;
--
--import java.io.PrintStream;
--import java.util.Iterator;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 5, 2004
-- * Time: 1:16:10 PM
-- */
--public class OMElementImpl extends OMNamedNodeImpl implements OMElement {
-- private OMNodeImpl firstChild;
-- OMXmlPullParserWrapper builder;
-- OMAttributeImpl firstAttribute;
-- OMNamespaceImpl firstNamespace;
--
-- public OMElementImpl(OMElement parent) {
-- super(parent);
-- }
--
-- public OMElementImpl(String localName, OMNamespace ns) {
-- super(localName, ns, null);
-- done = true;
-- }
--
-- public OMElementImpl(String localName, OMNamespace ns, OMElement parent, OMXmlPullParserWrapper builder) {
-- super(localName, ns, parent);
-- this.builder = builder;
--
-- }
--
-- /**
-- * This will add child to the element. One can decide whether he append the child or he adds to the
-- * front of the children list
-- *
-- * @param child
-- */
-- public void addChild(OMNode child) {
-- addChild((OMNodeImpl) child);
-- }
--
-- private void addChild(OMNodeImpl child) {
-- if (firstChild == null && !done)
-- builder.next();
-- child.setPreviousSibling(null);
-- child.setNextSibling(firstChild);
-- if (firstChild != null)
-- firstChild.setPreviousSibling(child);
-- child.setParent(this);
-- firstChild = child;
-- }
--
-- /**
-- * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-- *
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public OMNode getNextSibling() throws OMException {
-- while (!done)
-- builder.next();
-- return super.getNextSibling();
-- }
--
-- /**
-- * This returns a collection of this element.
-- * Children can be of types OMElement, OMText.
-- */
-- public Iterator getChildren() {
-- return new OMChildrenIterator(firstChild);
-- }
--
-- /**
-- * THis will create a namespace in the current element scope
-- *
-- * @param uri
-- * @param prefix
-- * @return
-- */
-- public OMNamespace createNamespace(String uri, String prefix) {
-- OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix);
-- ns.setNextSibling(firstNamespace);
-- firstNamespace = ns;
-- return ns;
-- }
--
-- /**
-- * This will find a namespace with the given uri and prefix, in the scope of the docuemnt.
-- * This will start to find from the current element and goes up in the hiararchy until this finds one.
-- * If none is found, return null
-- *
-- * @param uri
-- * @param prefix
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public OMNamespace resolveNamespace(String uri, String prefix) throws OMException {
-- OMNamespace ns = firstNamespace;
-- while (ns != null) {
-- if (ns.equals(uri, prefix))
-- return ns;
-- ns = (OMNamespace) ns.getNextSibling();
-- }
-- if (parent != null)
-- return parent.resolveNamespace(uri, prefix);
-- return null;
-- }
--
-- /**
-- * This will returns the first attribute of the element or null, if none is present
-- *
-- * @return
-- */
-- public OMAttribute getFirstAttribute() {
-- return firstAttribute;
-- }
--
-- /**
-- * This will return a List of OMAttributes
-- *
-- * @return
-- */
-- public Iterator getAttributes() {
-- return new OMChildrenIterator(getFirstAttribute());
-- }
--
-- /**
-- * This will insert attribute to this element. Implementor can decide as to insert this
-- * in the front or at the end of set of attributes
-- *
-- * @param attr
-- */
-- public void insertAttribute(OMAttribute attr) {
--
-- OMAttributeImpl attrImpl = (OMAttributeImpl) attr;
-- attrImpl.setPreviousSibling(null);
-- attrImpl.setNextSibling(firstAttribute);
-- if (firstAttribute != null)
-- firstAttribute.setPreviousSibling(attrImpl);
-- attrImpl.setParent(this);
-- firstAttribute = attrImpl;
-- }
--
-- public void removeAttribute(OMAttribute attr) {
-- attr.detach();
-- }
--
-- /**
-- * This will force the parser to proceed, if parser has not yet finished with the XML input
-- */
-- public void buildNext() {
-- builder.next();
-- }
--
-- public OMNodeImpl getFirstChild() {
-- if (firstChild == null && !done)
-- buildNext();
-- return firstChild;
-- }
--
--
-- public void setFirstChild(OMNodeImpl firstChild) {
-- this.firstChild = firstChild;
-- }
--
-- public void print(PrintStream s) throws OMException {
-- s.print('<');
-- super.print(s);
--
-- OMNodeImpl node = firstAttribute;
-- while (node != null) {
-- s.print(" ");
-- node.print(s);
-- node = (OMNodeImpl) node.getNextSibling();
-- }
--
-- node = firstNamespace;
-- while (node != null) {
-- s.print(" ");
-- node.print(s);
-- node = (OMNodeImpl) node.getNextSibling();
-- }
--
-- node = getFirstChild();
-- if (node != null) {
-- s.print('>');
-- while (node != null) {
-- node.print(s);
-- node = (OMNodeImpl) node.getNextSibling();
-- }
-- s.print('<');
-- s.print('/');
-- super.print(s);
-- } else
-- s.print('/');
-- s.print('>');
-- }
--
-- /**
-- * This will remove this information item and its children, from the model completely
-- *
-- * @throws org.apache.axis.om.OMException
-- */
-- public void detach() throws OMException {
-- if (done)
-- super.detach();
-- else
-- builder.discard(this);
-- }
--
-- public void setFirstAttribute(OMAttributeImpl firstAttribute) {
-- this.firstAttribute = firstAttribute;
-- }
--
--
-- public boolean isComplete() {
-- return done;
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.*;
-+import org.apache.axis.om.impl.util.OMChildrenIterator;
-+
-+import java.io.PrintStream;
-+import java.util.Iterator;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 5, 2004
-+ * Time: 1:16:10 PM
-+ */
-+public class OMElementImpl extends OMNamedNodeImpl implements OMElement {
-+ private OMNodeImpl firstChild;
-+ OMXmlPullParserWrapper builder;
-+ OMAttributeImpl firstAttribute;
-+ OMNamespaceImpl firstNamespace;
-+
-+ public OMElementImpl(OMElement parent) {
-+ super(parent);
-+ }
-+
-+ public OMElementImpl(String localName, OMNamespace ns) {
-+ super(localName, ns, null);
-+ done = true;
-+ }
-+
-+ public OMElementImpl(String localName, OMNamespace ns, OMElement parent, OMXmlPullParserWrapper builder) {
-+ super(localName, ns, parent);
-+ this.builder = builder;
-+
-+ }
-+
-+ /**
-+ * This will add child to the element. One can decide whether he append the child or he adds to the
-+ * front of the children list
-+ *
-+ * @param child
-+ */
-+ public void addChild(OMNode child) {
-+ addChild((OMNodeImpl) child);
-+ }
-+
-+ private void addChild(OMNodeImpl child) {
-+ if (firstChild == null && !done)
-+ builder.next();
-+ child.setPreviousSibling(null);
-+ child.setNextSibling(firstChild);
-+ if (firstChild != null)
-+ firstChild.setPreviousSibling(child);
-+ child.setParent(this);
-+ firstChild = child;
-+ }
-+
-+ /**
-+ * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-+ *
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public OMNode getNextSibling() throws OMException {
-+ while (!done)
-+ builder.next();
-+ return super.getNextSibling();
-+ }
-+
-+ /**
-+ * This returns a collection of this element.
-+ * Children can be of types OMElement, OMText.
-+ */
-+ public Iterator getChildren() {
-+ return new OMChildrenIterator(firstChild);
-+ }
-+
-+ /**
-+ * THis will create a namespace in the current element scope
-+ *
-+ * @param uri
-+ * @param prefix
-+ * @return
-+ */
-+ public OMNamespace createNamespace(String uri, String prefix) {
-+ OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix);
-+ ns.setNextSibling(firstNamespace);
-+ firstNamespace = ns;
-+ return ns;
-+ }
-+
-+ /**
-+ * This will find a namespace with the given uri and prefix, in the scope of the docuemnt.
-+ * This will start to find from the current element and goes up in the hiararchy until this finds one.
-+ * If none is found, return null
-+ *
-+ * @param uri
-+ * @param prefix
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public OMNamespace resolveNamespace(String uri, String prefix) throws OMException {
-+ OMNamespace ns = firstNamespace;
-+ while (ns != null) {
-+ if (ns.equals(uri, prefix))
-+ return ns;
-+ ns = (OMNamespace) ns.getNextSibling();
-+ }
-+ if (parent != null)
-+ return parent.resolveNamespace(uri, prefix);
-+ return null;
-+ }
-+
-+ /**
-+ * This will returns the first attribute of the element or null, if none is present
-+ *
-+ * @return
-+ */
-+ public OMAttribute getFirstAttribute() {
-+ return firstAttribute;
-+ }
-+
-+ /**
-+ * This will return a List of OMAttributes
-+ *
-+ * @return
-+ */
-+ public Iterator getAttributes() {
-+ return new OMChildrenIterator(getFirstAttribute());
-+ }
-+
-+ /**
-+ * This will insert attribute to this element. Implementor can decide as to insert this
-+ * in the front or at the end of set of attributes
-+ *
-+ * @param attr
-+ */
-+ public void insertAttribute(OMAttribute attr) {
-+
-+ OMAttributeImpl attrImpl = (OMAttributeImpl) attr;
-+ attrImpl.setPreviousSibling(null);
-+ attrImpl.setNextSibling(firstAttribute);
-+ if (firstAttribute != null)
-+ firstAttribute.setPreviousSibling(attrImpl);
-+ attrImpl.setParent(this);
-+ firstAttribute = attrImpl;
-+ }
-+
-+ public void removeAttribute(OMAttribute attr) {
-+ attr.detach();
-+ }
-+
-+ /**
-+ * This will force the parser to proceed, if parser has not yet finished with the XML input
-+ */
-+ public void buildNext() {
-+ builder.next();
-+ }
-+
-+ public OMNodeImpl getFirstChild() {
-+ if (firstChild == null && !done)
-+ buildNext();
-+ return firstChild;
-+ }
-+
-+
-+ public void setFirstChild(OMNodeImpl firstChild) {
-+ this.firstChild = firstChild;
-+ }
-+
-+ public void print(PrintStream s) throws OMException {
-+ s.print('<');
-+ super.print(s);
-+
-+ OMNodeImpl node = firstAttribute;
-+ while (node != null) {
-+ s.print(" ");
-+ node.print(s);
-+ node = (OMNodeImpl) node.getNextSibling();
-+ }
-+
-+ node = firstNamespace;
-+ while (node != null) {
-+ s.print(" ");
-+ node.print(s);
-+ node = (OMNodeImpl) node.getNextSibling();
-+ }
-+
-+ node = getFirstChild();
-+ if (node != null) {
-+ s.print('>');
-+ while (node != null) {
-+ node.print(s);
-+ node = (OMNodeImpl) node.getNextSibling();
-+ }
-+ s.print('<');
-+ s.print('/');
-+ super.print(s);
-+ } else
-+ s.print('/');
-+ s.print('>');
-+ }
-+
-+ /**
-+ * This will remove this information item and its children, from the model completely
-+ *
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public void detach() throws OMException {
-+ if (done)
-+ super.detach();
-+ else
-+ builder.discard(this);
-+ }
-+
-+ public void setFirstAttribute(OMAttributeImpl firstAttribute) {
-+ this.firstAttribute = firstAttribute;
-+ }
-+
-+
-+ public boolean isComplete() {
-+ return done;
-+ }
-+}
-Index: impl/OMNamedNodeImpl.java
-===================================================================
---- impl/OMNamedNodeImpl.java (revision 54509)
-+++ impl/OMNamedNodeImpl.java (working copy)
-@@ -1,71 +1,71 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNamedNode;
--import org.apache.axis.om.OMNamespace;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 5, 2004
-- * Time: 1:17:37 PM
-- */
--public class OMNamedNodeImpl extends OMNodeImpl implements OMNamedNode {
--
-- OMNamespace ns;
-- String localName;
--
--
-- public OMNamedNodeImpl(String localName, OMNamespace ns, OMElement parent) {
-- super(parent);
-- this.localName = localName;
-- this.ns = ns;
-- }
--
-- public OMNamedNodeImpl(OMElement parent) {
-- super(parent);
-- }
--
-- public String getLocalName() {
-- return localName;
-- }
--
-- public void setLocalName(String localName) {
-- this.localName = localName;
-- }
--
-- public OMNamespace getNamespace() throws OMException {
-- return ns;
-- }
--
-- /**
-- * @param namespace
-- */
-- public void setNamespace(OMNamespace namespace) {
-- this.ns = namespace;
-- }
--
-- public void print(PrintStream ps) throws OMException {
-- if (ns != null && !ns.isDefaultNs()) {
-- ps.print(ns.getPrefix());
-- ps.print(':');
-- }
-- ps.print(localName);
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNamedNode;
-+import org.apache.axis.om.OMNamespace;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 5, 2004
-+ * Time: 1:17:37 PM
-+ */
-+public class OMNamedNodeImpl extends OMNodeImpl implements OMNamedNode {
-+
-+ OMNamespace ns;
-+ String localName;
-+
-+
-+ public OMNamedNodeImpl(String localName, OMNamespace ns, OMElement parent) {
-+ super(parent);
-+ this.localName = localName;
-+ this.ns = ns;
-+ }
-+
-+ public OMNamedNodeImpl(OMElement parent) {
-+ super(parent);
-+ }
-+
-+ public String getLocalName() {
-+ return localName;
-+ }
-+
-+ public void setLocalName(String localName) {
-+ this.localName = localName;
-+ }
-+
-+ public OMNamespace getNamespace() throws OMException {
-+ return ns;
-+ }
-+
-+ /**
-+ * @param namespace
-+ */
-+ public void setNamespace(OMNamespace namespace) {
-+ this.ns = namespace;
-+ }
-+
-+ public void print(PrintStream ps) throws OMException {
-+ if (ns != null && !ns.isDefaultNs()) {
-+ ps.print(ns.getPrefix());
-+ ps.print(':');
-+ }
-+ ps.print(localName);
-+ }
-+}
-Index: impl/OMNamespaceImpl.java
-===================================================================
---- impl/OMNamespaceImpl.java (revision 54509)
-+++ impl/OMNamespaceImpl.java (working copy)
-@@ -1,70 +1,70 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNamespace;
--import org.apache.axis.om.OMNode;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 11:43:32 AM
-- */
--public class OMNamespaceImpl extends OMNodeImpl implements OMNamespace {
-- private String prefix;
--
-- protected OMNamespaceImpl(String uri, String prefix) {
-- value = uri;
-- this.prefix = prefix;
-- }
--
--
-- public boolean equals(OMNamespace ns) {
-- return ((prefix == null && ns.getPrefix() == null) || (prefix != null && prefix.equals(ns.getPrefix())))
-- && value.equals(ns.getValue());
-- }
--
-- public boolean equals(String uri, String prefix) {
-- return ((prefix == null && this.prefix == null) || (prefix != null && prefix.equals(this.prefix)))
-- && value.equals(uri);
-- }
--
-- public void print(PrintStream s) {
-- s.print("xmlns");
-- if (prefix != null) {
-- s.print(':');
-- s.print(prefix);
-- }
-- s.print('=');
-- s.print('"');
-- s.print(value);
-- s.print('"');
-- }
--
-- public boolean isDefaultNs() {
-- return prefix == null;
-- }
--
-- public String getPrefix() {
-- return prefix; //TODO implement this
-- }
--
-- public OMNode getNextSibling() throws OMException {
-- return nextSibling;
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNamespace;
-+import org.apache.axis.om.OMNode;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 11:43:32 AM
-+ */
-+public class OMNamespaceImpl extends OMNodeImpl implements OMNamespace {
-+ private String prefix;
-+
-+ protected OMNamespaceImpl(String uri, String prefix) {
-+ value = uri;
-+ this.prefix = prefix;
-+ }
-+
-+
-+ public boolean equals(OMNamespace ns) {
-+ return ((prefix == null && ns.getPrefix() == null) || (prefix != null && prefix.equals(ns.getPrefix())))
-+ && value.equals(ns.getValue());
-+ }
-+
-+ public boolean equals(String uri, String prefix) {
-+ return ((prefix == null && this.prefix == null) || (prefix != null && prefix.equals(this.prefix)))
-+ && value.equals(uri);
-+ }
-+
-+ public void print(PrintStream s) {
-+ s.print("xmlns");
-+ if (prefix != null) {
-+ s.print(':');
-+ s.print(prefix);
-+ }
-+ s.print('=');
-+ s.print('"');
-+ s.print(value);
-+ s.print('"');
-+ }
-+
-+ public boolean isDefaultNs() {
-+ return prefix == null;
-+ }
-+
-+ public String getPrefix() {
-+ return prefix; //TODO implement this
-+ }
-+
-+ public OMNode getNextSibling() throws OMException {
-+ return nextSibling;
-+ }
-+}
-Index: impl/OMDocumentImpl.java
-===================================================================
---- impl/OMDocumentImpl.java (revision 54509)
-+++ impl/OMDocumentImpl.java (working copy)
-@@ -1,56 +1,56 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMDocument;
--import org.apache.axis.om.OMElement;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 7, 2004
-- * Time: 10:52:17 AM
-- */
--public class OMDocumentImpl extends OMNodeImpl implements OMDocument {
--
-- private OMElementImpl root;
-- private OMXmlPullParserWrapper parserWrapper;
--
-- public OMDocumentImpl(OMXmlPullParserWrapper parserWrapper) {
-- this.parserWrapper = parserWrapper;
-- }
--
-- public OMElementImpl getRootElement() {
-- if (root == null) {
-- parserWrapper.next();
-- }
-- return root;
-- }
--
-- public void setRootElement(OMElementImpl root) {
-- this.root = root;
-- }
--
-- /**
-- * Get the root element of this document
-- *
-- * @return the root element
-- *
-- * This method should be changed as getRootElement
-- *
-- */
-- public OMElement getDocumentElement() {
-- return getRootElement();
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMDocument;
-+import org.apache.axis.om.OMElement;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 7, 2004
-+ * Time: 10:52:17 AM
-+ */
-+public class OMDocumentImpl extends OMNodeImpl implements OMDocument {
-+
-+ private OMElementImpl root;
-+ private OMXmlPullParserWrapper parserWrapper;
-+
-+ public OMDocumentImpl(OMXmlPullParserWrapper parserWrapper) {
-+ this.parserWrapper = parserWrapper;
-+ }
-+
-+ public OMElementImpl getRootElement() {
-+ if (root == null) {
-+ parserWrapper.next();
-+ }
-+ return root;
-+ }
-+
-+ public void setRootElement(OMElementImpl root) {
-+ this.root = root;
-+ }
-+
-+ /**
-+ * Get the root element of this document
-+ *
-+ * @return the root element
-+ *
-+ * This method should be changed as getRootElement
-+ *
-+ */
-+ public OMElement getDocumentElement() {
-+ return getRootElement();
-+ }
-+}
-Index: impl/util/OMChildrenIterator.java
-===================================================================
---- impl/util/OMChildrenIterator.java (revision 0)
-+++ impl/util/OMChildrenIterator.java (revision 0)
-@@ -0,0 +1,81 @@
-+package org.apache.axis.om.impl.util;
-+
-+import org.apache.axis.om.OMNode;
-+
-+import java.util.Iterator;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 11, 2004
-+ * Time: 11:23:07 AM
-+ */
-+public class OMChildrenIterator implements Iterator {
-+
-+ private OMNode currentChild;
-+
-+ public OMChildrenIterator(OMNode currentChild) {
-+ this.currentChild = currentChild;
-+ }
-+
-+ /**
-+ * Removes from the underlying collection the last element returned by the
-+ * iterator (optional operation). This method can be called only once per
-+ * call to <tt>next</tt>. The behavior of an iterator is unspecified if
-+ * the underlying collection is modified while the iteration is in
-+ * progress in any way other than by calling this method.
-+ *
-+ * @throws UnsupportedOperationException if the <tt>remove</tt>
-+ * operation is not supported by this Iterator.
-+ * @throws IllegalStateException if the <tt>next</tt> method has not
-+ * yet been called, or the <tt>remove</tt> method has already
-+ * been called after the last call to the <tt>next</tt>
-+ * method.
-+ */
-+ public void remove() {
-+ OMNode temp = currentChild.getNextSibling();
-+ currentChild.detach();
-+ currentChild = temp;
-+ }
-+
-+ /**
-+ * Returns <tt>true</tt> if the iteration has more elements. (In other
-+ * words, returns <tt>true</tt> if <tt>next</tt> would return an element
-+ * rather than throwing an exception.)
-+ *
-+ * @return <tt>true</tt> if the iterator has more elements.
-+ */
-+ public boolean hasNext() {
-+ return (currentChild == null || currentChild.getNextSibling() == null);
-+ }
-+
-+ /**
-+ * Returns the next element in the iteration.
-+ *
-+ * @return the next element in the iteration.
-+ * @throws java.util.NoSuchElementException
-+ * iteration has no more elements.
-+ */
-+ public Object next() {
-+
-+ if (hasNext()) {
-+ currentChild = currentChild.getNextSibling();
-+ return currentChild;
-+ }
-+ return null;
-+
-+ }
-+}
Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/chinthaka_getChildren_implemented.txt
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/chinthaka_getChildren_implemented.txt (original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/chinthaka_getChildren_implemented.txt Mon Oct 18 01:25:29 2004
@@ -1,3337 +0,0 @@
-Index: om/OMAttribute.java
-===================================================================
---- om/OMAttribute.java (revision 54508)
-+++ om/OMAttribute.java (working copy)
-@@ -1,28 +1,28 @@
--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.
-- * <p/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 4, 2004
-- * Time: 11:49:01 AM
-- * <p/>
-- * One must implement relevant constructors for the class implementing this interface
-- * all the things like namespace, parent, value, etc., that should come in this are defined in base classes
-- */
--public interface OMAttribute extends OMNamedNode {
--
--
--}
-+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.
-+ * <p/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 4, 2004
-+ * Time: 11:49:01 AM
-+ * <p/>
-+ * One must implement relevant constructors for the class implementing this interface
-+ * all the things like namespace, parent, value, etc., that should come in this are defined in base classes
-+ */
-+public interface OMAttribute extends OMNamedNode {
-+
-+
-+}
-Index: om/Printable.java
-===================================================================
---- om/Printable.java (revision 54508)
-+++ om/Printable.java (working copy)
-@@ -1,29 +1,29 @@
--package org.apache.axis.om;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 11:36:01 AM
-- * <p/>
-- * A component that implements this interface is printable to an outputstream
-- */
--public interface Printable {
--
-- public void print(PrintStream ps) throws OMException;
--}
-+package org.apache.axis.om;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 11:36:01 AM
-+ * <p/>
-+ * A component that implements this interface is printable to an outputstream
-+ */
-+public interface Printable {
-+
-+ public void print(PrintStream ps) throws OMException;
-+}
-Index: om/OMText.java
-===================================================================
---- om/OMText.java (revision 54508)
-+++ om/OMText.java (working copy)
-@@ -1,32 +1,32 @@
--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.
-- * <p/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 4, 2004
-- * Time: 2:04:43 PM
-- */
--public interface OMText extends OMNode {
-- /**
-- * We use the OMText class to hold comments, text, characterData, CData, etc.,
-- * The codes are found in OMNode class
-- *
-- * @param type
-- */
-- public void setTextType(short type);
--
-- public short getTextType();
--}
-+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.
-+ * <p/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 4, 2004
-+ * Time: 2:04:43 PM
-+ */
-+public interface OMText extends OMNode {
-+ /**
-+ * We use the OMText class to hold comments, text, characterData, CData, etc.,
-+ * The codes are found in OMNode class
-+ *
-+ * @param type
-+ */
-+ public void setTextType(short type);
-+
-+ public short getTextType();
-+}
-Index: om/OMNode.java
-===================================================================
---- om/OMNode.java (revision 54508)
-+++ om/OMNode.java (working copy)
-@@ -1,124 +1,124 @@
--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.
-- * <p/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 1, 2004
-- * Time: 3:36:14 PM
-- */
--public interface OMNode {
-- //==================================================================================
--
-- // Followings are the codes for node types. Extracted these from DOM API
-- /**
-- * The node is an <code>Element</code>.
-- */
-- public static final short ELEMENT_NODE = 1;
-- /**
-- * The node is an <code>Attr</code>.
-- */
-- public static final short ATTRIBUTE_NODE = 2;
-- /**
-- * The node is a <code>Text</code> node.
-- */
-- public static final short TEXT_NODE = 3;
-- /**
-- * The node is a <code>CDATASection</code>.
-- */
-- public static final short CDATA_SECTION_NODE = 4;
--
-- /**
-- * The node is a <code>Comment</code>.
-- */
-- public static final short COMMENT_NODE = 8;
-- /**
-- * The node is a <code>Document</code>.
-- */
-- public static final short DOCUMENT_NODE = 9;
--
-- //==================================================================================
--
-- /**
-- * This method should return the immediate parent of the node.
-- * Parent is always an Element
-- *
-- * @return
-- * @throws OMException
-- */
-- public OMElement getParent() throws OMException;
--
-- public void setParent(OMElement element);
--
-- /**
-- * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-- *
-- * @return
-- * @throws OMException
-- */
-- public OMNode getNextSibling() throws OMException;
--
-- public void setNextSibling(OMNode node);
--
-- /**
-- * This will return the literal value of the node.
-- * OMText --> the text
-- * OMElement --> name of the element as a QName in String format
-- * OMAttribute --> the value of the attribue
-- *
-- * @return
-- * @throws OMException
-- */
-- public String getValue() throws OMException;
--
-- public void setValue(String value);
--
-- /**
-- * this will indicate whether parser has parsed this information item completely or not.
-- * If somethings info are not available in the item, one has to check this attribute to make sure that, this
-- * item has been parsed completely or not.
-- *
-- * @return
-- */
-- public boolean isComplete();
--
-- public void setComplete(boolean state);
--
-- /**
-- * This will remove this information item and its children, from the model completely
-- *
-- * @throws OMException
-- */
-- public void detach() throws OMException;
--
-- /**
-- * This will insert a sibling just after the current information item.
-- *
-- * @param sibling
-- * @throws OMException
-- */
-- public void insertSiblingAfter(OMNode sibling) throws OMException;
--
-- /**
-- * This will insert a sibling just before the current information item
-- *
-- * @param sibling
-- * @throws OMException
-- */
-- public void insertSiblingBefore(OMNode sibling) throws OMException;
--}
-+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.
-+ * <p/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 1, 2004
-+ * Time: 3:36:14 PM
-+ */
-+public interface OMNode {
-+ //==================================================================================
-+
-+ // Followings are the codes for node types. Extracted these from DOM API
-+ /**
-+ * The node is an <code>Element</code>.
-+ */
-+ public static final short ELEMENT_NODE = 1;
-+ /**
-+ * The node is an <code>Attr</code>.
-+ */
-+ public static final short ATTRIBUTE_NODE = 2;
-+ /**
-+ * The node is a <code>Text</code> node.
-+ */
-+ public static final short TEXT_NODE = 3;
-+ /**
-+ * The node is a <code>CDATASection</code>.
-+ */
-+ public static final short CDATA_SECTION_NODE = 4;
-+
-+ /**
-+ * The node is a <code>Comment</code>.
-+ */
-+ public static final short COMMENT_NODE = 8;
-+ /**
-+ * The node is a <code>Document</code>.
-+ */
-+ public static final short DOCUMENT_NODE = 9;
-+
-+ //==================================================================================
-+
-+ /**
-+ * This method should return the immediate parent of the node.
-+ * Parent is always an Element
-+ *
-+ * @return
-+ * @throws OMException
-+ */
-+ public OMElement getParent() throws OMException;
-+
-+ public void setParent(OMElement element);
-+
-+ /**
-+ * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-+ *
-+ * @return
-+ * @throws OMException
-+ */
-+ public OMNode getNextSibling() throws OMException;
-+
-+ public void setNextSibling(OMNode node);
-+
-+ /**
-+ * This will return the literal value of the node.
-+ * OMText --> the text
-+ * OMElement --> name of the element as a QName in String format
-+ * OMAttribute --> the value of the attribue
-+ *
-+ * @return
-+ * @throws OMException
-+ */
-+ public String getValue() throws OMException;
-+
-+ public void setValue(String value);
-+
-+ /**
-+ * this will indicate whether parser has parsed this information item completely or not.
-+ * If somethings info are not available in the item, one has to check this attribute to make sure that, this
-+ * item has been parsed completely or not.
-+ *
-+ * @return
-+ */
-+ public boolean isComplete();
-+
-+ public void setComplete(boolean state);
-+
-+ /**
-+ * This will remove this information item and its children, from the model completely
-+ *
-+ * @throws OMException
-+ */
-+ public void detach() throws OMException;
-+
-+ /**
-+ * This will insert a sibling just after the current information item.
-+ *
-+ * @param sibling
-+ * @throws OMException
-+ */
-+ public void insertSiblingAfter(OMNode sibling) throws OMException;
-+
-+ /**
-+ * This will insert a sibling just before the current information item
-+ *
-+ * @param sibling
-+ * @throws OMException
-+ */
-+ public void insertSiblingBefore(OMNode sibling) throws OMException;
-+}
-Index: om/impl/OMAttributeImpl.java
-===================================================================
---- om/impl/OMAttributeImpl.java (revision 54508)
-+++ om/impl/OMAttributeImpl.java (working copy)
-@@ -1,75 +1,75 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMAttribute;
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNamespace;
--
--import java.io.PrintStream;
--import java.util.regex.Matcher;
--import java.util.regex.Pattern;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 11:43:23 AM
-- */
--public class OMAttributeImpl extends OMNamedNodeImpl implements OMAttribute {
-- private static String QUOTE_ENTITY = """;
-- private static Matcher matcher = Pattern.compile("\"").matcher(null);
--
-- public OMAttributeImpl(String localName, OMNamespace ns, String value, OMElement parent) {
-- super(localName, ns, parent);
-- setValue(value);
-- }
--
-- public OMAttributeImpl(String localName, OMNamespace ns, String value) {
-- super(localName, ns, null);
-- setValue(value);
-- }
--
-- synchronized static String replaceQuoteWithEntity(String value) {
-- matcher.reset(value);
-- return matcher.replaceAll(QUOTE_ENTITY);
-- }
--
-- public void print(PrintStream s) throws OMException {
-- super.print(s);
-- s.print('=');
-- String v = value;
-- char quote = '"';
-- if (value.indexOf('"') != -1)
-- if (value.indexOf('\'') == -1)
-- quote = '\'';
-- else
-- v = replaceQuoteWithEntity(value);
-- s.print(quote);
-- s.print(v);
-- s.print(quote);
-- }
--
-- public void detach() throws OMException {
-- if (parent == null)
-- throw new OMException();
-- if (getPreviousSibling() == null)
-- parent.setFirstAttribute((OMAttributeImpl) nextSibling);
-- else
-- previousSibling.setNextSibling(nextSibling);
-- if (nextSibling != null)
-- nextSibling.setPreviousSibling(previousSibling);
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMAttribute;
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNamespace;
-+
-+import java.io.PrintStream;
-+import java.util.regex.Matcher;
-+import java.util.regex.Pattern;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 11:43:23 AM
-+ */
-+public class OMAttributeImpl extends OMNamedNodeImpl implements OMAttribute {
-+ private static String QUOTE_ENTITY = """;
-+ private static Matcher matcher = Pattern.compile("\"").matcher(null);
-+
-+ public OMAttributeImpl(String localName, OMNamespace ns, String value, OMElement parent) {
-+ super(localName, ns, parent);
-+ setValue(value);
-+ }
-+
-+ public OMAttributeImpl(String localName, OMNamespace ns, String value) {
-+ super(localName, ns, null);
-+ setValue(value);
-+ }
-+
-+ synchronized static String replaceQuoteWithEntity(String value) {
-+ matcher.reset(value);
-+ return matcher.replaceAll(QUOTE_ENTITY);
-+ }
-+
-+ public void print(PrintStream s) throws OMException {
-+ super.print(s);
-+ s.print('=');
-+ String v = value;
-+ char quote = '"';
-+ if (value.indexOf('"') != -1)
-+ if (value.indexOf('\'') == -1)
-+ quote = '\'';
-+ else
-+ v = replaceQuoteWithEntity(value);
-+ s.print(quote);
-+ s.print(v);
-+ s.print(quote);
-+ }
-+
-+ public void detach() throws OMException {
-+ if (parent == null)
-+ throw new OMException();
-+ if (getPreviousSibling() == null)
-+ parent.setFirstAttribute((OMAttributeImpl) nextSibling);
-+ else
-+ previousSibling.setNextSibling(nextSibling);
-+ if (nextSibling != null)
-+ nextSibling.setPreviousSibling(previousSibling);
-+ }
-+}
-Index: om/impl/OMTextImpl.java
-===================================================================
---- om/impl/OMTextImpl.java (revision 54508)
-+++ om/impl/OMTextImpl.java (working copy)
-@@ -1,69 +1,69 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNode;
--import org.apache.axis.om.OMText;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 1:36:55 PM
-- */
--public class OMTextImpl extends OMNodeImpl implements OMText {
--
-- protected short textType;
--
-- public OMTextImpl(OMElement parent, String text) {
-- super(parent);
-- setValue(text);
-- done = true;
-- }
--
-- public OMTextImpl(String s) {
-- super();
-- setValue(s);
-- }
--
-- /**
-- * We use the OMText class to hold comments, text, characterData, CData, etc.,
-- * The codes are found in OMNode class
-- *
-- * @param type
-- */
-- public void setTextType(short type) {
-- this.textType = type;
-- }
--
-- public short getTextType() {
-- return textType; //TODO implement this
-- }
--
-- public OMNode getFirstChild() throws OMException {
-- throw new OMException();
-- }
--
-- public void setFirstChild(OMNode node) throws OMException {
-- throw new OMException();
-- }
--
-- public void print(PrintStream s) throws OMException {
-- s.print(value);
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNode;
-+import org.apache.axis.om.OMText;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 1:36:55 PM
-+ */
-+public class OMTextImpl extends OMNodeImpl implements OMText {
-+
-+ protected short textType;
-+
-+ public OMTextImpl(OMElement parent, String text) {
-+ super(parent);
-+ setValue(text);
-+ done = true;
-+ }
-+
-+ public OMTextImpl(String s) {
-+ super();
-+ setValue(s);
-+ }
-+
-+ /**
-+ * We use the OMText class to hold comments, text, characterData, CData, etc.,
-+ * The codes are found in OMNode class
-+ *
-+ * @param type
-+ */
-+ public void setTextType(short type) {
-+ this.textType = type;
-+ }
-+
-+ public short getTextType() {
-+ return textType; //TODO implement this
-+ }
-+
-+ public OMNode getFirstChild() throws OMException {
-+ throw new OMException();
-+ }
-+
-+ public void setFirstChild(OMNode node) throws OMException {
-+ throw new OMException();
-+ }
-+
-+ public void print(PrintStream s) throws OMException {
-+ s.print(value);
-+ }
-+}
-Index: om/impl/OMNodeImpl.java
-===================================================================
---- om/impl/OMNodeImpl.java (revision 54508)
-+++ om/impl/OMNodeImpl.java (working copy)
-@@ -1,195 +1,195 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNode;
--import org.apache.axis.om.Printable;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 5, 2004
-- * Time: 12:54:08 PM
-- */
--public class OMNodeImpl implements OMNode, Printable {
-- protected OMElementImpl parent;
-- protected OMNodeImpl nextSibling;
-- protected OMNodeImpl previousSibling;
-- protected String value;
-- protected boolean done;
--
-- public OMNodeImpl() {
-- }
--
-- /**
-- * For a node to exist there must be a parent
-- *
-- * @param parent
-- */
--
--
-- public OMNodeImpl(OMElement parent) {
-- if (parent instanceof OMNodeImpl)
-- this.parent = (OMElementImpl) parent;
-- }
--
-- /**
-- * This method should return the immediate parent of the node.
-- * Parent is always an Element
-- *
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public OMElement getParent() throws OMException {
-- return parent;
-- }
--
-- public void setParent(OMElement element) {
-- if (element instanceof OMNodeImpl)
-- this.parent = (OMElementImpl) element;
-- }
--
-- /**
-- * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-- *
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public OMNode getNextSibling() throws OMException {
-- System.out.println("***********parent = " + parent);
-- System.out.println("++++++++++++nextSibling = " + nextSibling);
-- if (nextSibling == null && !parent.isComplete())
-- parent.buildNext();
-- return nextSibling;
-- }
--
-- public void setNextSibling(OMNode node) {
-- this.nextSibling = (OMNodeImpl) node;
-- }
--
-- /**
-- * This will return the literal value of the node.
-- * OMText --> the text
-- * OMElement --> name of the element as a QName in String format
-- * OMAttribute --> the value of the attribue
-- *
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public String getValue() throws OMException {
-- return value;
-- }
--
-- public void setValue(String value) {
-- this.value = value;
-- }
--
-- /**
-- * this will indicate whether parser has parsed this information item completely or not.
-- * If somethings info are not available in the item, one has to check this attribute to make sure that, this
-- * item has been parsed completely or not.
-- *
-- * @return
-- */
-- public boolean isComplete() {
-- return true;
-- }
--
-- public void setComplete(boolean state) {
-- this.done = state;
-- }
--
-- /**
-- * This will remove this information item and its children, from the model completely
-- *
-- * @throws org.apache.axis.om.OMException
-- */
-- public void detach() throws OMException {
-- if (parent == null)
-- throw new OMException();
-- OMNodeImpl nextSibling = (OMNodeImpl) getNextSibling();
-- if (previousSibling == null)
-- parent.setFirstChild(nextSibling);
-- else
-- previousSibling.setNextSibling(nextSibling);
-- if (nextSibling != null)
-- nextSibling.setPreviousSibling(previousSibling);
--
-- }
--
-- /**
-- * This will insert a sibling just after the current information item.
-- *
-- * @param sibling
-- * @throws org.apache.axis.om.OMException
-- */
-- public void insertSiblingAfter(OMNode sibling) throws OMException {
-- if (parent == null)
-- throw new OMException();
-- sibling.setParent(parent);
--
-- if (sibling instanceof OMNodeImpl) {
-- OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
-- if (nextSibling == null)
-- getNextSibling();
-- siblingImpl.setPreviousSibling(this);
-- if (nextSibling != null)
-- nextSibling.setPreviousSibling(sibling);
-- sibling.setNextSibling(nextSibling);
-- nextSibling = siblingImpl;
-- }
--
-- }
--
-- /**
-- * This will insert a sibling just before the current information item
-- *
-- * @param sibling
-- * @throws org.apache.axis.om.OMException
-- */
-- public void insertSiblingBefore(OMNode sibling) throws OMException {
-- if (parent == null)
-- throw new OMException();
-- sibling.setParent(parent);
--
-- if (sibling instanceof OMNodeImpl) {
-- OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
-- siblingImpl.setPreviousSibling(previousSibling);
-- siblingImpl.setNextSibling(this);
-- if (previousSibling == null)
-- parent.setFirstChild(siblingImpl);
-- else
-- previousSibling.setNextSibling(siblingImpl);
-- previousSibling = siblingImpl;
-- }
-- }
--
-- public OMNode getPreviousSibling() {
-- return previousSibling;
-- }
--
-- public void setPreviousSibling(OMNode previousSibling) {
-- this.previousSibling = (OMNodeImpl) previousSibling;
-- }
--
-- public void print(PrintStream ps) throws OMException {
-- throw new OMException();
-- }
--
--
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNode;
-+import org.apache.axis.om.Printable;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 5, 2004
-+ * Time: 12:54:08 PM
-+ */
-+public class OMNodeImpl implements OMNode, Printable {
-+ protected OMElementImpl parent;
-+ protected OMNodeImpl nextSibling;
-+ protected OMNodeImpl previousSibling;
-+ protected String value;
-+ protected boolean done;
-+
-+ public OMNodeImpl() {
-+ }
-+
-+ /**
-+ * For a node to exist there must be a parent
-+ *
-+ * @param parent
-+ */
-+
-+
-+ public OMNodeImpl(OMElement parent) {
-+ if (parent instanceof OMNodeImpl)
-+ this.parent = (OMElementImpl) parent;
-+ }
-+
-+ /**
-+ * This method should return the immediate parent of the node.
-+ * Parent is always an Element
-+ *
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public OMElement getParent() throws OMException {
-+ return parent;
-+ }
-+
-+ public void setParent(OMElement element) {
-+ if (element instanceof OMNodeImpl)
-+ this.parent = (OMElementImpl) element;
-+ }
-+
-+ /**
-+ * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-+ *
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public OMNode getNextSibling() throws OMException {
-+ System.out.println("***********parent = " + parent);
-+ System.out.println("++++++++++++nextSibling = " + nextSibling);
-+ if (nextSibling == null && !parent.isComplete())
-+ parent.buildNext();
-+ return nextSibling;
-+ }
-+
-+ public void setNextSibling(OMNode node) {
-+ this.nextSibling = (OMNodeImpl) node;
-+ }
-+
-+ /**
-+ * This will return the literal value of the node.
-+ * OMText --> the text
-+ * OMElement --> name of the element as a QName in String format
-+ * OMAttribute --> the value of the attribue
-+ *
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public String getValue() throws OMException {
-+ return value;
-+ }
-+
-+ public void setValue(String value) {
-+ this.value = value;
-+ }
-+
-+ /**
-+ * this will indicate whether parser has parsed this information item completely or not.
-+ * If somethings info are not available in the item, one has to check this attribute to make sure that, this
-+ * item has been parsed completely or not.
-+ *
-+ * @return
-+ */
-+ public boolean isComplete() {
-+ return true;
-+ }
-+
-+ public void setComplete(boolean state) {
-+ this.done = state;
-+ }
-+
-+ /**
-+ * This will remove this information item and its children, from the model completely
-+ *
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public void detach() throws OMException {
-+ if (parent == null)
-+ throw new OMException();
-+ OMNodeImpl nextSibling = (OMNodeImpl) getNextSibling();
-+ if (previousSibling == null)
-+ parent.setFirstChild(nextSibling);
-+ else
-+ previousSibling.setNextSibling(nextSibling);
-+ if (nextSibling != null)
-+ nextSibling.setPreviousSibling(previousSibling);
-+
-+ }
-+
-+ /**
-+ * This will insert a sibling just after the current information item.
-+ *
-+ * @param sibling
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public void insertSiblingAfter(OMNode sibling) throws OMException {
-+ if (parent == null)
-+ throw new OMException();
-+ sibling.setParent(parent);
-+
-+ if (sibling instanceof OMNodeImpl) {
-+ OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
-+ if (nextSibling == null)
-+ getNextSibling();
-+ siblingImpl.setPreviousSibling(this);
-+ if (nextSibling != null)
-+ nextSibling.setPreviousSibling(sibling);
-+ sibling.setNextSibling(nextSibling);
-+ nextSibling = siblingImpl;
-+ }
-+
-+ }
-+
-+ /**
-+ * This will insert a sibling just before the current information item
-+ *
-+ * @param sibling
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public void insertSiblingBefore(OMNode sibling) throws OMException {
-+ if (parent == null)
-+ throw new OMException();
-+ sibling.setParent(parent);
-+
-+ if (sibling instanceof OMNodeImpl) {
-+ OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
-+ siblingImpl.setPreviousSibling(previousSibling);
-+ siblingImpl.setNextSibling(this);
-+ if (previousSibling == null)
-+ parent.setFirstChild(siblingImpl);
-+ else
-+ previousSibling.setNextSibling(siblingImpl);
-+ previousSibling = siblingImpl;
-+ }
-+ }
-+
-+ public OMNode getPreviousSibling() {
-+ return previousSibling;
-+ }
-+
-+ public void setPreviousSibling(OMNode previousSibling) {
-+ this.previousSibling = (OMNodeImpl) previousSibling;
-+ }
-+
-+ public void print(PrintStream ps) throws OMException {
-+ throw new OMException();
-+ }
-+
-+
-+}
-Index: om/impl/OMNavigator.java
-===================================================================
---- om/impl/OMNavigator.java (revision 54508)
-+++ om/impl/OMNavigator.java (working copy)
-@@ -1,78 +1,78 @@
--/*
-- * Copyright 2004 The Apache Software Foundation.
-- *
-- * 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
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * 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.
-- *
-- */
--
--/*
-- * Created on Sep 25, 2004
-- *
-- */
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMNode;
--
--/**
-- * @author Dasarath Weeratunge
-- */
--public class OMNavigator {
-- protected OMNode node;
-- private boolean visited;
-- private OMNode next;
-- private boolean backtracked;
--
-- public OMNavigator() {
-- }
--
-- public OMNavigator(OMNode node) {
-- init(node);
-- }
--
-- public void init(OMNode node) {
-- next = node;
-- backtracked = false;
-- }
--
-- public OMNode next() {
-- if (next == null)
-- return null;
-- node = next;
-- visited = backtracked;
-- backtracked = false;
-- if (next instanceof OMElement && !visited) {
-- OMElementImpl e = (OMElementImpl) next;
-- if (e.getFirstChild() != null)
-- next = e.getFirstChild();
-- else if (e.isComplete())
-- backtracked = true;
-- else
-- next = null;
-- return node;
-- }
-- OMNodeImpl n = (OMNodeImpl) next;
-- if (n.nextSibling != null)
-- next = n.nextSibling;
-- else if (n.parent != null && n.parent.isComplete()) {
-- next = n.parent;
-- backtracked = true;
-- } else
-- next = null;
-- return node;
-- }
--
-- public boolean visited() {
-- return visited;
-- }
--}
-+/*
-+ * Copyright 2004 The Apache Software Foundation.
-+ *
-+ * 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
-+ *
-+ * http://www.apache.org/licenses/LICENSE-2.0
-+ *
-+ * 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.
-+ *
-+ */
-+
-+/*
-+ * Created on Sep 25, 2004
-+ *
-+ */
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMNode;
-+
-+/**
-+ * @author Dasarath Weeratunge
-+ */
-+public class OMNavigator {
-+ protected OMNode node;
-+ private boolean visited;
-+ private OMNode next;
-+ private boolean backtracked;
-+
-+ public OMNavigator() {
-+ }
-+
-+ public OMNavigator(OMNode node) {
-+ init(node);
-+ }
-+
-+ public void init(OMNode node) {
-+ next = node;
-+ backtracked = false;
-+ }
-+
-+ public OMNode next() {
-+ if (next == null)
-+ return null;
-+ node = next;
-+ visited = backtracked;
-+ backtracked = false;
-+ if (next instanceof OMElement && !visited) {
-+ OMElementImpl e = (OMElementImpl) next;
-+ if (e.getFirstChild() != null)
-+ next = e.getFirstChild();
-+ else if (e.isComplete())
-+ backtracked = true;
-+ else
-+ next = null;
-+ return node;
-+ }
-+ OMNodeImpl n = (OMNodeImpl) next;
-+ if (n.nextSibling != null)
-+ next = n.nextSibling;
-+ else if (n.parent != null && n.parent.isComplete()) {
-+ next = n.parent;
-+ backtracked = true;
-+ } else
-+ next = null;
-+ return node;
-+ }
-+
-+ public boolean visited() {
-+ return visited;
-+ }
-+}
-Index: om/impl/OMElementImpl.java
-===================================================================
---- om/impl/OMElementImpl.java (revision 54508)
-+++ om/impl/OMElementImpl.java (working copy)
-@@ -1,235 +1,236 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.*;
--
--import java.io.PrintStream;
--import java.util.Iterator;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 5, 2004
-- * Time: 1:16:10 PM
-- */
--public class OMElementImpl extends OMNamedNodeImpl implements OMElement {
-- private OMNodeImpl firstChild;
-- OMXmlPullParserWrapper builder;
-- OMAttributeImpl firstAttribute;
-- OMNamespaceImpl firstNamespace;
--
-- public OMElementImpl(OMElement parent) {
-- super(parent);
-- }
--
-- public OMElementImpl(String localName, OMNamespace ns) {
-- super(localName, ns, null);
-- done = true;
-- }
--
-- public OMElementImpl(String localName, OMNamespace ns, OMElement parent, OMXmlPullParserWrapper builder) {
-- super(localName, ns, parent);
-- this.builder = builder;
--
-- }
--
-- /**
-- * This will add child to the element. One can decide whether he append the child or he adds to the
-- * front of the children list
-- *
-- * @param child
-- */
-- public void addChild(OMNode child) {
-- addChild((OMNodeImpl) child);
-- }
--
-- private void addChild(OMNodeImpl child) {
-- if (firstChild == null && !done)
-- builder.next();
-- child.setPreviousSibling(null);
-- child.setNextSibling(firstChild);
-- if (firstChild != null)
-- firstChild.setPreviousSibling(child);
-- child.setParent(this);
-- firstChild = child;
-- }
--
-- /**
-- * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-- *
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public OMNode getNextSibling() throws OMException {
-- while (!done)
-- builder.next();
-- return super.getNextSibling();
-- }
--
-- /**
-- * This returns a collection of this element.
-- * Children can be of types OMElement, OMText.
-- */
-- public Iterator getChildren() {
-- return null; //TODO implement this
-- }
--
-- /**
-- * THis will create a namespace in the current element scope
-- *
-- * @param uri
-- * @param prefix
-- * @return
-- */
-- public OMNamespace createNamespace(String uri, String prefix) {
-- OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix);
-- ns.setNextSibling(firstNamespace);
-- firstNamespace = ns;
-- return ns;
-- }
--
-- /**
-- * This will find a namespace with the given uri and prefix, in the scope of the docuemnt.
-- * This will start to find from the current element and goes up in the hiararchy until this finds one.
-- * If none is found, return null
-- *
-- * @param uri
-- * @param prefix
-- * @return
-- * @throws org.apache.axis.om.OMException
-- */
-- public OMNamespace resolveNamespace(String uri, String prefix) throws OMException {
-- OMNamespace ns = firstNamespace;
-- while (ns != null) {
-- if (ns.equals(uri, prefix))
-- return ns;
-- ns = (OMNamespace) ns.getNextSibling();
-- }
-- if (parent != null)
-- return parent.resolveNamespace(uri, prefix);
-- return null;
-- }
--
-- /**
-- * This will returns the first attribute of the element or null, if none is present
-- *
-- * @return
-- */
-- public OMAttribute getFirstAttribute() {
-- return firstAttribute;
-- }
--
-- /**
-- * This will return a List of OMAttributes
-- *
-- * @return
-- */
-- public Iterator getAttributes() {
-- return null; //TODO implement this
-- }
--
-- /**
-- * This will insert attribute to this element. Implementor can decide as to insert this
-- * in the front or at the end of set of attributes
-- *
-- * @param attr
-- */
-- public void insertAttribute(OMAttribute attr) {
--
-- OMAttributeImpl attrImpl = (OMAttributeImpl) attr;
-- attrImpl.setPreviousSibling(null);
-- attrImpl.setNextSibling(firstAttribute);
-- if (firstAttribute != null)
-- firstAttribute.setPreviousSibling(attrImpl);
-- attrImpl.setParent(this);
-- firstAttribute = attrImpl;
-- }
--
-- public void removeAttribute(OMAttribute attr) {
-- attr.detach();
-- }
--
-- /**
-- * This will force the parser to proceed, if parser has not yet finished with the XML input
-- */
-- public void buildNext() {
-- builder.next();
-- }
--
-- public OMNodeImpl getFirstChild() {
-- if (firstChild == null && !done)
-- buildNext();
-- return firstChild;
-- }
--
--
-- public void setFirstChild(OMNodeImpl firstChild) {
-- this.firstChild = firstChild;
-- }
--
-- public void print(PrintStream s) throws OMException {
-- s.print('<');
-- super.print(s);
--
-- OMNodeImpl node = firstAttribute;
-- while (node != null) {
-- s.print(" ");
-- node.print(s);
-- node = (OMNodeImpl) node.getNextSibling();
-- }
--
-- node = firstNamespace;
-- while (node != null) {
-- s.print(" ");
-- node.print(s);
-- node = (OMNodeImpl) node.getNextSibling();
-- }
--
-- node = getFirstChild();
-- if (node != null) {
-- s.print('>');
-- while (node != null) {
-- node.print(s);
-- node = (OMNodeImpl) node.getNextSibling();
-- }
-- s.print('<');
-- s.print('/');
-- super.print(s);
-- } else
-- s.print('/');
-- s.print('>');
-- }
--
-- /**
-- * This will remove this information item and its children, from the model completely
-- *
-- * @throws org.apache.axis.om.OMException
-- */
-- public void detach() throws OMException {
-- if (done)
-- super.detach();
-- else
-- builder.discard(this);
-- }
--
-- public void setFirstAttribute(OMAttributeImpl firstAttribute) {
-- this.firstAttribute = firstAttribute;
-- }
--
--
-- public boolean isComplete() {
-- return done;
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.*;
-+import org.apache.axis.om.impl.util.OMChildrenIterator;
-+
-+import java.io.PrintStream;
-+import java.util.Iterator;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 5, 2004
-+ * Time: 1:16:10 PM
-+ */
-+public class OMElementImpl extends OMNamedNodeImpl implements OMElement {
-+ private OMNodeImpl firstChild;
-+ OMXmlPullParserWrapper builder;
-+ OMAttributeImpl firstAttribute;
-+ OMNamespaceImpl firstNamespace;
-+
-+ public OMElementImpl(OMElement parent) {
-+ super(parent);
-+ }
-+
-+ public OMElementImpl(String localName, OMNamespace ns) {
-+ super(localName, ns, null);
-+ done = true;
-+ }
-+
-+ public OMElementImpl(String localName, OMNamespace ns, OMElement parent, OMXmlPullParserWrapper builder) {
-+ super(localName, ns, parent);
-+ this.builder = builder;
-+
-+ }
-+
-+ /**
-+ * This will add child to the element. One can decide whether he append the child or he adds to the
-+ * front of the children list
-+ *
-+ * @param child
-+ */
-+ public void addChild(OMNode child) {
-+ addChild((OMNodeImpl) child);
-+ }
-+
-+ private void addChild(OMNodeImpl child) {
-+ if (firstChild == null && !done)
-+ builder.next();
-+ child.setPreviousSibling(null);
-+ child.setNextSibling(firstChild);
-+ if (firstChild != null)
-+ firstChild.setPreviousSibling(child);
-+ child.setParent(this);
-+ firstChild = child;
-+ }
-+
-+ /**
-+ * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
-+ *
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public OMNode getNextSibling() throws OMException {
-+ while (!done)
-+ builder.next();
-+ return super.getNextSibling();
-+ }
-+
-+ /**
-+ * This returns a collection of this element.
-+ * Children can be of types OMElement, OMText.
-+ */
-+ public Iterator getChildren() {
-+ return new OMChildrenIterator(firstChild);
-+ }
-+
-+ /**
-+ * THis will create a namespace in the current element scope
-+ *
-+ * @param uri
-+ * @param prefix
-+ * @return
-+ */
-+ public OMNamespace createNamespace(String uri, String prefix) {
-+ OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix);
-+ ns.setNextSibling(firstNamespace);
-+ firstNamespace = ns;
-+ return ns;
-+ }
-+
-+ /**
-+ * This will find a namespace with the given uri and prefix, in the scope of the docuemnt.
-+ * This will start to find from the current element and goes up in the hiararchy until this finds one.
-+ * If none is found, return null
-+ *
-+ * @param uri
-+ * @param prefix
-+ * @return
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public OMNamespace resolveNamespace(String uri, String prefix) throws OMException {
-+ OMNamespace ns = firstNamespace;
-+ while (ns != null) {
-+ if (ns.equals(uri, prefix))
-+ return ns;
-+ ns = (OMNamespace) ns.getNextSibling();
-+ }
-+ if (parent != null)
-+ return parent.resolveNamespace(uri, prefix);
-+ return null;
-+ }
-+
-+ /**
-+ * This will returns the first attribute of the element or null, if none is present
-+ *
-+ * @return
-+ */
-+ public OMAttribute getFirstAttribute() {
-+ return firstAttribute;
-+ }
-+
-+ /**
-+ * This will return a List of OMAttributes
-+ *
-+ * @return
-+ */
-+ public Iterator getAttributes() {
-+ return new OMChildrenIterator(getFirstAttribute());
-+ }
-+
-+ /**
-+ * This will insert attribute to this element. Implementor can decide as to insert this
-+ * in the front or at the end of set of attributes
-+ *
-+ * @param attr
-+ */
-+ public void insertAttribute(OMAttribute attr) {
-+
-+ OMAttributeImpl attrImpl = (OMAttributeImpl) attr;
-+ attrImpl.setPreviousSibling(null);
-+ attrImpl.setNextSibling(firstAttribute);
-+ if (firstAttribute != null)
-+ firstAttribute.setPreviousSibling(attrImpl);
-+ attrImpl.setParent(this);
-+ firstAttribute = attrImpl;
-+ }
-+
-+ public void removeAttribute(OMAttribute attr) {
-+ attr.detach();
-+ }
-+
-+ /**
-+ * This will force the parser to proceed, if parser has not yet finished with the XML input
-+ */
-+ public void buildNext() {
-+ builder.next();
-+ }
-+
-+ public OMNodeImpl getFirstChild() {
-+ if (firstChild == null && !done)
-+ buildNext();
-+ return firstChild;
-+ }
-+
-+
-+ public void setFirstChild(OMNodeImpl firstChild) {
-+ this.firstChild = firstChild;
-+ }
-+
-+ public void print(PrintStream s) throws OMException {
-+ s.print('<');
-+ super.print(s);
-+
-+ OMNodeImpl node = firstAttribute;
-+ while (node != null) {
-+ s.print(" ");
-+ node.print(s);
-+ node = (OMNodeImpl) node.getNextSibling();
-+ }
-+
-+ node = firstNamespace;
-+ while (node != null) {
-+ s.print(" ");
-+ node.print(s);
-+ node = (OMNodeImpl) node.getNextSibling();
-+ }
-+
-+ node = getFirstChild();
-+ if (node != null) {
-+ s.print('>');
-+ while (node != null) {
-+ node.print(s);
-+ node = (OMNodeImpl) node.getNextSibling();
-+ }
-+ s.print('<');
-+ s.print('/');
-+ super.print(s);
-+ } else
-+ s.print('/');
-+ s.print('>');
-+ }
-+
-+ /**
-+ * This will remove this information item and its children, from the model completely
-+ *
-+ * @throws org.apache.axis.om.OMException
-+ */
-+ public void detach() throws OMException {
-+ if (done)
-+ super.detach();
-+ else
-+ builder.discard(this);
-+ }
-+
-+ public void setFirstAttribute(OMAttributeImpl firstAttribute) {
-+ this.firstAttribute = firstAttribute;
-+ }
-+
-+
-+ public boolean isComplete() {
-+ return done;
-+ }
-+}
-Index: om/impl/OMXmlPullParserWrapper.java
-===================================================================
---- om/impl/OMXmlPullParserWrapper.java (revision 54508)
-+++ om/impl/OMXmlPullParserWrapper.java (working copy)
-@@ -1,333 +1,333 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.*;
--import org.xmlpull.v1.XmlPullParser;
--import org.xmlpull.v1.XmlPullParserException;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 11:42:44 AM
-- */
--public class OMXmlPullParserWrapper {
-- private XmlPullParser parser;
-- // private OMElementImpl root;
-- private OMDocumentImpl document;
-- private OMNodeImpl lastNode;
-- private boolean cache = true;
-- private boolean slip = false;
-- private boolean navigate = false;
-- private boolean done = false;
-- private OMNavigator navigator = new OMNavigator();
--
-- public OMXmlPullParserWrapper(XmlPullParser parser) {
-- this.parser = parser;
-- }
--
--// public OMElementImpl getDocument() throws OMException {
--// if (root == null)
--// next();
--// return root;
--// }
-- public OMDocumentImpl getDocument() throws OMException {
-- document = new OMDocumentImpl(this);
-- return document;
-- }
--
-- private OMNode createOMElement() throws OMException {
-- OMElementImpl node;
-- if (lastNode == null) {
-- node = new OMElementImpl(parser.getName(), null, null, this);
-- document.setRootElement(node);
--// root = new OMElementImpl(parser.getName(), null, null, this);
--// node = root;
-- } else if (lastNode.isComplete()) {
-- node = new OMElementImpl(parser.getName(), null, lastNode.getParent(), this);
-- lastNode.setNextSibling(node);
-- node.setPreviousSibling(lastNode);
-- } else {
-- System.out.println("lastNode = " + lastNode.getClass());
-- OMElementImpl e = (OMElementImpl) lastNode;
-- node = new OMElementImpl(parser.getName(), null, (OMElement) lastNode, this);
-- e.setFirstChild(node);
-- }
--
-- int i, j;
-- try {
-- j = parser.getNamespaceCount(parser.getDepth());
-- i = 0;
-- if (j > 1)
-- i = parser.getNamespaceCount(parser.getDepth() - 1);
-- while (i < j) {
-- node.createNamespace(parser.getNamespaceUri(i), parser.getNamespacePrefix(i));
-- i++;
-- }
-- } catch (XmlPullParserException e) {
-- throw new OMException(e);
-- }
--
-- node.setNamespace(node.resolveNamespace(parser.getNamespace(), parser.getPrefix()));
--
-- j = parser.getAttributeCount();
-- for (i = 0; i < j; i++) {
-- OMNamespace ns = null;
-- String uri = parser.getAttributeNamespace(i);
-- if (uri.hashCode() != 0)
-- ns = node.resolveNamespace(uri, parser.getAttributePrefix(i));
-- node.insertAttribute(new OMAttributeImpl(parser.getAttributeName(i), ns, parser.getAttributeValue(i), node));
-- }
--
-- return node;
-- }
--
-- private OMNode createOMText() throws OMException {
-- if (lastNode == null)
-- throw new OMException();
-- OMNodeImpl node;
-- if (lastNode.isComplete()) {
-- node = new OMTextImpl(lastNode.getParent(), parser.getText());
-- lastNode.setNextSibling(node);
-- node.setPreviousSibling(lastNode);
-- } else {
-- OMElementImpl e = (OMElementImpl) lastNode;
-- node = new OMTextImpl(e, parser.getText());
-- e.setFirstChild(node);
-- }
-- return node;
-- }
--
-- public void reset(OMNode node) throws OMException {
-- navigate = true;
-- lastNode = null;
-- navigator.init(node);
-- }
--
-- // TODO:
-- public int next() throws OMException {
-- try {
-- if (navigate) {
-- OMNodeImpl next = (OMNodeImpl) navigator.next();
-- if (next != null) {
-- lastNode = next;
-- if (lastNode instanceof OMText)
-- return XmlPullParser.TEXT;
-- else if (navigator.visited())
-- return XmlPullParser.END_TAG;
-- else
-- return XmlPullParser.START_TAG;
-- }
-- navigate = false;
-- if (done)
-- return XmlPullParser.END_DOCUMENT;
-- if (slip)
-- throw new OMException();
-- }
--
-- if (done)
-- throw new OMException();
--
-- int token = parser.nextToken();
--
-- if (!cache) {
-- slip = true;
-- return token;
-- }
--
-- switch (token) {
-- case XmlPullParser.START_TAG:
-- lastNode = (OMNodeImpl) createOMElement();
-- break;
--
-- case XmlPullParser.TEXT:
-- lastNode = (OMNodeImpl) createOMText();
-- break;
--
-- case XmlPullParser.END_TAG:
-- if (lastNode.isComplete()) {
-- OMElement parent = lastNode.getParent();
-- parent.setComplete(true);
-- lastNode = (OMNodeImpl) parent;
-- } else {
-- OMElement e = (OMElement) lastNode;
-- e.setComplete(true);
-- }
-- break;
--
-- case XmlPullParser.END_DOCUMENT:
-- done = true;
-- break;
--
-- default :
-- throw new OMException();
-- }
-- return token;
-- } catch (OMException e) {
-- throw e;
-- } catch (Exception e) {
-- e.printStackTrace();
-- throw new OMException(e);
-- }
-- }
--
-- public void discard(OMElementImpl el) throws OMException {
-- if (el.isComplete() || !cache)
-- throw new OMException();
-- try {
-- cache = false;
-- do {
-- while (parser.next() != XmlPullParser.END_TAG) ;
-- // TODO:
-- } while (!parser.getName().equals(el.getLocalName()));
-- lastNode = (OMNodeImpl) el.getPreviousSibling();
-- if (lastNode != null)
-- lastNode.setNextSibling(null);
-- else {
-- OMElementImpl parent = (OMElementImpl) el.getParent();
-- if (parent == null)
-- throw new OMException();
-- parent.setFirstChild(null);
-- lastNode = parent;
-- }
-- slip = false;
-- cache = true;
-- } catch (OMException e) {
-- throw e;
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public void setCache(boolean b) {
-- cache = b;
-- }
--
-- public String getName() throws OMException {
-- if (navigate) {
-- try {
-- OMElement e = (OMElement) lastNode;
-- return e.getLocalName();
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
-- return parser.getName();
-- }
--
-- public String getText() throws OMException {
-- if (navigate) {
-- try {
-- return (String) lastNode.getValue();
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
-- return parser.getText();
-- }
--
-- public String getNamespace() throws OMException {
-- if (navigate) {
-- if (lastNode instanceof OMElement) {
-- OMElement node = (OMElement) lastNode;
-- OMNamespace ns = node.getNamespace();
-- if (ns != null)
-- return ns.getValue();
-- // TODO: else
-- }
-- throw new OMException();
-- }
-- return parser.getNamespace();
-- }
--
-- public int getNamespaceCount(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- try {
-- return parser.getNamespaceCount(arg);
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public String getNamespacePrefix(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- try {
-- return parser.getNamespacePrefix(arg);
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public String getNamespaceUri(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- try {
-- return parser.getNamespaceUri(arg);
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public String getNamespace(String arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- try {
-- return parser.getNamespace(arg);
-- } catch (Exception e) {
-- throw new OMException(e);
-- }
-- }
--
-- public String getPrefix() throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getPrefix();
-- }
--
-- public int getAttributeCount() throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getAttributeCount();
-- }
--
-- public String getAttributeNamespace(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getAttributeNamespace(arg);
-- }
--
-- public String getAttributeName(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getAttributeNamespace(arg);
-- }
--
-- public String getAttributePrefix(int arg) throws OMException {
-- if (navigate)
-- // TODO:
-- throw new OMException();
-- return parser.getAttributeNamespace(arg);
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.*;
-+import org.xmlpull.v1.XmlPullParser;
-+import org.xmlpull.v1.XmlPullParserException;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 11:42:44 AM
-+ */
-+public class OMXmlPullParserWrapper {
-+ private XmlPullParser parser;
-+ // private OMElementImpl root;
-+ private OMDocumentImpl document;
-+ private OMNodeImpl lastNode;
-+ private boolean cache = true;
-+ private boolean slip = false;
-+ private boolean navigate = false;
-+ private boolean done = false;
-+ private OMNavigator navigator = new OMNavigator();
-+
-+ public OMXmlPullParserWrapper(XmlPullParser parser) {
-+ this.parser = parser;
-+ }
-+
-+// public OMElementImpl getDocument() throws OMException {
-+// if (root == null)
-+// next();
-+// return root;
-+// }
-+ public OMDocumentImpl getDocument() throws OMException {
-+ document = new OMDocumentImpl(this);
-+ return document;
-+ }
-+
-+ private OMNode createOMElement() throws OMException {
-+ OMElementImpl node;
-+ if (lastNode == null) {
-+ node = new OMElementImpl(parser.getName(), null, null, this);
-+ document.setRootElement(node);
-+// root = new OMElementImpl(parser.getName(), null, null, this);
-+// node = root;
-+ } else if (lastNode.isComplete()) {
-+ node = new OMElementImpl(parser.getName(), null, lastNode.getParent(), this);
-+ lastNode.setNextSibling(node);
-+ node.setPreviousSibling(lastNode);
-+ } else {
-+ System.out.println("lastNode = " + lastNode.getClass());
-+ OMElementImpl e = (OMElementImpl) lastNode;
-+ node = new OMElementImpl(parser.getName(), null, (OMElement) lastNode, this);
-+ e.setFirstChild(node);
-+ }
-+
-+ int i, j;
-+ try {
-+ j = parser.getNamespaceCount(parser.getDepth());
-+ i = 0;
-+ if (j > 1)
-+ i = parser.getNamespaceCount(parser.getDepth() - 1);
-+ while (i < j) {
-+ node.createNamespace(parser.getNamespaceUri(i), parser.getNamespacePrefix(i));
-+ i++;
-+ }
-+ } catch (XmlPullParserException e) {
-+ throw new OMException(e);
-+ }
-+
-+ node.setNamespace(node.resolveNamespace(parser.getNamespace(), parser.getPrefix()));
-+
-+ j = parser.getAttributeCount();
-+ for (i = 0; i < j; i++) {
-+ OMNamespace ns = null;
-+ String uri = parser.getAttributeNamespace(i);
-+ if (uri.hashCode() != 0)
-+ ns = node.resolveNamespace(uri, parser.getAttributePrefix(i));
-+ node.insertAttribute(new OMAttributeImpl(parser.getAttributeName(i), ns, parser.getAttributeValue(i), node));
-+ }
-+
-+ return node;
-+ }
-+
-+ private OMNode createOMText() throws OMException {
-+ if (lastNode == null)
-+ throw new OMException();
-+ OMNodeImpl node;
-+ if (lastNode.isComplete()) {
-+ node = new OMTextImpl(lastNode.getParent(), parser.getText());
-+ lastNode.setNextSibling(node);
-+ node.setPreviousSibling(lastNode);
-+ } else {
-+ OMElementImpl e = (OMElementImpl) lastNode;
-+ node = new OMTextImpl(e, parser.getText());
-+ e.setFirstChild(node);
-+ }
-+ return node;
-+ }
-+
-+ public void reset(OMNode node) throws OMException {
-+ navigate = true;
-+ lastNode = null;
-+ navigator.init(node);
-+ }
-+
-+ // TODO:
-+ public int next() throws OMException {
-+ try {
-+ if (navigate) {
-+ OMNodeImpl next = (OMNodeImpl) navigator.next();
-+ if (next != null) {
-+ lastNode = next;
-+ if (lastNode instanceof OMText)
-+ return XmlPullParser.TEXT;
-+ else if (navigator.visited())
-+ return XmlPullParser.END_TAG;
-+ else
-+ return XmlPullParser.START_TAG;
-+ }
-+ navigate = false;
-+ if (done)
-+ return XmlPullParser.END_DOCUMENT;
-+ if (slip)
-+ throw new OMException();
-+ }
-+
-+ if (done)
-+ throw new OMException();
-+
-+ int token = parser.nextToken();
-+
-+ if (!cache) {
-+ slip = true;
-+ return token;
-+ }
-+
-+ switch (token) {
-+ case XmlPullParser.START_TAG:
-+ lastNode = (OMNodeImpl) createOMElement();
-+ break;
-+
-+ case XmlPullParser.TEXT:
-+ lastNode = (OMNodeImpl) createOMText();
-+ break;
-+
-+ case XmlPullParser.END_TAG:
-+ if (lastNode.isComplete()) {
-+ OMElement parent = lastNode.getParent();
-+ parent.setComplete(true);
-+ lastNode = (OMNodeImpl) parent;
-+ } else {
-+ OMElement e = (OMElement) lastNode;
-+ e.setComplete(true);
-+ }
-+ break;
-+
-+ case XmlPullParser.END_DOCUMENT:
-+ done = true;
-+ break;
-+
-+ default :
-+ throw new OMException();
-+ }
-+ return token;
-+ } catch (OMException e) {
-+ throw e;
-+ } catch (Exception e) {
-+ e.printStackTrace();
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public void discard(OMElementImpl el) throws OMException {
-+ if (el.isComplete() || !cache)
-+ throw new OMException();
-+ try {
-+ cache = false;
-+ do {
-+ while (parser.next() != XmlPullParser.END_TAG) ;
-+ // TODO:
-+ } while (!parser.getName().equals(el.getLocalName()));
-+ lastNode = (OMNodeImpl) el.getPreviousSibling();
-+ if (lastNode != null)
-+ lastNode.setNextSibling(null);
-+ else {
-+ OMElementImpl parent = (OMElementImpl) el.getParent();
-+ if (parent == null)
-+ throw new OMException();
-+ parent.setFirstChild(null);
-+ lastNode = parent;
-+ }
-+ slip = false;
-+ cache = true;
-+ } catch (OMException e) {
-+ throw e;
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public void setCache(boolean b) {
-+ cache = b;
-+ }
-+
-+ public String getName() throws OMException {
-+ if (navigate) {
-+ try {
-+ OMElement e = (OMElement) lastNode;
-+ return e.getLocalName();
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+ return parser.getName();
-+ }
-+
-+ public String getText() throws OMException {
-+ if (navigate) {
-+ try {
-+ return (String) lastNode.getValue();
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+ return parser.getText();
-+ }
-+
-+ public String getNamespace() throws OMException {
-+ if (navigate) {
-+ if (lastNode instanceof OMElement) {
-+ OMElement node = (OMElement) lastNode;
-+ OMNamespace ns = node.getNamespace();
-+ if (ns != null)
-+ return ns.getValue();
-+ // TODO: else
-+ }
-+ throw new OMException();
-+ }
-+ return parser.getNamespace();
-+ }
-+
-+ public int getNamespaceCount(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ try {
-+ return parser.getNamespaceCount(arg);
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public String getNamespacePrefix(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ try {
-+ return parser.getNamespacePrefix(arg);
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public String getNamespaceUri(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ try {
-+ return parser.getNamespaceUri(arg);
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public String getNamespace(String arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ try {
-+ return parser.getNamespace(arg);
-+ } catch (Exception e) {
-+ throw new OMException(e);
-+ }
-+ }
-+
-+ public String getPrefix() throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getPrefix();
-+ }
-+
-+ public int getAttributeCount() throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getAttributeCount();
-+ }
-+
-+ public String getAttributeNamespace(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getAttributeNamespace(arg);
-+ }
-+
-+ public String getAttributeName(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getAttributeNamespace(arg);
-+ }
-+
-+ public String getAttributePrefix(int arg) throws OMException {
-+ if (navigate)
-+ // TODO:
-+ throw new OMException();
-+ return parser.getAttributeNamespace(arg);
-+ }
-+}
-Index: om/impl/OMNamedNodeImpl.java
-===================================================================
---- om/impl/OMNamedNodeImpl.java (revision 54508)
-+++ om/impl/OMNamedNodeImpl.java (working copy)
-@@ -1,71 +1,71 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMElement;
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNamedNode;
--import org.apache.axis.om.OMNamespace;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 5, 2004
-- * Time: 1:17:37 PM
-- */
--public class OMNamedNodeImpl extends OMNodeImpl implements OMNamedNode {
--
-- OMNamespace ns;
-- String localName;
--
--
-- public OMNamedNodeImpl(String localName, OMNamespace ns, OMElement parent) {
-- super(parent);
-- this.localName = localName;
-- this.ns = ns;
-- }
--
-- public OMNamedNodeImpl(OMElement parent) {
-- super(parent);
-- }
--
-- public String getLocalName() {
-- return localName;
-- }
--
-- public void setLocalName(String localName) {
-- this.localName = localName;
-- }
--
-- public OMNamespace getNamespace() throws OMException {
-- return ns;
-- }
--
-- /**
-- * @param namespace
-- */
-- public void setNamespace(OMNamespace namespace) {
-- this.ns = namespace;
-- }
--
-- public void print(PrintStream ps) throws OMException {
-- if (ns != null && !ns.isDefaultNs()) {
-- ps.print(ns.getPrefix());
-- ps.print(':');
-- }
-- ps.print(localName);
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMElement;
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNamedNode;
-+import org.apache.axis.om.OMNamespace;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 5, 2004
-+ * Time: 1:17:37 PM
-+ */
-+public class OMNamedNodeImpl extends OMNodeImpl implements OMNamedNode {
-+
-+ OMNamespace ns;
-+ String localName;
-+
-+
-+ public OMNamedNodeImpl(String localName, OMNamespace ns, OMElement parent) {
-+ super(parent);
-+ this.localName = localName;
-+ this.ns = ns;
-+ }
-+
-+ public OMNamedNodeImpl(OMElement parent) {
-+ super(parent);
-+ }
-+
-+ public String getLocalName() {
-+ return localName;
-+ }
-+
-+ public void setLocalName(String localName) {
-+ this.localName = localName;
-+ }
-+
-+ public OMNamespace getNamespace() throws OMException {
-+ return ns;
-+ }
-+
-+ /**
-+ * @param namespace
-+ */
-+ public void setNamespace(OMNamespace namespace) {
-+ this.ns = namespace;
-+ }
-+
-+ public void print(PrintStream ps) throws OMException {
-+ if (ns != null && !ns.isDefaultNs()) {
-+ ps.print(ns.getPrefix());
-+ ps.print(':');
-+ }
-+ ps.print(localName);
-+ }
-+}
-Index: om/impl/OMNamespaceImpl.java
-===================================================================
---- om/impl/OMNamespaceImpl.java (revision 54508)
-+++ om/impl/OMNamespaceImpl.java (working copy)
-@@ -1,70 +1,70 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMException;
--import org.apache.axis.om.OMNamespace;
--import org.apache.axis.om.OMNode;
--
--import java.io.PrintStream;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 6, 2004
-- * Time: 11:43:32 AM
-- */
--public class OMNamespaceImpl extends OMNodeImpl implements OMNamespace {
-- private String prefix;
--
-- protected OMNamespaceImpl(String uri, String prefix) {
-- value = uri;
-- this.prefix = prefix;
-- }
--
--
-- public boolean equals(OMNamespace ns) {
-- return ((prefix == null && ns.getPrefix() == null) || (prefix != null && prefix.equals(ns.getPrefix())))
-- && value.equals(ns.getValue());
-- }
--
-- public boolean equals(String uri, String prefix) {
-- return ((prefix == null && this.prefix == null) || (prefix != null && prefix.equals(this.prefix)))
-- && value.equals(uri);
-- }
--
-- public void print(PrintStream s) {
-- s.print("xmlns");
-- if (prefix != null) {
-- s.print(':');
-- s.print(prefix);
-- }
-- s.print('=');
-- s.print('"');
-- s.print(value);
-- s.print('"');
-- }
--
-- public boolean isDefaultNs() {
-- return prefix == null;
-- }
--
-- public String getPrefix() {
-- return prefix; //TODO implement this
-- }
--
-- public OMNode getNextSibling() throws OMException {
-- return nextSibling;
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMException;
-+import org.apache.axis.om.OMNamespace;
-+import org.apache.axis.om.OMNode;
-+
-+import java.io.PrintStream;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 6, 2004
-+ * Time: 11:43:32 AM
-+ */
-+public class OMNamespaceImpl extends OMNodeImpl implements OMNamespace {
-+ private String prefix;
-+
-+ protected OMNamespaceImpl(String uri, String prefix) {
-+ value = uri;
-+ this.prefix = prefix;
-+ }
-+
-+
-+ public boolean equals(OMNamespace ns) {
-+ return ((prefix == null && ns.getPrefix() == null) || (prefix != null && prefix.equals(ns.getPrefix())))
-+ && value.equals(ns.getValue());
-+ }
-+
-+ public boolean equals(String uri, String prefix) {
-+ return ((prefix == null && this.prefix == null) || (prefix != null && prefix.equals(this.prefix)))
-+ && value.equals(uri);
-+ }
-+
-+ public void print(PrintStream s) {
-+ s.print("xmlns");
-+ if (prefix != null) {
-+ s.print(':');
-+ s.print(prefix);
-+ }
-+ s.print('=');
-+ s.print('"');
-+ s.print(value);
-+ s.print('"');
-+ }
-+
-+ public boolean isDefaultNs() {
-+ return prefix == null;
-+ }
-+
-+ public String getPrefix() {
-+ return prefix; //TODO implement this
-+ }
-+
-+ public OMNode getNextSibling() throws OMException {
-+ return nextSibling;
-+ }
-+}
-Index: om/impl/OMDocumentImpl.java
-===================================================================
---- om/impl/OMDocumentImpl.java (revision 54508)
-+++ om/impl/OMDocumentImpl.java (working copy)
-@@ -1,56 +1,56 @@
--package org.apache.axis.om.impl;
--
--import org.apache.axis.om.OMDocument;
--import org.apache.axis.om.OMElement;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 7, 2004
-- * Time: 10:52:17 AM
-- */
--public class OMDocumentImpl extends OMNodeImpl implements OMDocument {
--
-- private OMElementImpl root;
-- private OMXmlPullParserWrapper parserWrapper;
--
-- public OMDocumentImpl(OMXmlPullParserWrapper parserWrapper) {
-- this.parserWrapper = parserWrapper;
-- }
--
-- public OMElementImpl getRootElement() {
-- if (root == null) {
-- parserWrapper.next();
-- }
-- return root;
-- }
--
-- public void setRootElement(OMElementImpl root) {
-- this.root = root;
-- }
--
-- /**
-- * Get the root element of this document
-- *
-- * @return the root element
-- *
-- * This method should be changed as getRootElement
-- *
-- */
-- public OMElement getDocumentElement() {
-- return getRootElement();
-- }
--}
-+package org.apache.axis.om.impl;
-+
-+import org.apache.axis.om.OMDocument;
-+import org.apache.axis.om.OMElement;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 7, 2004
-+ * Time: 10:52:17 AM
-+ */
-+public class OMDocumentImpl extends OMNodeImpl implements OMDocument {
-+
-+ private OMElementImpl root;
-+ private OMXmlPullParserWrapper parserWrapper;
-+
-+ public OMDocumentImpl(OMXmlPullParserWrapper parserWrapper) {
-+ this.parserWrapper = parserWrapper;
-+ }
-+
-+ public OMElementImpl getRootElement() {
-+ if (root == null) {
-+ parserWrapper.next();
-+ }
-+ return root;
-+ }
-+
-+ public void setRootElement(OMElementImpl root) {
-+ this.root = root;
-+ }
-+
-+ /**
-+ * Get the root element of this document
-+ *
-+ * @return the root element
-+ *
-+ * This method should be changed as getRootElement
-+ *
-+ */
-+ public OMElement getDocumentElement() {
-+ return getRootElement();
-+ }
-+}
-Index: om/OMElement.java
-===================================================================
---- om/OMElement.java (revision 54508)
-+++ om/OMElement.java (working copy)
-@@ -1,87 +1,87 @@
--package org.apache.axis.om;
--
--import java.util.Iterator;
--
--/**
-- * 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/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 4, 2004
-- * Time: 11:52:18 AM
-- * <p/>
-- * One must make sure to insert relevant constructors for the classes that are implementing this interface
-- */
--public interface OMElement extends OMNamedNode {
--
-- /**
-- * This will add child to the element. One can decide whether he append the child or he adds to the
-- * front of the children list
-- *
-- * @param omNode
-- */
-- public void addChild(OMNode omNode);
--
-- /**
-- * This returns a collection of this element.
-- * Children can be of types OMElement, OMText.
-- */
-- public Iterator getChildren();
--
-- /**
-- * THis will create a namespace in the current element scope
-- *
-- * @param uri
-- * @param prefix
-- * @return
-- */
-- public OMNamespace createNamespace(String uri, String prefix);
--
-- /**
-- * This will find a namespace with the given uri and prefix, in the scope of the docuemnt.
-- * This will start to find from the current element and goes up in the hiararchy until this finds one.
-- * If none is found, return null
-- *
-- * @param uri
-- * @param prefix
-- * @return
-- * @throws OMException
-- */
-- public OMNamespace resolveNamespace(String uri, String prefix) throws OMException;
--
-- /**
-- * This will returns the first attribute of the element or null, if none is present
-- *
-- * @return
-- */
-- public OMAttribute getFirstAttribute();
--
-- /**
-- * This will return a List of OMAttributes
-- *
-- * @return
-- */
-- public Iterator getAttributes();
--
-- /**
-- * This will insert attribute to this element. Implementor can decide as to insert this
-- * in the front or at the end of set of attributes
-- *
-- * @param attr
-- */
-- public void insertAttribute(OMAttribute attr);
--
-- public void removeAttribute(OMAttribute attr);
--
--}
-+package org.apache.axis.om;
-+
-+import java.util.Iterator;
-+
-+/**
-+ * 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/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 4, 2004
-+ * Time: 11:52:18 AM
-+ * <p/>
-+ * One must make sure to insert relevant constructors for the classes that are implementing this interface
-+ */
-+public interface OMElement extends OMNamedNode {
-+
-+ /**
-+ * This will add child to the element. One can decide whether he append the child or he adds to the
-+ * front of the children list
-+ *
-+ * @param omNode
-+ */
-+ public void addChild(OMNode omNode);
-+
-+ /**
-+ * This returns a collection of this element.
-+ * Children can be of types OMElement, OMText.
-+ */
-+ public Iterator getChildren();
-+
-+ /**
-+ * THis will create a namespace in the current element scope
-+ *
-+ * @param uri
-+ * @param prefix
-+ * @return
-+ */
-+ public OMNamespace createNamespace(String uri, String prefix);
-+
-+ /**
-+ * This will find a namespace with the given uri and prefix, in the scope of the docuemnt.
-+ * This will start to find from the current element and goes up in the hiararchy until this finds one.
-+ * If none is found, return null
-+ *
-+ * @param uri
-+ * @param prefix
-+ * @return
-+ * @throws OMException
-+ */
-+ public OMNamespace resolveNamespace(String uri, String prefix) throws OMException;
-+
-+ /**
-+ * This will returns the first attribute of the element or null, if none is present
-+ *
-+ * @return
-+ */
-+ public OMAttribute getFirstAttribute();
-+
-+ /**
-+ * This will return a List of OMAttributes
-+ *
-+ * @return
-+ */
-+ public Iterator getAttributes();
-+
-+ /**
-+ * This will insert attribute to this element. Implementor can decide as to insert this
-+ * in the front or at the end of set of attributes
-+ *
-+ * @param attr
-+ */
-+ public void insertAttribute(OMAttribute attr);
-+
-+ public void removeAttribute(OMAttribute attr);
-+
-+}
-Index: om/OMNamedNode.java
-===================================================================
---- om/OMNamedNode.java (revision 54508)
-+++ om/OMNamedNode.java (working copy)
-@@ -1,39 +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.
-- * <p/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 4, 2004
-- * Time: 11:39:01 AM
-- * <p/>
-- * OMElement and OMAttribute must have namespace support and those two behave in same manner as far as the namespaces are concerned.
-- * So one can implement this interface specific methods in an abstract class.
-- */
--public interface OMNamedNode extends OMNode {
--
-- String getLocalName();
--
-- void setLocalName(String localName);
--
--
-- OMNamespace getNamespace() throws OMException;
--
-- /**
-- * @param namespace
-- */
-- void setNamespace(OMNamespace namespace);
--}
-+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.
-+ * <p/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 4, 2004
-+ * Time: 11:39:01 AM
-+ * <p/>
-+ * OMElement and OMAttribute must have namespace support and those two behave in same manner as far as the namespaces are concerned.
-+ * So one can implement this interface specific methods in an abstract class.
-+ */
-+public interface OMNamedNode extends OMNode {
-+
-+ String getLocalName();
-+
-+ void setLocalName(String localName);
-+
-+
-+ OMNamespace getNamespace() throws OMException;
-+
-+ /**
-+ * @param namespace
-+ */
-+ void setNamespace(OMNamespace namespace);
-+}
-Index: om/OMNamespace.java
-===================================================================
---- om/OMNamespace.java (revision 54508)
-+++ om/OMNamespace.java (working copy)
-@@ -1,34 +1,34 @@
--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.
-- * <p/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 4, 2004
-- * Time: 1:24:00 PM
-- */
--public interface OMNamespace extends OMNode {
-- //Constructors are not allowed in interfaces!!!!
-- //public OMNamespace(String uri, String prefix);
--
-- public boolean equals(OMNamespace ns);
--
-- public boolean equals(String uri, String prefix);
--
--
-- public boolean isDefaultNs();
--
-- public String getPrefix();
--}
-+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.
-+ * <p/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 4, 2004
-+ * Time: 1:24:00 PM
-+ */
-+public interface OMNamespace extends OMNode {
-+ //Constructors are not allowed in interfaces!!!!
-+ //public OMNamespace(String uri, String prefix);
-+
-+ public boolean equals(OMNamespace ns);
-+
-+ public boolean equals(String uri, String prefix);
-+
-+
-+ public boolean isDefaultNs();
-+
-+ public String getPrefix();
-+}
-Index: om/OMException.java
-===================================================================
---- om/OMException.java (revision 54508)
-+++ om/OMException.java (working copy)
-@@ -1,37 +1,37 @@
--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.
-- * <p/>
-- * User: Eran Chinthaka - Lanka Software Foundation
-- * Date: Oct 4, 2004
-- * Time: 11:47:19 AM
-- */
--public class OMException extends RuntimeException {
-- public OMException() {
-- }
--
-- public OMException(String message) {
-- super(message);
-- }
--
-- public OMException(String message, Throwable cause) {
-- super(message, cause);
-- }
--
-- public OMException(Throwable cause) {
-- super(cause);
-- }
--}
-+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.
-+ * <p/>
-+ * User: Eran Chinthaka - Lanka Software Foundation
-+ * Date: Oct 4, 2004
-+ * Time: 11:47:19 AM
-+ */
-+public class OMException extends RuntimeException {
-+ public OMException() {
-+ }
-+
-+ public OMException(String message) {
-+ super(message);
-+ }
-+
-+ public OMException(String message, Throwable cause) {
-+ super(message, cause);
-+ }
-+
-+ public OMException(Throwable cause) {
-+ super(cause);
-+ }
-+}
-Index: om/OMDocument.java
-===================================================================
---- om/OMDocument.java (revision 54508)
-+++ om/OMDocument.java (working copy)
-@@ -1,31 +1,31 @@
--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 Axis team
-- * Date: Oct 4, 2004
-- * Time: 4:48:10 PM
-- */
--public interface OMDocument extends OMNode {
--
-- /**
-- * Get the root element of this document
-- *
-- * @return the root element
-- */
-- OMElement getDocumentElement();
--
--}
-+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 Axis team
-+ * Date: Oct 4, 2004
-+ * Time: 4:48:10 PM
-+ */
-+public interface OMDocument extends OMNode {
-+
-+ /**
-+ * Get the root element of this document
-+ *
-+ * @return the root element
-+ */
-+ OMElement getDocumentElement();
-+
-+}
Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/OMAttributeImpl.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/OMAttributeImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/OMAttributeImpl.java Mon Oct 18 01:25:29 2004
@@ -63,6 +63,7 @@
}
public void detach() throws OMException {
+
if (parent == null)
throw new OMException();
if (getPreviousSibling() == null)
@@ -73,5 +74,5 @@
nextSibling.setPreviousSibling(previousSibling);
}
-
+
}
Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/OMTextImpl.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/OMTextImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/OMTextImpl.java Mon Oct 18 01:25:29 2004
@@ -67,5 +67,17 @@
s.print(value);
}
-
+ /**
+ * This is to get the type of node, as this is the super class of all the nodes
+ *
+ * @return
+ * @throws org.apache.axis.om.OMException
+ */
+ public short getType() throws OMException {
+ return OMNode.TEXT_NODE; //TODO implement this
+ }
+
+
+
+
}
Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/java/org/apache/axis/om/impl/util/OMChildrenQNameIterator.java Mon Oct 18 01:25:29 2004
@@ -71,15 +71,11 @@
while (needToMoveForward) {
if (omNode != null) {
- System.out.println("Checking the current node, *" + omNode.getValue() + "*");
// check the current node for the criteria
if ((omNode instanceof OMNamedNodeImpl) && ((OMNamedNodeImpl) omNode).getQName().equals(qName)) {
isMatchingNodeFound = true;
needToMoveForward = false;
- System.out.println("One Found");
} else {
-
- System.out.println("Moving to next Sibling ...");
// get the next named node
omNode = omNode.getNextSibling();
isMatchingNodeFound = needToMoveForward = !(omNode == null);
Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/test/org/apache/axis/om/OMElementTest.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/test/org/apache/axis/om/OMElementTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/test/org/apache/axis/om/OMElementTest.java Mon Oct 18 01:25:29 2004
@@ -35,6 +35,7 @@
private OMElement root;
private OMXmlPullParserWrapper omXmlPullParserWrapper;
+
public static void main(String[] args) {
}
@@ -44,6 +45,7 @@
protected void setUp() throws Exception {
super.setUp();
root = getOMBuilder().getDocument().getRootElement();
+
}
private OMXmlPullParserWrapper getOMBuilder() throws Exception {
@@ -72,13 +74,15 @@
}
}
assertTrue(newChildFound);
+
+ System.out.println(" \t\t OK");
}
public final void testGetChildrenWithName() {
- System.out.println("Testing getChildrenWithQName(QName) ......");
+ System.out.print("Testing getChildrenWithQName(QName) ......");
- // add new child with the name TestElement
+ // add new child with the name TestElement
OMNamespace omNamespace = OMNodeBuilder.createOMNamespace("http://opensource.lk/chinthaka", "prefix");
root.addChild(OMNodeBuilder.createOMElement("TestElement", omNamespace, root, omXmlPullParserWrapper));
@@ -86,112 +90,352 @@
int childrenCount = 0;
while (iter.hasNext()) {
iter.next();
- childrenCount ++;
+ childrenCount++;
}
assertTrue("getChildrenWithName is not working properly", childrenCount == 1);
+ System.out.println(" \t\t OK");
+
+
}
public final void testGetChildren() {
+ System.out.print("Testing getChildren ..............");
Iterator childrenIterator = root.getChildren();
- while (childrenIterator.hasNext()) {
- OMNode omNode = (OMNode) childrenIterator.next();
+ int totalNumberOfChildren = 0;
+ int elementNodes = 0;
+ int textNodes = 0;
+ OMNode omNode;
+ short nodeType;
+ String elementLocalName;
+ while (childrenIterator.hasNext()) {
+ omNode = (OMNode) childrenIterator.next();
+ nodeType = omNode.getType();
+ if (nodeType == OMNode.TEXT_NODE) {
+ textNodes++;
+ } else if (nodeType == OMNode.ELEMENT_NODE) {
+ elementLocalName = omNode.getValue();
+ assertTrue("No Header or Body element exists .......", (elementLocalName.equalsIgnoreCase("Header") || elementLocalName.equalsIgnoreCase("Body")));
+ elementNodes++;
+ }
+ totalNumberOfChildren++;
}
- }
- public final void testCreateNamespace() {
- //TODO Implement createNamespace().
+ assertEquals("Two Elements should exist", 2, elementNodes);
+ assertEquals("Three Text nodes should exist", 3, textNodes);
+ assertEquals("Five children should exist", 5, totalNumberOfChildren);
+
+ System.out.println(" \t\t OK");
+
}
- public final void testResolveNamespace() {
- //TODO Implement resolveNamespace().
+ public final void testNamespaceOperations() {
+ String uri = "http://opensource.lk/chinthaka";
+ String prefix = "prefix";
+
+ System.out.print("Testing create namespace .......");
+ root.createNamespace(uri, prefix);
+ OMNamespace namespace = root.resolveNamespace(uri, prefix);
+ assertTrue("namespace has not been set properly ", namespace.equals(uri, prefix));
+ System.out.println(" \t\t OK");
+
+ System.out.print("Testing resolve namespace .......");
+ OMNamespace dummyNamespace = root.resolveNamespace("dummy uri", " dummy prefix");
+ assertTrue(dummyNamespace == null);
+ System.out.println(" \t\t OK");
+
+ System.out.print("Testing get Namespace ...");
+ namespace = root.getNamespace();
+ assertTrue(namespace.equals("http://schemas.xmlsoap.org/soap/envelope/", "soapenv"));
+ System.out.println(" \t\t\t\t OK");
+
+ System.out.print("Testing set namespace .......");
+ namespace = OMNodeBuilder.createOMNamespace(uri, prefix);
+ root.setNamespace(namespace);
+ assertTrue(root.getNamespace().equals(namespace));
+ System.out.println(" \t\t\t OK");
+
}
+
public final void testGetAttributeWithQName() {
- //TODO Implement getAttributeWithQName().
+ System.out.print("Testing getAttributeWithQName ...");
+
+
+ Iterator toElementIter = getToElementIterator();
+ if (toElementIter == null) {
+ assertFalse("No To element found in the header element", true);
+ } else {
+ if (toElementIter.hasNext()) {
+ OMElement toElement = (OMElement) toElementIter.next();
+ Iterator attrubuteIter = toElement.getAttributeWithQName(new QName("http://schemas.xmlsoap.org/soap/envelope/", "mustUnderstand"));
+ if (attrubuteIter.hasNext()) {
+ OMAttribute omAttribute = (OMAttribute) attrubuteIter.next();
+ assertTrue(omAttribute.getLocalName().equalsIgnoreCase("mustUnderstand") && omAttribute.getValue().equals("0"));
+ }
+
+ }
+ }
+
+ System.out.println(" \t\t OK");
+
+ }
+
+ private Iterator getToElementIterator() {
+ Iterator headerElementIter = root.getChildrenWithName(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Header"));
+ if (headerElementIter.hasNext()) {
+ OMElement omElement = (OMElement) headerElementIter.next();
+ return omElement.getChildrenWithName(new QName("http://schemas.xmlsoap.org/ws/2004/03/addressing", "To"));
+ }
+
+ return null;
}
public final void testGetAttributes() {
- //TODO Implement getAttributes().
+ System.out.print("Testing getAttributes ...");
+
+ Iterator toElementIter = getToElementIterator();
+ if (toElementIter == null) {
+ assertFalse("No To element found in the header element", true);
+ } else {
+ if (toElementIter.hasNext()) {
+ OMElement toElement = (OMElement) toElementIter.next();
+ Iterator toElementAttributeIter = toElement.getAttributes();
+
+ int attribCount = 0;
+ while (toElementAttributeIter.hasNext()) {
+ OMAttribute omAttribute = (OMAttribute) toElementAttributeIter.next();
+ assertTrue("To element having attributes, other than mustUnderstand", omAttribute.getLocalName().equalsIgnoreCase("mustUnderstand"));
+ attribCount++;
+ }
+
+ assertTrue("To element having more than one attribute", attribCount == 1);
+ }
+ }
+
+ System.out.println(" \t\t OK");
+
}
public final void testInsertAttribute() {
- //TODO Implement insertAttribute().
+ System.out.print("Testing insertAttribute ....");
+
+ Iterator toElementIter = getToElementIterator();
+ if (toElementIter == null) {
+ assertFalse("No To element found in the header element", true);
+ } else {
+ if (toElementIter.hasNext()) {
+ OMElement toElement = (OMElement) toElementIter.next();
+ toElement.insertAttribute(OMNodeBuilder.createOMAttribute("AttributeOne", null, "AttributeValueOne", toElement));
+ toElement.insertAttribute(OMNodeBuilder.createOMAttribute("AttributeTwo", null, "AttributeValueTwo", toElement));
+
+ Iterator toElementAttributeIter = toElement.getAttributes();
+ boolean attribOneFound = false;
+ boolean attribTwoFound = false;
+
+ int attribCount = 0;
+ while (toElementAttributeIter.hasNext()) {
+ OMAttribute omAttribute = (OMAttribute) toElementAttributeIter.next();
+ if (omAttribute.getLocalName().equalsIgnoreCase("AttributeOne")) {
+ attribOneFound = true;
+ } else if (omAttribute.getLocalName().equalsIgnoreCase("AttributeTwo")) {
+ attribTwoFound = true;
+ }
+ attribCount++;
+
+ }
+
+ assertTrue("insertAttribute is not working properly", attribCount == 3);
+ assertTrue("Attribute insertion has not worked properly", attribOneFound && attribTwoFound);
+
+ }
+ }
+
+ System.out.println(" \t\t OK");
}
public final void testRemoveAttribute() {
- //TODO Implement removeAttribute().
+ System.out.print("Testing insertAttribute ....");
+
+ Iterator toElementIter = getToElementIterator();
+ if (toElementIter == null) {
+ assertFalse("No To element found in the header element", true);
+ } else {
+ if (toElementIter.hasNext()) {
+ OMElement toElement = (OMElement) toElementIter.next();
+ OMAttribute omAttribute = OMNodeBuilder.createOMAttribute("AttributeOne", null, "AttributeValueOne", toElement);
+ toElement.insertAttribute(omAttribute);
+
+ Iterator toElementAttributeIter = toElement.getAttributes();
+
+ int attribCount = 0;
+ while (toElementAttributeIter.hasNext()) {
+ toElementAttributeIter.next();
+ attribCount++;
+ }
+ assertTrue("Attribute addition has not been done properly", attribCount == 2);
+
+ toElement.removeAttribute(omAttribute);
+
+ toElementAttributeIter = toElement.getAttributes();
+ attribCount = 0;
+ while (toElementAttributeIter.hasNext()) {
+ toElementAttributeIter.next();
+ attribCount++;
+ }
+ assertTrue("Attribute removal has not been done properly", attribCount == 1);
+
+ }
+ }
+ System.out.println(" \t\t OK");
+
}
public final void testGetLocalName() {
- //TODO Implement getLocalName().
+ System.out.print("Testing getLocalName ...");
+ assertEquals("getLocalName not working properly ..", "Envelope", root.getLocalName());
+ System.out.println(" \t\t OK");
}
public final void testSetLocalName() {
- //TODO Implement setLocalName().
+ System.out.print("Testing setLocalName ...");
+ root.setLocalName("NewLocalName");
+ assertEquals("setLocalName not working properly ..", "NewLocalName", root.getLocalName());
+ System.out.println(" \t\t OK");
}
- public final void testGetNamespace() {
- //TODO Implement getNamespace().
- }
-
- public final void testSetNamespace() {
- //TODO Implement setNamespace().
- }
public final void testGetParent() {
- //TODO Implement getParent().
- }
+ System.out.print("Testing getParent ...");
+
+ Iterator rootChildrenIter = root.getChildren();
+ while (rootChildrenIter.hasNext()) {
+ OMNode omNode = (OMNode) rootChildrenIter.next();
+ assertTrue("getParent has some problems", omNode.getParent() == root);
+ }
+ System.out.println(" \t\t OK");
- public final void testSetParent() {
- //TODO Implement setParent().
}
+
public final void testGetNextSibling() {
- //TODO Implement getNextSibling().
+ System.out.print("Testing getNextSibling ...");
+
+ Iterator rootChildrenIter = root.getChildren();
+ OMNode previousSibling = null;
+ while (rootChildrenIter.hasNext()) {
+ OMNode omNode = (OMNode) rootChildrenIter.next();
+ if (previousSibling != null) {
+ assertTrue("getNextSibling is not working properly ... ", previousSibling.getNextSibling() == omNode);
+ }
+ }
+
+ System.out.println(" \t\t OK");
+
}
public final void testSetNextSibling() {
- //TODO Implement setNextSibling().
+ System.out.print("Testing getNextSibling ...");
+
+ Iterator rootChildrenIter = root.getChildren();
+
+ OMNode firstChild = getNextChild(rootChildrenIter);
+ OMNode secondChild = getNextChild(rootChildrenIter);
+ OMNode thirdChild = getNextChild(rootChildrenIter);
+
+ firstChild.setNextSibling(thirdChild);
+
+ assertTrue(firstChild.getNextSibling() == thirdChild);
+ System.out.println(" \t\t OK");
+
}
- public final void testGetValue() {
- //TODO Implement getValue().
+ private OMNode getNextChild(Iterator rootChildrenIter) {
+ if (rootChildrenIter.hasNext()) {
+ return (OMNode) rootChildrenIter.next();
+ }
+
+ return null;
}
- public final void testSetValue() {
- //TODO Implement setValue().
+ public final void testGetValue() {
+ System.out.print("Testing getValue ...");
+ assertEquals("Local Name is not equal to value of Element", root.getValue(), root.getLocalName());
+ System.out.println(" \t\t OK");
}
public final void testIsComplete() {
- //TODO Implement isComplete().
- }
+ System.out.print("Testing isComplete ...");
+
+ Iterator rootChildrenIter = root.getChildren();
+
+ OMNode firstChild = getNextChild(rootChildrenIter);
+ getNextChild(rootChildrenIter);
+
+ assertTrue("Complete has not been set properly", firstChild.isComplete());
+ System.out.println(" \t\t OK");
- public final void testSetComplete() {
- //TODO Implement setComplete().
}
public final void testDetach() {
- //TODO Implement detach().
+ System.out.println("Testing detach ....");
+ Iterator childrenIterator = root.getChildren();
+ while (childrenIterator.hasNext()) {
+ OMNode omNode = (OMNode) childrenIterator.next();
+ if (omNode.getType() == OMNode.TEXT_NODE) {
+ omNode.detach();
+ }
+ }
+
+ childrenIterator = root.getChildren();
+ while (childrenIterator.hasNext()) {
+ OMNode omNode = (OMNode) childrenIterator.next();
+ if (omNode.getType() == OMNode.TEXT_NODE) {
+ assertTrue("Detaching is not working", false);
+ }
+ }
+
+ System.out.println(" \t\t OK");
+
}
public final void testInsertSiblingAfter() {
- //TODO Implement insertSiblingAfter().
+ System.out.print("Testing insertSiblingAfter ...");
+
+ Iterator rootChildrenIter = root.getChildren();
+
+ OMNode firstChild = getNextChild(rootChildrenIter);
+ OMNode secondChild = getNextChild(rootChildrenIter);
+ OMNode thirdChild = getNextChild(rootChildrenIter);
+
+ firstChild.insertSiblingAfter(thirdChild);
+
+ assertTrue("insertSiblingAfter is not woking properly", firstChild.getNextSibling() == thirdChild);
+ System.out.println(" \t\t OK");
+
}
public final void testInsertSiblingBefore() {
- //TODO Implement insertSiblingBefore().
- }
+ System.out.print("Testing insertSiblingBefore ...");
- public final void testGetType() {
- //TODO Implement getType().
+ Iterator rootChildrenIter = root.getChildren();
+
+ OMNode firstChild = getNextChild(rootChildrenIter);
+ OMNode secondChild = getNextChild(rootChildrenIter);
+ OMNode thirdChild = getNextChild(rootChildrenIter);
+
+ firstChild.insertSiblingBefore(thirdChild);
+
+ assertTrue("insertSiblingBefore is not woking properly", thirdChild.getNextSibling() == firstChild);
+ System.out.println(" \t\t OK");
}
- public final void testSetType() {
- //TODO Implement setType().
+ public final void testGetType() {
+ assertTrue("Element type is not set properly ", root.getType() == OMNode.ELEMENT_NODE);
}
+
}
Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/test/org/apache/axis/om/util/OMNodeBuilder.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/test/org/apache/axis/om/util/OMNodeBuilder.java (original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OMAPI_with_Impl/src/test/org/apache/axis/om/util/OMNodeBuilder.java Mon Oct 18 01:25:29 2004
@@ -2,9 +2,11 @@
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMAttribute;
import org.apache.axis.om.impl.OMElementImpl;
import org.apache.axis.om.impl.OMXmlPullParserWrapper;
import org.apache.axis.om.impl.OMNamespaceImpl;
+import org.apache.axis.om.impl.OMAttributeImpl;
/**
* Copyright 2001-2004 The Apache Software Foundation.
@@ -57,7 +59,7 @@
* @return
*/
public static OMElement createOMElement(String localName, OMNamespace namespace, OMElement parent, OMXmlPullParserWrapper pullParserWrapper){
- return new OMElementImpl(localName, namespace, parent, pullParserWrapper);
+ return new OMElementImpl(localName, namespace, parent, pullParserWrapper);
}
/**
@@ -69,4 +71,17 @@
public static OMNamespace createOMNamespace(String uri, String prefix){
return new OMNamespaceImpl(uri, prefix);
}
+
+ /**
+ *
+ * @param localName
+ * @param ns
+ * @param value
+ * @param parent
+ * @return
+ */
+ public static OMAttribute createOMAttribute(String localName, OMNamespace ns, String value, OMElement parent){
+ return new OMAttributeImpl(localName, ns, value, parent);
+ }
+
}