- Published: 2006-03-01 14:17
- Modified: 2006-03-01 14:17
- Author: TarquinWJ
- Requires: Opera 8.0
- Install as: Opera User JS
- Install as: Greasemonkey script
Learn how to install scripts
If an XML file contains no style information, Opera will render it as an unstyled Web page. In many cases, this serves no purpose. Some other browsers display the XML tree for the page. This script replicates that behaviour in Opera, making it a useful tool for analysing XML files.
Files are syntax highlighted, and their contents can be expanded and collapsed. There is also the option to go back to the normal rendered XML view. By default, the script just works, but for those of you who feel the need to tweak everything (you know who you are ;), the script allows you to:
- Exclude file types (based on the root XML node).
- Protect files that import elements from the (X)HTML namespace.
- Configure the syntax highlighting for XML processing instructions (Opera 9+), doctype tags, elements, attributes, attribute values, comments, text nodes and CDATA blocks.
- Configure text strings so you can translate it into your own language.
- Configure the size of the notification bar.
- Set the font size.
- Say if 'expand/collapse all' links should be shown, and if they should remain static if the page scrolls.
Known limitations in Opera 8.x (these are fixed in Opera 9):
- XML tree view cannot display XML processing instructions.
- XML files will be converted into XML tree view even if they already have CSS or XSLT stylesheets (Opera 8 did not understand XSLT anyway, so this does not really matter). You can use the link to go back to the rendered view. Note that this does not affect XHTML documents; they will always be rendered correctly.
- Doctype declarations are sometimes displayed with one letter missing from the doctype name (as in the example above).
Note, this script uses inline frames so if you disable inline frames, you will need to enable them to use this script.
- Version 1.1.1: Fix to prevent the script running on WML pages in Opera 8.0-8.5
- Version 1.1: Added options to specify font size, the height of the notification bar, and if 'expand/collapse all' links should be shown.
- Version 1.0.2: Improved collapsing of whitespace in otherwise empty element nodes (it's less than a 1% performance hit - I hope you don't mind).
- Version 1.0.1: Excluded the script from running within e-mail header view.