Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SAXPARSER - Problem while parsing HTTPS Response XML

 
Kacee Saxena
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
startElement( , ,,) method is not gettign called properly by SAXParser. The qName value is getting assigned to localName variable. Please see screenshot attached. (Not able to paste the image )
Is it some nameSpace problem ?

HTTP Response xml looks like :

<status>
<created_at>Thu Mar 23 00:03:19 +0000 2006</created_at>
<id>123</id>
<text>finished analyzing smam/ac success rates</text>
<source>web</source>
<truncated>false</truncated>
..
.
</status>

Please help
SAXPArserErr.PNG
[Thumbnail for SAXPArserErr.PNG]
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't say it doesn't get called properly - I'd say you're confused over the difference between localName and qName. The javadocs clearly state that qName can be empty.
 
Kacee Saxena
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please provide a link that has details of how SAXParser actually parses input to "localName" and "Qualified Name" string.

Getting many docs, but couldn find much relevant and detail.

Something is wrong with my code / input format(spacing) / Namespaces. Need to figure it out ASAP.

Thanks,
Kacee
 
Kacee Saxena
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understood that qName is optional as per Java docs found here :

http://java.sun.com/j2se/1.5.0/docs/api/ ( ContentHandler)


what i am not getting is I have another piece of xml input :


which gets parsed successfully with all default properties. Tokens are going to qName.
But when i am trying same with code mentioned in initial post, my qName is remaining empty.

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The relevant javadoc section states "qName: the qualified name (with prefix), or the empty string if qualified names are not available". Unless you understand under which circumstances qualified names are available, the sensible thing to do is to assume that they're not.

There's actually more about it: "the qualified name is required when the namespace-prefixes property is true, and is optional when the namespace-prefixes property is false (the default)."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic