Methods in XML--pL help

I have string...as

String xstr="<?xml version=\"1.0\"?>\n"+

"<UserGroups>\n<u_bit><![CDATA[1]]></u_bit>\n"+

"<u_title><![CDATA[public]]></u_title>\n<u_description><![CDATA[Pages are available to all visitors - no restrictions are applied]]></u_description>\n"+

"<u_used><![CDATA[1]]></u_used>\n<u_fromname/>\n<u_fromemail/>\n<pw_email/>\n<u_user/>\n<u_password/>\n</UserGroups>"+

"";

I am trying to form a xmlDoc using String Reader as follows..

java.io.Reader reader = new java.io.StringReader(xstr);

org.xml.sax.InputSource source = new org.xml.sax.InputSource(reader);

org.w3c.dom.Document xmlDoc=null;

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();

xmlDoc = builder.parse(source);

Element xmlRoot=xmlDoc.getDocumentElement();

Table_Name=xmlRoot.getNodeName();

NodeList oNodeList = xmlRoot.getChildNodes();

Node PNode=oNodeList.item(0);

But at the end...ONodeList.item(0)...does not give anything...Am I doing anything wrong...Pl help if possible soon

smita

[1293 byte] By [smitaunni] at [2007-9-26 8:24:02]
# 1

On further working on it...I could find...it is not

Node PNode=oNodeList.item(0);

But

Node PNode=oNodeList.item(1);

Then GetNodeName gives the name of the node...But getNodeValue returns null ...since Value is within the CDATA tag...Any further help How I can get the value as

"1"...the value inside the CDATA tag

smitaunni at 2007-7-1 18:59:43 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

>since Value is within the CDATA tag...

You see a "CDATA tag", as you call it, in your XML, but the parser strips that all off and normalizes it to an ordinary string. So writing

<![CDATA[public]]>

is exactly the same as writing

public

and the parser treats them identically. So identically, in fact, that there is no way for you to find out whether CDATA was used at all.

Sorry, that doesn't answer your actual question, but hopefully it prevents you looking in the wrong direction.

DrClap at 2007-7-1 18:59:43 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...