net.groboclown.xml.resource.v1
Class XMLResourceLink
java.lang.Object
|
+--net.groboclown.xml.resource.v1.XMLBaseResource
|
+--net.groboclown.xml.resource.v1.XMLResourceLink
- All Implemented Interfaces:
- IXMLResource
- public class XMLResourceLink
- extends XMLBaseResource
Loads another XML file from the resource URL specified in the "src"
attribute, and all resources loaded from that URL will replace this
object in the children hierarchy.
Usable attributes are:
- src
- [required] the source URI to load the
XML from. This source will be loaded relative from the
current document's location, in the same method as the
current document.
Since this class "hides" the link element from the parent, it requires
special handling from the XMLResourceHandler.
- Version:
- Alpha 0.9.0
- Author:
- Matt Albrecht
Constructor Summary |
XMLResourceLink()
Default constructor - required by IXMLResource contract. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
XML_NAME_SRC
private static final String XML_NAME_SRC
source
private String source
DISPLAY_LINK
private static final boolean DISPLAY_LINK
XMLResourceLink
public XMLResourceLink()
- Default constructor - required by IXMLResource contract.
loadChildren
public IXMLResource[] loadChildren(IInputStreamGenerator isg)
throws SAXException
- Root method invoked by XMLResourceHandler.
parseXMLAttribute
protected boolean parseXMLAttribute(String uri,
String localName,
String rawName,
String name,
String value,
IXMLResource parent)
throws SAXException
- Called when the instance is being initialized with XML attribute data.
At this point, the XML children nodes have not been initialized.
Subclasses which extend this method must have at the
beginning:
if (super.parseXMLAttribute( uri, localName, rawName, name,
value, parent )) return true;
- Overrides:
parseXMLAttribute
in class XMLBaseResource
- Parameters:
uri
- the URI of the element tag's namespace.localName
- name of the XML element tag without the namespace.rawName
- full name of the XML element, with namespace.name
- the attribute namevalue
- the attribute valueparent
- the parent node who contains this node. Useful if the
children need to register themselves with the parent. Can be
null
if this node has no parent.- Returns:
- true if the attribute was parsed, else false.
- Throws:
SAXException
- thrown on any kind of error.
loadXMLChild
protected boolean loadXMLChild(IXMLResource child)
throws SAXException
- Called when the instance is being initialized with its XML children.
This is the last method invoked on the instance during XML
initialization by the XML resource loader, but parent nodes may
invoke methods on it itself.
Subclasses which extend this method must have at the
beginning:
if (super.loadXMLChild( child )) return true;
- Overrides:
loadXMLChild
in class XMLBaseResource
- Parameters:
children
- the IXMLResource
instances loaded
from the XML file, who were contained within this instance's
XML start and end tags.- Returns:
- true if the child was used, else false.
- Throws:
SAXException
- thrown on any kind of error.
Written under the LGPL