• 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

XML parsing Help needed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all..I am new to the forum hoping for some help.

I have an xml to be parsed using a schema defined in xsl. I am using Streaming API for XML (StAX). Using a transfomer I am feeding the xsl I defined and xml to be parsed. But some home when XML contains the reference elements the engine is not parsing the xml properly and hence not giving desired output.
ex xml:
<a>
<b>
<c/>
<d>
<c reference='../b/c'>
</c>
</b>
</a>

If i give the above xml is and I want to get data from c node it is not parsing and not giving me the data I requested.

Instead If I give xml like this
<a>
<b>
</b>
<c>
</c>
</a>

It is working as expected. Please help me out
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vijay, welcome to JavaRanch!

Could you post the code of your parser? (Please, UseCodeTags.) At a guess, I'd say that you are parsing everything all right, and just not outputting the attribute.

Also you say your schema is defined in XSL, but do you mean XSD? If it's XSL, then maybe I don't understand what you're doing.
 
vijay Roger
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Greg Charles wrote:Hi Vijay, welcome to JavaRanch!

Could you post the code of your parser? (Please, UseCodeTags.) At a guess, I'd say that you are parsing everything all right, and just not outputting the attribute.

Also you say your schema is defined in XSL, but do you mean XSD? If it's XSL, then maybe I don't understand what you're doing.





This code is to parse xml.. I have stylesheet something like this



and sample xml will be like this


 
vijay Roger
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any help?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I notice that the XML you posted isn't well-formed. Perhaps that's your problem. But we can only guess because we don't have a good description of your problem. In fact I would go so far as to say we don't have any description of your problem -- I don't see how what you wrote in your original post relates to what you just posted.

So how about a description of your problem? You know... error messages, what happened and what was supposed to happen, that sort of thing?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic