How to View an XML File

From The SBN Wiki
Jump to navigation Jump to search

If you've never worked with XML before, simply looking at XML can be a bit intimidating - there's a lot of syntax there to read around. Until you get used to the syntax, and even afterwards, it can be helpful to look at XML files in a program that provides some value-added display capabilities. The commonly available options are:

  • XML-aware editors. Editors like Eclipse and oXygen, which support XML and schema markup and validation, can offer not only syntax highlighting, but also alternate views of the content - like document trees or expandable graphic layouts. This is your best option if you want to do anything other than browse casually through the file.
  • Editors with syntax highlighting. If you have a favorite program editor that provides color syntax highlighting, there's a good chance the more recent updates will include options for XML highlighting and possibly more. UltraEdit, for example, has an option for showing the document as a tree without the XML markup.
  • Web Browsers. All the major web browsers (Google Chrome, Internet Explorer, Firefox, and Safari, for example) can display XML files with syntax highlighting and the option of collapsing/expanding code blocks. For Chrome, IE, and Firefox, all you have to do is open the file with the browser. For Safari, you might need to turn on the Development menu first - open your Preferences menu, select the Advanced tab, and check the Show Development Menu in the Menu Bar box.
If your browser or version doesn't seem to be doing the job (that is, you get a mostly blank page, or you get a page that just looks like a solid block of unformatted text), try the "View Source" option of your browser.
  • Browser Plug-ins. If your browser allows you to add extended functions via plug-ins, extensions, or apps, try browsing those collections for XML viewers. As of this writing, the selection is limited but growing. The best one I've personally tried so far for browsing through PDS4 labels is the "XV - XML Viewer" extension available for the Google Chrome browser. If you've come across a particularly good example, please let us know.