DOM object

R

Raju

Hi
I am using JDK1.2.2,DOM objects to parsing the XML file.When i am
reading the Element it is having some #text nodes.How do i remove
them.
when i am writing removeNode(int),It is not compiling .I dont know
JDK1.2.2 has this method or not.
Can any one help me how do i remove #textnodes.

Here i am giving sample of my code
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
dbf.setNamespaceAware(false);
DocumentBuilder parser = dbf.newDocumentBuilder();
Document doc = parser.parse(httpURLconn.getInputStream())

Element eBay = doc.getDocumentElement();
eBay.normalize();
Node ebayCurrentTime = eBay.getFirstChild();
//Here is the exception..when i am trying to read firstchild ..its
sending me whitespace.
System.out.println("Time " +ebayCurrentTime);
Timestamp currentEbayTime = null;

//first child should be ebay time ...but when i am reading it is
sending me white spaces....
//i am seeing there is an extra white space after each parent
tag...also...


//this is the xml response i am getting it from eBay.

<eBay> <EBayTime>2003-09-30 14:00:51</EBayTime><Errors> <Error>
<Code>8
7</Code><SeverityCode>1</SeverityCode><Severity>SeriousError</Severity><Line>0</
Line><Column>0</Column><ErrorClass>RequestError</ErrorClass><ShortMessage><![CDA
TA[Invalid category.]]></ShortMessage><LongMessage><![CDATA[The
category selecte
d is not a leaf category.]]></LongMessage></Error> </Errors> </eBay>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,588
Members
45,100
Latest member
MelodeeFaj
Top