Raymond Feng wrote:
> Hi,
> 
> Should we allow the XMLStreamReader to be at START_DOCUMENT position for
> the following method? In this case, the root DataObject will be returned.
> 
> /**
> * Create a DataObject from an element in a XML stream.
> * The reader must be positioned on a START_ELEMENT event.
> *
> * @param reader the stream to read
> * @return a DataObject created from the element in the stream
> * @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;
> 

The XMLDocument API is there to provide the user with access to the
information they would not be able to get otherwise. That would be lost
if we did that here.

It's trival (reader.nextTag()) for a user to get to the root element so
I would prefer to keep the contract simple here.

--
Jeremy

Reply via email to