You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2006/07/17 03:41:47 UTC
svn commit: r422595 - in
/xerces/java/branches/stax-dev/src/org/apache/xerces/stax:
DOMXMLStreamReaderImpl.java EmptyLocation.java
Author: mrglavas
Date: Sun Jul 16 18:41:46 2006
New Revision: 422595
URL: http://svn.apache.org/viewvc?rev=422595&view=rev
Log:
JIRA Issue #1171
http://issues.apache.org/jira/browse/XERCESJ-1171
Merging in updates to the DOM XMLStreamReader from Hua Lei.
Renamed DOMLocation to EmptyLocation to give it a more descriptive name.
Added:
xerces/java/branches/stax-dev/src/org/apache/xerces/stax/EmptyLocation.java (with props)
Modified:
xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java
Modified: xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java?rev=422595&r1=422594&r2=422595&view=diff
==============================================================================
--- xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java (original)
+++ xerces/java/branches/stax-dev/src/org/apache/xerces/stax/DOMXMLStreamReaderImpl.java Sun Jul 16 18:41:46 2006
@@ -54,13 +54,13 @@
private Node domNode;
// The following are four XML declaration features
- private String xmlVersion;
+ private String xmlVersion = "1.0";
- private boolean xmlStandalone;
+ private boolean xmlStandalone = false;
- private String xmlEncoding;
+ private String xmlEncoding = "UTF-8";
- private String inputEncoding;
+ private String inputEncoding = "UTF-8";
// Record the cursor's position
private Node curNode;
@@ -90,7 +90,7 @@
* @param domNode
* @param xif
*/
- public DOMXMLStreamReaderImpl(Node domNode, XMLInputFactory xif){
+ public DOMXMLStreamReaderImpl(Node domNode, XMLInputFactory xif) {
this.domNode = domNode;
this.xif = xif;
this.curNode = domNode;
@@ -134,7 +134,7 @@
* @return The value of the property
* @throws IllegalArgumentException if name is null
*/
- public Object getProperty(java.lang.String name) throws java.lang.IllegalArgumentException{
+ public Object getProperty(java.lang.String name) throws java.lang.IllegalArgumentException {
if (name == null)
throw new IllegalArgumentException("The feature name should not be null");
return xif.getProperty(name);
@@ -149,7 +149,7 @@
* @return true if there are more events, false otherwise
* @throws XMLStreamException if there is a fatal error detecting the next state
*/
- public boolean hasNext() throws XMLStreamException{
+ public boolean hasNext() throws XMLStreamException {
if (curType == XMLStreamConstants.END_DOCUMENT) return false;
return true;
}
@@ -1054,7 +1054,7 @@
* called.
*/
public Location getLocation() {
- return null;
+ return EmptyLocation.getInstance();
}
/**
Added: xerces/java/branches/stax-dev/src/org/apache/xerces/stax/EmptyLocation.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/stax-dev/src/org/apache/xerces/stax/EmptyLocation.java?rev=422595&view=auto
==============================================================================
--- xerces/java/branches/stax-dev/src/org/apache/xerces/stax/EmptyLocation.java (added)
+++ xerces/java/branches/stax-dev/src/org/apache/xerces/stax/EmptyLocation.java Sun Jul 16 18:41:46 2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006 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.xerces.stax;
+
+import javax.xml.stream.Location;
+
+/**
+ * <p>Location which always returns <code>-1</code>
+ * and <code>null</code> from its methods.</p>
+ *
+ * @version $Id$
+ */
+public final class EmptyLocation implements Location {
+
+ /**
+ * Singleton instance.
+ */
+ private static final EmptyLocation EMPTY_LOCATION_INSTANCE
+ = new EmptyLocation();
+
+ private EmptyLocation() {}
+
+ /** Returns the one and only instance of this class. */
+ public static EmptyLocation getInstance() {
+ return EMPTY_LOCATION_INSTANCE;
+ }
+
+ /**
+ * Return the line number where the current event ends,
+ * returns -1 if none is available.
+ * @return the current line number
+ */
+ public int getLineNumber() {
+ return -1;
+ }
+
+ /**
+ * Return the column number where the current event ends,
+ * returns -1 if none is available.
+ * @return the current column number
+ */
+ public int getColumnNumber() {
+ return -1;
+ }
+
+ /**
+ * Return the byte or character offset into the input source this location
+ * is pointing to. If the input source is a file or a byte stream then
+ * this is the byte offset into that stream, but if the input source is
+ * a character media then the offset is the character offset.
+ * Returns -1 if there is no offset available.
+ * @return the current offset
+ */
+ public int getCharacterOffset() {
+ return -1;
+ }
+
+ /**
+ * Returns the public ID of the XML
+ * @return the public ID, or null if not available
+ */
+ public String getPublicId() {
+ return null;
+ }
+
+ /**
+ * Returns the system ID of the XML
+ * @return the system ID, or null if not available
+ */
+ public String getSystemId() {
+ return null;
+ }
+}
Propchange: xerces/java/branches/stax-dev/src/org/apache/xerces/stax/EmptyLocation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/stax-dev/src/org/apache/xerces/stax/EmptyLocation.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org