I want to use XMLConstants of J2SE lib. The problem is IDE just understands XMLConstants class here is of Stax API. XMLConstants class of Stax API doesn't have W3C_XML_SCHEMA_NS_URI property. That's why Eclipse can't compile my java file. I can't remove Stax API from my program because there are some others places I used it. Do you know how to solve this one? Thanks very much.
The import should make sure you're using the JSE class and not the Stax class. It's only available since Java 5.0 though. Are you perhaps still using Java 1.4?
Single import statements always take precedence over wildcard import statements (e.g. import java.util.*) so with that line either you are using the right class or the entire import will cause a compiler error.
That's what I thought at first too, Rob, but acting on a hunch, I downloaded the jar (thanks for the link!) The API jar file actually includes its own copy of javax/xml/XMLConstants.class , as vile as that may seem to us.
My recommendation to you, Vu Pham, would be to build your own stax.jar which didn't include this class; just removing the file from the jar. You could just un-jar it, delete that one class, and re-jar it.