wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes XML parsing Help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML parsing Help needed" Watch "XML parsing Help needed" New topic
Author

XML parsing Help needed

vijay Roger
Greenhorn

Joined: Apr 03, 2013
Posts: 4
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

Joined: Oct 01, 2001
Posts: 2834
    
  11

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

Joined: Apr 03, 2013
Posts: 4
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

Joined: Apr 03, 2013
Posts: 4
any help?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML parsing Help needed
 
Similar Threads
Delay while I type characters in the text box
Unicode characters - javax . xml . transform . Transformer
Unicode characters - javax . xml . transform . Transformer
Performance Recommendation for Simple XML Parsing
IBM XML certification questions