You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ve...@apache.org on 2005/04/28 08:42:28 UTC
svn commit: r165108 [5/6] - in
/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance:
./ XMLConformanceTestingProject/ XMLConformanceTestingProject/bin/
XMLConformanceTestingProject/src/ XMLConformanceTestingProject/src/org/
XMLConformanceTestingProject/src/org/apache/
XMLConformanceTestingProject/src/org/apache/axis/
XMLConformanceTestingProject/src/org/apache/axis/om/
XMLConformanceTestingProject/src/org/apache/axis/om/impl/
XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/
XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/
XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/
XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/
XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/
XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/
XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/util/
XMLConformanceTestingProject/test/
XMLConformanceTestingProject/test/junittesting/
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPBodyImpl.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPBodyImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPBodyImpl.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPFault;
+
+/**
+ * Class SOAPBodyImpl
+ */
+public class SOAPBodyImpl extends OMElementImpl
+ implements SOAPBody, OMConstants {
+ /**
+ * Field hasSOAPFault
+ */
+ private boolean hasSOAPFault = false;
+
+ /**
+ * @param envelope
+ */
+ public SOAPBodyImpl(SOAPEnvelope envelope) {
+ super(envelope);
+ this.ns = envelope.getNamespace();
+ this.localName = OMConstants.BODY_LOCAL_NAME;
+ }
+
+ /**
+ * Constructor SOAPBodyImpl
+ *
+ * @param envelope
+ * @param builder
+ */
+ public SOAPBodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+ super(OMConstants.BODY_LOCAL_NAME, envelope.getNamespace(), envelope,
+ builder);
+ }
+
+ /**
+ * Creates a new <code>SOAPFault</code> object and adds it to
+ * this <code>SOAPBody</code> object.
+ *
+ * @param e
+ * @return the new <code>SOAPFault</code> object
+ * @throws org.apache.axis.om.OMException if there is a SOAP error
+ * @throws OMException
+ */
+ public SOAPFault addFault(Exception e) throws OMException {
+ SOAPFault soapFault = new SOAPFaultImpl(this, e);
+ addFault(soapFault);
+ return soapFault;
+ }
+
+ /**
+ * Indicates whether a <code>SOAPFault</code> object exists in
+ * this <code>SOAPBody</code> object.
+ *
+ * @return <code>true</code> if a <code>SOAPFault</code> object exists in
+ * this <code>SOAPBody</code> object; <code>false</code>
+ * otherwise
+ */
+ public boolean hasFault() {
+ if (hasSOAPFault) {
+ return true;
+ } else {
+ OMElement element = getFirstElement();
+ if(element != null
+ && SOAPFAULT_LOCAL_NAME.equals(element.getLocalName())
+ && SOAPFAULT_NAMESPACE_URI.equals(element.getNamespaceName())){
+ hasSOAPFault = true;
+ return true;
+ }else{
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object.
+ *
+ * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object
+ */
+ public SOAPFault getFault() {
+ if(hasSOAPFault){
+ OMElement element = getFirstElement();
+ if(element != null
+ && SOAPFAULT_LOCAL_NAME.equals(element.getLocalName())
+ && SOAPFAULT_NAMESPACE_URI.equals(element.getNamespaceName())){
+ hasSOAPFault = true;
+ return (SOAPFault)element;
+ }else{
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param soapFault
+ * @throws org.apache.axis.om.OMException
+ * @throws OMException
+ */
+ public void addFault(SOAPFault soapFault) throws OMException {
+ if (hasSOAPFault) {
+ throw new OMException(
+ "SOAP Body already has a SOAP Fault and there can not be more than one SOAP fault");
+ }
+ addChild(soapFault);
+ hasSOAPFault = true;
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPEnvelopeImpl.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPEnvelopeImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPEnvelopeImpl.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPHeader;
+
+/**
+ * Class SOAPEnvelopeImpl
+ */
+public class SOAPEnvelopeImpl extends OMElementImpl
+ implements SOAPEnvelope, OMConstants {
+ /**
+ * @param builder
+ */
+ public SOAPEnvelopeImpl(OMXMLParserWrapper builder) {
+ super(SOAPENVELOPE_LOCAL_NAME, null, null, builder);
+ }
+
+ /**
+ * Constructor SOAPEnvelopeImpl
+ *
+ * @param ns
+ * @param builder
+ */
+ public SOAPEnvelopeImpl(OMNamespace ns, OMXMLParserWrapper builder) {
+ super(SOAPENVELOPE_LOCAL_NAME, ns, null, builder);
+ }
+
+ /**
+ * @param ns
+ */
+ public SOAPEnvelopeImpl(OMNamespace ns) {
+ super(SOAPENVELOPE_LOCAL_NAME, ns);
+ }
+
+ /**
+ * Returns the <CODE>SOAPHeader</CODE> object for this <CODE>
+ * SOAPEnvelope</CODE> object.
+ * <P> This SOAPHeader will just be a container for all the headers in the
+ * <CODE>OMMessage</CODE>
+ * </P>
+ *
+ * @return the <CODE>SOAPHeader</CODE> object or <CODE>
+ * null</CODE> if there is none
+ * @throws org.apache.axis.om.OMException if there is a problem
+ * obtaining the <CODE>SOAPHeader</CODE> object
+ * @throws OMException
+ */
+ public SOAPHeader getHeader() throws OMException {
+ OMElement element = getFirstElement();
+ if (OMConstants.HEADER_LOCAL_NAME.equals(element.getLocalName())) {
+ return (SOAPHeader) element;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the <CODE>SOAPBody</CODE> object associated with
+ * this <CODE>SOAPEnvelope</CODE> object.
+ * <P> This SOAPBody will just be a container for all the BodyElements in the
+ * <CODE>OMMessage</CODE>
+ * </P>
+ *
+ * @return the <CODE>SOAPBody</CODE> object for this <CODE>
+ * SOAPEnvelope</CODE> object or <CODE>null</CODE> if there
+ * is none
+ * @throws org.apache.axis.om.OMException if there is a problem
+ * obtaining the <CODE>SOAPBody</CODE> object
+ * @throws OMException
+ */
+ public SOAPBody getBody() throws OMException {
+ OMElement element = getFirstElement();
+ if (OMConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
+ return (SOAPBody) element;
+ }else{
+ element = element.getNextSiblingElement();
+ if (OMConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
+ return (SOAPBody) element;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method detach
+ *
+ * @throws OMException
+ */
+ public void detach() throws OMException {
+ throw new OMException("Root Element can not be detached");
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPFaultImpl.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPFaultImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPFaultImpl.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,302 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPFault;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Iterator;
+
+/**
+ * Class SOAPFaultImpl
+ */
+public class SOAPFaultImpl extends OMElementImpl
+ implements SOAPFault, OMConstants {
+ /**
+ * Field e
+ */
+ private Exception e;
+
+ /**
+ * Field faultCodeElement
+ */
+ private OMElementImpl faultCodeElement;
+
+ /**
+ * Field faultActorElement
+ */
+ private OMElementImpl faultActorElement;
+
+ /**
+ * Field faultStringElement
+ */
+ private OMElementImpl faultStringElement;
+
+ /**
+ * Field detailElement
+ */
+ private OMElementImpl detailElement;
+
+ /**
+ * Constructor SOAPFaultImpl
+ *
+ * @param parent
+ * @param e
+ */
+ public SOAPFaultImpl(OMElement parent, Exception e) {
+ super(SOAPFAULT_LOCAL_NAME,
+ new OMNamespaceImpl(SOAPFAULT_NAMESPACE_URI,
+ SOAPFAULT_NAMESPACE_PREFIX));
+ this.parent = (OMElementImpl) parent;
+ this.e = e;
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ this.setDetailInformation(OMFactory.newInstance().createText(sw.getBuffer().toString()));
+ }
+
+ /**
+ * Constructor SOAPFaultImpl
+ *
+ * @param ns
+ * @param parent
+ * @param builder
+ */
+ public SOAPFaultImpl(OMNamespace ns, OMElement parent,
+ OMXMLParserWrapper builder) {
+ super(SOAPFAULT_LOCAL_NAME, ns, parent, builder);
+ }
+
+ /**
+ * Method setFaultCode
+ *
+ * @param faultCode
+ * @throws OMException
+ */
+ public void setFaultCode(QName faultCode) throws OMException {
+ if (faultCodeElement != null) {
+ faultCodeElement.detach();
+ }
+ faultCodeElement =
+ new OMElementImpl(OMConstants.SOAPFAULT_CODE_LOCAL_NAME, this.ns);
+ this.addChild(faultCodeElement);
+ faultCodeElement.addChild(new OMTextImpl(faultCodeElement,
+ faultCode.getPrefix() + ':'
+ + faultCode.getLocalPart()));
+ }
+
+ /**
+ * Method getFaultCode
+ *
+ * @return
+ */
+ public QName getFaultCode() {
+ if (faultCodeElement != null) {
+ Iterator childrenIter = faultCodeElement.getChildren();
+ while (childrenIter.hasNext()) {
+ Object o = childrenIter.next();
+ if ((o instanceof OMText)
+ && !((OMText) o).getValue().trim().equals("")) {
+ String[] strings = ((OMText) o).getValue().split(":");
+ return new QName("", strings[1], strings[0]);
+ }
+ }
+ } else {
+ faultCodeElement = (OMElementImpl) this.getChildWithName(
+ new QName(
+ this.ns.getName(), OMConstants.SOAPFAULT_CODE_LOCAL_NAME,
+ this.ns.getPrefix()));
+ if (faultCodeElement != null) {
+ return this.getFaultCode();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method setFaultActor
+ *
+ * @param faultActor
+ * @throws OMException
+ */
+ public void setFaultActor(String faultActor) throws OMException {
+ if (faultActorElement != null) {
+ faultActorElement.detach();
+ }
+ faultActorElement =
+ new OMElementImpl(OMConstants.SOAPFAULT_ACTOR_LOCAL_NAME, this.ns);
+ this.addChild(faultActorElement);
+ faultActorElement.addChild(new OMTextImpl(faultActorElement,
+ faultActor));
+ }
+
+ /**
+ * Method getFaultActor
+ *
+ * @return
+ */
+ public String getFaultActor() {
+ if (faultActorElement != null) {
+ Iterator childrenIter = faultActorElement.getChildren();
+ while (childrenIter.hasNext()) {
+ Object o = childrenIter.next();
+ if ((o instanceof OMText)
+ && !"".equals(((OMText) o).getValue())) {
+ return ((OMText) o).getValue();
+ }
+ }
+ } else {
+ faultActorElement = (OMElementImpl) this.getChildWithName(
+ new QName(
+ this.ns.getName(), OMConstants.SOAPFAULT_ACTOR_LOCAL_NAME,
+ this.ns.getPrefix()));
+ if (faultActorElement != null) {
+ return this.getFaultString();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method setFaultString
+ *
+ * @param faultString
+ * @throws OMException
+ */
+ public void setFaultString(String faultString) throws OMException {
+ if (faultStringElement != null) {
+ faultStringElement.detach();
+ }
+ faultStringElement =
+ new OMElementImpl(OMConstants.SOAPFAULT_STRING_LOCAL_NAME, this.ns);
+ this.addChild(faultStringElement);
+ faultStringElement.addChild(new OMTextImpl(faultStringElement,
+ faultString));
+ }
+
+ /**
+ * Method getFaultString
+ *
+ * @return
+ */
+ public String getFaultString() {
+ if (faultStringElement != null) {
+ Iterator childrenIter = faultStringElement.getChildren();
+ while (childrenIter.hasNext()) {
+ Object o = childrenIter.next();
+ if ((o instanceof OMText)
+ && !"".equals(((OMText) o).getValue())) {
+ return ((OMText) o).getValue();
+ }
+ }
+ } else {
+ faultStringElement = (OMElementImpl) this.getChildWithName(
+ new QName(
+ this.ns.getName(), OMConstants.SOAPFAULT_STRING_LOCAL_NAME,
+ this.ns.getPrefix()));
+ if (faultStringElement != null) {
+ return this.getFaultString();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method setDetailInformation
+ *
+ * @param detailInformation
+ */
+ public void setDetailInformation(OMNode detailInformation) {
+ if (detailElement != null) {
+ detailElement.detach();
+ }
+ detailElement =
+ new OMElementImpl(OMConstants.SOAPFAULT_DETAIL_LOCAL_NAME, this.ns);
+ this.addChild(detailElement);
+ detailElement.addChild(detailInformation);
+ }
+
+ /**
+ * Method getDetailInformation
+ *
+ * @return
+ */
+ public OMNode getDetailInformation() {
+ if (detailElement != null) {
+ Iterator childrenIter = detailElement.getChildren();
+ while (childrenIter.hasNext()) {
+ Object o = childrenIter.next();
+ if (!((o instanceof OMText)
+ && "".equals(((OMText) o).getValue()))) {
+ return (OMNode) o;
+ }
+ }
+ } else {
+ detailElement = (OMElementImpl) this.getChildWithName(
+ new QName(
+ this.ns.getName(), OMConstants.SOAPFAULT_DETAIL_LOCAL_NAME,
+ this.ns.getPrefix()));
+ if (detailElement != null) {
+ return detailElement;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method getException
+ *
+ * @return
+ * @throws OMException
+ */
+ public Exception getException() throws OMException {
+ if (e == null) {
+ OMNode detailsInformationNode = this.getDetailInformation();
+ if (detailsInformationNode instanceof OMElement) {
+ try {
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter writer =
+ XMLOutputFactory.newInstance().createXMLStreamWriter(
+ sw);
+ ((OMElement) detailsInformationNode).serialize(writer,
+ true);
+ writer.flush();
+ return new Exception(sw.toString());
+ } catch (XMLStreamException e1) {
+ throw new OMException("Exception in StAX Writer", e1);
+ }
+ } else if (detailsInformationNode instanceof OMText) {
+ return new Exception(
+ ((OMText) detailsInformationNode).getValue());
+ }
+ } else {
+ return e;
+ }
+ return null;
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPHeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPHeaderBlockImpl.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPHeaderBlockImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPHeaderBlockImpl.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom;
+
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPHeaderBlock;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class SOAPHeaderBlockImpl
+ */
+public class SOAPHeaderBlockImpl extends OMElementImpl
+ implements SOAPHeaderBlock {
+ /**
+ * @param localName
+ * @param ns
+ */
+ public SOAPHeaderBlockImpl(String localName, OMNamespace ns) {
+ super(localName, ns);
+ }
+
+ /**
+ * Constructor SOAPHeaderBlockImpl
+ *
+ * @param localName
+ * @param ns
+ * @param parent
+ * @param builder
+ */
+ public SOAPHeaderBlockImpl(String localName, OMNamespace ns,
+ OMElement parent, OMXMLParserWrapper builder) {
+ super(localName, ns, parent, builder);
+ }
+
+ /**
+ * Sets the actor associated with this <CODE>
+ * SOAPHeaderBlock</CODE> object to the specified actor. The
+ * default value of an actor is: <CODE>
+ * OMConstants.URI_SOAP_ACTOR_NEXT</CODE>
+ *
+ * @param actorURI a <CODE>String</CODE> giving
+ * the URI of the actor to set
+ * @throws IllegalArgumentException if
+ * there is a problem in setting the actor.
+ * @see #getActor() getActor()
+ */
+ public void setActor(String actorURI) {
+ setAttribute(OMConstants.ATTR_ACTOR, actorURI);
+ }
+
+ /**
+ * @param attributeName
+ * @param attrValue
+ */
+ private void setAttribute(String attributeName, String attrValue) {
+ OMAttribute omAttribute = this.getAttributeWithQName(
+ new QName(OMConstants.SOAP_ENVELOPE_NAMESPACE_URI, attributeName));
+ if (omAttribute != null) {
+ omAttribute.setValue(attrValue);
+ } else {
+ OMAttribute attribute = new OMAttributeImpl(
+ attributeName,
+ new OMNamespaceImpl(
+ OMConstants.SOAP_ENVELOPE_NAMESPACE_URI,
+ OMConstants.SOAPENVELOPE_NAMESPACE_PREFIX), attrValue);
+ this.insertAttribute(attribute);
+ }
+ }
+
+ /**
+ * Returns the uri of the actor associated with this <CODE>
+ * SOAPHeaderBlock</CODE> object.
+ *
+ * @return a <CODE>String</CODE> giving the URI of the
+ * actor
+ * @see #setActor(String) setActor(java.lang.String)
+ */
+ public String getActor() {
+ return getAttribute(OMConstants.ATTR_ACTOR);
+ }
+
+ /**
+ * Method getAttribute
+ *
+ * @param attrName
+ * @return
+ */
+ private String getAttribute(String attrName) {
+ OMAttribute omAttribute = this.getAttributeWithQName(
+ new QName(OMConstants.SOAP_ENVELOPE_NAMESPACE_URI, attrName));
+ return (omAttribute != null)
+ ? omAttribute.getValue()
+ : null;
+ }
+
+ /**
+ * Sets the mustUnderstand attribute for this <CODE>
+ * SOAPHeaderBlock</CODE> object to be on or off.
+ * <P>If the mustUnderstand attribute is on, the actor who
+ * receives the <CODE>SOAPHeaderBlock</CODE> must process it
+ * correctly. This ensures, for example, that if the <CODE>
+ * SOAPHeaderBlock</CODE> object modifies the message, that
+ * the message is being modified correctly.</P>
+ *
+ * @param mustUnderstand <CODE>true</CODE> to
+ * set the mustUnderstand attribute on; <CODE>false</CODE>
+ * to turn if off
+ * @throws IllegalArgumentException if
+ * there is a problem in setting the actor.
+ * @see #getMustUnderstand() getMustUnderstand()
+ */
+ public void setMustUnderstand(boolean mustUnderstand) {
+ setAttribute(OMConstants.ATTR_MUSTUNDERSTAND, mustUnderstand
+ ? "true"
+ : "false");
+ }
+
+ /**
+ * Returns whether the mustUnderstand attribute for this
+ * <CODE>SOAPHeaderBlock</CODE> object is turned on.
+ *
+ * @return <CODE>true</CODE> if the mustUnderstand attribute of
+ * this <CODE>SOAPHeaderBlock</CODE> object is turned on;
+ * <CODE>false</CODE> otherwise
+ */
+ public boolean getMustUnderstand() {
+ String mustUnderstand = "";
+ if ((mustUnderstand = getAttribute(OMConstants.ATTR_MUSTUNDERSTAND))
+ != null) {
+ return mustUnderstand.equalsIgnoreCase("true");
+ }
+ return false;
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPHeader;
+import org.apache.axis.om.SOAPHeaderBlock;
+import org.apache.axis.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * Class SOAPHeaderImpl
+ */
+public class SOAPHeaderImpl extends OMElementImpl implements SOAPHeader {
+ /**
+ * @param envelope
+ */
+ public SOAPHeaderImpl(SOAPEnvelope envelope) {
+ super(envelope);
+
+ // set the namespaces
+ this.ns = envelope.getNamespace();
+ this.localName = OMConstants.HEADER_LOCAL_NAME;
+ }
+
+ /**
+ * Constructor SOAPHeaderImpl
+ *
+ * @param envelope
+ * @param builder
+ */
+ public SOAPHeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+ super(OMConstants.HEADER_LOCAL_NAME, (envelope == null)
+ ? null
+ : envelope.getNamespace(), envelope,
+ builder);
+ }
+
+ /**
+ * Creates a new <CODE>SOAPHeaderBlock</CODE> object
+ * initialized with the specified name and adds it to this
+ * <CODE>SOAPHeader</CODE> object.
+ *
+ * @param localName
+ * @param ns
+ * @return the new <CODE>SOAPHeaderBlock</CODE> object that
+ * was inserted into this <CODE>SOAPHeader</CODE>
+ * object
+ * @throws org.apache.axis.om.OMException if a SOAP error occurs
+ * @throws OMException
+ */
+ public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
+ throws OMException {
+ SOAPHeaderBlock soapHeaderBlock = new SOAPHeaderBlockImpl(localName,
+ ns);
+ this.addChild(soapHeaderBlock);
+ soapHeaderBlock.setComplete(true);
+ return soapHeaderBlock;
+ }
+
+ /**
+ * Returns a list of all the <CODE>SOAPHeaderBlock</CODE>
+ * objects in this <CODE>SOAPHeader</CODE> object that have the
+ * the specified actor. An actor is a global attribute that
+ * indicates the intermediate parties to whom the message should
+ * be sent. An actor receives the message and then sends it to
+ * the next actor. The default actor is the ultimate intended
+ * recipient for the message, so if no actor attribute is
+ * included in a <CODE>SOAPHeader</CODE> object, the message is
+ * sent to its ultimate destination.
+ *
+ * @param paramActor a <CODE>String</CODE> giving the
+ * URI of the actor for which to search
+ * @return an <CODE>Iterator</CODE> object over all the <CODE>
+ * SOAPHeaderBlock</CODE> objects that contain the
+ * specified actor
+ * @see #extractHeaderBlocks(String) extractHeaderBlocks(java.lang.String)
+ */
+ public Iterator examineHeaderBlocks(String paramActor) {
+ Iterator headerBlocksIter = this.getChildren();
+ while (headerBlocksIter.hasNext()) {
+ Object o = headerBlocksIter.next();
+ if (o instanceof SOAPHeaderBlock) {
+ SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o;
+ String actor = soapHeaderBlock.getActor();
+ if ((actor != null) && actor.equalsIgnoreCase(paramActor)) {
+
+ // headerBlocksIter.
+ }
+ }
+ }
+ return headerBlocksIter;
+ }
+
+ /**
+ * Returns a list of all the <CODE>SOAPHeaderBlock</CODE>
+ * objects in this <CODE>SOAPHeader</CODE> object that have
+ * the the specified actor and detaches them from this <CODE>
+ * SOAPHeader</CODE> object.
+ * <P>This method allows an actor to process only the parts of
+ * the <CODE>SOAPHeader</CODE> object that apply to it and to
+ * remove them before passing the message on to the next
+ * actor.
+ *
+ * @param actor a <CODE>String</CODE> giving the
+ * URI of the actor for which to search
+ * @return an <CODE>Iterator</CODE> object over all the <CODE>
+ * SOAPHeaderBlock</CODE> objects that contain the
+ * specified actor
+ * @see #examineHeaderBlocks(String) examineHeaderBlocks(java.lang.String)
+ */
+ public Iterator extractHeaderBlocks(String actor) {
+ return new OMChildrenWithSpecificAttributeIterator(
+ getFirstChild(),
+ new QName(
+ OMConstants.SOAP_ENVELOPE_NAMESPACE_URI, OMConstants.ATTR_ACTOR),
+ actor, true);
+ }
+
+ /**
+ * Returns an <code>Iterator</code> over all the
+ * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader</code>
+ * object that have the specified actor and that have a MustUnderstand
+ * attribute whose value is equivalent to <code>true</code>.
+ *
+ * @param actor a <code>String</code> giving the URI of the actor for which
+ * to search
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderBlock</code> objects that contain the
+ * specified actor and are marked as MustUnderstand
+ */
+ public Iterator examineMustUnderstandHeaderBlocks(String actor) {
+ return new OMChildrenWithSpecificAttributeIterator(
+ getFirstChild(),
+ new QName(
+ OMConstants.SOAP_ENVELOPE_NAMESPACE_URI, OMConstants.ATTR_ACTOR),
+ actor, false);
+ }
+
+ /**
+ * Returns an <code>Iterator</code> over all the
+ * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader</code>
+ * object.
+ * Not that this will return elements containing the QName (http://schemas.xmlsoap.org/soap/envelope/, Header)
+ *
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderBlock</code> objects contained by this
+ * <code>SOAPHeader</code>
+ */
+ public Iterator examineAllHeaderBlocks() {
+ return this.getChildrenWithName(null);
+ }
+
+ /**
+ * Returns an <code>Iterator</code> over all the
+ * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader </code>
+ * object and detaches them from this <code>SOAPHeader</code> object.
+ *
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderBlock</code> objects contained by this
+ * <code>SOAPHeader</code>
+ */
+ public Iterator extractAllHeaderBlocks() {
+ throw new UnsupportedOperationException(); // TODO implement this
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/SAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/SAXOMBuilder.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/SAXOMBuilder.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/SAXOMBuilder.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+
+package org.apache.axis.om.impl.llom.builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNode;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class SAXOMBuilder extends DefaultHandler {
+ OMElement root = null;
+
+ OMNode lastNode = null;
+
+ OMElement nextElem = null;
+
+ OMFactory factory = OMFactory.newInstance();
+
+ List prefixMappings = new ArrayList();
+
+ public void setDocumentLocator(Locator arg0) {
+ }
+
+ public void startDocument() throws SAXException {
+
+ }
+
+ public void endDocument() throws SAXException {
+ }
+
+ protected OMElement createNextElement(String localName) throws OMException {
+ OMElement e;
+ if (lastNode == null) {
+ root = e = factory.createOMElement(localName, null, null, null);
+ } else if (lastNode.isComplete()) {
+ e = factory.createOMElement(localName, null, lastNode.getParent(),
+ null);
+ lastNode.setNextSibling(e);
+ e.setPreviousSibling(lastNode);
+ } else {
+ OMElement parent = (OMElement) lastNode;
+ e = factory.createOMElement(localName, null, (OMElement) lastNode,
+ null);
+ parent.setFirstChild(e);
+ }
+ return e;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String,
+ * java.lang.String)
+ */
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException {
+ if (nextElem == null)
+ nextElem = createNextElement(null);
+ nextElem.declareNamespace(uri, prefix);
+ }
+
+ public void endPrefixMapping(String arg0) throws SAXException {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.ContentHandler#startElement(java.lang.String,
+ * java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String namespaceURI, String localName,
+ String qName, Attributes atts) throws SAXException {
+ if (localName == null || localName.trim().equals(""))
+ localName = qName.substring(qName.indexOf(':') + 1);
+ if (nextElem == null)
+ nextElem = createNextElement(localName);
+ else
+ nextElem.setLocalName(localName);
+ nextElem
+ .setNamespace(nextElem.findInScopeNamespace(namespaceURI, null));
+ int j = atts.getLength();
+ for (int i = 0; i < j; i++)
+ nextElem.insertAttribute(atts.getLocalName(i), atts.getValue(i),
+ nextElem.findInScopeNamespace(atts.getURI(i), null));
+ lastNode = nextElem;
+ nextElem = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.ContentHandler#endElement(java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ public void endElement(String arg0, String arg1, String arg2)
+ throws SAXException {
+ if (lastNode.isComplete()) {
+ OMElement parent = lastNode.getParent();
+ parent.setComplete(true);
+ lastNode = parent;
+ } else {
+ OMElement e = (OMElement) lastNode;
+ e.setComplete(true);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.ContentHandler#characters(char[], int, int)
+ */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ if (lastNode == null) {
+ throw new SAXException("");
+ }
+ OMNode node;
+ if (lastNode.isComplete()) {
+ node = factory.createText(lastNode.getParent(), new String(ch,
+ start, length));
+ lastNode.setNextSibling(node);
+ node.setPreviousSibling(lastNode);
+ } else {
+ OMElement e = (OMElement) lastNode;
+ node = factory.createText(e, new String(ch, start, length));
+ e.setFirstChild(node);
+ }
+ lastNode = node;
+ }
+
+ public void ignorableWhitespace(char[] arg0, int arg1, int arg2)
+ throws SAXException {
+ }
+
+ public void processingInstruction(String arg0, String arg1)
+ throws SAXException {
+ }
+
+ public void skippedEntity(String arg0) throws SAXException {
+ }
+
+ /**
+ * @return Returns the root.
+ */
+ public OMElement getRootElement() {
+ return root;
+ }
+}
\ No newline at end of file
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXBuilder.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXBuilder.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXBuilder.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,432 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom.builder;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.impl.llom.OMElementImpl;
+import org.apache.axis.om.impl.llom.OMNodeImpl;
+
+/**
+ * OM should be able to built from any data source. And the model it builds may be a SOAP specific one
+ * or just an XML model. This class will give some common functionality of OM Building from StAX.
+ */
+public abstract class StAXBuilder implements OMXMLParserWrapper {
+ /**
+ * Field ombuilderFactory
+ */
+ protected OMFactory ombuilderFactory;
+
+ /**
+ * Field parser
+ */
+ protected XMLStreamReader parser;
+
+ /**
+ * Field omfactory
+ */
+ protected OMFactory omfactory;
+
+ /**
+ * Field lastNode
+ */
+ protected OMNode lastNode;
+
+ // keeps state of occurence of document element
+ /**
+ * Field foundRootElement
+ */
+ protected boolean foundRootElement = false;
+
+ // returns the state of completion
+
+ /**
+ * Field done
+ */
+ protected boolean done = false;
+
+ // keeps the state of the cache
+
+ /**
+ * Field cache
+ */
+ protected boolean cache = true;
+
+ // keeps the state of the parser access. if the parser is
+ // accessed atleast once,this flag will be set
+
+ /**
+ * Field parserAccessed
+ */
+ protected boolean parserAccessed = false;
+
+ /**
+ * Constructor StAXBuilder
+ *
+ * @param ombuilderFactory
+ * @param parser
+ */
+ protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {
+ this.ombuilderFactory = ombuilderFactory;
+ this.parser = parser;
+ omfactory = OMFactory.newInstance();
+ }
+
+ /**
+ * Constructor StAXBuilder
+ *
+ * @param parser
+ */
+ protected StAXBuilder(XMLStreamReader parser) {
+ this(OMFactory.newInstance(), parser);
+ omfactory = OMFactory.newInstance();
+ }
+
+ /**
+ * Method setOmbuilderFactory
+ *
+ * @param ombuilderFactory
+ */
+ public void setOmbuilderFactory(OMFactory ombuilderFactory) {
+ this.ombuilderFactory = ombuilderFactory;
+ }
+
+ /**
+ * Method processNamespaceData
+ *
+ * @param node
+ * @param isSOAPElement
+ */
+ protected abstract void processNamespaceData(OMElement node,
+ boolean isSOAPElement);
+
+ // since the behaviors are different when it comes to namespaces
+ // this must be implemented differently
+
+ /**
+ * Method processAttributes
+ *
+ * @param node
+ */
+ protected void processAttributes(OMElement node) {
+ int attribCount = parser.getAttributeCount();
+ for (int i = 0; i < attribCount; i++) {
+ OMNamespace ns = null;
+ String uri = parser.getAttributeNamespace(i);
+ if (uri.hashCode() != 0) {
+ ns = node.findInScopeNamespace(uri,
+ parser.getAttributePrefix(i));
+ }
+
+ // todo if the attributes are supposed to namespace qualified all the time
+ // todo then this should throw an exception here
+ node.insertAttribute(parser.getAttributeLocalName(i),
+ parser.getAttributeValue(i), ns);
+ }
+ }
+
+ /**
+ * Method createOMText
+ *
+ * @return
+ * @throws OMException
+ */
+ protected OMNode createOMText() throws OMException {
+ if (lastNode == null) {
+ throw new OMException();
+ }
+ OMNode node;
+ if (lastNode.isComplete()) {
+ node = omfactory.createText(lastNode.getParent(), parser.getText());
+ lastNode.setNextSibling(node);
+ node.setPreviousSibling(lastNode);
+ } else {
+ OMElement e = (OMElement) lastNode;
+ node = omfactory.createText(e, parser.getText());
+ e.setFirstChild(node);
+ }
+ return node;
+ }
+
+ /**
+ * Method reset
+ *
+ * @param node
+ * @throws OMException
+ */
+ public void reset(OMNode node) throws OMException {
+ lastNode = null;
+ }
+
+ /**
+ * Method discard
+ *
+ * @param el
+ * @throws OMException
+ */
+ public void discard(OMElement el) throws OMException {
+ OMElementImpl elementImpl = null;
+ if (el instanceof OMElementImpl) {
+ elementImpl = (OMElementImpl) el;
+ } else {
+ throw new OMException();
+ }
+ if (elementImpl.isComplete() || !cache) {
+ throw new OMException();
+ }
+ try {
+ cache = false;
+ do {
+ while (parser.next() != XMLStreamConstants.END_ELEMENT) ;
+
+ // TODO:
+ } while (!parser.getName().equals(elementImpl.getQName()));
+ lastNode = (OMNodeImpl) elementImpl.getPreviousSibling();
+ if (lastNode != null) {
+ lastNode.setNextSibling(null);
+ } else {
+ OMElement parent = elementImpl.getParent();
+ if (parent == null) {
+ throw new OMException();
+ }
+ parent.setFirstChild(null);
+ lastNode = parent;
+ }
+ cache = true;
+ } catch (OMException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new OMException(e);
+ }
+ }
+
+ /**
+ * Method getText
+ *
+ * @return
+ * @throws OMException
+ */
+ public String getText() throws OMException {
+ return parser.getText();
+ }
+
+ /**
+ * Method getNamespace
+ *
+ * @return
+ * @throws OMException
+ */
+ public String getNamespace() throws OMException {
+ return parser.getNamespaceURI();
+ }
+
+ /**
+ * Method getNamespaceCount
+ *
+ * @return
+ * @throws OMException
+ */
+ public int getNamespaceCount() throws OMException {
+ try {
+ return parser.getNamespaceCount();
+ } catch (Exception e) {
+ throw new OMException(e);
+ }
+ }
+
+ /**
+ * Method getNamespacePrefix
+ *
+ * @param index
+ * @return
+ * @throws OMException
+ */
+ public String getNamespacePrefix(int index) throws OMException {
+ try {
+ return parser.getNamespacePrefix(index);
+ } catch (Exception e) {
+ throw new OMException(e);
+ }
+ }
+
+ /**
+ * Method getNamespaceUri
+ *
+ * @param index
+ * @return
+ * @throws OMException
+ */
+ public String getNamespaceUri(int index) throws OMException {
+ try {
+ return parser.getNamespaceURI(index);
+ } catch (Exception e) {
+ throw new OMException(e);
+ }
+ }
+
+ /**
+ * Method setCache
+ *
+ * @param b
+ */
+ public void setCache(boolean b) {
+ if (parserAccessed && b) {
+ throw new UnsupportedOperationException(
+ "parser accessed. cannot set cache");
+ }
+ cache = b;
+ }
+
+ /**
+ * Method getName
+ *
+ * @return
+ * @throws OMException
+ */
+ public String getName() throws OMException {
+ return parser.getLocalName();
+ }
+
+ /**
+ * Method getPrefix
+ *
+ * @return
+ * @throws OMException
+ */
+ public String getPrefix() throws OMException {
+ return parser.getPrefix();
+ }
+
+ /**
+ * Method getAttributeCount
+ *
+ * @return
+ * @throws OMException
+ */
+ public int getAttributeCount() throws OMException {
+ return parser.getAttributeCount();
+ }
+
+ /**
+ * Method getAttributeNamespace
+ *
+ * @param arg
+ * @return
+ * @throws OMException
+ */
+ public String getAttributeNamespace(int arg) throws OMException {
+ return parser.getAttributeNamespace(arg);
+ }
+
+ /**
+ * Method getAttributeName
+ *
+ * @param arg
+ * @return
+ * @throws OMException
+ */
+ public String getAttributeName(int arg) throws OMException {
+ return parser.getAttributeNamespace(arg);
+ }
+
+ /**
+ * Method getAttributePrefix
+ *
+ * @param arg
+ * @return
+ * @throws OMException
+ */
+ public String getAttributePrefix(int arg) throws OMException {
+ return parser.getAttributeNamespace(arg);
+ }
+
+ /**
+ * Method getParser
+ *
+ * @return
+ */
+ public Object getParser() {
+ if (!cache) {
+ parserAccessed = true;
+ return parser;
+ } else {
+ throw new UnsupportedOperationException(
+ "cache must be switched off to access the parser");
+ }
+ }
+
+ /**
+ * Method isCompleted
+ *
+ * @return
+ */
+ public boolean isCompleted() {
+ return done;
+ }
+
+ /**
+ * This method will be called with the XMLStreamConstants.START_ELEMENT event
+ *
+ * @return
+ * @throws OMException
+ */
+ protected abstract OMNode createOMElement() throws OMException;
+
+ /**
+ * This should proceed the parser one step further, if parser is not completed yet.
+ * If this has been called whist parser is done, then throw an OMException.
+ * If the cache is set to false, then should be return the event, *without* building the OM tree.
+ * If the cache is set to true, then this should handle all the events within this, and should build
+ * the object structure appropriately and return the event.
+ *
+ * @return
+ * @throws OMException
+ */
+ public abstract int next() throws OMException;
+
+ /**
+ * @return
+ */
+ public short getBuilderType() {
+ return OMConstants.PULL_TYPE_BUILDER;
+ }
+
+ /**
+ * Method registerExternalContentHandler
+ *
+ * @param obj
+ */
+ public void registerExternalContentHandler(Object obj) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Method getRegisteredContentHandler
+ *
+ * @return
+ */
+ public Object getRegisteredContentHandler() {
+ throw new UnsupportedOperationException();
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,322 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom.builder;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMComment;
+import org.apache.axis.om.OMPI;
+import org.apache.axis.om.OMDTD;
+//import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.impl.llom.OMDocument;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * This will construct an OM without using SOAP specific classes like SOAPEnvelope, SOAPHeader, SOAPHeaderBlock and SOAPBody.
+ * And this will habe the Document concept also.
+ */
+public class StAXOMBuilder extends StAXBuilder implements OMXMLParserWrapper {
+ /**
+ * Field document
+ */
+ protected OMDocument document;
+
+ /**
+ * Field omFactory
+ */
+ protected OMFactory omFactory;
+
+ /**
+ * Constructor StAXOMBuilder
+ *
+ * @param ombuilderFactory
+ * @param parser
+ */
+ public StAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {
+ super(ombuilderFactory, parser);
+ document = new OMDocument(this);
+ omfactory = OMFactory.newInstance();
+ }
+
+ /**
+ * Constructor StAXOMBuilder
+ *
+ * @param parser
+ */
+ public StAXOMBuilder(XMLStreamReader parser) {
+ super(parser);
+ document = new OMDocument(this);
+ omfactory = OMFactory.newInstance();
+ }
+
+ /**
+ * Method createOMElement
+ *
+ * @return
+ * @throws OMException
+ */
+ protected OMNode createOMElement() throws OMException {
+ OMElement node=null;
+ String elementName = parser.getLocalName();
+ if (!foundRootElement) {
+ node = omfactory.createOMElement(elementName, null, document, this);
+ document.setRootElement(node);
+ foundRootElement = true;
+ if (lastNode == null) {
+ document.setFirstChild(node);
+ }else if (lastNode.isComplete()) {
+ lastNode.setNextSibling(node);
+ node.setPreviousSibling(lastNode);
+ } else {
+ OMElement e = (OMElement) lastNode;
+ node = omfactory.createOMElement(elementName, null,
+ (OMElement) lastNode, this);
+ e.setFirstChild(node);
+ }
+ }else {
+ if (lastNode.isComplete()) {
+ node = omfactory.createOMElement(elementName, null,
+ lastNode.getParent(), this);
+ lastNode.setNextSibling(node);
+ node.setPreviousSibling(lastNode);
+ } else {
+ OMElement e = (OMElement) lastNode;
+ node = omfactory.createOMElement(elementName, null,
+ (OMElement) lastNode, this);
+ e.setFirstChild(node);
+ }
+ }
+
+ // create the namespaces
+ processNamespaceData(node, false);
+
+ // fill in the attributes
+ processAttributes(node);
+ return node;
+ }
+
+ public OMPI createOMPI() throws OMException{
+ String piTarget = parser.getPITarget();
+ String content = parser.getPIData();
+ OMPI omPI;
+ if(lastNode == null) {//meaning it is a document level comment
+
+
+ //...No more waiting I've done that
+ omPI = omfactory.createOMPI(document, piTarget, content);
+ omPI.setComplete(true);
+ //also here we should add this comment as a child of document element.
+ //But that functionality is missing in OMDocument class. So lets wait for it.
+ document.setFirstChild(omPI);
+ //return null; //The reason behind returning null is that the return value of this
+ //will be used to update lastNode variable. Actually for all the stuff
+ }
+ else {
+ //this is a PI inside some element
+ if (lastNode.isComplete()) {
+ omPI = omfactory.createOMPI(lastNode.getParent(), piTarget, content);
+ omPI.setComplete(true);
+ lastNode.setNextSibling((OMNode)omPI);
+ omPI.setPreviousSibling(lastNode);
+ } else {
+ OMElement e = (OMElement) lastNode;
+ omPI = omfactory.createOMPI(e, piTarget, content);
+ omPI.setComplete(true);
+ e.setFirstChild(omPI);
+ }
+ }
+ return omPI;
+ }
+
+ public OMComment createOMComment() throws OMException {
+ OMComment comment;
+ String content = parser.getText();
+ if(lastNode == null) {//meaning it is a document level comment and is the first child of document too
+ comment = omfactory.createOMComment(document,content);
+ comment.setComplete(true);
+ document.setFirstChild(comment);
+ //return null; //For all nodes outside of document element, lastNode should remain to be null. Hence returning null
+ }
+ else {
+ //this is a comment inside some element
+ if (lastNode.isComplete()) {
+ comment = omfactory.createOMComment(lastNode.getParent(), content);
+ comment.setComplete(true);
+ lastNode.setNextSibling(comment);
+ comment.setPreviousSibling(lastNode);
+ } else {
+ OMElement e = (OMElement) lastNode;
+ comment = omfactory.createOMComment(e, content);
+ comment.setComplete(true);
+ e.setFirstChild(comment);
+ }
+ }
+ return comment;
+ }
+
+ /**/
+ public OMDTD createOMDTD() throws OMException {
+ OMDTD dtd;
+ String content = parser.getText();
+ //By default only one DOCTYPE declaration can be present and it will be
+ //well outside of document element scope. so lastNode is null for this always
+ dtd = omfactory.createOMDTD(document, content);
+ dtd.setComplete(true);
+ if (lastNode == null)
+ document.setFirstChild(dtd);
+ else if (lastNode.isComplete()) {
+ lastNode.setNextSibling(dtd);
+ dtd.setPreviousSibling(lastNode);
+ }
+ else { //meaning dtd is being tried to be put inside as a child of some element
+ throw new OMException("DTD can't be a child of any element");
+ }
+ return dtd;
+ }
+ /**/
+
+ /**
+ * Method getOMEnvelope
+ *
+ * @return
+ * @throws OMException
+ */
+ public SOAPEnvelope getOMEnvelope() throws OMException {
+ throw new UnsupportedOperationException(); // TODO implement this
+ }
+
+ /**
+ * Method next
+ *
+ * @return
+ * @throws OMException
+ */
+ public int next() throws OMException {
+ try {
+ if (done) {
+ throw new OMException();
+ }
+ int token = parser.next();
+ if (!cache) {
+ return token;
+ }
+ switch (token) {
+ case XMLStreamConstants.START_ELEMENT:
+ lastNode = createOMElement();
+ break;
+ case XMLStreamConstants.START_DOCUMENT:
+ document = new OMDocument(this);
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ lastNode = createOMText();
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (lastNode.isComplete()) {
+ OMElement parent = lastNode.getParent();
+ parent.setComplete(true);
+ lastNode = parent;
+ } else {
+ OMElement e = (OMElement) lastNode;
+ e.setComplete(true);
+ }
+ break;
+ case XMLStreamConstants.DTD:
+ /*
+ System.out.println("DTD element encountered. Currently no support for DTD");
+ System.out.println("DTD text is: "+parser.getText());
+ next();
+ */
+ lastNode = createOMDTD();
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ /*
+ System.out.println("Processing Instruction element encountered. Currently no support for Processing Instruction");
+ System.out.println("PI text is: "+parser.getText());
+ next();
+ */
+ lastNode = createOMPI();
+ break;
+ case XMLStreamConstants.COMMENT:
+ /*
+ System.out.println("Comment element encountered. Currently no support for Comment");
+ System.out.println("Comment text is: "+parser.getText());
+ next();
+ */
+ lastNode = createOMComment();
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ done = true;
+ document.setComplete(true);
+ break;
+ case XMLStreamConstants.SPACE:
+ next();
+ break;
+ default :
+ throw new OMException();
+ }
+ return token;
+ } catch (OMException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new OMException(e);
+ }
+ }
+
+ /**
+ * Method getDocumentElement
+ *
+ * @return
+ */
+ public OMElement getDocumentElement() {
+ return document.getRootElement();
+ }
+
+ /**
+ * Method getDocument
+ *
+ * @return
+ */
+ public OMElement getDocument() {
+ return document;
+ }
+
+ /**
+ * Method processNamespaceData
+ *
+ * @param node
+ * @param isSOAPElement
+ */
+ protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
+ int namespaceCount = parser.getNamespaceCount();
+ for (int i = 0; i < namespaceCount; i++) {
+ node.declareNamespace(parser.getNamespaceURI(i),
+ parser.getNamespacePrefix(i));
+ }
+
+ // set the own namespace
+ OMNamespace namespace =
+ node.findInScopeNamespace(parser.getNamespaceURI(),
+ parser.getPrefix());
+ node.setNamespace(namespace);
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXSOAPModelBuilder.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXSOAPModelBuilder.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXSOAPModelBuilder.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,301 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom.builder;
+
+import org.apache.axis.om.*;
+import org.apache.axis.om.impl.llom.OMElementImpl;
+import org.apache.axis.om.impl.llom.SOAPEnvelopeImpl;
+import org.apache.axis.om.impl.llom.exception.OMBuilderException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Class StAXSOAPModelBuilder
+ */
+public class StAXSOAPModelBuilder extends StAXBuilder {
+ /**
+ * Field envelope
+ */
+ private SOAPEnvelopeImpl envelope;
+
+ /**
+ * Field headerPresent
+ */
+ private boolean headerPresent = false;
+
+ /**
+ * Field bodyPresent
+ */
+ private boolean bodyPresent = false;
+
+ /**
+ * Field log
+ */
+ private Log log = LogFactory.getLog(getClass());
+
+ /**
+ * element level 1 = envelope level element level 2 = Header or Body level
+ * element level 3 = HeaderElement or BodyElement level
+ */
+ private int elementLevel = 0;
+
+ /**
+ * Constructor StAXSOAPModelBuilder
+ *
+ * @param ombuilderFactory
+ * @param parser
+ */
+ public StAXSOAPModelBuilder(OMFactory ombuilderFactory,
+ XMLStreamReader parser) {
+ super(ombuilderFactory, parser);
+ }
+
+ /**
+ * Constructor StAXSOAPModelBuilder
+ *
+ * @param parser
+ */
+ public StAXSOAPModelBuilder(XMLStreamReader parser) {
+ super(parser);
+ }
+
+ /**
+ * Method getSOAPEnvelope
+ *
+ * @return
+ * @throws OMException
+ */
+ public SOAPEnvelope getSOAPEnvelope() throws OMException {
+ while ((envelope == null) && !done) {
+ next();
+ }
+ return envelope;
+ }
+
+ /**
+ * Method createOMElement
+ *
+ * @return
+ * @throws OMException
+ */
+ protected OMNode createOMElement() throws OMException {
+ OMElement node;
+ String elementName = parser.getLocalName();
+ if (lastNode == null) {
+ node = constructNode(null, elementName, true);
+ } else if (lastNode.isComplete()) {
+ node = constructNode(lastNode.getParent(), elementName, false);
+ lastNode.setNextSibling(node);
+ node.setPreviousSibling(lastNode);
+ } else {
+ OMElement e = (OMElement) lastNode;
+ node = constructNode((OMElement) lastNode, elementName, false);
+ e.setFirstChild(node);
+ }
+
+ // fill in the attributes
+ processAttributes(node);
+ log.info("Build the OMElelment {" + node.getNamespaceName() + '}'
+ + node.getLocalName() + "By the StaxSOAPModelBuilder");
+ return node;
+ }
+
+ /**
+ * Method constructNode
+ *
+ * @param parent
+ * @param elementName
+ * @param isEnvelope
+ * @return
+ */
+ private OMElement constructNode(OMElement parent, String elementName,
+ boolean isEnvelope) {
+ OMElement element = null;
+ if (parent == null) {
+ if (!elementName.equalsIgnoreCase(OMConstants.SOAPENVELOPE_LOCAL_NAME)) {
+ throw new OMException("First Element must contain the local name, "
+ + OMConstants.SOAPENVELOPE_LOCAL_NAME);
+ }
+ envelope =
+ (SOAPEnvelopeImpl) ombuilderFactory.createSOAPEnvelope(null,
+ this);
+ element = (OMElementImpl) envelope;
+ processNamespaceData(element, true);
+ } else if (elementLevel == 2) {
+
+ // this is either a header or a body
+ if (elementName.equals(OMConstants.HEADER_LOCAL_NAME)) {
+ if (headerPresent) {
+ throw new OMBuilderException("Multiple headers encountered!");
+ }
+ if (bodyPresent) {
+ throw new OMBuilderException("Header Body wrong order!");
+ }
+ headerPresent = true;
+ element =
+ ombuilderFactory.createSOAPHeader((SOAPEnvelope) parent,
+ this);
+
+ // envelope.setHeader((SOAPHeader)element);
+ processNamespaceData(element, true);
+ } else if (elementName.equals(OMConstants.BODY_LOCAL_NAME)) {
+ if (bodyPresent) {
+ throw new OMBuilderException("Multiple body elements encountered");
+ }
+ bodyPresent = true;
+ element =
+ ombuilderFactory.createSOAPBody((SOAPEnvelope) parent,
+ this);
+
+ // envelope.setBody((SOAPBody)element);
+ processNamespaceData(element, true);
+ } else {
+ throw new OMBuilderException(elementName
+ + " is not supported here. Envelope can not have elements other than Header and Body.");
+ }
+ } else if ((elementLevel == 3)
+ && parent.getLocalName().equalsIgnoreCase(OMConstants.HEADER_LOCAL_NAME)) {
+
+ // this is a headerblock
+ element = ombuilderFactory.createSOAPHeaderBlock(elementName, null,
+ parent, this);
+ processNamespaceData(element, false);
+ } else if ((elementLevel == 3) && parent.getLocalName().equalsIgnoreCase(OMConstants.BODY_LOCAL_NAME) && elementName.equalsIgnoreCase(OMConstants.BODY_FAULT_LOCAL_NAME)) {
+
+ // this is a headerblock
+ element = ombuilderFactory.createSOAPFault(null, (SOAPBody) parent,
+ this);
+ processNamespaceData(element, false);
+ } else {
+
+ // this is neither of above. Just create an element
+ element = ombuilderFactory.createOMElement(elementName, null,
+ parent, this);
+ processNamespaceData(element, false);
+ }
+ return element;
+ }
+
+ /**
+ * Method next
+ *
+ * @return
+ * @throws OMException
+ */
+ public int next() throws OMException {
+ try {
+ if (done) {
+ throw new OMException();
+ }
+ int token = parser.next();
+ if (!cache) {
+ return token;
+ }
+ switch (token) {
+ case XMLStreamConstants.START_ELEMENT:
+ elementLevel++;
+ lastNode = createOMElement();
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ lastNode = createOMText();
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (lastNode.isComplete()) {
+ OMElement parent = lastNode.getParent();
+ parent.setComplete(true);
+ lastNode = parent;
+ } else {
+ OMElement e = (OMElement) lastNode;
+ e.setComplete(true);
+ }
+ elementLevel--;
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ done = true;
+ break;
+ case XMLStreamConstants.SPACE:
+ next();
+ break;
+ default :
+ throw new OMException();
+ }
+ return token;
+ } catch (OMException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new OMException(e);
+ }
+ }
+
+ /**
+ * Method getDocumentElement
+ *
+ * @return
+ */
+ public OMElement getDocumentElement() {
+ return getSOAPEnvelope();
+ }
+
+ /**
+ * Method processNamespaceData
+ *
+ * @param node
+ * @param isSOAPElement
+ */
+ protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
+ int namespaceCount = parser.getNamespaceCount();
+ for (int i = 0; i < namespaceCount; i++) {
+ node.declareNamespace(parser.getNamespaceURI(i),
+ parser.getNamespacePrefix(i));
+ }
+
+ // set the own namespace
+ String namespaceURI = parser.getNamespaceURI();
+ String prefix = parser.getPrefix();
+ OMNamespace namespace = null;
+ if (!"".equals(namespaceURI)) {
+ if (prefix == null) {
+ // this means, this elements has a default namespace or it has inherited a default namespace from its parent
+ namespace = node.findDeclaredNamespace(namespaceURI, "");
+ if (namespace == null) {
+ namespace = node.declareNamespace(namespaceURI, "");
+ }
+ } else {
+ namespace = node.findInScopeNamespace(namespaceURI, prefix);
+ }
+ node.setNamespace(namespace);
+ } else {
+
+ }
+
+
+
+ // TODO we got to have this to make sure OM reject mesagess that are not sname space qualified
+ // But got to comment this to interop with Axis.1.x
+ // if (namespace == null) {
+ // throw new OMException("All elements must be namespace qualified!");
+ // }
+ if (isSOAPElement) {
+ if (node.getNamespace() != null && !node.getNamespace().getName().equals(OMConstants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+ throw new OMBuilderException("invalid SOAP namespace URI");
+ }
+ }
+
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/OMBuilderException.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/OMBuilderException.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/OMBuilderException.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/OMBuilderException.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom.exception;
+
+import org.apache.axis.om.OMException;
+
+/**
+ * Class OMBuilderException
+ */
+public class OMBuilderException extends OMException {
+ /**
+ * Constructor OMBuilderException
+ *
+ * @param s
+ */
+ public OMBuilderException(String s) {
+ super(s);
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/OMStreamingException.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/OMStreamingException.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/OMStreamingException.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/OMStreamingException.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+package org.apache.axis.om.impl.llom.exception;
+
+import org.apache.axis.om.OMException;
+
+/**
+ * Class OMStreamingException
+ */
+public class OMStreamingException extends OMException {
+ /**
+ * Constructor OMStreamingException
+ */
+ public OMStreamingException() {
+ }
+
+ /**
+ * Constructor OMStreamingException
+ *
+ * @param message
+ */
+ public OMStreamingException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor OMStreamingException
+ *
+ * @param message
+ * @param cause
+ */
+ public OMStreamingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructor OMStreamingException
+ *
+ * @param cause
+ */
+ public OMStreamingException(Throwable cause) {
+ super(cause);
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/XMLComparisonException.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/XMLComparisonException.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/XMLComparisonException.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/XMLComparisonException.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,35 @@
+package org.apache.axis.om.impl.llom.exception;
+
+/**
+ * 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/>
+ */
+public class XMLComparisonException extends Exception {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ public XMLComparisonException(String message) {
+ super(message);
+ }
+
+ public XMLComparisonException(Throwable cause) {
+ super(cause);
+ }
+
+ public XMLComparisonException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}