How To Hyperlink XML Layer (Part 4)

Hey,

As you know, I have been running a blog series on “Playing with XML Layer”. I have written 3 parts till now, that were tips and Tricks…

Its time for Part 4, though this isn’t any tips and Tricks, as its an abstract tutorial to hyperlink XML Layer, which conforms to any Document-Type-Definition.

Already there exists a tutorial to hyperlink the value contained within the HREF attribute (HTML files) in Platform Tutorials.

At the bottom of that Tutorial, they have mentioned what could be the Next Steps to follow, basically Work Ahead!

Working with JSP and XML documents. (Same principle as above.)

Implementation

As you can see they have mentioned in one of the points, that XML documents can follow the same principle. So, as part of my internship project, I worked to hyperlink the ELEMENT names and their ATTLIST attributes.

For instance;

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
<filesystem>
    <folder name="Actions">
        <folder name="Tools">
            <file name="org-nvarun-tat-SayCheez.instance"/>
        </folder>
    </folder>
    <!--Remember SayCheez in earlier parts,
        this is just a snippet of that XML Layer-->
</filesystem>

Now, I made use of XMLTokenId, as the reference tutorial made use of HTMLTokenId, and did the implementation based on XMLTokenId constants.

Note
The required HyperlinkProvider instance will be registered under text/xml, so any XML file with that MIME Type will hyperlink as suggested.

Features

  • When you click on filesystem/folder/file, a Dialog Box prompts the user with a message that you have clicked right hyperlink, IDE opens the DTD file represented by PUBLIC_ID.
  • For that to happen, click on PUBLIC_ID first to let the IDE know which DTD, does the XML is specified by, then PUBLIC_ID -> URI mapping takes place (redesigning, refer to XML Code Completion support).
  • Also, it extracts the DTD file clicking the SYSTEM_ID (if present is hyperlinked) conforms to and hyperlinks it, clicking it will launch the Browser with the identified URL.

Work Ahead

When you click on filesystem/folder/file, locate the DTD file and open in NetBeans IDE, with specific caret position. As you know, Angad has already created a module for DTD-intra-hyperlinking! So, you would be able to enjoy both functionalities, similar to the one existing in IntelliJ IDEA!

Updated on July 14, 2008

sTay Tuned for More…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s