You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by oz...@apache.org on 2009/11/23 18:03:17 UTC
svn commit: r883412 -
/incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/Parser.java
Author: ozzy
Date: Mon Nov 23 17:03:17 2009
New Revision: 883412
URL: http://svn.apache.org/viewvc?rev=883412&view=rev
Log:
ARIES-46 Update to custom namespaced attribute handling. Ignore various w3c uri's that do not require handlers for blueprint.
Modified:
incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/Parser.java
Modified: incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/Parser.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/Parser.java?rev=883412&r1=883411&r2=883412&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/Parser.java (original)
+++ incubator/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/Parser.java Mon Nov 23 17:03:17 2009
@@ -234,7 +234,7 @@
private void findNamespaces(Set<URI> namespaces, Node node) {
if (node instanceof Element || node instanceof Attr) {
String ns = node.getNamespaceURI();
- if (ns != null && !isBlueprintNamespace(ns) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(ns)) {
+ if (ns != null && !isBlueprintNamespace(ns) && !isIgnorableAttributeNamespace(ns)) {
namespaces.add(URI.create(ns));
}else if ( ns == null && //attributes from blueprint are unqualified as per schema.
node instanceof Attr &&
@@ -1195,7 +1195,7 @@
if (node instanceof Attr &&
node.getNamespaceURI() != null &&
!isBlueprintNamespace(node.getNamespaceURI()) &&
- !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(node.getNamespaceURI()) ) {
+ !isIgnorableAttributeNamespace(node.getNamespaceURI()) ) {
enclosingComponent = decorateCustomNode(node, enclosingComponent);
}
}
@@ -1262,6 +1262,30 @@
return BLUEPRINT_NAMESPACE.equals(ns);
}
+ /**
+ * Test if this namespace uri does not require a Namespace Handler.<p>
+ * <li> XMLConstants.RELAXNG_NS_URI
+ * <li> XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI
+ * <li> XMLConstants.W3C_XML_SCHEMA_NS_URI
+ * <li> XMLConstants.W3C_XPATH_DATATYPE_NS_URI
+ * <li> XMLConstants.W3C_XPATH_DATATYPE_NS_URI
+ * <li> XMLConstants.XML_DTD_NS_URI
+ * <li> XMLConstants.XML_NS_URI
+ * <li> XMLConstants.XMLNS_ATTRIBUTE_NS_URI
+ * @param ns URI to be tested.
+ * @return true if the uri does not require a namespace handler.
+ */
+ public static boolean isIgnorableAttributeNamespace(String ns) {
+ return XMLConstants.RELAXNG_NS_URI.equals(ns) ||
+ XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI.equals(ns) ||
+ XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(ns) ||
+ XMLConstants.W3C_XPATH_DATATYPE_NS_URI.equals(ns) ||
+ XMLConstants.W3C_XPATH_DATATYPE_NS_URI.equals(ns) ||
+ XMLConstants.XML_DTD_NS_URI.equals(ns) ||
+ XMLConstants.XML_NS_URI.equals(ns) ||
+ XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(ns);
+ }
+
private static boolean nodeNameEquals(Node node, String name) {
return (name.equals(node.getNodeName()) || name.equals(node.getLocalName()));
}