Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML parsing Help needed

 
vijay Roger
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
 
Greg Charles
Sheriff
Posts: 2985
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
any help?
 
Paul Clapham
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic