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
37
votes
3 answers

Python SVG parser

I want to parse an SVG file using python to extract coordinates/paths (I believe this is listed under the "path" ID, specifically the d="..."/>). This data will eventually be used to drive a 2 axis CNC. I've searched on SO and Google for libraries…
user2253513
36
votes
2 answers

PHP generated XML shows invalid Char value 27 message

I am generating XML using PHP library as below: $dom = new DOMDocument("1.0","utf-8"); Doing above results in a page which shows a message on top of the output. This page contains the following errors: error on line 16 at column 274505: PCDATA…
Prashant
  • 2,005
  • 3
  • 17
  • 24
35
votes
4 answers

How to create XML file with specific structure in Java

I would like to create XML file using Java. My XML file structure: chrome http:fut abcd john
user3438838
  • 476
  • 1
  • 5
  • 10
35
votes
14 answers

How to fix Invalid byte 1 of 1-byte UTF-8 sequence

I am trying to fetch the below xml from db using a java method but I am getting an error Code used to parse the xml DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is =…
shaiksha
  • 993
  • 5
  • 17
  • 35
35
votes
9 answers

Android Google Maps fragment in the xml. I get "Unexpected namespace prefix"

I'm trying to learn android, and having followed the instructions on how to use the Google Maps API V.2 I now got it working. However, the instructions on how to configure the initial state of the maps, found at developers.google.com, suggests a…
34
votes
5 answers

How to get specific XML elements with specific attribute value?

I am trying to parse an XML file from a URL by taking all "" elements where is parameter type_id="4218"?? XML document:
dusmanka
  • 625
  • 1
  • 9
  • 16
34
votes
2 answers

XML Parsing: Element Tree (etree) vs. minidom

I've been using minidom to parse XML for years. Now I've suddenly learned about Element Tree. My question which is better for parsing? That is: Which is faster? Which uses less memory? Do either have any O(n^2) dependencies I should worry about? Is…
vy32
  • 28,461
  • 37
  • 122
  • 246
34
votes
2 answers

Divide timespan by 2?

I have two times, and their values are picked up from a XML from web. XElement xmlWdata = XElement.Parse(e.Result); string SunRise = xmlWdata.Element("sun").Attribute("rise").Value; string SunSet =…
Megaoctane
  • 919
  • 3
  • 9
  • 10
32
votes
3 answers

iPhone Development - XMLParser vs. libxml2 vs. TouchXML

I cannot find comparison of these parsing technique. Which one is most commonly used? Regards. Mustafa
Mustafa
  • 20,504
  • 42
  • 146
  • 209
32
votes
13 answers

Error unmarshalling xml in java-8 "secure-processing org.xml.sax.SAXNotRecognizedException causing java.lang.IllegalStateException"

The following code worked fine in Java 7 import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; String xmlString = '
mmx73
  • 972
  • 1
  • 8
  • 19
30
votes
3 answers

Why is it such a bad idea to parse XML with regex?

I was just reviewing a previous post I made and noticed a number of people suggesting that I don't use Regex to parse xml. In that case the xml was relatively simple, and Regex didn't pose any problems. I was also parsing a number of other code…
yatakaka
  • 357
  • 1
  • 4
  • 10
30
votes
4 answers

How to parse invalid (bad / not well-formed) XML?

Currently, I'm working on a feature that involves parsing XML that we receive from another product. I decided to run some tests against some actual customer data, and it looks like the other product is allowing input from users that should be…
jvhashe
  • 1,071
  • 2
  • 12
  • 15
30
votes
2 answers

Howto let the SAX parser determine the encoding from the xml declaration?

I'm trying to parse xml files from different sources (over which I have little control). Most of the them are encoded in UTF-8 and don't cause any problems using the following snippet: SAXParserFactory factory =…
Allan
  • 549
  • 1
  • 4
  • 9
30
votes
4 answers

What browsers support Xpath 2.0?

I have recently been working with XPath and have been searching for information on which browsers support XPath 2.0 without much luck. The best I could find was the query technologies comparison table of various rendering engines. This clearly tells…
Default
  • 16,020
  • 3
  • 24
  • 38
29
votes
6 answers

How to create/write a simple XML parser from scratch?

How to create/write a simple XML parser from scratch? Rather than code samples, I want to know what are the simplified, basic steps in English. How is a good parser designed? I understand that regex should not be used in a parser, but how much is…
XP1
  • 6,910
  • 8
  • 54
  • 61