Can't get value for property with format saving, because DOM4JConfiguration using org.dom4j.Element#getTrimedText() method to get value for the property
But it is very critical for me to save format of the property value.
desicion:
make a change in the format of the xml configuration file
<baseElement>
<query trim-value="false"><![CDATA[
select /*+ ORDERED */
id
\, id2
\, other_party
...
]]></query>
</baseElement>--- old.java Thu Sep 11 07:29:34 2003
+++ DOM4JConfiguration.java Thu Sep 11 06:56:58 2003
@@ -185,7 +185,12 @@
StringBuffer subhierarchy = new StringBuffer(hierarchy.toString());
Element child = (Element) it.next();
String nodeName = child.getName();
- String nodeValue = child.getTextTrim();
+ String nodeValue = null;
+ Attribute ta = child.attribute("trim-value");
+ if (ta == null || ta.getValue().equals("true"))
+ nodeValue = child.getTextTrim();
+ else
+ nodeValue = child.getText();
subhierarchy.append(nodeName);
if (nodeValue.length() > 0)
{
@@ -197,9 +202,11 @@
for (int j = 0, k = attributes.size(); j < k; j++)
{
Attribute a = (Attribute) attributes.get(j);
- String attName = subhierarchy.toString() + '[' + ATTRIB_MARKER +
a.getName() + ']';
- String attValue = a.getValue();
- super.addProperty(attName, attValue);
+ if (!a.getName().equals("trim-value")){
+ String attName = subhierarchy.toString() + '['
+ ATTRIB_MARKER + a.getName() + ']';
+ String attValue = a.getValue();
+ super.addProperty(attName, attValue);
+ }
}
StringBuffer buf = new StringBuffer(subhierarchy.toString());
initProperties(child, buf.append('.'));--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
