Questions tagged [xmlstreamreader]
75 questions
14
votes
3 answers
What is the difference between XMLStreamReader and XMLEventReader?
I surf through the web. I found that the XMLStreamReader is Cursor style API for parsing XML. And XMLEventReader is Iterator style API for Parsing XML.Could any one tell me in detail?

Arunselvan
- 163
- 1
- 1
- 8
9
votes
3 answers
StAX XML all content between two required tags
Starting learning the StAX, using XMLStreamReader, I faced with some problem. How can I get ALL content between tags as Text? I mean, I know name of needed tag, and when I find it, I must go to the close tag, and everything I found between them I…

Den Doeson
- 168
- 1
- 13
7
votes
2 answers
How to get the element of and invalid xml file with failed xsd Validation
I am currently using my XSD to Validate my xml. This part works fine my porblem is that I want to obtain the element of the tag /value that is invalid.
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(xml));
…

bubblebath
- 939
- 4
- 18
- 45
6
votes
5 answers
Convert Java w3c Document to XMLStreamReader
I would like to reuse some existing code in our code base that accepts an XMLStreamReader my application has the required data as a w3c Document.
The following example is a minimum test case:
public static void main(String[] args) throws Exception…

Gareth Davis
- 27,701
- 12
- 73
- 106
5
votes
1 answer
Get an InputStream/io.Reader from OMElement object
I have a OMElement object and from that I want to get an InputStream or reader object. What I want is to stream the xml from the OMElement which I have, without getting loaded into memory. I only could be able to get XMLStreamReader object from…

erandi
- 51
- 3
5
votes
1 answer
How to get the full content of an XML file as a String using XmlStreamReader?
I'm in a part of an application where I have an access to the XmlStreamReader which is representing the XML file needed to be fully read into a String.
Is there a way to obtain the XML content without building another XmlStreamReader or using…

M. A. Kishawy
- 5,001
- 11
- 47
- 72
5
votes
1 answer
Can't Java XMLStreamReader have attribute values with higher Unicode planes?
Lets create an XML file with two attribute values witch contain an extended unicode char
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new…

markus falkhausen
- 73
- 1
- 6
5
votes
2 answers
Java XMLStreamReader, how to get element text when text contains START_ELEMENT
If I have an XML element such as:
this is a title
The text is very easy to get using XMLStreamReader.getElementText(). However, if I run into an element like this, I cannot figure out how to get the text:
this is a…

The111
- 5,757
- 4
- 39
- 55
4
votes
1 answer
How can we parse the DOCTYPE information using XMLEventReader?
I have some existing code which parses the top-level element namespace to determine what kind of XML file we're looking at.
XMLEventReader reader = createXMLEventReader(...);
try {
while (reader.hasNext()) {
XMLEvent event =…

Hakanai
- 12,010
- 10
- 62
- 132
4
votes
2 answers
Reading an XML Feed into XElement
I have an Xml Stream that I'd like to read into an XElement. I've seen samples that use XmlTextReader but I need it in an XElement.
The code that I have so far:
string url =
String.Format(…

Armstrongest
- 15,181
- 13
- 67
- 106
4
votes
3 answers
XMLStreamReader for Objective C iPhone?
I am using XMLWriter for generating the xml. Now I want to read this xml with some Reader library/framework. Is there any complementary framework/library available for this.
I am currently looking to use TouchXML library to read this, but its not…
user573842
3
votes
1 answer
Stax XMLStreamReader check for the next event without moving ahead
I have a large XML file that consists of many events. I would like to unmarshal them. As it's a large file, I would like to unmarshal them one by one so the whole file is not stored in memory. It works for some events but fails for some due to the…

BATMAN_2008
- 2,788
- 3
- 31
- 98
3
votes
1 answer
XMLStreamReader - Strange error
I have the following XML code
medium
weak
…

Joeblackdev
- 7,217
- 24
- 69
- 106
3
votes
1 answer
How to read namespace as it is in a xml using XMLStreamReader?
I have an xml file from which i read using an XMLStreamReader object.
So i'll keep it simple :
Let's take this xml example :
So what i need is to get the value…

maher.belkh
- 473
- 2
- 7
- 21
3
votes
0 answers
XMLStreamReader skips elements
I am trying to analyse wikipedia articles from dump. The file zhwiki-latest-pages-articles.xml is a huge XML file. I decided to use XMLStreamReader to read the file and import to the database.
The problems is XMLStreamReader does not recognize some…

Shisoft
- 4,197
- 7
- 44
- 61