Questions tagged [saxparser]

SAX (Simple API for XML) is an event-based parser for XML documents.

SAX is an alternative model to DOM for processing XML documents. Where DOM works on the document as a whole, SAX works piece by piece.

935 questions
268
votes
7 answers

What is the difference between SAX and DOM?

I read some articles about the XML parsers and came across SAX and DOM. SAX is event-based and DOM is tree model -- I don't understand the differences between these concepts. From what I have understood, event-based means some kind of event happens…
user414967
  • 5,225
  • 10
  • 40
  • 61
42
votes
4 answers

What is 'Push Approach' and 'Pull Approach' to parsing?

Under the push parsing approach, a push parser generates synchronous events as a document is parsed, and these events can be processed by an application using a callback handler model This is the text given in the book Pro XML Development with…
An SO User
  • 24,612
  • 35
  • 133
  • 221
31
votes
5 answers

How to disable accessExternalDTD and entityExpansionLimit warnings with logback

I'm using logback with groovy and get lots of warnings showing up when parsing xml. I am aware of the bug in JDK1.7_u45 that is causing this. Warning: org.apache.xerces.parsers.SAXParser: Property…
msoori
  • 351
  • 1
  • 4
  • 6
22
votes
7 answers

SAX parser vs XMLPull parser

I understand the difference between how the SAX parser works vs the XMLPull parser. In fact there's a pretty good explanation here: http://www.firstobject.com/xml-reader-sax-vs-xml-pull-parser.htm The article is a bit .NET centric but the concepts…
Nelson Ramirez
  • 7,864
  • 7
  • 28
  • 34
17
votes
2 answers

How to retrieve value of an attribute which contains colon in the attribute name using xpath

I have a simple requirement where in I need to fetch the value of attribute xml:id i.e af1. I am making use of a SAXParser and here is my xpath:a/aff/@xml:id on the contrary I was able to fetch value of using the xpath:a/aff/@value. But i was unable…
KRISHNA JAYANTH
  • 233
  • 3
  • 11
17
votes
3 answers

With SAX Parser, get an attribute's value

I am parsing XML from the web using Android. The code below shows a sample of the XML. The problem I'm having is I can't get the string value of the item tag. When I use name = attributes.getQName(i); it outputs the name, not the value of the…
carsey88
  • 377
  • 2
  • 6
  • 15
16
votes
3 answers

javax.xml.parsers.SAXParserFactory ClassCastException

I get on my local machine the following exception when running the tests by maven (mvn test). ch.qos.logback.core.joran.event.SaxEventRecorder@195ed659 - Parser configuration error occured java.lang.ClassCastException:…
rit
  • 2,308
  • 3
  • 19
  • 27
16
votes
8 answers

How to solve the XML parsing performance issue on Android

I have to read a XML file with about ~4000 lines on Android. First I tried the SimpleXML library because it's the easiest and it took about 2 minutes on my HTC Desire. So I thought maybe SimpleXML is so slow because of reflection and all the other…
Korbi
  • 1,438
  • 4
  • 15
  • 22
16
votes
6 answers

Getting UnknownLengthHttpInputStream while getting InputStream from HttpURLConnection in android

HttpURLConnection.getInputStream() gives UnknownLengthHttpInputStream and due to this Document parsing throws SAX parser exception. Following is the code try{ URL url = new URL(uri); HttpURLConnection connection = (HttpURLConnection)…
Achsah
  • 543
  • 4
  • 16
16
votes
3 answers

Difference among XML SAX parser, Pull parser & DOM Parser in android

I want to know what's the difference between XML SAX parser, Pull parser & DOM parser in Android. In which condition, which one is better in performance and implementation? Thanx. Khobaib.
Khobaib
  • 1,577
  • 3
  • 21
  • 29
13
votes
2 answers

What is the difference between XML Pull Parser and SAX Parser

I am searching for the main difference between SAX and Pull Parser . I know the SAX parser is good for handling the large XML file as it does not store the XML and traverse in only one direction. as compared to DOM. But I am unable to find the major…
sharma.mahesh369
  • 985
  • 11
  • 28
12
votes
1 answer

decode string encoded in utf-8 format in android

I have a string which comes via an xml , and it is text in German. The characters that are German specific are encoded via the UTF-8 format. Before display the string I need to decode it. I have tried the following: try { BufferedReader in =…
user590849
  • 11,655
  • 27
  • 84
  • 125
11
votes
3 answers

SaxParser on Android: Unexpected End Of Document Exception

I'm getting a "SAXParseException: Unexpected end of document" error when trying to parse an xml document on android. The document in question is from the google weather api, but it seems to throw the same error regardless of the xml file in…
Dave Smylie
  • 2,663
  • 3
  • 25
  • 32
11
votes
5 answers

The element type "META" must be terminated by the matching end-tag ""

I've got the following error sometimes when I'm try to parse a XML file with Java (within GAE server): Parse: org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 3; The element type "META" must be terminated by the matching end-tag…
danny11
  • 483
  • 1
  • 5
  • 12
10
votes
1 answer

How to use xml sax parser to read and write a large xml?

I'm trying to remove all the project1 nodes (along with their child elements) from the below sample xml document (original document is about 30 GB) using SAX parser.It would be fine to have a separate modified file or ok with the in-line…
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274
1
2 3
62 63