This article shows you how to view the code contained in an XML file. You can do this directly using the text editor built into the operating system, an internet browser or a web service.
Steps
Method 1 of 3: Using a Text Editor
Step 1. Locate the XML file to be scanned
To open it in a text editor, you can use the "Open with" function of your computer's operating system. This way the code in the file will appear as plain text, without any specific formatting.
Step 2. Select the XML file with the right mouse button
The relevant context menu will be displayed.
If you are using a Mac, select the XML file with a click of the mouse, then enter the menu File located in the upper left corner of the screen.
Step 3. Choose the Open With option
It is located in the middle of the appeared menu. A pop-up window will appear.
- If you are using a Mac, the voice Open with is listed in the menu File.
- If you are using a Windows computer and voice Open with does not appear in the context menu, select the XML file using the left mouse button, then click its icon using the right mouse button.
Step 4. Select the text editor built into your computer's operating system
In the case of a Windows system you will need to use the program Block notes, while on Mac you will have to choose the voice TextEdit. The selected XML file will be opened using your computer's text editor.
Step 5. Review the code contained in the XML file
Even if there is a formatting of the data present in the XML file, using a normal text editor it will not be displayed. However, the source code used to create the file will be displayed.
If you want to view the data formatted according to the XML code of the file in question, you will need to use an internet browser or an XML file viewer
Method 2 of 3: Using an Internet Browser
Step 1. Launch your preferred browser
Here is a list of popular internet browsers that can view the contents of an XML file (Microsoft Edge cannot view these files):
- Google Chrome;
- Firefox;
- Safari.
Step 2. Open a new tab
Press the "New Tab" button, which is normally located to the right of the header of the last currently open tab. The open tabs are listed at the top of the browser window.
Using most browsers, you can open a new tab by pressing the key combination Ctrl + T (on Windows systems) or ⌘ Command + T (on Mac)
Step 3. Drag the XML file under consideration to the new browser tab
Access the folder where it is stored, then select its icon and drag it into the browser window.
Step 4. Review the contents of the file
After releasing the XML file icon into the browser window, the browser should immediately display the data contained in the file in the form of a tree menu.
Click the small icon in the shape of + you hate - (or triangle if you are using Chrome) placed on the right of each XML tag to show or hide its content.
Method 3 of 3: Use an XML File Viewer
Step 1. Log in to a web service that can view the contents of an XML file
Use the browser of your choice to access the following URL. It is a website that allows you to upload an XML file and consult its content using different viewing modes.
Step 2. Press the Browse button
It is located in the top center of the page. The "File Explorer" (on Windows systems) or "Finder" (on Mac) window will appear.
Step 3. Select the XML file to parse
Navigate to the folder where it is stored, then select its icon to highlight it.
Step 4. Press the Open button
It is located in the lower right corner of the dialog box. The chosen XML file will be automatically uploaded to the site and its content will be displayed in the "XML Input" box, located on the left side of the page.
Step 5. Press the Format button
It is positioned in the center of the page. In this way the content of the XML file, duly formatted according to a series of colors, will be shown in the "Result" box on the right side of the page.
The sections of the XML code visible in the two boxes that refer to the same color (other than black) correspond to each other. For example, green text refers to XML tags
Step 6. Use the view mode called "tree"
Press the green button Tree View located in the center of the page, so that the data displayed in the "Result" pane is automatically formatted, for easier consultation.