Author:
Janice Evans
Date Of Creation:
27 July 2021
Update Date:
1 July 2024
Content
- Steps
- Method 1 of 3: Using a text editor
- Method 2 of 3: Using a web browser
- Method 3 of 3: Using an online service to view XML files
- Tips
- Warnings
This article will show you how to view the code in an XML file. You can do this on any computer using a built-in text editor, a web browser, or an online XML viewer.
Steps
Method 1 of 3: Using a text editor
- 1 Find the XML file. Use the Open With option to open the XML file in a text editor and view the XML file code.
- 2 Right click on the XML file. A menu will open.
- On a Mac computer, click the XML file, and then click File in the upper left of the screen.
- 3 Please select To open with. It's in the middle of the menu. Another menu will open.
- On a Mac, the Open With option is on the File menu.
- If you do not see the "Open With" option in Windows, left-click the XML file and then right-click the XML file.
- 4 Choose a text editor. Click Notepad on Windows or TextEdit on Mac. The XML file opens in a text editor.
- 5 Review the XML file code. The XML file's code format will not be preserved when you open the file in a text editor, but you can simply view the actual code that was used to create the XML file.
- To view the code format of an XML file, open the file in a web browser or use an online XML viewer service.
Method 2 of 3: Using a web browser
- 1 Open your web browser. In the most popular web browsers, you can view the code for XML files (but not in Microsoft Edge):
- Google Chrome;
- Firefox;
- Safari.
- 2 Open a new tab. Click the New Tab button to the right of the last tab at the top of the window.
- In most web browsers, you can also click Ctrl+T (Windows) or ⌘ Command+T (Mac) to open a new tab.
- 3 Drag the XML file to the browser window. Open the folder with the XML file and then drag it into the browser window.
- 4 Review the code. When you drag the XML file into the browser, the XML file code (tree view) is displayed.
- Click the + or - button (in Chrome, click the triangle) to the left of the main code tags to expand or collapse sections of your code.
Method 3 of 3: Using an online service to view XML files
- 1 Open the service website to view the XML files. Go to http://www.xmlviewer.org/ in your computer's web browser. With this service, you can view the code of the XML file, and also select different viewing formats.
- 2 Click on Browse (Overview). You will find this button at the top of the window. An Explorer (Windows) or Finder (Mac) window opens.
- 3 Select the XML file. Open the folder with the XML file and click on it to select.
- 4 Click on Open. It's in the lower-right corner of the window. The XML file will be uploaded to the service site, and the code will be displayed on the left side of the page.
- 5 Click on Format (Format). It's a button in the middle of the window. The XML file code appears in color in the Result box on the right side of the page.
- Code elements colored in the same (not black) color correspond to each other. For example, tags are colored green.
- 6 Use the "Tree" option. Click on the green Tree button in the middle of the page to make the code displayed in the Result window easy to read.
- Click on each of the headings in the Tree View Result window to collapse or expand them.
Tips
- On a Windows computer, you can also use Notepad ++ to view the XML file code in color format.
Warnings
- Many XML files have been typed without any format, so don't be surprised if you see jumbled text on your screen.