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
0
votes
1 answer

Reading XML for getting entities

I'm using SAX (Simple API for XML) to parse an XML document. My purpose is to parse the document so that i can separate entities from the the XML and create an ER Diagram from these entities (which i will create manually after i get all the entities…
Subhan
  • 1,544
  • 3
  • 25
  • 58
0
votes
1 answer

Using the SAX characters method to parse PCDATA from an XML element

I'm using the SAX API to parse in an xml document, but struggling to store the element PCDATA from each location within the XML. The Oracle docs SAX API show that the characters() is used to parse in PCDATA from an element, but I'm not sure on how…
Brian Var
  • 6,029
  • 25
  • 114
  • 212
0
votes
2 answers

Get all the tags and values from XML using SAX parser in java

I am trying to parse xml using SAX. I want all the tags and their values from xml in nested way. Is it possible with SAX parser. Can anyone provide me an example. (I think SAX is efficient than w3 document builder, So I chose it. And I want to know…
Nikhitha Reddy
  • 285
  • 7
  • 19
0
votes
1 answer

Java - how to adress a Hashtable in a Hashtable

I'm currently trying to write an XML Parser with SAX and want to save the elements of an XML file into a Hashtable, but for this I need another one in that first table ( like this ): Hashtable> table; My question is…
user263980
  • 31
  • 1
  • 6
0
votes
1 answer

Writing xml using contentHandler

Using contentHandler I want to produce this xml 123 456 How to write elements using…
bhar
  • 67
  • 2
0
votes
0 answers

SAXparser method's arguments

I am using a method to use SAXparser which uses an extended version of the defaulthandler. as a result, when trying to use parser method with inputstream and the extended defaulthandler arguments, it gives an error saying that it can not find a…
lonesome
  • 2,503
  • 6
  • 35
  • 61
0
votes
1 answer

Error reading Xml Attribute Values using SAX

I am having some strange behaviour when reading xml attribute values with SAX. It seems to be a bug in the SAX library I am using which is the system default. Xml is very simple:
user1472672
  • 313
  • 1
  • 9
0
votes
1 answer

XML Sax parser doesn't parse as supposed. XML-file seems fine

My sax parser is working fine for other xml files, however for this file it's not working. Before formatting and after xml file formatted I can't find what's wrong in the XML code, some online validators says it's ok, and some doesn't. I have put a…
Jakkra
  • 641
  • 8
  • 25
0
votes
1 answer

SAX parsing and parent / child relations

So I am facing this issue where I am required to parse an XML file to popluate domain objects. Sounds simple enough, however, an element within the XML file can have an unknown ammount of children, hence the domain object can have a instance…
Mark Stroeven
  • 676
  • 2
  • 6
  • 24
0
votes
1 answer

java.io.UTFDataFormatException: Invalid UTF8 encoding

I am using sax parser to parse some xml files. While trying to do that i am hitting exception as: java.io.UTFDataFormatException: Invalid UTF8 encoding. at oracle.xml.parser.v2.XMLUTF8Reader.checkUTF8Byte(XMLUTF8Reader.java:174) at…
Vik
  • 8,721
  • 27
  • 83
  • 168
0
votes
1 answer

Parsing XML-response and store to a container

I'm making HTTP-queries to a website and response I get is in XML-format. What I want to do is make multiple queries, parse data and have them in an ArrayList or some other container so I can easily access each query's data. I've been using some…
mpak
  • 2,458
  • 2
  • 13
  • 19
0
votes
2 answers

Extract tags from xml in string to array

I want to extract below xml data received in string variable to a list. Is it best to use an SAX parser or Xpath and which is quickest way? It would also be helpful if you can guide me with some code. Input String
rVr
  • 1,331
  • 8
  • 11
0
votes
1 answer

Why did PortStemmer in NLTK converts my "string" into u"string"

import nltk import string from nltk.corpus import stopwords from collections import Counter def get_tokens(): with open('comet_interest.xml','r') as bookmark: text=bookmark.read() lowers=text.lower() …
Hao Wu
  • 143
  • 1
  • 11
0
votes
2 answers

Missing string using Python xml.sax to parse XML file

I am trying to parse a XML file with Python 2.7 Here is the XML file I am using:
ChangeMyName
  • 7,018
  • 14
  • 56
  • 93
0
votes
2 answers

Java Help: why can't I access the static methods declared in a class outside the current main method file

Following the JavaDocs tutorial for SAX: The method usage() is not recognised from the main method. As far as I know it should be accessible as the methods are declared as static and exist within the same package as the main method. public class…