Questions tagged [jaxp]

The Java API for XML Processing (JAXP) enables applications to parse, transform, validate and query XML documents using an API that is independent of a particular XML processor implementation.

The Java API for XML Processing (JAXP) enables applications to parse, transform, validate and query XML documents using an API that is independent of a particular XML processor implementation.

JAXP provides a pluggability layer to enable vendors to provide their own implementations without introducing dependencies in application code. Using this software, application and tool developers can build fully-functional XML-enabled Java applications for e-commerce, application integration, and web publishing.

JAXP is a standard component in the Java platform. An implementation of the JAXP 1.3 is included in J2SE 5.0 and an implementation of JAXP 1.4 is in Java SE 6.0 and OpenJDK7. JAXP 1.4 is a maintenance release of JAXP 1.3 with support for the Streaming API for XML (StAX).

External links:

215 questions
56
votes
3 answers

Java XPath (Apache JAXP implementation) performance

NOTE: If you experience this issue as well, please upvote it on Apache JIRA: https://issues.apache.org/jira/browse/XALANJ-2540 I have come to an astonishing conclusion that this: Element e = (Element)…
Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
51
votes
2 answers

Get an attribute of a dom node

I am trying to get an attribute of an xml node example: I want to grab the name attribute of the car node. DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); …
MBU
  • 4,998
  • 12
  • 59
  • 98
39
votes
5 answers

How do I find out which JAXP implementation is in use and where it was loaded from?

I would like to provide diagnostic information about what JAXP implementation is in use, and which JAR file it was loaded from. One way to achieve this is to create in instance of, for example, a DocumentBuilderFactory, and then inspect the…
Daniel Fortunov
  • 43,309
  • 26
  • 81
  • 106
28
votes
1 answer

Java and XML (JAXP) - What about caching and thread-safety?

I'd like to know which objects can be reused (in the same or different document) when using the Java API for XML processing, JAXP: DocumentBuilderFactory DocumentBuilder XPath Node ErrorHandler (EDIT: I forgot that this has to be implemented in my…
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
24
votes
1 answer

What's causing these ParseError exceptions when reading off an AWS SQS queue in my Storm cluster

I'm using Storm 0.8.1 to read incoming messages off an Amazon SQS queue and am getting consistent exceptions when doing so: 2013-12-02 02:21:38 executor [ERROR] java.lang.RuntimeException: com.amazonaws.AmazonClientException: Unable to unmarshall…
Joel Rosenberg
  • 1,432
  • 3
  • 13
  • 15
19
votes
4 answers

Is DocumentBuilderFactory thread-safe in Java 5+?

The Java 1.4 doc for javax.xml.parsers.DocumentBuilderFactory states in no uncertain terms: An implementation of the DocumentBuilderFactory class is NOT guaranteed to be thread safe. It is up to the user application to make sure about the use of…
David Moles
  • 48,006
  • 27
  • 136
  • 235
15
votes
2 answers

jboss-deployment-structure.xml add JAXP exclusion

I am implementing XML validation which prevents XXE (External XML Entity) Injection. I borrowed some code from OWASP XXE Prevention Cheat Sheet. My code looks like this - SchemaFactory factory =…
Ankit Rustagi
  • 5,539
  • 12
  • 39
  • 70
15
votes
5 answers

How to validate an XML document using a RELAX NG schema and JAXP?

I would like to validate XML documents using RELAX NG schemata, and I would like to use the JAXP validation API. From Googling around, it appeared that I could use Jing and the ISO RELAX JARV to JAXP Bridge. Unfortunately, after adding both to my…
Avi Flax
  • 50,872
  • 9
  • 47
  • 64
12
votes
2 answers

Make JAXB go faster

I have a 8 Meg file. Marshalling using JAXB takes 1082ms, using DOM takes 862ms, using SAX takes 438ms. This is using all defaults with JDK 1.6, no extra configuration such as using woodstox is used. In an effort, to get better performance from…
More Than Five
  • 9,959
  • 21
  • 77
  • 127
10
votes
2 answers

What is the advantage of using JAXP instead of DOM / SAX directly in Java?

Being new to XML parsing I'm trying to understand the different technologies. There is a confusing amount of different technologies for different…
hamena314
  • 2,969
  • 5
  • 30
  • 57
8
votes
1 answer

JAXP: How to validate a org.w3c.dom.Document against a XML Schema

How to validate an (already parsed) org.w3c.dom.Document against a XML Schema using JAXP?
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
8
votes
1 answer

Java (JAXP) XML parsing differences of DocumentBuilder

Is there any kind of difference between DocumentBuilder.parse(InputStream) and DocumentBuilder.parse(InputSource) ? I could only find that for the first case, the parser detects the encoding from the stream so it is safer while in the latter…
Cratylus
  • 52,998
  • 69
  • 209
  • 339
8
votes
6 answers

Invalid JAXP API when unmarshaling JAXB

I have a JAXB object I can unmarshal fine. However, if I add a Element[] field annotated with @XmlAnyElement, when attempting to unmarshal it throws: java.lang.IllegalStateException: You are running with invalid JAXP api or implementation. JAXP…
samblake
  • 1,517
  • 3
  • 16
  • 33
8
votes
4 answers

Workaround for XMLSchema not supporting maxOccurs larger than 5000

My problem is with parsing an XSD Schema that has elements with maxOccurs larger than 5000 (but not unbounded). This is actually a know issue in either Xerces (which I'm using, version 2.9.1) or JAXP, as described here:…
mzywiol
  • 386
  • 1
  • 3
  • 11
8
votes
2 answers

Difference SAXParserFactory XMLReaderFactory. Which one to choose?

Both of them seem to have the same purpose (create a XMLReader). Some Tutorials contain the one, some the other. SAXParserFactory: http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/SAXParserFactory.html seems to be more configurable more…
juwens
  • 3,729
  • 4
  • 31
  • 39
1
2 3
14 15