mrglavas 2004/09/06 15:25:27
Modified: java/src/org/apache/xerces/dom DOMNormalizer.java
java/src/org/apache/xml/serialize DOMSerializerImpl.java
Log:
Fixing JIRA Bug #1006:
http://nagoya.apache.org/jira/browse/XERCESJ-1006
We can't assume that the DOM we're serializing is from Xerces.
The LSSerializer should work with any DOM Level 3 core implementation.
Getting rid of casts to implementation classes which caused a
ClassCastException to be thrown when attempting to check the
well-formedness of attribute values.
Revision Changes Path
1.57 +3 -3 xml-xerces/java/src/org/apache/xerces/dom/DOMNormalizer.java
Index: DOMNormalizer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DOMNormalizer.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- DOMNormalizer.java 15 Jun 2004 21:36:39 -0000 1.56
+++ DOMNormalizer.java 6 Sep 2004 22:25:27 -0000 1.57
@@ -1185,8 +1185,8 @@
* @param value
*/
public static final void isAttrValueWF(DOMErrorHandler errorHandler,
DOMErrorImpl error,
- DOMLocatorImpl locator, AttributeMap attributes, AttrImpl a, String
value, boolean xml11Version) {
- if (a.hasStringValue()) {
+ DOMLocatorImpl locator, NamedNodeMap attributes, Attr a, String value,
boolean xml11Version) {
+ if (a instanceof AttrImpl && ((AttrImpl)a).hasStringValue()) {
isXMLCharWF(errorHandler, error, locator, value, xml11Version);
} else {
NodeList children = a.getChildNodes();
1.29 +4 -7
xml-xerces/java/src/org/apache/xml/serialize/DOMSerializerImpl.java
Index: DOMSerializerImpl.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xml/serialize/DOMSerializerImpl.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- DOMSerializerImpl.java 14 Jul 2004 19:24:23 -0000 1.28
+++ DOMSerializerImpl.java 6 Sep 2004 22:25:27 -0000 1.29
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-
-
package org.apache.xml.serialize;
import java.io.File;
@@ -32,8 +30,6 @@
import java.util.StringTokenizer;
import java.util.Vector;
-import org.apache.xerces.dom.AttrImpl;
-import org.apache.xerces.dom.AttributeMap;
import org.apache.xerces.dom.CoreDocumentImpl;
import org.apache.xerces.dom.DOMErrorImpl;
import org.apache.xerces.dom.DOMLocatorImpl;
@@ -56,6 +52,7 @@
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.ls.LSException;
@@ -1071,13 +1068,13 @@
}
}
- AttributeMap attributes = (node.hasAttributes()) ? (AttributeMap)
node.getAttributes() : null;
+ NamedNodeMap attributes = (node.hasAttributes()) ?
node.getAttributes() : null;
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); ++i) {
Attr attr = (Attr) attributes.item(i);
fLocator.fRelatedNode = attr;
DOMNormalizer.isAttrValueWF( fErrorHandler, fError,
fLocator,
- attributes,(AttrImpl) attr, attr.getValue(),
xml11Version);
+ attributes, attr, attr.getValue(),
xml11Version);
if (verifyNames) {
wellformed = CoreDocumentImpl.isXMLName(
attr.getNodeName(), xml11Version);
if (!wellformed) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]