You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@apache.org on 2001/05/10 20:11:16 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/dom DeferredElementNSImpl.java DeferredAttrNSImpl.java
lehors 01/05/10 11:11:15
Modified: java/src/org/apache/xerces/parsers DOMParser.java
java/src/org/apache/xerces/dom DeferredElementNSImpl.java
DeferredAttrNSImpl.java
Log:
our parser now uses accross the board an empty string on elements
and attributes with no namepace, the DOM still needs to return null though,
this fixes this. - bug #1164
Revision Changes Path
1.49 +17 -6 xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java
Index: DOMParser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/DOMParser.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- DOMParser.java 2001/05/10 15:51:24 1.48
+++ DOMParser.java 2001/05/10 18:11:02 1.49
@@ -109,7 +109,7 @@
* DOMParser provides a parser which produces a W3C DOM tree as its output
*
*
- * @version $Id: DOMParser.java,v 1.48 2001/05/10 15:51:24 lehors Exp $
+ * @version $Id: DOMParser.java,v 1.49 2001/05/10 18:11:02 lehors Exp $
*/
public class DOMParser
extends XMLParser
@@ -1124,9 +1124,12 @@
Element e;
if (nsEnabled) {
- e = fDocument.createElementNS(
- // REVISIT: Make sure uri is filled in by caller.
- fStringPool.toString(elementQName.uri), elementName);
+ String namespaceURI = fStringPool.toString(elementQName.uri);
+ // hide the fact that our parser uses an empty string for null
+ if (namespaceURI.length() == 0) {
+ namespaceURI = null;
+ }
+ e = fDocument.createElementNS(namespaceURI, elementName);
} else {
e = fDocument.createElement(elementName);
}
@@ -1145,7 +1148,11 @@
// done here.
int prefixIndex = xmlAttrList.getAttrPrefix(attrHandle);
String prefix = fStringPool.toString(prefixIndex);
- if (namespaceURI == null || namespaceURI.length() == 0) {
+ // hide that our parser uses an empty string for null
+ if (namespaceURI.length() == 0) {
+ namespaceURI = null;
+ }
+ if (namespaceURI == null) {
if (prefix != null) {
if (prefix.equals("xmlns")) {
namespaceURI = "http://www.w3.org/2000/xmlns/";
@@ -2141,7 +2148,11 @@
// So as long as the XML parser doesn't do it, it needs to
// done here.
String prefix = fStringPool.toString(attributeDecl.prefix);
- if (namespaceURI == null || namespaceURI.length() == 0) {
+ // hide that our parser uses an empty string for null
+ if (namespaceURI.length() == 0) {
+ namespaceURI = null;
+ }
+ if (namespaceURI == null) {
if (prefix != null) {
if (prefix.equals("xmlns")) {
namespaceURI = "http://www.w3.org/2000/xmlns/";
1.9 +6 -5 xml-xerces/java/src/org/apache/xerces/dom/DeferredElementNSImpl.java
Index: DeferredElementNSImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredElementNSImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DeferredElementNSImpl.java 2001/02/08 17:27:33 1.8
+++ DeferredElementNSImpl.java 2001/05/10 18:11:08 1.9
@@ -56,7 +56,7 @@
*/
-/* $Id: DeferredElementNSImpl.java,v 1.8 2001/02/08 17:27:33 lehors Exp $ */
+/* $Id: DeferredElementNSImpl.java,v 1.9 2001/05/10 18:11:08 lehors Exp $ */
/*
* WARNING: because java doesn't support multi-inheritance some code is
@@ -66,13 +66,10 @@
package org.apache.xerces.dom;
-import java.util.Enumeration;
-import java.util.Vector;
+import org.w3c.dom.NamedNodeMap;
import org.apache.xerces.utils.StringPool;
-import org.w3c.dom.*;
-
/**
* DeferredElementNSImpl is to ElementNSImpl, what DeferredElementImpl is to
* ElementImpl.
@@ -153,6 +150,10 @@
}
namespaceURI = pool.toString(ownerDocument.getNodeURI(fNodeIndex));
+ // hide the fact that our parser uses an empty string for null
+ if (namespaceURI.length() == 0) {
+ namespaceURI = null;
+ }
// attributes
setupDefaultAttributes();
1.14 +6 -4 xml-xerces/java/src/org/apache/xerces/dom/DeferredAttrNSImpl.java
Index: DeferredAttrNSImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DeferredAttrNSImpl.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DeferredAttrNSImpl.java 2001/03/19 22:12:22 1.13
+++ DeferredAttrNSImpl.java 2001/05/10 18:11:10 1.14
@@ -61,13 +61,11 @@
* DeferredAttrImpl.java at the same time.
*/
-/* $Id: DeferredAttrNSImpl.java,v 1.13 2001/03/19 22:12:22 lehors Exp $ */
+/* $Id: DeferredAttrNSImpl.java,v 1.14 2001/05/10 18:11:10 lehors Exp $ */
package org.apache.xerces.dom;
-import org.w3c.dom.*;
-
import org.apache.xerces.utils.StringPool;
/**
@@ -153,11 +151,15 @@
isSpecified(ownerDocument.getNodeValue(fNodeIndex) == 1);
//namespaceURI = pool.toString(ownerDocument.getNodeURI(attrQName));
namespaceURI = pool.toString(ownerDocument.getNodeURI(fNodeIndex));
+ // hide the fact that our parser uses an empty string for null
+ if (namespaceURI.length() == 0) {
+ namespaceURI = null;
+ }
// DOM Level 2 wants all namespace declaration attributes
// to be bound to "http://www.w3.org/2000/xmlns/"
// So as long as the XML parser doesn't do it, it needs to
// done here.
- if (namespaceURI == null || namespaceURI.length() == 0) {
+ if (namespaceURI == null) {
if (prefix != null) {
if (prefix.equals("xmlns")) {
namespaceURI = "http://www.w3.org/2000/xmlns/";
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org