stax

Small modification to an XML document using StAX

I'm currently trying to read in an XML file, make some minor changes (alter the value of some attributes), and write it back out again. I have intended to use a StAX parser (javax.xml.stream.XMLStreamReader) to read in each event, see if it was one I wanted to change, and then pass it straight on to the StAX writer (javax.xml.stream.XML...

How would you use Java to handle various XML documents?

I'm looking for the best method to parse various XML documents using a Java application. I'm currently doing this with SAX and a custom content handler and it works great - zippy and stable. I've decided to explore the option having the same program, that currently recieves a single format XML document, receive two additional XML docu...

Best StAX Implementation

My quick search reveals the reference implementation (http://stax.codehaus.org), the Woodstox implementation (http://woodstox.codehaus.org), and Sun's SJSXP implementation (https://sjsxp.dev.java.net/). Please comment on the relative merits of these, and fill me in on any other implementations I should consider. ...

JAXB or StAX Message Limits

I'm current developing a WebService in a Bea Websphere 6.1 environment with Axis 2 implementation, I'm trying to respect the current standards for Web Services (JAXB, JAXWS, StAX...). How long can be an XML message on this platform? I've searched around but I haven't found anything related to this topic. ...

StAX XML formatting in Java

Is it possible using StAX (specifically woodstox) to format the output xml with newlines and tabs, i.e. in the form: <element1> <element2> someData </element2> </element1> instead of: <element1><element2>someData</element2></element1> If this is not possible in woodstox, is there any other lightweight libs that can do this? ...

How do I stop the Sun JDK1.6 builtin StAX parser from resolving DTD entities

I'm using the StAX event based API's to modify an XML stream. The stream represents an HTML document, complete with DTD declaration. I would like to copy this DTD declaration into the output document (written using an XMLEventWriter). When I ask the factory to disregard DTD's it will not download the DTD, but remove the whole statement a...

How do I format and read XML processing instructions using Java StAX?

First, how do I format the XML processing instruction, is it: <?processingInstructionName attribute="value" attribute2="value2"?> Using StAX, I then want to read it by handling the XMLStreamConstants.PROCESSING_INSTRUCTION (javadoc) event, but it only provides two methods to then retrieve information about the processing instruction f...

Logic (if any) behind Google App Engine excluding standard JDK 1.6 APIs

It looks like GAE has chosen a subset of JDK 1.6 classes, as per: Google App Engine JDK white list which is very unfortunate as one gets class linkage errors all over the place with most common java libraries that deal with data binding, reflection, class loading and annotations. Although some omissions may be for deprecated or legacy ...

StAX parsing from Java NIO channel

I am attempting to receive a stream of XML events over a Java NIO channel. I am new to both NIO and StAX parsing, so I could very easily be overlooking something :) My search has led me to several SAX and StAX implementations, but they all seem to operate on InputStreams and InputSources--not NIO channels. The two closest attempts I hav...

self-closing tags with XMLEventWriter

So the question is pretty much as stated in the title. I am doing some xml work and using XMLEventWriter. The big issue I'm having is that I need to create some self closing tags The problem is that I haven't figured out a way to do this with the eventWriter. I have tried everything I can think of using XMLEventFactory but nothi...

How to do encryption/decryption in xml with StAX?

Hi, One of the reason I use StAX is because of it low memory consumption in processing large xml files. I've been requested to encrypt the whole xml files, and decrypt them later. The easier solution I can come up with, without having major change to existing code, is encrypt content only. xsw.writeStartElement("row"); xsw.writeC...

which .jar file has javax.xml.stream.* ?

Going nuts again with my Mac running Java 1.5.... where do I get a .jar file that has javax.xml.stream.XMLInputFactory ? I want to use StAX but don't know how to get it set up right. :::scream::: I can't seem to get this setup. I've now downloaded jaxp-api.jar, jsr173_1.0_api.jar, sjsxp.jar, stax-api-1.0.1.jar, stax2-api-3.0.1.jar, an...

StAX - how to set XMLInputFactory.IS_VALIDATING to true?

Hi, this is my first time using StAX for parsing XML documents (still in the learning stage). During the process to parse an XML document using XMLStreamReader and generate a copy of the document using XMLStreamWriter, I encountered the following warning represented as a comment in the output of the writer: <!-- Exception scanning Ext...

StAX Writer Implementation for C/C++

Are there any other STaX Writer implementation for C/C++ except libxml2? ...

Can XSLT processors be multi-threaded?

Hi everyone, I'm fishing for approaches to a problem with XSLT processing. Is it possible to use parallel processing to speed up an XSLT processor? Or are XSLT processors inherently serial? My hunch is that XML can be partitioned into chunks which could be processed by different threads, but since I'm not really finding any documentat...

Is there a Java XML API that can parse a document without resolving character entities?

I have program that needs to parse XML that contains character entities. The program itself doesn't need to have them resolved, and the list of them is large and will change, so I want to avoid explicit support for these entities if I can. Here's a simple example: <?xml version="1.0" encoding="UTF-8"?> <xml>Hello there &something;</xm...

How do I prevent a pair of XMLEvent[Reader|Writer] from splitting empty tags into start+end tags?

Hello, everyone! I have an understanding problem of how the following code works: XMLInputFactory xif = XMLInputFactory.newFactory(); XMLOutputFactory xof = XMLOutputFactory.newFactory(); XMLEventReader reader = xif.createXMLEventReader(/* ... */); XMLEventWriter writer = xof.createXMLEventWriter(/* ... */); writer.add(reader); The...

Validation using JAXB and Stax to marshal XML document

I have created an XML schema (foo.xsd) and used xjc to create my binding classes for JAXB. Let's say the root element is "collection" and I am writing N "document" objects, which are complex types. Because I plan to write out large XML files, I am using Stax to write out the "collection" root element, and JAXB to marshal document subtr...

Stax processing instruction

I'm trying to parse a processing instruction like this using StAX: <?item something="<some_element></some_element>"?> StAX doesn't appear to recognize this as a processing instruction. It finds these events: < - CharacterEvent ?item something=" - CharacterEvent <some_element> - StartEvent </some_element> - EndEvent "?> - CharacterE...

XMLStreamReader and a real stream

Update There is no ready XML parser in Java community which can do NIO and XML parsing. This is the closest I found, and it's incomplete: http://wiki.fasterxml.com/AaltoHome I have the following code: InputStream input = ...; XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance(); XMLStreamReader streamReader = xmlInputFactor...