I mentioned a while ago something about trimming all whitespace from
metadata values, but that was rejected because some data might need that
whitespace.  I also added support to auto trim attribute values from
jboss.jcml.

Now I would like to suggest changing things such that all leading
and trailing whitespace is truncated for all attribtes (jcml and metadata)
unless the data is enclosed in a CDATA element.

Initially I was not sure if this was possible, but I just check and we can
detect if a node is a CDATA via the Node.getNodeType() ==
Node.CDATA_SECTION_NODE.

Lets assume that there is no autoTrim in ConfigurationService and we have a
mbean that looks like this:

  <mbean code="org.jboss.web.WebService"
         name="DefaultDomain:service=Webserver">
    <attribute name="Port">
      8083
    </attribute>
  </mbean>

The value of Port should resolve to "8083".

  <mbean code="org.jboss.web.WebService"
         name="DefaultDomain:service=Webserver">
    <attribute name="Port">
      <!CDATA[8083]]>
    </attribute>
  </mbean>

The value of Port should still resolve to "8083", since we can cast aside
the first node, since it is empty and its sibling is a cdata.

To make this work, some modifications will be required to look for empty
nodes with siblings that are CDATA.  We could also support comments inside,
such that this would also work:

  <mbean code="org.jboss.web.WebService"
         name="DefaultDomain:service=Webserver">
    <attribute name="Port">
      <!-- use this port -->
      8083
    </attribute>
  </mbean>

Any ways, I think that this would be very, very helpful to allow more
freedom with respect to usage of XML syntax, and provide a mechanism to
indicate that whitespace should not be trimmed.

Any comments?

--jason


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to