0

I Started working on Stax Parser for past three months. I used to see data or text in the stax events while debugging. This used to help me a lot while working on my task. But from past 2days,there is weird behavior. When i debugged the project, i can only see events like this...[Stax Event #1], [Stax Event #4], [Stax Event #1], [Stax Event #4]

This is giving me hard time debugging. I am woodStox stax and java 1.6.
These are dependencies i am using
 <dependency>
    <groupId>javax.xml</groupId>
    <artifactId>jsr173</artifactId>
    <version>1.0</version>
 </dependency>
 <dependency>
    <groupId>org.codehaus.woodstox</groupId>
    <artifactId>wstx-asl</artifactId>
    <version>4.0.6</version>
 </dependency>
 <dependency>
    <groupId>stax</groupId>
    <artifactId>stax-api</artifactId>
    <version>1.0.1</version>
 </dependency>
 <dependency>
    <groupId>com.sun.xml.stream</groupId>
    <artifactId>sjsxp</artifactId>
    <version>1.0.2</version>
 </dependency>


Do i need to change my settings to get back to normal behavior.
Vishwa
  • 117
  • 1
  • 2
  • 12

2 Answers2

1

You have two StAX implementations: sjsxp and woodstox, so it's kind of random which one is actually used. Most likel you'll want to remove the dependency to sjsxp.

You also have two StAX APIs: jsr173 and stax-api. Definitely avoid the former, it's buggy! With Java 6 or later you may/should also remove the latter.

chris
  • 3,573
  • 22
  • 20
  • I removed all the unwanted dependencies as suggested. The application runs but i am able to see events in the same format...[Stax Event #1], [Stax Event #4], [Stax Event #1], [Stax Event #4] while debugging...how can i see the text or data in this events while debugging. Do i need to change any other settings. – Vishwa Jul 15 '13 at 15:22
  • 1
    Instead of using `XMLInputFactory.newInstance()`, use `new WstxInputFactory()` to force Woodstox implementation. Or, use the service API as described here: http://docs.oracle.com/javaee/5/api/javax/xml/stream/XMLInputFactory.html#newInstance() – chris Jul 17 '13 at 09:10
  • I think Since i am using Java 6 or later, i am not able to see the data or text in events. Because the projects which use java 1.5, i can see the data in the events while debugging. One more question, does forcing the new WstxInputFactory() help us in improving the performance. – Vishwa Jul 17 '13 at 15:23
  • 1
    Yes, woodstox is also much faster. – chris Jul 24 '13 at 13:36
0

What code do you use to print output statements? Stax API always allows you to access any data events have; but it may not work by simply doing event.toString().

StaxMan
  • 113,358
  • 34
  • 211
  • 239