Parsing, strange behaviour

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Parsing, strange behaviour

Postby finucas » Wed Jul 21, 2010 4:26 pm

Hi, hopefully someone can finally answer a question on this forum for me.

I have such a strange problem and am tearing out my hair because of it.

I have build three SaxHandlers now w/o any problems,

I have built another to handle html,

its finding start and end tags fine, i can print these to my log, its laso finding attributes in the div tag,
this should have taken a few minutes to do but when i add in a simple if statement everything goes pare-shaped,

Ok in start elm i would have

if (localName.equalsIgnoreCase("div"))

idTag = attrs.getValue("id");

i would now print this to the log to see what the id tag contained and everything is fine!

when i try and do a simple if stament on it like so

if(idTag.contains("parent-fieldname"))
{
Log.v("parse","GO GO GO");
}

i also tried

if(idTad.equal("parent-fieldName"))
{
Do someting
}

It stops parsing with these if statments?? wtf?

is it something to do with processing inside the startElm or endElm methods?

I'm completely at a loss.

Thanks

heres some code

@Override
public void startElement(String uri, String localName,String qName, Attributes attrs) throws SAXException
{



//Log.v("parse","Start elm = "+localName);

// If Div tag get attributes
if (localName.equalsIgnoreCase("div"))
{

idTag = attrs.getValue("id");
Log.v("parse","start div = "+localName);

Log.v("parse","idTag ="+idTag);
//idTag.trim();

if(idTag.equals("parent-fieldname"))
{
Log.v("parse","GO GO GO)");
}



//Log.v("parse","id = "+id);

// Add identifier1 to Database
// next add the found title to databse

}

// Get resources information


}
finucas
Freshman
Freshman
 
Posts: 6
Joined: Tue Jul 13, 2010 4:26 pm

Top

Re: Parsing, strange behaviour

Postby limteckchai » Thu Jul 22, 2010 5:13 am

Sorry, even though i can't help u, i got a tip for u.

Please seperate your codes from your text, two quick glances and i still do not see your question.
limteckchai
Experienced Developer
Experienced Developer
 
Posts: 92
Joined: Mon Jun 28, 2010 3:33 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 8 guests