Questions tagged [sax]

SAX stands for Simple API for XML, and is an event-based way of reading XML data from a document.

SAX (Simple API for XML) is an event-based sequential access parser API developed by the XML-DEV mailing list for XML documents.
SAX provides a mechanism for reading data from an XML document that is an alternative to that provided by the Document Object Model (DOM). Where the DOM operates on the document as a whole, SAX parsers operate on each piece of the XML document sequentially.

XML processing with SAX

A parser that implements SAX (i.e., a SAX Parser) functions as a stream parser, with an event-driven API. The user defines a number of callback methods that will be called when events occur during parsing. The SAX events include (among others):

Useful references:

1784 questions
12
votes
2 answers

how to import XSD types into root schema?

This is my existing XSD schema in foo.xsd, that declares just the type:
yegor256
  • 102,010
  • 123
  • 446
  • 597
12
votes
3 answers

Light weight C++ SAX XML parser

I know of at least three light weight C++ XML parsers: RapidXML, TinyXML and PugiXML. However, all three use a DOM based interface (ie, they build their own in-memory representation of the XML document and then provide an interface to traverse and…
John Bartholomew
  • 6,428
  • 1
  • 30
  • 39
12
votes
5 answers

Java SAX parser progress monitoring

I'm writing a SAX parser in Java to parse a 2.5GB XML file of wikipedia articles. Is there a way to monitor the progress of the parsing in Java?
Danijel
  • 143
  • 2
  • 7
12
votes
3 answers

Parsing local XML file using Sax in Android

Can anyone tell me how to parse a local XML file stored in the system using SAX, with an example code? Please also tell me where can I find information on that.
apoorva
  • 195
  • 1
  • 2
  • 13
12
votes
1 answer

Parse XML string using SAX

Is there any way to parse an XML string using Android SAX?
Rui Gonçalves
  • 2,423
  • 6
  • 30
  • 42
12
votes
2 answers

How to convert String having contents in XML format into JDom document

How convert String having contents in XML format into JDom document. i am trying with below code: String docString = txtEditor.getDocumentProvider().getDocument( txtEditor.getEditorInput()).get(); SAXBuilder sb= new SAXBuilder(); doc =…
User_86
  • 265
  • 1
  • 4
  • 13
12
votes
4 answers

SAX vs XmlTextReader - SAX in C#

I am attempting to read a large XML document and I wanted to do it in chunks vs XmlDocument's way of reading the entire file into memory. I know I can use XmlTextReader to do this but I was wondering if anyone has used SAX for .NET? I know Java…
cgreeno
  • 31,943
  • 7
  • 66
  • 87
11
votes
3 answers

getChildNodes giving unexpected result

My XML looks like this- ValueGoesHere
user837208
  • 2,487
  • 7
  • 37
  • 54
11
votes
4 answers

Referring to a local DTD in Java

I have some XML that I'm parsing with a SAX parser in Java. It starts with this preamble: How do I change this to use a local…
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
11
votes
2 answers

Determining if at leaf node with SAX parser

Using org.xml.sax.helpers.DefaultHandler, can you determine whether you're at a leaf node within endElement(String, String, String)? Or do you need to use a DOM parser to determine this?
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
11
votes
4 answers

why is sax parsing faster than dom parsing ? and how does stax work?

somewhat related to: libxml2 from java yes, this question is rather long-winded - sorry. I kept is as dense as I felt possible. I bolded the questions to make it easier to peek at before reading the whole thing. Why is sax parsing faster than dom…
andersonbd1
  • 5,266
  • 14
  • 44
  • 62
11
votes
2 answers

Using SAX to parse common XML elements

I'm currently using SAX (Java) to parse a a handful of different XML documents, with each document representing different data and having slightly different structures. For this reason, each XML document is handled by a different SAX class…
Dave
  • 6,064
  • 4
  • 31
  • 38
11
votes
1 answer

How can I force a SAX parser to use a DTD if one is not specified in the input file?

How can I force a SAX parser (specifically, Xerces in Java) to use a DTD when parsing a document without having any doctype in the input document? Is this even possible? Here are some more details of my scenario: We have a bunch of XML documents…
Kaypro II
  • 3,210
  • 8
  • 30
  • 41
11
votes
5 answers

Xml not parsing String as input with sax

I have a string input from which I need to extract simple information, here is the sample xml (from mkyong): yong mook kim
Gandalf StormCrow
  • 25,788
  • 70
  • 174
  • 263
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