Questions tagged [xml]

Extensible Markup Language (XML) is a flexible, structured document format that defines human- and machine-readable encoding rules.

1885
votes
28answers
359k views

How do you parse and process HTML/XML in PHP?

How can one parse HTML/XML and extract information from it?
375
votes
12answers
38k views

Can you provide some examples of why it is hard to parse XML and HTML with a regex? [closed]

One mistake I see people making over and over again is trying to parse XML or HTML with a regex. Here are a few of the reasons parsing XML and HTML is hard:People want to treat a file as a sequence ...
368
votes
15answers
529k views

How to Deserialize XML document

How do I Deserialize this XML document:<?xml version="1.0" encoding="utf-8"?><Cars><Car><StockNumber>1020</StockNumber><Make>Nissan</Make>...
752
votes
13answers
900k views

How do I parse XML in Python?

I have many rows in a database that contains xml and I'm trying to write a Python script that will go through those rows and count how many instances of a particular node attribute show up. For ...
779
votes
9answers
785k views

What characters do I need to escape in XML documents?

What characters must be escaped in XML documents, or where could I find such a list?
492
votes
12answers
361k views

How does one parse XML files? [closed]

Is there a simple method of parsing XML files in C#? If so, what?
72
votes
14answers
48k views

Is there any difference between 'valid xml' and 'well formed xml'?

I wasn't aware of a difference, but a coworker says there is, although he can't back it up. What's the difference if any?
230
votes
6answers
364k views

How to read XML using XPath in Java

I want to read XML data using XPath in Java, so for the information I have gathered I am not able to parse XML according to my requirement.here is what I want to do:Get XML file from online via ...
13
votes
1answer
2k views

How does XPath deal with XML namespaces?

How does XPath deal with XML namespaces?If I use/IntuitResponse/QueryResponse/Bill/Idto parse the XML document below I get 0 nodes back. <?xml version="1.0" encoding="UTF-8" standalone="yes"...
514
votes
13answers
365k views

Best practice to save application settings in a Windows Forms Application [closed]

What I want to achieve is very simple: I have a Windows Forms (.NET 3.5) application that uses a path for reading information. This path can be modified by the user, by using the options form I ...
250
votes
35answers
333k views

How to convert array to SimpleXML

How can I convert an array to a SimpleXML object in PHP?
793
votes
11answers
966k views

What does <![CDATA[]]> in XML mean?

I often find this strange CDATA tag in XML files:<![CDATA[some stuff]]>I have observed that this CDATA tag always comes at the beginning, and then followed by some stuff.But sometimes it ...
191
votes
10answers
208k views

XML parsing of a variable string in JavaScript

I have a variable string that contains well-formed and valid XML. I need to use JavaScript code to parse this feed.How can I accomplish this using (browser-compatible) JavaScript code?
361
votes
8answers
303k views

Best XML parser for Java [closed]

I need to read smallish (few MB at the most, UTF-8 encoded) XML files, rummage around looking at various elements and attributes, perhaps modify a few and write the XML back out again to disk (...
10
votes
4answers
3k views

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 ...
112
votes
5answers
84k views

Parsing XML with namespace in Python via 'ElementTree'

I have the following XML which I want to parse using Python's ElementTree:<rdf:RDF xml:base="http://dbpedia.org/ontology/"xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:...
126
votes
6answers
161k views

Best XML Parser for PHP [duplicate]

I have used the XML Parser before, and even though it worked OK, I wasn't happy with it in general, it felt like I was using workarounds for things that should be basic functionality.I recently saw ...
24
votes
2answers
9k views

A simple program to CRUD node and node values of xml file [closed]

I decided to save setting in xml file since field takes only one value.My XML file is like <?xml version="1.0" encoding="UTF-8"?><setting><setting1>setting1 value</...
226
votes
20answers
58k views

XML attribute vs XML element

At work we are being asked to create XML files to pass data to another offline application that will then create a second XML file to pass back in order to update some of our data. During the process ...
180
votes
5answers
371k views

LINQ to read XML

I got this XML file<root><level1 name="A"><level2 name="A1" /><level2 name="A2" /></level1><level1 name="B"><level2 ...
48
votes
7answers
66k views

Parse XML with Namespace using SimpleXML

I have this as xml:<root xmlns:event="http://www.webex.com/schemas/2002/06/service/event"><event:event><event:sessionKey></event:sessionKey><event:...
50
votes
3answers
8k views

Why is XML::Simple “Discouraged”?

From the documentation of XML::Simple:The use of this module in new code is discouraged. Other modules are available which provide more straightforward and consistent interfaces. In particular, ...
109
votes
4answers
88k views

android.content.res.Resources$NotFoundException: String resource ID #0x0

I'm developing an Android app which reads data from MySQL database and I faced this error. I have this XML layout:<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http:...
383
votes
17answers
219k views

How to handle button clicks using the XML onClick within Fragments

Pre-Honeycomb (Android 3), each Activity was registered to handle button clicks via the onClick tag in a Layout's XML:android:onClick="myClickMethod"Within that method you can use view.getId()...
43
votes
17answers
88k views

Remove a child with a specific attribute, in SimpleXML for PHP

I have several identical elements with different attributes that I'm accessing with SimpleXML:<data><seg id="A1"/><seg id="A5"/><seg id="A12"/><seg id="...
0
votes
3answers
558 views

XSLT Transform doesn't work until I remove root node

I'm trying to extract the headline from the below XML from the Met Office web service using XSLT, however my XSLT select returns blank.SOURCE:<RegionalFcst xmlns="www.metoffice.gov.uk/xml/...
192
votes
6answers
355k views

How to generate XML file dynamically using PHP?

I have to generate a xml file dynamically at runtime. Please help me in generating the below XML file dynamically using PHP.<?xml version="1.0" encoding="UTF-8"?><xml><track>...
384
votes
31answers
380k views

How to pretty print XML from Java? [closed]

I have a Java String that contains XML, with no line feeds or indentations. I would like to turn it into a String with nicely formatted XML. How do I do this?String unformattedXml="<tag><...
202
votes
8answers
259k views

XMLHttpRequest Origin null is not allowed Access-Control-Allow-Origin for file:/// to file:/// (Serverless)

I'm trying to create a website that can be downloaded and run locally by launching its index file.All the files are local, no resources are used online.When I try to use the AJAXSLT plugin for ...
362
votes
6answers
227k views

What does “xmlns” in XML mean?

I saw the following line in an XML file:xmlns:android="http://schemas.android.com/apk/res/android"I have also seen xmlns in many other XML files that I've come across.What is it?
91
votes
8answers
102k views

Accessing @attribute from SimpleXML

I am having a problem accessing the @attribute section of my SimpleXML object. When I var_dump the entire object, I get the correct output, and when I var_dump the rest of the object (the nested tags)...
442
votes
6answers
183k views

Declaring a custom android UI element using XML

How do I declare an Android UI element using XML?
443
votes
8answers
157k views

XDocument or XmlDocument

I am now learning XmlDocument but I've just ran into XDocument and when I try to search the difference or benefits of them I can't find something useful, could you please tell me why you would use one ...
31
votes
2answers
30k views

SimpleXML: Selecting Elements Which Have A Certain Attribute Value

In an XML document, I have elements which share the same name, but the value of an attribute defines what type of data it is, and I want to select all of those elements which have a certain value from ...
108
votes
7answers
260k views

Convert XML to JSON (and back) using Javascript

How would you convert from XML to JSON and then back to XML?The following tools work quite well, but aren't completely consistent:xml2jsonHas anyone encountered this situation before?
147
votes
3answers
111k views

“ArrayAdapter requires the resource ID to be a TextView” xml problems

I am getting an error when trying to set my view to display the ListView for the file I want to display(text file). I am pretty sure it has something to do with the xml. I just want to display the ...
259
votes
10answers
475k views

How do I read and parse an XML file in C#?

How do I read and parse an XML file in C#?
196
votes
3answers
107k views

Normalization in DOM parsing with java - how does it work?

I saw the line below in code for a DOM parser at this tutorial.doc.getDocumentElement().normalize();Why do we do this normalization ?I read the docs but I could not understand a word.Puts all ...
175
votes
14answers
494k views

Invalid Characters in XML

I am working with some XML at the moment.I have nodes that hold strings like below:<node>This is a string</node>Some of the strings that I am passing to the nodes will have ...
54
votes
12answers
65k views

Using Xpath With Default Namespace in C#

I've got an XML document with a default namespace. I'm using a XPathNavigator to select a set of nodes using Xpath as follows: XmlElement myXML=...; XPathNavigator navigator=myXML....
104
votes
14answers
203k views

How to parse XML in Bash?

Ideally, what I would like to be able to do is:cat xhtmlfile.xhtml |getElementViaXPath --path='/html/head/title' |sed -e 's%(^<title>|</title>$)%%g' > titleOfXHTMLPage.txt
1
vote
2answers
4k views

Recursion, parsing xml file with attributes into treeview c#

I'm currently working on a project where an application will take on XML files and display it into a treeview in C#. I'm using Visual Studio 10 to write this code. I cannot limit number of times the ...
339
votes
18answers
245k views

Pretty printing XML in Python

What is the best way (or even the various ways) to pretty print xml in Python?
135
votes
4answers
62k views

Proper way to implement IXmlSerializable?

Once a programmer decides to implement IXmlSerializable, what are the rules and best practices for implementing it? I've heard that GetSchema() should return null and ReadXml should move to the next ...
128
votes
10answers
279k views

How to convert xml into array in php?

I want to convert below XML to PHP array. Any suggestions on how I can do this?<aaaa Version="1.0"><bbb><cccc><dddd Id="id:pass" /><eeee name="...
155
votes
5answers
156k views

Error: The processing instruction target matching “[xX][mM][lL]” is not allowed

The error in the title occurs whenever I run an XSLT page that begins as follows:<?xml version="1.0" encoding="windows-1256"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/...
135
votes
4answers
94k views

Scraping html tables into R data frames using the XML package

How do I scrape html tables using the XML package?Take, for example, this wikipedia page on the Brazilian soccer team. I would like to read it in R and get the "list of all matches Brazil have ...
366
votes
28answers
112k views

SOAP or REST for Web Services? [closed]

Is REST a better approach to doing Web Services or is SOAP? Or are they different tools for different problems? Or is it a nuanced issue - that is, is one slightly better in certain arenas than ...
128
votes
25answers
421k views

org.xml.sax.SAXParseException: Content is not allowed in prolog

I have a Java based web service client connected to Java web service (implemented on the Axis1 framework). I am getting following exception in my log file:Caused by: org.xml.sax.SAXParseException: ...
26
votes
3answers
17k views

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

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 ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,