Skip to content

Commit

Permalink
Fix usage of XMLStreamConstants, and some javadoc typos
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfl committed Mar 16, 2012
1 parent b3d4831 commit 7c4f97a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions core/src/java/org/jdom2/input/StAXEventBuilder.java
Expand Up @@ -79,15 +79,15 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
/**
* Builds a JDOM Document from a StAX-based XMLEventReader.
* <p>
* XMLStreamReaders are pre-configured and as a result JDOM is not able to
* alter whether the input is validated, or whether the Stream has escaped
* XMLSeventReaders are pre-configured and as a result JDOM is not able to
* alter whether the input is validated, or whether the Events have escaped
* entities or not. These (and other) characteristics are configurable by
* setting the correct features and properties on the XMLInputFactory when it
* is used to create the XMLStreamReader.
* <p>
* Useful configuration to set, or know about is:
* <ul>
* <li>StAX streams seldom differentiate between Text and CDATA content. You
* <li>StAX Events seldom differentiate between Text and CDATA content. You
* will likely want to configure your StAX factory (XMLInputFactory) with
* <code>http://java.sun.com/xml/stream/properties/report-cdata-event</code>
* for the default Java StAX implementation, or the equivalent property for your
Expand All @@ -109,7 +109,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* @author Rolf Lear
*
*/
public class StAXEventBuilder implements XMLStreamConstants {
public class StAXEventBuilder {


/**
Expand Down
17 changes: 9 additions & 8 deletions core/src/java/org/jdom2/input/StAXStreamBuilder.java
Expand Up @@ -54,11 +54,12 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

package org.jdom2.input;

import static javax.xml.stream.XMLStreamConstants.*;

import java.util.ArrayList;
import java.util.List;

import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

Expand All @@ -74,7 +75,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
import org.jdom2.input.stax.StAXFilter;

/**
* Builds a JDOM Document from a StAX-based XMLStremReader.
* Builds a JDOM Document from a StAX-based XMLStreamReader.
* <p>
* XMLStreamReaders are pre-configured and as a result JDOM is not able to
* alter whether the input is validated, or whether the Stream has escaped
Expand Down Expand Up @@ -106,7 +107,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* @author Rolf Lear
*
*/
public class StAXStreamBuilder implements XMLStreamConstants {
public class StAXStreamBuilder {

/**
* Create a Document from an XMLStreamReader
Expand All @@ -122,14 +123,14 @@ private static final Document process(final JDOMFactory factory,

int state = stream.getEventType();

if (XMLStreamConstants.START_DOCUMENT != state) {
if (START_DOCUMENT != state) {
throw new JDOMException("JDOM requires that XMLStreamReaders " +
"are at their beginning when being processed.");
}

final Document document = factory.document(null);

while (state != XMLStreamConstants.END_DOCUMENT) {
while (state != END_DOCUMENT) {
switch (state) {

case START_DOCUMENT:
Expand Down Expand Up @@ -193,7 +194,7 @@ private List<Content> processFragments(JDOMFactory factory, XMLStreamReader stre

int state = stream.getEventType();

if (XMLStreamConstants.START_DOCUMENT != state) {
if (START_DOCUMENT != state) {
throw new JDOMException("JDOM requires that XMLStreamReaders " +
"are at their beginning when being processed.");
}
Expand Down Expand Up @@ -286,7 +287,7 @@ private static final Element processPrunableElement(final JDOMFactory factory,
final XMLStreamReader reader, final int topdepth, StAXFilter filter)
throws XMLStreamException, JDOMException {

if (XMLStreamConstants.START_ELEMENT != reader.getEventType()) {
if (START_ELEMENT != reader.getEventType()) {
throw new JDOMException("JDOM requires that the XMLStreamReader " +
"is at the START_ELEMENT state when retrieving an " +
"Element Fragment.");
Expand Down Expand Up @@ -438,7 +439,7 @@ private static final Content processFragment(final JDOMFactory factory,
private static final Element processElementFragment(final JDOMFactory factory,
final XMLStreamReader reader) throws XMLStreamException, JDOMException {

if (XMLStreamConstants.START_ELEMENT != reader.getEventType()) {
if (START_ELEMENT != reader.getEventType()) {
throw new JDOMException("JDOM requires that the XMLStreamReader " +
"is at the START_ELEMENT state when retrieving an " +
"Element Fragment.");
Expand Down

0 comments on commit 7c4f97a

Please sign in to comment.