You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2011/09/29 02:59:01 UTC
svn commit: r1177136 -
/xml/commons/trunk/java/src/org/apache/xml/resolver/helpers/Namespaces.java
Author: mrglavas
Date: Thu Sep 29 00:59:01 2011
New Revision: 1177136
URL: http://svn.apache.org/viewvc?rev=1177136&view=rev
Log:
Fix-up indentation.
Modified:
xml/commons/trunk/java/src/org/apache/xml/resolver/helpers/Namespaces.java
Modified: xml/commons/trunk/java/src/org/apache/xml/resolver/helpers/Namespaces.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/src/org/apache/xml/resolver/helpers/Namespaces.java?rev=1177136&r1=1177135&r2=1177136&view=diff
==============================================================================
--- xml/commons/trunk/java/src/org/apache/xml/resolver/helpers/Namespaces.java (original)
+++ xml/commons/trunk/java/src/org/apache/xml/resolver/helpers/Namespaces.java Thu Sep 29 00:59:01 2011
@@ -34,6 +34,7 @@ import org.w3c.dom.Node;
* @version 1.0
*/
public class Namespaces {
+
/**
* Returns the "prefix" part of a QName or the empty string (not
* null) if the name has no prefix.
@@ -42,14 +43,14 @@ public class Namespaces {
* @return The prefix part of the element name.
*/
public static String getPrefix(Element element) {
- String name = element.getTagName();
- String prefix = "";
+ String name = element.getTagName();
+ String prefix = "";
- if (name.indexOf(':') > 0) {
- prefix = name.substring(0, name.indexOf(':'));
- }
+ if (name.indexOf(':') > 0) {
+ prefix = name.substring(0, name.indexOf(':'));
+ }
- return prefix;
+ return prefix;
}
/**
@@ -60,13 +61,13 @@ public class Namespaces {
* @return The local part of a QName.
*/
public static String getLocalName(Element element) {
- String name = element.getTagName();
+ String name = element.getTagName();
- if (name.indexOf(':') > 0) {
- name = name.substring(name.indexOf(':')+1);
- }
+ if (name.indexOf(':') > 0) {
+ name = name.substring(name.indexOf(':')+1);
+ }
- return name;
+ return name;
}
/**
@@ -79,22 +80,22 @@ public class Namespaces {
* null if no namespace declaration exists for the prefix.
*/
public static String getNamespaceURI(Node node, String prefix) {
- if (node == null || node.getNodeType() != Node.ELEMENT_NODE) {
- return null;
- }
-
- if (prefix.length() == 0) {
- if (((Element) node).hasAttribute("xmlns")) {
- return ((Element) node).getAttribute("xmlns");
- }
- } else {
- String nsattr = "xmlns:" + prefix;
- if (((Element) node).hasAttribute(nsattr)) {
- return ((Element) node).getAttribute(nsattr);
- }
- }
+ if (node == null || node.getNodeType() != Node.ELEMENT_NODE) {
+ return null;
+ }
+
+ if (prefix.length() == 0) {
+ if (((Element) node).hasAttribute("xmlns")) {
+ return ((Element) node).getAttribute("xmlns");
+ }
+ } else {
+ String nsattr = "xmlns:" + prefix;
+ if (((Element) node).hasAttribute(nsattr)) {
+ return ((Element) node).getAttribute(nsattr);
+ }
+ }
- return getNamespaceURI(node.getParentNode(), prefix);
+ return getNamespaceURI(node.getParentNode(), prefix);
}
/**
@@ -106,7 +107,7 @@ public class Namespaces {
* element, or null if no namespace declaration exists for it.
*/
public static String getNamespaceURI(Element element) {
- String prefix = getPrefix(element);
- return getNamespaceURI(element, prefix);
+ String prefix = getPrefix(element);
+ return getNamespaceURI(element, prefix);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org