JDOM2
0.0.2-BETA

org.jdom2.util
Class XMLBase

java.lang.Object
  extended by org.jdom2.util.XMLBase

public final class XMLBase
extends java.lang.Object

Class used to calculate the XMLBase URI for an Element as per the XMLBase specification here: http://www.w3.org/TR/xmlbase/

This class assumes that all values in xml:base attributes are valid URI values according to the java.net.URI implementation. The same implementation is used to resolve relative URI values, and thus this code follows the assumptions in java.net.URI.

Author:
Rolf Lear

Method Summary
static java.net.URI xmlBase(Element element)
          Calculate the XMLBase URI for an Element using the rules defined in the XMLBase specification, as well as the values supplied in the xml:base attributes on the supplied Element and the Element's ancestry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

xmlBase

public static java.net.URI xmlBase(Element element)
                            throws java.net.URISyntaxException
Calculate the XMLBase URI for an Element using the rules defined in the XMLBase specification, as well as the values supplied in the xml:base attributes on the supplied Element and the Element's ancestry.

This method assumes that all values in xml:base attributes are valid URI values according to the java.net.URI implementation. The same implementation is used to resolve relative URI values, and thus this code follows the assumptions in java.net.URI.

This technically deviates from the XMLBase spec because to fully support legacy HTML the xml:base attribute could contain what is called a 'LIERI' which is a superset of true URI values, but for practical purposes JDOM users should never encounter such values because they are not processing raw HTML (but xhtml maybe).

Parameters:
element - The Element for which to calculate the XMLBase
Returns:
a URI representing the XMLBase value for the supplied Element, or null if one could not be calculated.
Throws:
java.net.URISyntaxException - if it is not possible to create java.new.URI values from the data in the xml:base attributes.

JDOM2
0.0.2-BETA

Copyright © 2011 Jason Hunter, Brett McLaughlin. All Rights Reserved.