cwi.GraphXML.Elements
Class Reference

java.lang.Object
  extended bycwi.GraphXML.Elements.Reference
All Implemented Interfaces:
java.io.Serializable

public class Reference
extends java.lang.Object
implements java.io.Serializable

This class represents a link reference as used in the GraphXML dtd.

The real references are stored in java.net.URL objects. As a reminder: the URL.getRef() method can be used to retrieve the "anchor", or the "reference" part of the url, ie, the portion following the "#" character. This portion is usually used to refer to the a graph in the same file.

Formally, each URL specification must have a protocol part, ie, the form

 <... href="#name"/>
 
is not valid. This implementation catches this problem, and adds the "file" protocol to the url.

Author:
Ivan Herman
See Also:
Serialized Form

Constructor Summary
(package private) Reference(java.net.URL u, java.lang.String cr, java.lang.String ct)
           
 
Method Summary
static Reference create(org.w3c.dom.Node node, ParserError parserError)
          Retrieve the representation of a reference from a node, and returns a corresponding class instance.
static Reference create(org.w3c.dom.Node node, java.lang.String attrName, ParserError parserError)
          Retrieve the representation of a reference from a node via the given attribute name, and return a corresponding class instance.
 java.lang.String getContentRole()
           
 java.lang.String getContentTitle()
           
 java.net.URL getURL()
           
 java.lang.String toString()
          Overrides the corresponding public method in Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Reference

Reference(java.net.URL u,
          java.lang.String cr,
          java.lang.String ct)
Method Detail

getURL

public java.net.URL getURL()

getContentRole

public java.lang.String getContentRole()

getContentTitle

public java.lang.String getContentTitle()

create

public static Reference create(org.w3c.dom.Node node,
                               ParserError parserError)
Retrieve the representation of a reference from a node, and returns a corresponding class instance. If exceptions are raised by the java.net.URL class, these are caught and reported as parser fatal errors.

Parameters:
node - The node containing the xlink information
parserError - The parser in charge; used to generate error messages
Returns:
new Reference class, or null

create

public static Reference create(org.w3c.dom.Node node,
                               java.lang.String attrName,
                               ParserError parserError)
Retrieve the representation of a reference from a node via the given attribute name, and return a corresponding class instance. A typical use is for an edge whose endpoint(s) are a cross-reference:

< edge source="xlink:href='#subgraph0.source'" target="target" >

or

< edge source="source" target="xlink:href='#subgraph1.target'" >

If exceptions are raised by the java.net.URL class, these are caught and reported as parser fatal errors.

Parameters:
node - The node containing the xlink information
attrName - The specific attribute of the node containing the xlink information
parserError - The parser in charge; used to generate error messages
Returns:
new Reference class, or null

toString

public java.lang.String toString()
Overrides the corresponding public method in Object.

Returns:
String representation of the object