Questions tagged [xml]

A simple, very flexible text format that stands for eXtensible Markup Language.

Wikipedia has a great description about XML. Here is a quote about it:

XML (Extensible Markup Language) is a set of rules for encoding documents in both human-readable and machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards.

Extensible - XML is extensible. It lets you define your own tags.

Markup - The most attractive feature of XML has to be its ability to allow its user to create their own tags. The tags that can be created will be similar to tags in HTML. But with XML you are afforded the opportunity to define your own tags.

Language - XML is a language that is very similar to HTML. But it’s much more flexible because it allows to create custom tags. In this way XML acts like a meta-language: a language that allows us to create or define other languages. For example, with XML we can create other languages, such as RSS.

Another site is StackOverflow, with questions using tag XML.

418 questions
42
votes
2 answers

How to insert variables inside a string containing ""?

I want to construct an xml string by inserinting variables: str1="Hello" str2="world" xml='$str1$str2' echo $xml The result should be
supermario
  • 3,179
  • 5
  • 19
  • 14
39
votes
1 answer

Vim: Making XML text "pretty"

Is there an easy way within vi to make your XML text "pretty"? For example: I want this.. Nick 26 male doctor to be this...
Rob Avery IV
  • 3,075
  • 3
  • 17
  • 14
31
votes
2 answers

Jump from one XML tag to the closing one

Is there a shortcut to jump from, e.g, to ? I already gave it a try with %, but it doesn't work in this situation.
daisy
  • 53,527
  • 78
  • 236
  • 383
27
votes
9 answers

Parse XML to get node value in bash script?

I would like to know how I can get the value of a node with the following paths:…
MagePsycho
  • 485
  • 1
  • 6
  • 14
25
votes
8 answers

how to use patch and diff to merge two files and automatically resolve conflicts

I have read about diff and patch but I can't figure out how to apply what I need. I guess its pretty simple, so to show my problem take these two files: a.xml #AAABBB
Rafael T
  • 815
  • 3
  • 11
  • 16
22
votes
2 answers

Substitute text with sed and keep part of the original text

I am trying to convert 1 ENTERPRISE RESOURCE PLANNING to: 1 ENTERPRISE RESOURCE PLANNING I am assuming the best tool for the job would be sed, however I can't figure out…
Mike
  • 459
  • 1
  • 5
  • 14
17
votes
6 answers

Extract an attribute value from XML

Using Bash, File:
John
  • 173
  • 1
  • 1
  • 4
15
votes
2 answers

Reformatting a large number of XML files

I am manipulating a large number of XML files scattered throughout a nested directory structure. I tried the following: $ find . -name "*.xml" -type f | xargs -- xmllint --format The problem is that generates the formatted XML output on the…
Harry
  • 1,843
  • 3
  • 13
  • 8
11
votes
4 answers

How do I parse namespaces from an XML file using XMLLINT and BASH

Below I have an example of an Adobe XML swidtag used to track inventory. I need to parse out relevant information using xmllint in bash and output that to a new text file. For example I would like to parse the…
macman
  • 113
  • 1
  • 1
  • 5
10
votes
2 answers

Parsing XML, JSON, and newer data file formats in UNIX using command line utilities

The Unix environment has some excellent tools for parsing text in various forms. However, of late, the data is not in the traditional (historical) formats (CSV, TSV, record-based or some other delimiter-based) it used to be before. Data these days…
kamaal
  • 181
  • 1
  • 4
10
votes
4 answers

how to compare two xml files having same data in different lines?

I have two files have same data but in different lines. File 1: 048206031415072010Comcast.USR8JR ccp_test_79 JOSH CCP
user32026
  • 101
  • 1
  • 1
  • 3
10
votes
2 answers

XML command line (shell script) manipulation

How to manipulate XML from command line in shell script? There are many commands for manipulating tabular data, substituting environment variable or replacing text fragments with regex, but I haven't found anything for XML. My build script need to…
user224076
8
votes
1 answer

how to massage or format html in order to parse with xmstarlet?

Do I first need to run html in the wild through something like jsoup? Not to make it valid in a human sense, might turn it to gibberish, but at least so that xmlstarlet can process the file? Preferably looking for a CLI which can be installed and…
Thufir
  • 1,810
  • 6
  • 33
  • 60
7
votes
1 answer

How to remove nodes from XML file as command line with namespace?

I have an xml file that contains the tag several times. It is used like this TO REMOVE However the content between the tag itself is sometimes different. Could there be a way to use sed or something other to…
Felix
  • 145
  • 1
  • 9
7
votes
1 answer

$1 not working with sed

I have a bunch of files that contain XML tags like: PIDAT O I need to delete everything what comes after the first in that line, so I can get this: For that I'm using sed -i -e 's/(^<.*?>).+/$1/' *.conll But it seems that sed is…
1
2 3
27 28