• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SAXPARSER - Problem while parsing HTTPS Response XML

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)."
 
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic