[jdom-interest] Re: RE: getChildren() returns an empty list.. (please help)

Malachi de AElfweald malachi at tremerechantry.com
Wed Oct 23 07:44:43 PDT 2002


Yes, in general, I think that looks cleaner and is easier to read.
What you had before wasn't incorrect, just redundant.

One side note though... depending on what data could be inside the
description tag, I normally make all Note/Descriptions into CDATA
tags. The reason for this is that something as simple as "Smith & Sons"
would break XML otherwise. Unless you *KNOW* they will never use
restricted characters (any character requiring escaping),
you might want to use cdata.

Example:
	<description><![CDATA[Smith & Sons]]></description>

In JDOM, it is really easy to use, as the CDATA has its own class.
	appDescr = new CDATA("Smith & Sons");
	appElem.addContent(appDescr);


Malachi


10/23/2002 3:12:17 AM, "Mirabito, Massimo" <mcm8 at cdc.gov> wrote:

>
>Hello Malachi,
> 
>As far as question 1 and  2 I was just confused because I did not realize
>that I need to traverse the tree to get to the element (thought I could just
>go to it directly)
> 
>For your 3rd question you bring up a very good point. So would this be
>better?
>
><?xml version="1.0" encoding="UTF-8"?>
><security>
>  <application>
>    <id>100</application-id>
>    <name>Application 1</application-name>
>    <description>Application 1Description</application-description>
>    <roles>
>      <role id="1" name="Role 1" description="Role 1 Desc" />
>      <role id="2" name="Role 2" description="Role 2 Desc" />
>    </roles>
>  </application>
>  <user>
>    <role id="1" name="Role 1" description="Role 1 Desc">
>      <access id="1" name="can">111111</access>
>    </role>
>    <role id="2" name="Role 2" description="Role 2 Desc">
>      <access id="2" name="irb_id">4444444</access>
>    </role>
>  </user>
></security>
>
>
>thanks in advance
>
>Max
>
>






More information about the jdom-interest mailing list