[jdom-interest] Newbie - need help

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


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


           // 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");
               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">


- <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 

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






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



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