Questions tagged [xml-parsing]

An XML parser goes through text documents containing XML trees and allows the information in the hierarchy to be used. Use this tag for problems implementing an XML parser or generated by the use of an existing parser in a given language.

An XML parser goes through text documents containing XML trees and allows the information in the hierarchy to be used. Use this tag for problems implementing an XML parser or generated by the use of an existing parser in a given language.

An XML parser converts an XML document into an XML DOM object - which can then be manipulated with JavaScript. All modern browsers have a built-in XML parser.

The XML document specification places requirements on what an XML processor must do and not do, but the application is outside its scope. The processor (as the specification calls it) is often referred to colloquially as an XML parser.

13856 questions
91
votes
5 answers

Read a XML (from a string) and get some fields - Problems reading XML

I have this XML (stored in a C# string called myXML) 123
markzzz
  • 47,390
  • 120
  • 299
  • 507
89
votes
2 answers

jQuery XML error ' No 'Access-Control-Allow-Origin' header is present on the requested resource.'

I am working on this personal project of mine just for fun where I want to read an xml file which is located at http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml and parse the xml and use it to convert values between the currencies. So…
Bazinga777
  • 5,140
  • 13
  • 53
  • 92
87
votes
6 answers

How to read and write XML files?

I have to read and write to and from an XML file. What is the easiest way to read and write XML files using Java?
Jame
  • 21,150
  • 37
  • 80
  • 107
87
votes
5 answers

How to use sed to extract substring

I have a file containing the following lines:
MOHAMED
  • 41,599
  • 58
  • 163
  • 268
86
votes
2 answers

Groovy XmlSlurper vs XmlParser

I searched for a while on this topic and found some results too, which I am mentioning at the end of post. Can someone help me precisely answer these three questions for the cases listed below them? For which use-cases using XmlSluper makes more…
kdabir
  • 9,623
  • 3
  • 43
  • 45
86
votes
6 answers

When should I choose SAX over StAX?

Streaming xml-parsers like SAX and StAX are faster and more memory efficient than parsers building a tree-structure like DOM-parsers. SAX is a push parser, meaning that it's an instance of the observer pattern (also called listener pattern). SAX was…
Rinke
  • 6,095
  • 4
  • 38
  • 55
86
votes
8 answers

How to parse XML using vba

I work in VBA, and want to parse a string eg 24.365 78.63 and get the X & Y values…
Devdatta Tengshe
  • 4,015
  • 10
  • 46
  • 59
78
votes
8 answers

Apostrophe not preceded by \

I have a string defined in an android application: '{string}' occurs {times} This gives the error: Apostrophe not preceded by \ (in '{string}' occurs {times}) I've tried a number of things to fix this:
Frank Schnabel
  • 1,156
  • 2
  • 10
  • 14
76
votes
7 answers

UnicodeEncodeError: 'ascii' codec can't encode character u'\xef' in position 0: ordinal not in range(128)

I want to parse my XML document. So I have stored my XML document as below class XMLdocs(db.Expando): id = db.IntegerProperty() name=db.StringProperty() content=db.BlobProperty() Now my below is my code parser = make_parser() …
mahesh
  • 4,625
  • 11
  • 42
  • 61
68
votes
7 answers

How to write a Parser in C#?

How do I go about writing a Parser (Recursive Descent?) in C#? For now I just want a simple parser that parses arithmetic expressions (and reads variables?). Though later I intend to write an xml and html parser (for learning purposes). I am doing…
ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
61
votes
8 answers

org.xml.sax.SAXParseException: Premature end of file for *VALID* XML

I am getting very strange "Premature end of file." exception for last few days on one of our servers. The same configuration XML works fine on another server. We are using Tomcat 5.0.28 on both these servers. This code has been working for ages (7+…
Manish
  • 1,735
  • 2
  • 17
  • 30
59
votes
2 answers

Parsing XML with Ruby

I'm way new to working with XML but just had a need dropped in my lap. I have been given an usual (to me) XML format. There are colons within the tags. 1234
n8gard
  • 1,870
  • 8
  • 26
  • 41
58
votes
4 answers

DTD prohibited in xml document exception

I'm getting this error when trying to parse through an XML document in a C# application: "For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the…
ConnorU
  • 1,379
  • 2
  • 15
  • 27
56
votes
5 answers

lxml etree xmlparser remove unwanted namespace

I have an xml doc that I am trying to parse using Etree.lxml
1
some stuff My code is: path = "path to xml file" from…
Mark
  • 2,522
  • 5
  • 36
  • 42
56
votes
3 answers

How do I convert an ISO8601 TimeSpan to a C# TimeSpan?

I am getting a System.FormatException when I try to do the following (as an example): TimeSpan ts = XmlConvert.ToTimeSpan("P72H"); I've investigated the ISO8601 Standard and it seems to be correct, but I cannot get it to parse hours without…
Codeman
  • 12,157
  • 10
  • 53
  • 91