[jdom-interest] Newbie - need help

Mark Glass mglass at datalinx.net
Tue Apr 24 09:42:22 PDT 2001


Hi,



Is there a problem with the getText method in the Element class? My code 
runs fine until it gets to

the call for the elements childs text.



My code looks

like:

           // Get the root element
           Element root = doc.getRootElement();
                      String namespace = root.getNamespace().toString();
                     Element childElement = 
root.getChild("responseDocDirPath", ns);
                     // get the path to the response directory

//program  fails at next statement
           if ( null == (m_responseDocDirPath = 
childElement.getTextTrim() ))
               System.out.println("text in child is null");
           else
               System.out.println("Response doc Directory Path = " + 
this.m_responseDocDirPath );





My XML looks like

<?xml version="1.0" encoding="UTF-8" ?>


- <cid:part2.01040003.02090202 at netscape.com> 
<mailto:cid:part2.01040003.02090202 at netscape.com><testSimConfiguration 
xmlns="myNamespace" xmlns:xsi="schema namespace" 
xsi:schemaLocation="path to schema.xsd">



<responseDocDirPath>/usr/local/ipa/testsim/responseDocs</responseDocDirPath> 


- <cid:part3.02020502.09020008 at netscape.com> 
<mailto:cid:part3.02020502.09020008 at netscape.com><lookupTable>

- <cid:part4.04040403.08070203 at netscape.com> 
<mailto:cid:part4.04040403.08070203 at netscape.com>     <service 
name="XX_CreateRegisteredUser">

- <cid:part5.06070506.09090101 at netscape.com> 
<mailto:cid:part5.06070506.09090101 at netscape.com>         <keyElementField>

             <Xpath>/userInfo/firstName</Xpath>

          </keyElementField>

         <responseDoc 
triggerString="juan">XX_CreateRegisteredUserResponse_109.xml</responseDoc>

         <responseDoc 
triggerString="ming">XX_CreateRegisteredUserResponse_110.xml</responseDoc>

</service>

- <cid:part6.03050508.01070104 at netscape.com> 
<mailto:cid:part6.03050508.01070104 at netscape.com></lookupTable>

</testSimConfiguration>



Thanks,



Mark Glass

Datalinx Corp.

Tarrytown, NY

mglass at datalinx.net <mailto:mglass at datalinx.net><mailto:mglass at datalinx.net>




More information about the jdom-interest mailing list