de.upb.swt.epctools.plugin.editor
Class EpctoolsXmlFile

java.lang.Object
  extended by de.upb.swt.epctools.plugin.editor.EpctoolsXmlFile

public class EpctoolsXmlFile
extends java.lang.Object

This class reads an epml2.0 file and creates the corresponding EPC instance. After loading an epml file, the EpctoolsXmlFile instance should not be discarded because it is needed to save the xml after the content has been edited (because the xml loading function remembers the structure of the xml file (e.g. comments) and preserves the information when writing the new file).


Field Summary
protected static java.lang.String EPML_ELEMENT_NS
           
protected static java.lang.String EPML_NAMESPACE_URI
           
private  org.w3c.dom.Document m_dom
           
private  EPC m_epc
           
private  org.w3c.dom.Node m_epc_dom
           
protected static java.lang.String SCHEMA_VALIDATION_FEATURE_ID
          Schema validation feature id (http://apache.org/xml/features/validation/schema).
 
Constructor Summary
EpctoolsXmlFile()
          This is the default constructor
EpctoolsXmlFile(org.eclipse.core.resources.IFile file)
          Initialization
 
Method Summary
static java.util.Vector addNodeListToVector(java.util.Vector v, org.w3c.dom.NodeList list)
          This function adds all elements from list to v.
private  void createArcs(org.w3c.dom.Document dom, float scaling_factor)
           
private  org.w3c.dom.Document createEmptyDocument()
          This function returns an empty epml document.
private  void createModel(org.w3c.dom.Document dom)
           
static java.lang.String getEmptyXmlFile()
           
 EPC getEPC()
          This function returns the computed EPC model instance after initialization.
static java.util.Vector getVectorFromNodeList(org.w3c.dom.NodeList list)
          This function converts a NodeList to a Vector.
 java.io.ByteArrayOutputStream save(EPC epc)
          This function saves an EPC model to hard disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEMA_VALIDATION_FEATURE_ID

protected static final java.lang.String SCHEMA_VALIDATION_FEATURE_ID
Schema validation feature id (http://apache.org/xml/features/validation/schema).

See Also:
Constant Field Values

EPML_NAMESPACE_URI

protected static final java.lang.String EPML_NAMESPACE_URI
See Also:
Constant Field Values

EPML_ELEMENT_NS

protected static final java.lang.String EPML_ELEMENT_NS
See Also:
Constant Field Values

m_epc

private EPC m_epc

m_epc_dom

private org.w3c.dom.Node m_epc_dom

m_dom

private org.w3c.dom.Document m_dom
Constructor Detail

EpctoolsXmlFile

public EpctoolsXmlFile(org.eclipse.core.resources.IFile file)
Initialization

Parameters:
file - The input file

EpctoolsXmlFile

public EpctoolsXmlFile()
This is the default constructor

Method Detail

createEmptyDocument

private org.w3c.dom.Document createEmptyDocument()
This function returns an empty epml document.


createModel

private void createModel(org.w3c.dom.Document dom)

createArcs

private void createArcs(org.w3c.dom.Document dom,
                        float scaling_factor)

getEPC

public EPC getEPC()
This function returns the computed EPC model instance after initialization.

Returns:
The EPC corresponding to the input file

save

public java.io.ByteArrayOutputStream save(EPC epc)
This function saves an EPC model to hard disk. This method uses the old dom structure to save user added comments etc..

Parameters:
epc -

getVectorFromNodeList

public static java.util.Vector getVectorFromNodeList(org.w3c.dom.NodeList list)
This function converts a NodeList to a Vector. The returned Vector contains Nodes only!


addNodeListToVector

public static java.util.Vector addNodeListToVector(java.util.Vector v,
                                                   org.w3c.dom.NodeList list)
This function adds all elements from list to v. The returned Vector contains Nodes only, if the parameter v contains Nodes only.


getEmptyXmlFile

public static java.lang.String getEmptyXmlFile()