Questions tagged [xml]

XML (Extensible Markup Language) is a structured document format defining text encoding rules. When using this tag include additional tags such as programming language, tool sets, XML technologies being used, and other tags describing the environment of the problem posted. XML flexibility lends to a wide variety of uses for human and machine data transfer so be specific as to tools and libraries.

Filter by
Sorted by
Tagged with
2300 votes
31 answers
473k views

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

How can one parse HTML/XML and extract information from it?
1251 votes
13 answers
1.6m 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 ...
dontWatchMyProfile's user avatar
1150 votes
20 answers
1.6m views

How to parse XML and get instances of a particular node attribute?

I have many rows in XML and I'm trying to get instances of a particular node attribute. <foo> <bar> <type foobar="1"/> <type foobar="2"/> &...
randombits's user avatar
1106 votes
10 answers
1.3m 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?
Julius A's user avatar
  • 38.1k
1026 votes
12 answers
274k views

What's "tools:context" in Android layout files?

Starting with a recent new version of ADT, I've noticed this new attribute on the layout XML files, for example: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:...
android developer's user avatar
1022 votes
2 answers
2.0m views

Text editor to open big (giant, huge, large) text files [closed]

I mean 100+ MB big; such text files can push the envelope of editors. I need to look through a large XML file, but cannot if the editor is buggy. Any suggestions?
900 votes
9 answers
2.1m views

How do I comment out a block of tags in XML?

How do I comment out a block of tags in XML? I.e. How can I comment out <staticText> and everything inside it, in the code below? <detail> <band height="20"> <...
Jonas's user avatar
  • 121k
727 votes
9 answers
1.3m views

How To Auto-Format / Indent XML/HTML in Notepad++

Is there a way to re-indent a block of code? I'm looking for something similar to Ctrl+Shift+F in Eclipse (Auto-Format/Indent). To be clear, I already know how to format XML outside of Notepad++ (...
SBoss's user avatar
  • 8,875
674 votes
18 answers
621k views

How do I align views at the bottom of the screen?

Here's my layout code; <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:...
gav's user avatar
  • 29k
671 votes
12 answers
407k views

How to pretty print XML from the command line?

Related: How can I pretty-print JSON in (unix) shell script? Is there a (unix) shell script to format XML in human-readable form? Basically, I want it to transform the following: <root><...
svidgen's user avatar
  • 13.8k
652 votes
10 answers
682k views

java.util.Date to XMLGregorianCalendar

Isn't there a convenient way of getting from a java.util.Date to a XMLGregorianCalendar?
mac's user avatar
  • 9,905
652 votes
14 answers
544k views

How can I save application settings in a Windows Forms application?

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 ...
Fueled's user avatar
  • 8,776
634 votes
21 answers
713k views

How to make layout with rounded corners..?

How can I make a layout with rounded corners? I want to apply rounded corners to my LinearLayout.
Addy's user avatar
  • 6,363
626 votes
20 answers
208k views

Can the Android layout folder contain subfolders?

Right now, I'm storing every XML layout file inside the 'res/layout' folder, so it is feasible and simple to manage small projects, but when there is a case of large and heavy projects, then there ...
Paresh Mayani's user avatar
599 votes
10 answers
832k views

How do I escape ampersands in XML so they are rendered as entities in HTML?

I have some XML text that I wish to render in an HTML page. This text contains an ampersand, which I want to render in its entity representation: &amp;. How do I escape this ampersand in the ...
AJM's user avatar
  • 32.1k
593 votes
7 answers
224k 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 ...
Tarik's user avatar
  • 79.8k
588 votes
5 answers
345k views

What's the difference between text/xml vs application/xml for webservice response

This is more of a general question about the difference between text/xml and application/xml. I am fairly new to writing webservices (REST - Jersey). I have been producing application/xml since it is ...
Mike's user avatar
  • 8,137
534 votes
16 answers
807k 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> ...
Alex's user avatar
  • 39.3k
527 votes
27 answers
539k views

Pretty printing XML in Python

What is the best way (or are the various ways) to pretty print XML in Python?
Hortitude's user avatar
  • 13.7k
497 votes
34 answers
548k views

How to pretty print XML from Java?

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><...
Steve McLeod's user avatar
  • 51.8k
495 votes
6 answers
345k 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?
user88637's user avatar
  • 11.8k
491 votes
12 answers
451k views

How does one parse XML files? [closed]

Is there a simple method of parsing XML files in C#? If so, what?
domoaringatoo's user avatar
489 votes
6 answers
204k views

Declaring a custom android UI element using XML

How do I declare an Android UI element using XML?
Casebash's user avatar
  • 115k
460 votes
19 answers
275k 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()...
smith324's user avatar
  • 13k
458 votes
12 answers
927k views

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

How do I read and parse an XML file in C#?
Gajendra's user avatar
  • 4,669
457 votes
9 answers
371k views

How can I build XML in C#?

How can I generate valid XML in C#?
436 votes
13 answers
594k views

Web colors in an Android color XML resource file

What do all of the X11/w3c color codes look like in the format of an Android XML resource file? I know this looks a tad ridiculous as a question, but given the votes apparently it's useful and ...
gssi's user avatar
  • 5,043
435 votes
8 answers
552k views

How can I find an element by CSS class with XPath?

In my webpage, there's a div with a class named Test. How can I find it with XPath?
Strawberry's user avatar
  • 66.1k
427 votes
45 answers
583k views

Manifest Merger failed with multiple errors in Android Studio

So, I am a beginner into Android and Java. I just began learning. While I was experimenting with Intent today, I incurred an error. Error:Execution failed for task ':app:processDebugManifest'. > ...
Rohan's user avatar
  • 4,466
417 votes
8 answers
515k views

Getting attribute using XPath

Given an XML structure like so: <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title lang="eng">Harry Potter</title> <price>29.99</price&...
GurdeepS's user avatar
  • 65.2k
415 votes
9 answers
686k views

POST XML file using cURL command line

How can I POST an XML file to a local server http://localhost:8080 using cURL from the command line? What command should I use?
Arnab Sen Gupta's user avatar
415 votes
12 answers
51k 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 ...
Chas. Owens's user avatar
  • 64.2k
403 votes
13 answers
256k views

What's the difference between an element and a node in XML?

I'm working in Java with XML and I'm wondering; what's the difference between an element and a node?
Philip Morton's user avatar
397 votes
8 answers
325k 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 (...
Evan's user avatar
  • 18.2k
391 votes
28 answers
124k 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 ...
user13276's user avatar
  • 4,873
390 votes
7 answers
987k views

XPath contains(text(),'some string') doesn't work when used with node with more than one Text subnode

I have a small problem with XPath contains with dom4j ... Let's say my XML is <Home> <Addr> <Street>ABC</Street> <Number>5</Number> <...
Mike Milkin's user avatar
  • 3,971
383 votes
4 answers
152k views

Populate XDocument from String

I'm working on a little something and I am trying to figure out whether I can load an XDocument from a string. XDocument.Load() seems to take the string passed to it as a path to a physical XML file. ...
StevenMcD's user avatar
  • 17.3k
371 votes
18 answers
409k views

How to view AndroidManifest.xml from APK file?

Is it possible to view Androidmanifest.xml file? I just changed the extension of the apk file to zip. This zip file contains the Androidmanifest.xml file. But I am unable view the contents of ...
bharath's user avatar
  • 14.3k
369 votes
19 answers
276k views

XmlSerializer - There was an error reflecting type

Using C# .NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer ...
leora's user avatar
  • 189k
365 votes
6 answers
166k views

What to use instead of "addPreferencesFromResource" in a PreferenceActivity?

I just noticed the fact that the method addPreferencesFromResource(int preferencesResId) is marked deprecated in Android's documentation (Reference Entry). Unfortunately, no alternative method is ...
mweisz's user avatar
  • 3,899
361 votes
21 answers
444k views

Center a button in a Linear layout

I am using a linear layout to display a pretty light initial screen. It has 1 button that is supposed to centre in the screen both horizontally and vertically. However no matter what I try to do the ...
themaninthesuitcase's user avatar
347 votes
14 answers
147k views

Android XML Percent Symbol

I have an array of strings in which the % symbol is used. Proper format for using the % is &#37;. When I have a string in that array with multiple &#37; it gives me this error. Multiple ...
zaid's user avatar
  • 6,259
328 votes
12 answers
646k views

How to convert JSON to XML or XML to JSON in C#?

I started to use Json.NET to convert a string in JSON format to object or viceversa. I am not sure in the Json.NET framework, is it possible to convert a string in JSON to XML format and viceversa?
David.Chu.ca's user avatar
  • 37.5k
324 votes
7 answers
102k views

Android Replace "..." with ellipsis character

Since AVD tools 16 I'm getting this warning: Replace "..." with ellipsis character (..., &#8230;) ? in my strings.xml at this line <string name="searching">Searching...</string> ...
Blundell's user avatar
  • 75.5k
323 votes
22 answers
137k views

Android: remove left margin from actionbar's custom layout

I am using a custom actionbar view, and as you can see in the screenshot below, there is a blank gray space in the actionbar. I want to remove it. What have I done: res/values-v11/styles.xml <...
Zbarcea Christian's user avatar
323 votes
8 answers
542k views

Extract value of attribute node via XPath

How can I extract the value of an attribute node via XPath? A sample XML file is: <parents name='Parents'> <Parent id='1' name='Parent_1'> <Children name='Children'> &...
Rehman's user avatar
  • 3,918
320 votes
5 answers
176k views

What does the 'standalone' directive mean in XML?

What does the 'standalone' directive mean in an XML document?
Nick's user avatar
  • 25.1k
311 votes
19 answers
325k views

Class 'DOMDocument' not found

I've found an error on a page in my Magento application; it always show this message error when I visit it: Fatal error: Class 'DOMDocument' not found in /home/.../lib/Zend/Feed/Abstract.php on ...
ws_123's user avatar
  • 5,195
310 votes
4 answers
83k views

Are SVG parameters such as 'xmlns' and 'version' needed?

In about half of the svg examples I see on the internet, the code is wrapped in plain simple <svg></svg> tags. In the other half, the svg tags have lots of complicated attributes like ...
Lars's user avatar
  • 7,948
309 votes
34 answers
501k views

How to convert array to SimpleXML

How can I convert an array to a SimpleXML object in PHP?
user avatar

1
2 3 4 5
4279