You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by he...@apache.org on 2004/09/24 12:35:58 UTC
svn commit: rev 47146 - in webservices/axis/trunk/java/dev/scratch/priyanga: . StAX-T StAX-T/src StAX-T/src/org StAX-T/src/org/apache StAX-T/src/org/apache/axis StAX-T/src/org/apache/axis/xml
Author: hemapani
Date: Fri Sep 24 03:35:56 2004
New Revision: 47146
Added:
webservices/axis/trunk/java/dev/scratch/priyanga/
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/ContentComparable.java
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamException.java
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamReader.java
webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamWriter.java
Log:
checking in the praposal for the Streaming API that OM is going to have on behalf of Priyanga
Added: webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/ContentComparable.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/ContentComparable.java Fri Sep 24 03:35:56 2004
@@ -0,0 +1,86 @@
+/*
+ * TODO: Put the licence text
+ *
+ *
+ */
+package org.apache.axis.xml;
+
+/**
+ *
+ * This interface provides a set of methods to compare the properties of the
+ * elements, while parsing a xml document in pull pasion. Then the user
+ * doesn't have to create unneccessary String objects for comparison purpose.
+ * <br><br>
+ * This methods can be used to improve the performance of the applications
+ * that uses the parsers which truely implement this.
+ *
+ * @author Rajith Priyanga (rpriyanga@yahoo.com)
+ * @date Sep 20, 2004
+ *
+ */
+public interface ContentComparable {
+
+ /**
+ * Compares the given local name with the local name of the current
+ * element. If it doesn't match or the current element is not a starting
+ * or ending tag, this returns false. Otherwise true.
+ * @param localName
+ * @return
+ */
+ public boolean isLocalNameEqualTo(String localName);
+
+ /**
+ * Compares the given string with namespace prefix of the current element.
+ * If it doesn't match or the current element is not a starting
+ * or ending tag, this returns false. Otherwise true.
+ * @param namespacePrefix
+ * @return
+ */
+ public boolean isNamespacePrefixEqualTo(String namespacePrefix);
+
+
+ /**
+ * Compares the given string with the namespace of the current element.
+ * @param namespace The string to be compared.
+ * @return true if the given string is equal to the namespace. If the
+ * element type is not applicable for this operation or if they are not
+ * equal, this returns false.
+ */
+ public boolean isNamespaceEqualTo(String namespace);
+
+
+ /**
+ * If the element is a starting or ending tag and the namespace and local name
+ * mathces with the given ones, this returns true. Otherwise false.
+ * @param namespace
+ * @param localName
+ * @return
+ */
+ public boolean isNameEqualTo(String namespace, String localName);
+
+
+ /**
+ * If the current element is a starting tag, it returns true if the attribute
+ * with the given namespace and local name, is found in the attribute list.
+ * Otherwise false.
+ * @param namespace If null, only the local name is compared.
+ * @param localName
+ * @return
+ */
+ public boolean isAttributeAvailable(String namespace, String localName);
+
+
+
+ /**
+ * returns true only when all of the following are true. else false.
+ * 1. Current element is a starting tag.
+ * 2. The attribute with given namespace and local name is available.
+ * 3. The value of the attribute is equal to the given value
+ * @param namespace If null, only the local name is compared.
+ * @param localName
+ * @param value
+ * @return
+ */
+ public boolean isAttributeValueEqualTo(String namespace, String localName, String value);
+
+}
Added: webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamException.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamException.java Fri Sep 24 03:35:56 2004
@@ -0,0 +1,50 @@
+/*
+ * TODO: Put the licence text
+ *
+ *
+ */
+package org.apache.axis.xml;
+
+import javax.xml.stream.XMLStreamException;
+
+/**
+ * @author Rajith Priyanga
+ * @date Sep 20, 2004
+ *
+ */
+public class TypedXMLStreamException extends XMLStreamException {
+
+ /**
+ *
+ */
+ public TypedXMLStreamException() {
+ super();
+ // TODO
+ }
+
+ /**
+ * @param msg
+ */
+ public TypedXMLStreamException(String msg) {
+ super(msg);
+ // TODO
+ }
+
+ /**
+ * @param cause
+ */
+ public TypedXMLStreamException(Throwable cause) {
+ super(cause);
+ // TODO
+ }
+
+ /**
+ * @param msg
+ * @param cause
+ */
+ public TypedXMLStreamException(String msg, Throwable cause) {
+ super(msg, cause);
+ // TODO
+ }
+
+}
Added: webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamReader.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamReader.java Fri Sep 24 03:35:56 2004
@@ -0,0 +1,78 @@
+/*
+ * TODO: Put the licence text
+ *
+ *
+ */
+package org.apache.axis.xml;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * This interface allows the applications to read the xml content as the
+ * required java typed values, without creating unnecessary intermediary
+ * String objects which persist in memory. Therefore a true implementation
+ * of this interface can be used to optimize performance of the application.
+ *
+ *
+ * @author Rajith Priyanga
+ * @date Sep 20, 2004
+ *
+ */
+public interface TypedXMLStreamReader extends ContentComparable, javax.xml.stream.XMLStreamReader {
+
+ /**
+ * If the reader is at a Start Tag of a text only element, reads the
+ * next text as a requested xsd typed value and returns the appropriate java
+ * typed value. If the reader is at a Text, reads it as a requested
+ * xsd typed value and returns the appropriate java typed value.
+ *
+ * @return The element value in the requested type
+ * @throws TypedXMLStreamException If the current is invalid for this operation or
+ * if the value is not in the correct canonical form of the requested xsd type,
+ * thorws a TypedXMLStreamException..
+ */
+ public boolean readElementAsXSDBoolean() throws TypedXMLStreamException;
+ public byte readElementAsXSDByte() throws TypedXMLStreamException;
+ public short readElementAsXSDShort() throws TypedXMLStreamException;
+ public int readElementAsXSDInt() throws TypedXMLStreamException;
+ public long readElementAsXSDLong() throws TypedXMLStreamException;
+ public float readElementAsXSDFloat() throws TypedXMLStreamException;
+ public double readElementAsXSDDouble() throws TypedXMLStreamException;
+ public byte[] readElementAsXSDBase64() throws TypedXMLStreamException;
+ public BigInteger readElementAsXSDInteger() throws TypedXMLStreamException;
+ public BigDecimal readElementAsXSDDecimal() throws TypedXMLStreamException;
+ public URI readElementAsXSDAnyURI() throws TypedXMLStreamException;
+ public QName readElementAsXSDQName() throws TypedXMLStreamException;
+ public String readElementAsXSDString(boolean normalize, boolean replaceEntityRefs) throws TypedXMLStreamException;
+
+ /**
+ * If the reader is at a Start Tag, reads the given attribute as a requested
+ * xsd typed value and returns the appropriate java typed value.
+ *
+ * @param namespace If null only the local name is compared.
+ * @param localName
+ * @return The attribute value
+ * @throws TypedXMLStreamException If the current event is not a Start Tag
+ * or if the given attribute is not available or it is not in the
+ * correct canonical form of the requested xsd type, thorws a TypedXMLStreamException.
+ */
+ public boolean readAttributeAsXSDBoolean(String namespace, String localName) throws TypedXMLStreamException;
+ public byte readAttributeAsXSDByte(String namespace, String localName) throws TypedXMLStreamException;
+ public short readAttributeAsXSDShort(String namespace, String localName) throws TypedXMLStreamException;
+ public int readAttributeAsXSDInt(String namespace, String localName) throws TypedXMLStreamException;
+ public long readAttributeAsXSDLong(String namespace, String localName) throws TypedXMLStreamException;
+ public float readAttributeAsXSDFloat(String namespace, String localName) throws TypedXMLStreamException;
+ public double readAttributeAsXSDDouble(String namespace, String localName) throws TypedXMLStreamException;
+ public byte[] readAttributeAsXSDBase64(String namespace, String localName) throws TypedXMLStreamException;
+ public BigInteger readAttributeAsXSDInteger(String namespace, String localName) throws TypedXMLStreamException;
+ public BigDecimal readAttributeAsXSDDecimal(String namespace, String localName) throws TypedXMLStreamException;
+ public URI readAttributeAsXSDAnyURI(String namespace, String localName) throws TypedXMLStreamException;
+ public QName readAttributeAsXSDQName(String namespace, String localName) throws TypedXMLStreamException;
+ public String readAttributeAsXSDString(String namespace, String localName, boolean normalize, boolean replaceEntityRefs) throws TypedXMLStreamException;
+
+}
Added: webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamWriter.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/priyanga/StAX-T/src/org/apache/axis/xml/TypedXMLStreamWriter.java Fri Sep 24 03:35:56 2004
@@ -0,0 +1,351 @@
+/*
+ * TODO: Put the licence text
+ *
+ *
+ */
+package org.apache.axis.xml;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+
+/**
+ * This interface provides mthods to serialize Java Typed values
+ * easily to a xml document in appropriate xsd canonical formats.
+ *
+ * A serializer which truely implement this interface can be used to
+ * improve the performance of an application.
+ *
+ * @author Rajith Priyanga
+ * @date Sep 23, 2004
+ *
+ */
+
+public interface TypedXMLStreamWriter extends javax.xml.stream.XMLStreamWriter {
+
+ /**
+ * Writes the given boolean value in the xsd:boolean canonical form
+ */
+ public void writeCharacters(boolean value) throws XMLStreamException;
+
+ /**
+ * Writes the given byte value in the xsd:byte canonical form
+ */
+ public void writeCharacters(byte value) throws XMLStreamException;
+
+ /**
+ * Writes the given short value in the xsd:short canonical form
+ */
+ public void writeCharacters(short value) throws XMLStreamException;
+
+ /**
+ * Writes the given int value in the xsd:int canonical form
+ */
+ public void writeCharacters(int value) throws XMLStreamException;
+
+ /**
+ * Writes the given long value in the xsd:long canonical form
+ */
+ public void writeCharacters(long value) throws XMLStreamException;
+
+ /**
+ * Writes the given float value in the xsd:float canonical form
+ */
+ public void writeCharacters(float value) throws XMLStreamException;
+
+ /**
+ * Writes the given double value in the xsd:double canonical form
+ */
+ public void writeCharacters(double value) throws XMLStreamException;
+
+ /**
+ * Writes the given bytes array in the xsd:Base64 canonical form
+ */
+ public void writeCharacters(byte[] value) throws XMLStreamException;
+
+ /**
+ * Writes the value of the given BigInteger object in the xsd:Integer canonical form
+ */
+ public void writeCharacters(BigInteger value) throws XMLStreamException;
+
+ /**
+ * Writes the value of the given BugDecimal object in the xsd:Decimal canonical form
+ */
+ public void writeCharacters(BigDecimal value) throws XMLStreamException;
+
+ /**
+ * Writes the given URI in the xsd:AnyURI canonical form
+ */
+ public void writeCharacters(URI value) throws XMLStreamException;
+
+ /**
+ * Writes the given QName in the xsd:QName canonical form
+ */
+ public void writeCharacters(QName value) throws XMLStreamException;
+
+
+
+
+ /**
+ * Writes the given boolean value in the xsd:boolean canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, boolean value) throws XMLStreamException;
+
+ /**
+ * Writes the given byte value in the xsd:byte canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, byte value) throws XMLStreamException;
+
+ /**
+ * Writes the given short value in the xsd:short canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, short value) throws XMLStreamException;
+
+ /**
+ * Writes the given int value in the xsd:int canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, int value) throws XMLStreamException;
+
+ /**
+ * Writes the given long value in the xsd:long canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, long value) throws XMLStreamException;
+
+
+ /**
+ * Writes the given float value in the xsd:float canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, float value) throws XMLStreamException;
+
+ /**
+ * Writes the given double value in the xsd:double canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, double value) throws XMLStreamException;
+
+ /**
+ * Writes the given byte array in the xsd:Base64 canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, byte[] value) throws XMLStreamException;
+
+
+ /**
+ * Writes the given BigInteger in the xsd:Integer canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, BigInteger value) throws XMLStreamException;
+
+
+ /**
+ * Writes the given BigDecimal in the xsd:Decimal canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, BigDecimal value) throws XMLStreamException;
+
+ /**
+ * Writes the given URI in the xsd:AnyURI canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, URI value) throws XMLStreamException;
+
+ /**
+ * Writes the given QName in the xsd:QName canonical form as
+ * an attribute.
+ *
+ * @param prefix The namespace prefix of the attribute.
+ * If null the prefix which the given namespace is already bound is taken.
+ *
+ * @param namespace The namespace of the attribute.
+ *
+ * If prefix==null and namespace==null, no prefix will be written
+ * If prefix!=null and namespace==null, given prefix will be written
+ * If prefix==null and namespace!=null, The prefix which the namespcae already bound will be written
+ * If prefix!=null and namespace!=null, given prefix will be written and xmlns:prefix = "namespace" will also be written.
+ *
+ * @param localName The local name of the atribute. It can't be null.
+ * @param value The value of the attribute.
+ *
+ * @throws XMLStreamException
+ */
+ public void writeAttribute(String prefix, String namespace, String localName, QName value) throws XMLStreamException;
+
+
+
+
+}