FAQ Database Discussion Community


Java XMLStreamWriter: Outputting Unicode extended characters (non-BMP)

java,xml,unicode,stax
Does anyone know how to correctly output extended characters (non-BMP, more than 1 char) using Java's XMLStreamWriter? For example, trying to output Unicode U+10480 𐒀: import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class XmlStreamWriterExtendedCharactersFail { public static void main(String[] args) throws XMLStreamException { String inlineStr =...

Java Modify XML

java,xml,stax
I want to read an XML file in Java and then update certain elements in that file with new values. My file is > 200mb and performance is important, so the DOM model cannot be used. I feel that a StaX Parser is the solution, but there is no decent...

How to alias the data type using XStream?

java,xstream,stax
I want to convert the object in to xml where it requires to give the alias for String data type. For example: public class ArrayTest { private int id=4; public String area[]; public void setArea(String ar[]) { area = ar; } } Object to xml Conversion class is like: public...

JAVA get attributes value from xml using stax parser

java,xml,rss,stax
i'm working on a project that read RSS feed using java i use this tutorial they using Stax parser my question is how i can read attributes values ? http://www.vogella.com/tutorials/RSSFeed/article.html this is the RSSReader class package de.vogella.rss.read; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import...

StAX with JAXB XML parsing Only Parsing first instance

java,xml,jaxb,stax
Hi I have an XML structure like this: <?xml version="1.0" encoding="UTF-8"?> <response> <result> <name>Chrome</name> <version>2</version> </result> <result> <name>IE</name> <version>8</version> </result> </response> I am trying to use staxx to parse out just the stuff in the middle with JAXB. The problem I am getting is that it isn't getting all result...

Escaped Characters with XMLStreamReader

java,xml,unicode,stax
I'm using the XMLStreamReader to read a xml file. The file contains escaped cahrecters in the following form: &#195;&#188;. In my opinion the two escaped charecters should represents the char "ü" (UTF-8 encoded?) But the xml Stream reader creates the following string: ã¼ Did I make something wrong during the...

Chunking XML with XMLStreamReader failing

java,xml,jaxb,stax
I am trying to chunk out a big XML into smaller pieces with StAX and JAXB. Here is the sample XML that I am working on: <asset> <entity> <record> <field> <id>remarks</id> <value>ready to test1</value> </field> </record> <record> <field> <id>input_quarter</id> <value>Jun-Sep</value> </field> </record> </entity> </asset> I want to read on record...