Files that end in the .xml file extension are plain text files containing XML code. Rather than "execute" them like you would a program or script, you'd simply open it in one of two ways—in a text editor or a web browser. You can also convert the file to a different format using a converter like xmlto.

Method 1
Method 1 of 3:

Using a Text Editor

  1. 1
    Press Control+Alt+T. This opens a terminal window.
  2. 2
    Navigate to the directory containing your XML file. You'll use the cd command to do this. For example, cd /usr/local/files takes you to a directory called /usr/local/files.
    Advertisement
  3. 3
    Type vim filename.xml. Replace filename.xml with the name of the XML file you want to view. This opens the file for viewing and editing in VIM.
  4. Advertisement
Method 2
Method 2 of 3:

Using a Web Browser

  1. 1
    Navigate to the .xml file you want to view. If you're using Gnome, you can open GNOME Files and double-click the folder where the file is stored. If you're using KDE, the built-in file manager is Dolphin.[1]
  2. 2
    Right-click the file and select Open With Other Application. A list of applications will appear.[2]
  3. 3
    Select your web browser. Firefox comes preinstalled on many Linux flavors, but you can use any modern web browser—they should all display XML files. This will automatically display the contents of the file.
  4. Advertisement
Method 3
Method 3 of 3:

Converting to Another Format

  1. 1
    Press Control+Alt+T. This opens a terminal window.
  2. 2
    Update the repository. To make sure you're downloading the latest version of xmlto, the tool yo'ull be using to convert the XML file to plain text, run the command sudo apt update.
  3. 3
    Install the xml2 package. To install xmlto, run the command sudo apt install xmlto.
  4. 4
    Navigate to the directory containing your XML file. You'll use the cd command to do this. For example, cd /usr/local/files takes you to a directory called /usr/local/files.
  5. 5
    Run the command to convert the file to another format. The command you'll use depends on the type of file you want to create:
    • xmlto pdf myfile.xml converts to a PDF.[3]
    • To convert to another file type, replace pdf with the desired file type, such as: html, htmlhelp (HTML help file), javahelp (Java help file), dvi (text DVI file), man (Unix manual pages), txt (plain text), ps (postscript), xhtml, fo (XSL-FO formatting objects).
  6. Advertisement

About This Article

Nicole Levine, MFA
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 43,421 times.
How helpful is this?
Co-authors: 3
Updated: March 5, 2021
Views: 43,421
Categories: Linux
Article SummaryX

1. Open the file in a web browser if you just want to view it.
2. To edit the file, open it in VIM.
3. Use xtmlto to convert the file to another format.

Did this summary help you?
Advertisement