• 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 parser

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys, what is exception? How I can fix it? Thanks in advance!

 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please don't use images to show errors. Please copy and paste the error as text into your posts.

Also, show the xml that is being parsed.
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:Please don't use images to show errors. Please copy and paste the error as text into your posts.

Also, show the xml that is being parsed.



title : Parallel Integer Sorting and Simulation Amongst CRCW Models.
title : Pattern Matching in Trees and Nets.
title : NP-complete Problems Simplified on Tree Schemas.
title : On the Power of Chain Rules in Context Free Grammars.
title : Schnelle Multiplikation von Polynomen nullber Knullrpern der Charakteristik 2.
title : A characterization of rational D0L power series.
title : The Derivation of Systolic Implementations of Programs.
title : Fifo Nets Without Order Deadlock.
title : On the Complementation Rule for Multivalued Dependencies in Database Relations.
title : Equational weighted tree transformations.
title : Merged processes: a new condensed representation of Petri net behaviour.
title : Verifying a simplification of mutual exclusion by Lycklama-Hadzilacos.
title : A Three-Stage Construction for Multiconnection Networks.
title : The Expressive Power of Delay Operators in SCCS.
title : Calculi for Interaction.
title : A Synthesis of Several Sorting Algorithms.
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[268,35]
Message: elementGetText() function expects text only elment but START_ELEMENT was encountered.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.getElementText(XMLStreamReaderImpl.java:857)
at Parser.SAXParser.main(SAXParser.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
title : A Workload Model Representative of Static and Dynamic Characteristics.
title : Gray visiting Motzkins.
title : Trace- and failure-based semantics for responsiveness.
title : Branching Processes in the Analysis of the Heights of Trees.
title : Least Upper Bound on the Cost of Optimum Binary Search Trees.
title : The Mathematical Analysis of the Computer System Modeled as a Two Stage Cyclic Queue.
title : Invariants, Composition, and Substitution.

Process finished with exit code 0



xml file is a big (~1.7GB). It does not open in textpad.

Sorry, I paste picture here. It's only a part of xml file.



 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Alex Chun wrote:Sorry, I paste picture here. It's only a part of xml file.


Please don't do that. I cannot read anything in that image.

Just paste the part of the xml relevant to the error. What's on and around line 268?
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:

Alex Chun wrote:Sorry, I paste picture here. It's only a part of xml file.


Please don't do that. I cannot read anything in that image.

Just paste the part of the xml relevant to the error. What's on and around line 268?



Tim, I 've tried open xml by notepad, readers. They do not open it because it's too big. I do know how I can do it.
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure how you could view that on a Windows machine. Perhaps someone else will be able to help with that.

On a *NIX machine I would suggest using sed to print out a small range of lines from the whole file. I don't know if you have sed on Windows, or some equivalent even.
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:I'm not sure how you could view that on a Windows machine. Perhaps someone else will be able to help with that.

On a *NIX machine I would suggest using sed to print out a small range of lines from the whole file. I don't know if you have sed on Windows, or some equivalent even.



I have dmd file.
I 've just checked other attributes: "author", "year", "isbn", "booktitle". There are parsing without any problem. But "title" execute an exception.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without seeing line 268 we cannot see what's going wrong. All I can tell you is what the message says - you have an element that expects only text content but instead contains a nested element.
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:Without seeing line 268 we cannot see what's going wrong. All I can tell you is what the message says - you have an element that expects only text content but instead contains a nested element.



How I can print out this code in Java at [row,col]:[268,35]
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: JAXP00010001: The parser has encountered more than "64000" entity expansions in this document; this is the limit imposed by the JDK.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:601)
at Parser.SAXParser.parseTitle(SAXParser.java:62)
at Parser.SAXParser.main(SAXParser.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Process finished with exit code 0


JDK 1.8
I've read this bug was in 1.7 and before.
What is problem?
 
Tim Cooke
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your last post doesn't look relevant to your problem at all. You need to show us what data is on and around the line in error.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suspect that you are running a 32-bit JVM.

In any event, I ALSO suspect that you're attempting to process a 1.7 GB file by loading the entire freaking thing into memory.

And that there's nothing necessarily wrong with the XML other than that there's simply too much of it.

That much data rarely needs to be (or should be!) processed in RAM directly. There are other ways to handle XML that allow you to process the XML as a stream instead of as one big indigestible lump. Consider using a SAX or STaX parser instead, and it you actually want to do complex things, you might store the received data into a database where it can be more efficiently accessed.
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:I suspect that you are running a 32-bit JVM.

In any event, I ALSO suspect that you're attempting to process a 1.7 GB file by loading the entire freaking thing into memory.

And that there's nothing necessarily wrong with the XML other than that there's simply too much of it.

That much data rarely needs to be (or should be!) processed in RAM directly. There are other ways to handle XML that allow you to process the XML as a stream instead of as one big indigestible lump. Consider using a SAX or STaX parser instead, and it you actually want to do complex things, you might store the received data into a database where it can be more efficiently accessed.



Tim, yes, you're right. I run 32-bit JVM.
But I use StAX parser

PS. Yes, before I tried to use DOM-parser and I've got "Out of memory".
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if you can bring up the offending XML in your viewer program, highlight the failing parts and do a copy/paste of that segment into Notepad (or directly into the JavaRanch message editor), it will help us a lot more than screenshots.
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Well, if you can bring up the offending XML in your viewer program...



It's one of problems. Editors can not open too large file.
 
Marshal
Posts: 8856
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Alex Chun wrote:xml file is a big (~1.7GB). It does not open in textpad...It's one of problems. Editors can not open too large file.


Have you tried to download any other text editor as Notepad++, it should be able to handle files up to 2GB. Search for a different editor, surely there is some on Windows too.
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:
Have you tried to download any other text editor as Notepad++, it should be able to handle files up to 2GB. Search for a different editor, surely there is some on Windows too.



Only I tried Notepad, OpenOffice and embedded Intellij IDEA edutor


Upd. Just I've tried open it in Notepad++ and showed: "File is too big to be opened by NotePad++"
 
Alex Chun
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've decided the last problem by stackoverflow
Problem with title is not solved.
I tried to parse by "article" and got the same exception.
So title and article have emdbedded tags.
From dtd file:


<!ENTITY % titlecontents "#PCDATA|sub|sup|i|tt|ref">
<!ELEMENT title (%titlecontents;)*>
<!ATTLIST title


E.g. title contains subtags: |sub|sup|i|tt|

How it can be solved? Give me a hint please.

PS. My wife gave birth a boy yesterday
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First you've to verify whether your version of jdk falls within the category where the bug on XML Reader's entity expansion counter applies.
https://bugs.openjdk.java.net/browse/JDK-8028111

Run the short test program there to see if it provokes the error jaxp00010001.

If yes, you may consider the update of your jdk that's the best course to take.
If not, or even that is yes and before taking any update, you may try to run the workaround equally mentioned in the link see if resolves the problem.

These are what I would check.

ps Congratulations on your new baby!
 
Always look on the bright side of life. At least this ad is really tiny:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic