You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2014/06/28 23:33:27 UTC
svn commit: r1606395 - in /webservices/axiom/trunk:
modules/axiom-api/src/main/java/org/apache/axiom/om/impl/
modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/
modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/
modules/axiom-...
Author: veithen
Date: Sat Jun 28 21:33:26 2014
New Revision: 1606395
URL: http://svn.apache.org/r1606395
Log:
More DOOM fixes.
Added:
webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMAttributeEx.java (with props)
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOMStAXParserConfiguration.java (with props)
Modified:
webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java
webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
webservices/axiom/trunk/testsuites/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMFeature.java
Added: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMAttributeEx.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMAttributeEx.java?rev=1606395&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMAttributeEx.java (added)
+++ webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMAttributeEx.java Sat Jun 28 21:33:26 2014
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl;
+
+import org.apache.axiom.om.OMAttribute;
+
+/**
+ * Interface that is used internally by Axiom and that should not be considered being part of the
+ * public API.
+ */
+public interface OMAttributeEx extends OMAttribute {
+ void setSpecified(boolean specified);
+}
Propchange: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMAttributeEx.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java (original)
+++ webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java Sat Jun 28 21:33:26 2014
@@ -32,6 +32,7 @@ import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMAttributeEx;
import org.apache.axiom.om.impl.OMContainerEx;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
import org.apache.axiom.om.util.StAXUtils;
@@ -243,7 +244,9 @@ public abstract class StAXBuilder implem
OMAttribute attr = node.addAttribute(parser.getAttributeLocalName(i),
parser.getAttributeValue(i), namespace);
attr.setAttributeType(parser.getAttributeType(i));
-
+ if (attr instanceof OMAttributeEx) {
+ ((OMAttributeEx)attr).setSpecified(parser.isAttributeSpecified(i));
+ }
}
}
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java Sat Jun 28 21:33:26 2014
@@ -27,6 +27,7 @@ import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMAttributeEx;
import org.apache.axiom.om.impl.common.OMNamedInformationItemHelper;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
import org.apache.axiom.om.impl.common.serializer.push.Serializer;
@@ -41,7 +42,7 @@ import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
/** Implementation of <code>org.w3c.dom.Attr</code> and <code>org.apache.axiom.om.OMAttribute</code> */
-public class AttrImpl extends RootNode implements OMAttribute, Attr, NamedNode {
+public class AttrImpl extends RootNode implements OMAttributeEx, Attr, NamedNode {
private String localName;
private String type;
@@ -256,8 +257,11 @@ public class AttrImpl extends RootNode i
}
public boolean getSpecified() {
- // Since we don't support DTD or schema, we always return true
- return true;
+ return (flags & DEFAULT_ATTR) == 0;
+ }
+
+ public void setSpecified(boolean specified) {
+ flags = (short) (specified ? flags & ~DEFAULT_ATTR : flags | DEFAULT_ATTR);
}
/**
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java Sat Jun 28 21:33:26 2014
@@ -130,7 +130,7 @@ public class AttributeMap implements Nam
previous.setOwnerElement(null, true);
// make sure it won't be mistaken with defaults in case it's reused
- previous.isSpecified(true);
+ previous.setSpecified(true);
} else {
i = -1 - i; // Insert point (may be end of list)
if (null == nodes) {
@@ -178,7 +178,7 @@ public class AttributeMap implements Nam
nodes.setElementAt(attr, i);
previous.setOwnerElement(null, useDomSemantics);
// make sure it won't be mistaken with defaults in case it's reused
- previous.isSpecified(true);
+ previous.setSpecified(true);
} else {
// If we can't find by namespaceURI, localName, then we find by
// nodeName so we know where to insert.
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CDATASectionImpl.java Sat Jun 28 21:33:26 2014
@@ -38,6 +38,10 @@ public class CDATASectionImpl extends Te
return Node.CDATA_SECTION_NODE;
}
+ public String getNodeName() {
+ return "#cdata-section";
+ }
+
ChildNode createClone() {
return new CDATASectionImpl(textValue, factory);
}
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java Sat Jun 28 21:33:26 2014
@@ -94,7 +94,7 @@ public abstract class CharacterImpl exte
public void insertData(int offset, String data) throws DOMException {
int length = this.getLength();
- if (offset < 0 || offset > length - 1) {
+ if (offset < 0 || offset > length) {
throw DOMUtil.newDOMException(DOMException.INDEX_SIZE_ERR);
}
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java Sat Jun 28 21:33:26 2014
@@ -499,6 +499,9 @@ public class DocumentImpl extends RootNo
childNode.detach();
}
childNode.setOwnerDocument(this);
+ if (node instanceof AttrImpl) {
+ ((AttrImpl)node).setSpecified(true);
+ }
return childNode;
} else {
return null;
@@ -515,8 +518,7 @@ public class DocumentImpl extends RootNo
}
public String getInputEncoding() {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
+ return charEncoding;
}
public boolean getStrictErrorChecking() {
@@ -525,7 +527,7 @@ public class DocumentImpl extends RootNo
}
public String getXmlEncoding() {
- return this.charEncoding;
+ return xmlEncoding;
}
public boolean getXmlStandalone() {
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java Sat Jun 28 21:33:26 2014
@@ -949,7 +949,7 @@ public class ElementImpl extends ParentN
for (int i=0, l=attributes.getLength(); i<l; i++) {
AttrImpl attr = (AttrImpl)attributes.item(i);
AttrImpl clonedAttr = (AttrImpl)attr.clone(options, null, true, false);
- clonedAttr.isSpecified(attr.isSpecified());
+ clonedAttr.setSpecified(attr.getSpecified());
clone.setAttributeNodeNS(clonedAttr, false, namespaceRepairing && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI()));
}
return clone;
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/EntityReferenceImpl.java Sat Jun 28 21:33:26 2014
@@ -67,6 +67,14 @@ public class EntityReferenceImpl extends
return Node.ENTITY_REFERENCE_NODE;
}
+ public Node getFirstChild() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Node getLastChild() {
+ throw new UnsupportedOperationException();
+ }
+
public final NodeList getChildNodes() {
throw new UnsupportedOperationException();
}
@@ -86,4 +94,12 @@ public class EntityReferenceImpl extends
public final Node replaceChild(Node newChild, Node oldChild) throws DOMException {
throw DOMUtil.newDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);
}
+
+ public String getTextContent() throws DOMException {
+ throw new UnsupportedOperationException();
+ }
+
+ void getTextContent(StringBuffer buf) {
+ throw new UnsupportedOperationException();
+ }
}
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java Sat Jun 28 21:33:26 2014
@@ -28,6 +28,14 @@ public abstract class LeafNode extends C
super(factory);
}
+ public final Node getFirstChild() {
+ return null;
+ }
+
+ public final Node getLastChild() {
+ return null;
+ }
+
public final NodeList getChildNodes() {
return EmptyNodeList.INSTANCE;
}
@@ -47,4 +55,15 @@ public abstract class LeafNode extends C
public final Node replaceChild(Node newChild, Node oldChild) throws DOMException {
throw DOMUtil.newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
}
+
+ public final String getTextContent() throws DOMException {
+ return getNodeValue();
+ }
+
+ final void getTextContent(StringBuffer buf) {
+ String content = getNodeValue();
+ if (content != null) {
+ buf.append(content);
+ }
+ }
}
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java Sat Jun 28 21:33:26 2014
@@ -71,7 +71,11 @@ public abstract class NodeImpl implement
protected final static short FIRSTCHILD = 0x1 << 2;
- protected final static short SPECIFIED = 0x1 << 4;
+ /**
+ * Used by {@link AttrImpl} to determine whether the attribute has been specified explicitly
+ * (flag unset) or has a default value (flag set).
+ */
+ protected final static short DEFAULT_ATTR = 0x1 << 4;
//
// Constructors
@@ -135,28 +139,6 @@ public abstract class NodeImpl implement
return null; // overridden in ElementImpl
}
- /**
- * Gets the first child of this Node, or null if none.
- * <p/>
- * By default we do not have any children, ParentNode overrides this.
- *
- * @see ParentNode
- */
- public Node getFirstChild() {
- return null;
- }
-
- /**
- * Gets the last child of this Node, or null if none.
- * <p/>
- * By default we do not have any children, ParentNode overrides this.
- *
- * @see ParentNode
- */
- public Node getLastChild() {
- return null;
- }
-
public final Node cloneNode(boolean deep) {
OMCloneOptions options = new OMCloneOptions();
// This is not specified by the API, but it's compatible with versions before 1.2.14
@@ -193,14 +175,6 @@ public abstract class NodeImpl implement
flags = (short) (value ? flags | FIRSTCHILD : flags & ~FIRSTCHILD);
}
- final boolean isSpecified() {
- return (flags & SPECIFIED) != 0;
- }
-
- final void isSpecified(boolean value) {
- flags = (short) (value ? flags | SPECIFIED : flags & ~SPECIFIED);
- }
-
/*
* DOM-Level 3 methods
*/
@@ -217,17 +191,8 @@ public abstract class NodeImpl implement
throw DOMUtil.newDOMException(DOMException.NOT_SUPPORTED_ERR);
}
- public String getTextContent() throws DOMException {
- return getNodeValue(); // overriden in some subclasses
- }
-
// internal method taking a StringBuffer in parameter
- void getTextContent(StringBuffer buf) throws DOMException {
- String content = getNodeValue();
- if (content != null) {
- buf.append(content);
- }
- }
+ abstract void getTextContent(StringBuffer buf);
public void setTextContent(String textContent) throws DOMException {
setNodeValue(textContent); // overriden in some subclasses
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java Sat Jun 28 21:33:26 2014
@@ -37,6 +37,7 @@ import org.apache.axiom.om.impl.common.O
import org.apache.axiom.om.impl.common.OMDescendantsIterator;
import org.apache.axiom.om.impl.common.serializer.push.sax.XMLReaderImpl;
import org.apache.axiom.om.impl.traverse.OMChildrenIterator;
+import org.apache.axiom.om.impl.traverse.OMFilterIterator;
import org.apache.axiom.om.impl.traverse.OMQNameFilterIterator;
import org.apache.axiom.om.impl.traverse.OMQualifiedNameFilterIterator;
import org.w3c.dom.DOMException;
@@ -583,7 +584,11 @@ public abstract class ParentNode extends
if (name.equals("*")) {
return new NodeListImpl() {
protected Iterator getIterator() {
- return getDescendants(false);
+ return new OMFilterIterator(getDescendants(false)) {
+ protected boolean matches(OMNode node) {
+ return node.getType() == OMNode.ELEMENT_NODE;
+ }
+ };
}
};
} else {
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java Sat Jun 28 21:33:26 2014
@@ -26,6 +26,7 @@ import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNode;
+import org.w3c.dom.Node;
public class TextImpl extends TextNodeImpl {
private boolean isWhitespace;
@@ -81,6 +82,14 @@ public class TextImpl extends TextNodeIm
return isWhitespace ? OMNode.SPACE_NODE : OMNode.TEXT_NODE;
}
+ public String getNodeName() {
+ return "#text";
+ }
+
+ public short getNodeType() {
+ return Node.TEXT_NODE;
+ }
+
ChildNode createClone() {
return new TextImpl(this, factory);
}
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java Sat Jun 28 21:33:26 2014
@@ -203,18 +203,6 @@ public abstract class TextNodeImpl exten
}
// /
- // /org.w3c.dom.Node methods
- // /
-
- public String getNodeName() {
- return "#text";
- }
-
- public short getNodeType() {
- return Node.TEXT_NODE;
- }
-
- // /
// /OMNode methods
// /
Added: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOMStAXParserConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOMStAXParserConfiguration.java?rev=1606395&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOMStAXParserConfiguration.java (added)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOMStAXParserConfiguration.java Sat Jun 28 21:33:26 2014
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.dom.jaxp;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.axiom.om.util.StAXParserConfiguration;
+import org.apache.axiom.util.stax.dialect.StAXDialect;
+
+final class DOMStAXParserConfiguration implements StAXParserConfiguration {
+ private final boolean coalescing;
+ private final boolean expandEntityReferences;
+
+ public DOMStAXParserConfiguration(boolean coalescing, boolean expandEntityReferences) {
+ this.coalescing = coalescing;
+ this.expandEntityReferences = expandEntityReferences;
+ }
+
+ public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) {
+ if (!coalescing) {
+ factory = StAXParserConfiguration.PRESERVE_CDATA_SECTIONS.configure(factory, dialect);
+ }
+ factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.valueOf(expandEntityReferences));
+ return factory;
+ }
+
+ public int hashCode() {
+ return (coalescing ? 1 : 0) | (expandEntityReferences ? 2 : 0);
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof DOMStAXParserConfiguration) {
+ DOMStAXParserConfiguration other = (DOMStAXParserConfiguration)obj;
+ return other.coalescing == coalescing && other.expandEntityReferences == expandEntityReferences;
+ } else {
+ return false;
+ }
+ }
+
+ public String toString() {
+ return "DOM(coalescing=" + coalescing + ",expandEntityReferences=" + expandEntityReferences + ")";
+ }
+}
Propchange: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOMStAXParserConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java Sat Jun 28 21:33:26 2014
@@ -41,12 +41,12 @@ import java.io.InputStream;
public class DOOMDocumentBuilder extends DocumentBuilder {
private final OMFactory factory;
- private final boolean coalescing;
+ private final StAXParserConfiguration parserConfiguration;
private final Schema schema;
- DOOMDocumentBuilder(OMFactory factory, boolean coalescing, Schema schema) {
+ DOOMDocumentBuilder(OMFactory factory, StAXParserConfiguration parserConfiguration, Schema schema) {
this.factory = factory;
- this.coalescing = coalescing;
+ this.parserConfiguration = parserConfiguration;
this.schema = schema;
}
@@ -99,8 +99,7 @@ public class DOOMDocumentBuilder extends
public Document parse(InputSource inputSource) throws SAXException, IOException {
OMXMLParserWrapper builder = factory.getMetaFactory().createOMBuilder(factory,
- coalescing ? StAXParserConfiguration.DEFAULT : StAXParserConfiguration.PRESERVE_CDATA_SECTIONS,
- inputSource);
+ parserConfiguration, inputSource);
DocumentImpl doc = (DocumentImpl) builder.getDocument();
doc.close(true);
return doc;
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java Sat Jun 28 21:33:26 2014
@@ -50,7 +50,7 @@ public class DOOMDocumentBuilderFactory
public DocumentBuilder newDocumentBuilder()
throws ParserConfigurationException {
- return new DOOMDocumentBuilder(factory, isCoalescing(), schema);
+ return new DOOMDocumentBuilder(factory, new DOMStAXParserConfiguration(isCoalescing(), isExpandEntityReferences()), schema);
}
public Object getAttribute(String name) throws IllegalArgumentException {
Modified: webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java Sat Jun 28 21:33:26 2014
@@ -39,11 +39,7 @@ public class DOMImplementationTest exten
}
}, new DOMFeature[] { DOMFeature.ENTITIES, DOMFeature.NOTATIONS, DOMFeature.TYPE_INFO, DOMFeature.BASE_URI });
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnotspecifiedvalue)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalueremove)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdataend)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecdatasection)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementdefaultattr)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnametotallength)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateattribute)");
@@ -52,7 +48,6 @@ public class DOMImplementationTest exten
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref1)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementgetelementsbytagnamespecialvalue)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinvalidcharacterexception)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattribute)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementremoveattributerestoredefaultvalue)");
@@ -62,29 +57,23 @@ public class DOMImplementationTest exten
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapremovenameditemgetvalue)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchilddocfragment)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchildinvalidnodetype)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodecdatasectionnodename)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforeinvalidnodetype)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildinvalidnodetype)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchildexists)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/processinginstructionsetdatanomodificationallowederr)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatainsertdataend)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentgetelementsbytagnametotallength)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateattribute1)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentinvalidcharacterexceptioncreateelement1)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementgetelementsbytagnamespecialvalue)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementinvalidcharacterexception1)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementnormalize2)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributeaftercreate)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementreplaceattributewithself)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildchildexists)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchilddocfragment)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeappendchildinvalidnodetype)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforeinvalidnodetype)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeinsertbeforenewchildexists)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildinvalidnodetype)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodereplacechildnewchildexists)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrappendchild2)");
@@ -225,9 +214,7 @@ public class DOMImplementationTest exten
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid04)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid05)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid07)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform03)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform06)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/cdatasections01)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/checkcharacternormalization01)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode07)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentadoptnode08)");
@@ -241,16 +228,8 @@ public class DOMImplementationTest exten
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetdocumenturi01)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetdocumenturi02)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetdocumenturi03)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetinputencoding01)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetinputencoding02)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetinputencoding03)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetinputencoding04)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetstricterrorchecking01)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetstricterrorchecking02)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding01)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding03)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding04)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlencoding05)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlstandalone05)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlversion02)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentgetxmlversion03)");
@@ -469,7 +448,6 @@ public class DOMImplementationTest exten
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/noderemovechild19)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild13)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild20)");
- builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild24)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild27)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild28)");
builder.exclude(W3CTestCase.class, "(id=http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild30)");
Modified: webservices/axiom/trunk/testsuites/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMFeature.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMFeature.java?rev=1606395&r1=1606394&r2=1606395&view=diff
==============================================================================
--- webservices/axiom/trunk/testsuites/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMFeature.java (original)
+++ webservices/axiom/trunk/testsuites/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMFeature.java Sat Jun 28 21:33:26 2014
@@ -28,6 +28,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.domts.level1.core.attrremovechild1;
import org.w3c.domts.level1.core.attrreplacechild1;
+import org.w3c.domts.level1.core.attrsetvaluenomodificationallowederr;
import org.w3c.domts.level1.core.attrsetvaluenomodificationallowederrEE;
import org.w3c.domts.level1.core.characterdataappenddatanomodificationallowederr;
import org.w3c.domts.level1.core.characterdataappenddatanomodificationallowederrEE;
@@ -47,6 +48,7 @@ import org.w3c.domts.level1.core.element
import org.w3c.domts.level1.core.elementsetattributenodenomodificationallowederr;
import org.w3c.domts.level1.core.elementsetattributenodenomodificationallowederrEE;
import org.w3c.domts.level1.core.elementsetattributenomodificationallowederrEE;
+import org.w3c.domts.level1.core.hc_textparseintolistofelements;
import org.w3c.domts.level1.core.nodeappendchildnomodificationallowederr;
import org.w3c.domts.level1.core.nodeinsertbeforenomodificationallowederr;
import org.w3c.domts.level1.core.noderemovechildnomodificationallowederr;
@@ -56,6 +58,7 @@ import org.w3c.domts.level1.core.noderep
import org.w3c.domts.level1.core.nodesetnodevaluenomodificationallowederr;
import org.w3c.domts.level1.core.nodesetnodevaluenomodificationallowederrEE;
import org.w3c.domts.level1.core.processinginstructionsetdatanomodificationallowederrEE;
+import org.w3c.domts.level1.core.textparseintolistofelements;
import org.w3c.domts.level1.core.textsplittextnomodificationallowederr;
import org.w3c.domts.level1.core.textsplittextnomodificationallowederrEE;
import org.w3c.domts.level2.core.elementsetattributenodens06;
@@ -70,11 +73,13 @@ import org.w3c.domts.level3.core.nodecom
import org.w3c.domts.level3.core.nodecomparedocumentposition27;
import org.w3c.domts.level3.core.nodecomparedocumentposition28;
import org.w3c.domts.level3.core.nodecomparedocumentposition29;
+import org.w3c.domts.level3.core.nodegettextcontent14;
import org.w3c.domts.level3.core.nodegettextcontent17;
import org.w3c.domts.level3.core.nodeinsertbefore15;
import org.w3c.domts.level3.core.noderemovechild13;
import org.w3c.domts.level3.core.noderemovechild14;
import org.w3c.domts.level3.core.noderemovechild15;
+import org.w3c.domts.level3.core.noderemovechild31;
public final class DOMFeature {
static final class Signature {
@@ -145,6 +150,11 @@ public final class DOMFeature {
noderemovechild13.class,
noderemovechild14.class,
noderemovechild15.class,
+ attrsetvaluenomodificationallowederr.class,
+ textparseintolistofelements.class,
+ hc_textparseintolistofelements.class,
+ noderemovechild31.class,
+ nodegettextcontent14.class,
});
public static final DOMFeature NOTATIONS = new DOMFeature(
new Signature[] {