936 questions
275
votes
7
answers
257k
views
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 ...
44
votes
4
answers
18k
views
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 ...
31
votes
5
answers
52k
views
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 '...
22
votes
7
answers
18k
views
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
...
18
votes
3
answers
39k
views
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); ...
17
votes
3
answers
15k
views
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.
17
votes
3
answers
7k
views
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 ...
16
votes
3
answers
22k
views
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....
16
votes
8
answers
12k
views
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 ...
16
votes
6
answers
2k
views
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);
...
13
votes
2
answers
4k
views
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 ...
12
votes
1
answer
66k
views
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 ...
11
votes
5
answers
61k
views
The element type "META" must be terminated by the matching end-tag "</META>"
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" ...
11
votes
3
answers
13k
views
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 ...
10
votes
1
answer
10k
views
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 ...
9
votes
1
answer
38k
views
How to get element's value from XML using SAX parser in startElement?
Is it possible to get the content of an element from a XML file in startElement function that is the override function of the SAX handler?
Below is the specification.
1) XML file
<employees>
...
8
votes
9
answers
12k
views
A lightweight XML parser efficient for large files?
I need to parse potentially huge XML files, so I guess this rules out DOM parsers.
Is out there any good lightweight SAX parser for C++, comparable with TinyXML on footprint?
The structure of XML is ...
8
votes
4
answers
23k
views
SAX parser: Ignoring special characters
I'm using Xerces to parse my XML document. The issue is that XML escaped characters like &nbsp; appear in characters() method as non-escaped ones. I need to get escaped characters inside ...
8
votes
3
answers
14k
views
Difference between SAXParser and XMLReader
What is the difference between below two snippet, if i just have to parse the XML?
1.By using SAXParser parse method:
SAXParserFactory sfactory = SAXParserFactory.newInstance();
SAXParser parser = ...
8
votes
2
answers
12k
views
Android parse Plist file
Hello Im trying to parse an plist file that contains array of dict's. Im trying to do this using xmlwise. The content of the plistfile is here
So far I only have this in my activity and im getting ...
7
votes
5
answers
19k
views
using SAX parser, how do you parse an xml file which has same name tags but in different elements?
Is it possible to give path expressions in SAX parser? I have an XML file which has a few same name tags, but they are in different element. Is there any way to differentiate between them.
Here is the ...
7
votes
2
answers
20k
views
SAXParser equivalent in C#
I have below java code , I need to convert these in C#, Kindly help me ..
public class Configuration {
private ConfigContentHandler confHandler;
public Configuration() {
}
public boolean ...
7
votes
3
answers
21k
views
Why am I getting "MalformedURLException: no protocol" when using SAXParser?
I'm copying code from one part of our application (an applet) to inside the app. I'm parsing XML as a String. It's been awhile since I parsed XML, but from the error that's thrown it looks like it ...
7
votes
7
answers
8k
views
Parsing big XML files using SAX parser (skip some lines/tags)
I am currently developing an app that retrieves data from the internet using SAX. I used it before for parsing simple XML files like Google Weather API. However, the websites that I am interested in ...
7
votes
3
answers
29k
views
Open XML file from res/xml in Android
I created a Java application which opens an xml file that looks something like this:
<AnimalTree>
<animal>
<mammal>canine</mammal>
<color>blue</color>
&...
7
votes
3
answers
3k
views
How to save & update the values in xml file?
I am reading a xml file from the SD card. Here I want to change the values of the XML file and I want to save the file to the sd card..
My code is like below.... Please guide me how to save XML file ...
7
votes
3
answers
7k
views
Handling Empty Tags in XML using Sax Parser, Java
I'm Using a Sax parser to handle a pre-written XML file....i have no way of changing the XML as it is held by another application but need to parse data from it. The XML file contains a Tag
< ...
6
votes
4
answers
6k
views
Android: Best parser to parse XML data [closed]
I am developing an application in which the first time I am going to parse data from an xml file coming from a remote server.
But i am not able to select which parser is efficient or best suited for ...
6
votes
2
answers
17k
views
How to get "xmlns:XXX" attribute if set setNamespaceAware(true) in SAX?
Here is my code:
path = wsdlPath;
SAXParserFactory saxfac = SAXParserFactory.newInstance();
saxfac.setNamespaceAware(true);
saxfac.setXIncludeAware(true);
saxfac.setValidating(false);
SAXParser ...
6
votes
2
answers
19k
views
Solve security issue parsing xml using SAX parser
I have an android app, in which user can enter any xml source url to parse. My app then parses the xml(if valid) and displays results.
The issue is, if the user enters an untrusted xml source url, ...
6
votes
1
answer
755
views
How can I fetch specific nodes from XML using XPath in Java?
My xml file structure is like this
<?xml version="1.0" encoding="utf-8" ?>
<book>
<chapters>
<chapter id="1">
<page id="1" cid= "1" bid = "Book1"&...
6
votes
2
answers
6k
views
SAX parser get attribute from endelement
I use SAX XML Parser and when I use:
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException
I can get attributes.
But I need get ...
5
votes
2
answers
13k
views
performing xml validation against xsd
I have XML as a string and an XSD as a file, and I need to validate the XML with the XSD. How can I do this?
5
votes
1
answer
6k
views
Sax - ExpatParser$ParseException
I'm making an Android application that reads an XML Internet. This application uses SAX to parse XML. This is my code for the part of parsing:
public LectorSAX(String url){
try{
...
5
votes
2
answers
5k
views
Using SAX parser on xml file inside a zip
This may be beyond the capabilities of the Java VM due to the size of the files being dealt with (50-100MB xml files)
Right now I have a set of xml files sent as zips, which are in turn all ...
5
votes
3
answers
7k
views
translate xml to json in node.js
could you, please, point me to some working xml -> json translation library for node.js?
A SAX-styled would be preferable to get things done while the xml file is still receiving.
Thanks
5
votes
2
answers
2k
views
SAXParser fails to parse some characters
I am doing some simple SAXParsing with SAXParser etc on android/java
It can parse files properly, but hiccups when it encounters some special characters, for example if it parses this xml below:
<...
5
votes
2
answers
2k
views
parsing XML in Java using SAX: value cut in 2 halves
I am trying to read a file format that is based on xml and is called mzXML using SAX in JAVA. It carries partially encoded mass spectrometric data (signals with intensities).
This is what the entry ...
5
votes
2
answers
25k
views
org.xml.sax.SAXParseException: Invalid byte 2 of 3-byte UTF-8 sequence
I am encountering the above error in production environment whereas the process went fine in UAT.
I was wondering whether this error is related to jar file loading. We are using webmethods and the ...
5
votes
1
answer
3k
views
Android: why use XMLReader?
Is there any reason why I should use a XMLReader with the SAXParser? I'm seeing this kind of usage quite a lot:
sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
...
5
votes
1
answer
2k
views
Jython and the SAX Parser: No more than 64000 entities allowed?
I've done a simple test of the xml.sax parser in Jython on a large XML file (800 MB) and encountered the following error:
Traceback (most recent call last):
File "src/project/xmltools.py", line 92, ...
5
votes
1
answer
4k
views
Parse XML with SAX in java, case insensitive.
I can parse xml just fine with SAXParserFactory in Java, BUT in some files,
there are some non-lowercase attributes present, like linear3D="0.5" etc.
I would like to somehow make
attributes.getValue(...
5
votes
2
answers
267
views
Why does SAXParser read so much before throwing events?
Scenario: I'm receiving a huge xml file via extreme slow network so I want so start the excessive processing as early as possible. Because of that I decided to use SAXParser.
I expected that after a ...
5
votes
1
answer
4k
views
how to ignore XML errors when parsing faulty XML with Sax (on Android)
Question on the Sax XML parser on Android, using Java: I need to parse XML files I get from the web, and that I have no control over. Some contain errors and cause the parser to abort with errors like ...
5
votes
1
answer
3k
views
How to apply validation of local DTD file to xml file in java?
I need to parse a bunch of incoming XML documents but it does not contain DTD declaration. Currently I am parsing xml documents using SAX Parser but without DTD validation. Now I want to apply DTD ...
4
votes
2
answers
5k
views
org.apache.harmony.xml.ExpatParser$ParseException(invalid token)
I am Using following two methods for parsing my Xml Data:
private static XMLReader prepareSAX() throws ParserConfigurationException,
SAXException {
SAXParserFactory spf = SAXParserFactory....
4
votes
2
answers
24k
views
How to set FEATURE_SECURE_PROCESSING in XMLReaderFactory?
I am using Piccolo jar and creating XML reader using XMLReaderFactory.
I need to set the secure processing feature and hence i did this way,
xmlReader = XMLReaderFactory.createXMLReader("com.bluecast....
4
votes
2
answers
13k
views
get body content of html file in java
i'm trying to get body content of html page.
suppose this html file:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www....
4
votes
2
answers
3k
views
xml.sax parser and line numbers etc
The task is to parse a simple XML document, and analyze the contents by line number.
The right Python package seems to be xml.sax. But how do I use it?
After some digging in the documentation, I ...
4
votes
3
answers
562
views
How to use SAX on this xml file
I have an XML file that I am trying to parse with Sax (this is my first time doing this). I've researched how to implement the parser, and that all makes sense, but I'm unsure of the best way to ...