Working on JAXP 1.4 support.
This commit is contained in:
@@ -19,7 +19,6 @@ package org.springframework.xml.dom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
@@ -29,6 +28,8 @@ import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* SAX <code>ContentHandler</code> that transforms callback calls to DOM <code>Node</code>s.
|
||||
*
|
||||
@@ -100,7 +101,9 @@ public class DomContentHandler extends DefaultHandler {
|
||||
String attrUri = attributes.getURI(i);
|
||||
String attrQname = attributes.getQName(i);
|
||||
String value = attributes.getValue(i);
|
||||
element.setAttributeNS(attrUri, attrQname, value);
|
||||
if (!attrQname.startsWith("xmlns")) {
|
||||
element.setAttributeNS(attrUri, attrQname, value);
|
||||
}
|
||||
}
|
||||
parent.appendChild(element);
|
||||
elements.add(element);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class DomContentHandlerTest extends XMLTestCase {
|
||||
documentBuilderFactory.setNamespaceAware(true);
|
||||
documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
result = documentBuilder.newDocument();
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
||||
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
}
|
||||
|
||||
public void testContentHandlerDocument() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user