sk.uniba.euromath.document
Class XMLAccess

java.lang.Object
  extended by sk.uniba.euromath.document.XMLAccess

public final class XMLAccess
extends Object

Provides access to the document. Accessible from out of document package. Class is not intended to be instantiated by clients.

Author:
Martin Vysny

Field Summary
 String fileName
          The name of the document file, including the extension, without the path specifier.
 URL fileURL
          The name of the document file, including the extension and full path.
 
Method Summary
 void checkNode(Node node)
          Checks the node if it is from our document.
 void checkPtr(DomPointer ptr)
          Checks the pointer if it points into our document.
 void closeView(DocumentView view)
          Unregisters the view.
 Set<String> getAllNamespaces()
          Deprecated. 
 Document getDocument()
           Access to the XML document.
 DocumentModifyHelper getDocumentModifyHelper()
          Returns clients Helper for modifying.
 URL getDocumentURL()
          Returns full URI address of the document.
 String getEncoding()
          Returns encoding, in which the document is serialized.
 EntityManager getEntityManager()
          Returns entity manager for this document.
 String getFileName()
          Returns the name of the document file, including the extension, without the path specifier.
 IDManager getIDManager()
          Returns IDManager instance for this document.
 DocumentListeners getListeners()
          Returns document listeners manager for this document.
 DocumentModifier getModifier()
          Returns document modifier, which is used to transparently modify the document.
 NamespaceManager getNsManager()
          Returns namespace manager for this document.
 URLDir getRoot()
          Returns URL pointing to the directory where the document is located.
 DocumentSchema getSchema()
          Document's content modifier helper.
 DocumentFragment getSource(Node mark)
          Returns the nametree from the original document, that the emp:mark element points to.
 SplittedDocChangeCollector getSplittedChanges()
          Returns object that collects changes in the splitted document.
 SplittedDocHolder getSplittedDoc()
          Returns DomToSplitted instance for this document.
 UndoManager getUndoManager()
          Returns instance of the undo manager for this document.
 boolean isOurNode(Node node)
          Checks the node if it is from our document.
 void loadGlobalSchemas()
          Loads global schemas for all namespaces, present in the document, for which no local schema was loaded.
 void openView(DocumentView view)
          Opens new view on the document.
 void saveDocument(OutputStream out, String encoding, boolean prettyFormatting)
          Serializes in-memory document to specified output stream.
 void serialize(OutputStream out)
          Serializes transformed document "as-is", no emp:id removal is performed.
 void validate()
          Validates this document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileName

public final String fileName
The name of the document file, including the extension, without the path specifier.


fileURL

public final URL fileURL
The name of the document file, including the extension and full path. URI address.

Method Detail

getSplittedChanges

public final SplittedDocChangeCollector getSplittedChanges()
Returns object that collects changes in the splitted document.

Returns:
object that collects changes in the splitted document, never null.

checkNode

public void checkNode(Node node)
Checks the node if it is from our document.

Parameters:
node - node to check.
Throws:
IllegalArgumentException - if node is not from bound document

checkPtr

public void checkPtr(DomPointer ptr)
Checks the pointer if it points into our document.

Parameters:
ptr - pointer to check.
Throws:
IllegalArgumentException - if pointer is not from bound document

isOurNode

public boolean isOurNode(Node node)
Checks the node if it is from our document.

Parameters:
node - node to check.
Returns:
true if the node was created by this document, false otherwise.

getIDManager

public IDManager getIDManager()
Returns IDManager instance for this document.

Returns:
An IDManager for this document.

getSplittedDoc

public SplittedDocHolder getSplittedDoc()
Returns DomToSplitted instance for this document.

Returns:
An DomToSplitted for this document.

getSource

public DocumentFragment getSource(Node mark)
Returns the nametree from the original document, that the emp:mark element points to.

Parameters:
mark - the mark element, or null.
Returns:
the nametree represented as a document fragment. This fragment must not be modified. If null is provided then root fragment is returned.
Throws:
IllegalArgumentException - if the element is not emp:mark or the ID does not exist.

openView

public void openView(DocumentView view)
Opens new view on the document. The view must be initialized.

Parameters:
view - the view to register.

closeView

public void closeView(DocumentView view)
Unregisters the view. The view is no more used by the transformation engine and is subject to garbage collection.

Parameters:
view - the document view to close. Fails if the view was not opened for this document.

getUndoManager

public UndoManager getUndoManager()
Returns instance of the undo manager for this document.

Returns:
the undo manager.

getAllNamespaces

@Deprecated
public Set<String> getAllNamespaces()
Deprecated. 

Returns all namespaces present in the document.

Returns:
set of namespaces. null namespace (nor empty namespace) does not occur in the returned set. Deprecated, use namespace manager methods.

getDocument

public Document getDocument()

Access to the XML document. This document has this special feature: Every element has ExportUtils.GENE_ID_ATTRIBUTE_QNAME attribute, denoting ID of that element.

Returns:
the DOM document.

validate

public void validate()
              throws SchemaException
Validates this document.

Throws:
SchemaException - if something goes wrong in the process of validation.

getModifier

public DocumentModifier getModifier()
Returns document modifier, which is used to transparently modify the document.

Returns:
the document modifier instance.

loadGlobalSchemas

public void loadGlobalSchemas()
                       throws SchemaException,
                              IOException
Loads global schemas for all namespaces, present in the document, for which no local schema was loaded. It must be called before the Schema interface is used, to ensure that all schemata are properly loaded.

Throws:
SchemaException - if error happens during loading of schemas.
IOException - if i/o error occurs

getSchema

public DocumentSchema getSchema()
Document's content modifier helper. For chosen operation returns all possibilities of document modification, that will result in valid document.

Returns:
the document schema instance.

getNsManager

public NamespaceManager getNsManager()
Returns namespace manager for this document.

Returns:
namespace manager for this document.

getEntityManager

public EntityManager getEntityManager()
Returns entity manager for this document.

Returns:
entity manager for this document.

saveDocument

public void saveDocument(OutputStream out,
                         String encoding,
                         boolean prettyFormatting)
Serializes in-memory document to specified output stream.

Parameters:
out - stream, where to store saved xml.
encoding - the encoding. If null, then UTF-8 is used.
prettyFormatting - if output xml will be pretty-formatted - readable by user. Warning: this adds some whitespaces to xml, thus modifying result xml. User must be sure that these whitespaces are discardable.

getEncoding

public String getEncoding()
Returns encoding, in which the document is serialized. May return null if the encoding was not specified.

Returns:
the encoding.

serialize

public void serialize(OutputStream out)
Serializes transformed document "as-is", no emp:id removal is performed. Used only for debug. Serializes only root fragment.

Parameters:
out - the outputstream.

getListeners

public DocumentListeners getListeners()
Returns document listeners manager for this document.

Returns:
document listeners manager for this document.

getDocumentURL

public URL getDocumentURL()
Returns full URI address of the document.

Returns:
document location.

getFileName

public String getFileName()
Returns the name of the document file, including the extension, without the path specifier.

Returns:
the file name without the path.

getRoot

public URLDir getRoot()
Returns URL pointing to the directory where the document is located.

Returns:
location of the XML file.

getDocumentModifyHelper

public DocumentModifyHelper getDocumentModifyHelper()
Returns clients Helper for modifying.

Returns:
DocumentModifyHelper instance


Copyright © 2003-2006 null. All Rights Reserved.