[jbosscache-commits] JBoss Cache SVN: r6726 - core/trunk/src/main/java/org/jboss/cache/config/parsing.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Mon Sep 15 11:01:20 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-09-15 11:01:20 -0400 (Mon, 15 Sep 2008)
New Revision: 6726
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
Log:
Updates
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java 2008-09-15 15:01:12 UTC (rev 6725)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java 2008-09-15 15:01:20 UTC (rev 6726)
@@ -57,13 +57,17 @@
// Ignore Namespace until JGroups defines one
Element tag = (Element) node;
String protocol = tag.getLocalName();
+ if (protocol == null)
+ {
+ protocol = tag.getNodeName(); // try a non-namespace aware version
+ }
buffer.append(protocol);
processAttributes(buffer, tag);
buffer.append(':');
}
if (buffer.length() > 0)
{
- //Remove the trailing ':'
+ //Remove the trailing ':'
buffer.setLength(buffer.length() - 1);
}
return buffer.toString();
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2008-09-15 15:01:12 UTC (rev 6725)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2008-09-15 15:01:20 UTC (rev 6726)
@@ -377,6 +377,23 @@
}
/**
+ * Converts a String representing an XML snippet into an {@link org.w3c.dom.Element}.
+ *
+ * @param xml snippet as a string
+ * @return a DOM Element
+ * @throws Exception if unable to parse the String or if it doesn't contain valid XML.
+ */
+ public static Element stringToElement(String xml) throws Exception
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("utf8"));
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document d = builder.parse(bais);
+ bais.close();
+ return d.getDocumentElement();
+ }
+
+ /**
* Gets the first child element of an element
*
* @param element the parent
More information about the jbosscache-commits
mailing list