aspose file tools*
The moose likes XML and Related Technologies and the fly likes xml parsers does not read such a large file contents Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml parsers does not read such a large file contents" Watch "xml parsers does not read such a large file contents" New topic
Author

xml parsers does not read such a large file contents

Mohan rvscas
Ranch Hand

Joined: Jul 03, 2010
Posts: 39
Hi friends,



am trying to parse and read the content from the above xml file.

am using dom parser and also i tried StAX parser to parse the xml contents.

but i cannot parse such a large file content.

could any one please help me to get out from this issue.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18643
    
    8

What problems are you having, specifically, with the Stax parser? DOM parsers build a tree of the entire document, so if the document is big enough you will get out-of-memory exceptions. But I don't think you should have that problem with a Stax parser; I would expect it to break a very large text node into a number of Character events.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Mohan rvscas wrote:
but i cannot parse such a large file content.


What happens when you try? You have to TellTheDetails(⇐click) because ItDoesntWorkIsUseless.(⇐click)
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Also:
get the content from http://172.16.12.242/file/hex.txt path because i cannot give such a large content to coderanch forum


Nobody here can get that, because it's a private IP address.(⇐click)

But even if we could, we wouldn't. All we need to know is how big it is; we don't need to see the entire content.
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2393
    
  28

If it's huge ass data in one node then even SAXParsers will falter because the SAXParser operates at the level of the node. It will have to load the entire node in memory

James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1030
    
    5

Mohan

For anyone to help you further, you must provide more information on what you have tried and what error you are getting.

If you had a problem with your plumbing and you rang a plumber and said "My water is not working", would you expect him to be able to fix the problem given that information?
Mohan rvscas
Ranch Hand

Joined: Jul 03, 2010
Posts: 39
Sorry, i gave the local ip address please change and refer the path http://122.183.130.242/file/hex.txt (this is public).

my problem :

In xml content there is a tag called field with the name field5. that has the long text. You can see the actual content in http://122.183.130.242/file/hex.txt url path.
i tried with out field5 tag its working fine but when i try with field5 tag the parser is not parsing actual content means it skips the reading and printing empty values

does my problem is meaning full? have any one understand my problem?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
If it's huge ass data in one node then even SAXParsers will falter because the SAXParser operates at the level of the node. It will have to load the entire node in memory


Only true if an Element node has a huge number of attributes. A very unlikely situation.

Text nodes are read in buffer loads which is why the characters() method can be called with fragments of a Text node. This well known pitfall for beginning XML programmers may be the cause of the OP's confusion.

Bill
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18643
    
    8

Mohan rvscas wrote:i tried with out field5 tag its working fine but when i try with field5 tag the parser is not parsing actual content means it skips the reading and printing empty values

does my problem is meaning full? have any one understand my problem?


No, I don't understand your problem. You said the parser is printing empty values: this doesn't make any sense because the parser doesn't print anything. So perhaps you meant something else by that statement. Perhaps it's your code which is causing the problem. So why don't you post your code? Or actually, post the simplest possible version of it. An SSCCE (follow and read this link) would be the best thing to post.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xml parsers does not read such a large file contents