All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.gluebooster.java.booster.basic.text.xml.XmlInContext Maven / Gradle / Ivy

package net.sf.gluebooster.java.booster.basic.text.xml;


import net.sf.gluebooster.java.booster.essentials.container.ResourceSystem;
import net.sf.gluebooster.java.booster.essentials.utils.DomBoostUtils;

import org.w3c.dom.Node;

/**
 * A xml file in a resource system context.
 * @author CBauer
 *
 */
public class XmlInContext {

	/**
	 * The xml.
	 */
	private Node xml;
	
	/**
	 * The resource system the xml is stored
	 */
	private ResourceSystem resourceSystem;
	
	/**
	 * The id in the resource system.
	 */
	private Object resourceId;
 
	public Node getXml() {
		return xml;
	}

	public void setXml(Node xmlRoot) {
		this.xml = xmlRoot;
	}

	public ResourceSystem getResourceSystem() {
		return resourceSystem;
	}

	public void setResourceSystem(ResourceSystem resourceSystem) {
		this.resourceSystem = resourceSystem;
	}

	public Object getResourceId() {
		return resourceId;
	}

	public void setResourceId(Object resourceId) {
		this.resourceId = resourceId;
	}

	/**
	 * The root node of the xml.
	 * 
	 * @return the found node
	 */
	public Node getRootNode() throws Exception{
		if (xml == null){
			xml = DomBoostUtils.read( resourceSystem.getInputStream(resourceId));
		}
		
		return xml;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy