Author: jboynes
Date: Thu Mar 30 11:52:21 2006
New Revision: 390229
URL: http://svn.apache.org/viewcvs?rev=390229&view=rev
Log:
add API as suggested by Raymond Feng for retrieving a reader
I changed the method name to match XMLInputFactory
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java?rev=390229&r1=390228&r2=390229&view=diff
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
(original)
+++
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
Thu Mar 30 11:52:21 2006
@@ -38,7 +38,7 @@
* @throws XMLStreamException if there was a problem reading the stream
* @throws IllegalStateException if the reader is not positioned on a
START_DOCUMENT event
*/
- public XMLDocument load(XMLStreamReader reader) throws XMLStreamException,
IllegalStateException;
+ XMLDocument load(XMLStreamReader reader) throws XMLStreamException,
IllegalStateException;
/**
* Save a XMLDocument to an XML stream.
@@ -47,7 +47,16 @@
* @param writer the stream to write to
* @throws XMLStreamException if there was a problem writing to the stream
*/
- public void save(XMLDocument document, XMLStreamWriter writer) throws
XMLStreamException;
+ void save(XMLDocument document, XMLStreamWriter writer) throws
XMLStreamException;
+
+ /**
+ * Creates and returns a XMLStreamReader that can be used to read an
XMLDocument as a XML event stream.
+ * The reader will be positioned on a START_DOCUMENT event.
+ *
+ * @param document the XMLDocument to be read
+ * @return an XMLStreamReader that can be used to read the document
+ */
+ XMLStreamReader createXMLStreamReader(XMLDocument document) throws
XMLStreamException;
/**
* Create a DataObject from an element in a XML stream.
@@ -58,7 +67,7 @@
* @throws XMLStreamException if there was a problem reading the stream
* @throws IllegalStateException if the reader is not positioned on a
START_ELEMENT event
*/
- public DataObject loadObject(XMLStreamReader reader) throws
XMLStreamException, IllegalStateException;
+ DataObject loadObject(XMLStreamReader reader) throws XMLStreamException,
IllegalStateException;
/**
* Save a DataObject to an XML stream.
@@ -67,5 +76,14 @@
* @param writer the stream to write to
* @throws XMLStreamException if there was a problem writing to the stream
*/
- public void saveObject(DataObject sdo, XMLStreamWriter writer) throws
XMLStreamException;
+ void saveObject(DataObject sdo, XMLStreamWriter writer) throws
XMLStreamException;
+
+ /**
+ * Creates and returns a XMLStreamReader that can be used to read a
DataObject as a XML event stream.
+ * The reader will be positioned on a START_ELEMENT event.
+ *
+ * @param sdo the DataObject to be read
+ * @return an XMLStreamReader that can be used to read the DataObject
+ */
+ XMLStreamReader createXMLStreamReader(DataObject sdo);
}
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java?rev=390229&r1=390228&r2=390229&view=diff
==============================================================================
---
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
(original)
+++
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
Thu Mar 30 11:52:21 2006
@@ -37,11 +37,19 @@
throw new UnsupportedOperationException();
}
+ public XMLStreamReader createXMLStreamReader(XMLDocument document) throws
XMLStreamException {
+ throw new UnsupportedOperationException();
+ }
+
public DataObject loadObject(XMLStreamReader reader) throws
XMLStreamException, IllegalStateException {
throw new UnsupportedOperationException();
}
public void saveObject(DataObject sdo, XMLStreamWriter writer) throws
XMLStreamException {
+ throw new UnsupportedOperationException();
+ }
+
+ public XMLStreamReader createXMLStreamReader(DataObject sdo) {
throw new UnsupportedOperationException();
}
}