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

Method Summary
 void closeView(DocumentView view)
          Unregisters the view.
 Set<String> getAllNamespaces()
          Deprecated. 
 DocumentContent getContent()
          Returns document content retriever for this document.
 Document getDocument()
           Access to the XML document.
 DocumentModifyHelper getDocumentModifyHelper()
          Returns clients Helper for modifying.
 URL getDocumentURL()
          Returns full URI address of the document.
 DomCore getDomProxy()
          Deprecated.  
 String getEncoding()
          Returns encoding, in which the document is serialized.
 sk.baka.ikslibs.ref.EntityManager getEntityManager()
          Returns entity manager for this document.
 ExportManager getExportManager()
          Returns the export manager for this document.
 String getFileName()
          Returns the name of the document file, including the extension, without the path specifier.
 sk.baka.ikslibs.ids.IDManager getIdManager()
          Returns ID manager, that maps IDs to nodes and vice versa.
 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.
 sk.baka.ikslibs.splitted.SplittedDocHolder getSplittedDoc()
          Returns object accessing the 'splitted' image of the document.
 UndoManager getUndoManager()
          Returns instance of the undo manager for this 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
 

Method Detail

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 emp:id attribute, denoting ID of that element.

WARNING: It's client responsibility to use returned reference for read-access only. Any change of the document leads to inconsistency and errorneous behaviour. For write-access use the DocumentModifier object obtained using the getModifier() method.

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.

getIdManager

public sk.baka.ikslibs.ids.IDManager getIdManager()
Returns ID manager, that maps IDs to nodes and vice versa.

Returns:
Id mapper.

getNsManager

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

Returns:
namespace manager for this document.

getEntityManager

public sk.baka.ikslibs.ref.EntityManager getEntityManager()
Returns entity manager for this document.

Returns:
entity manager for this document.

getContent

public DocumentContent getContent()
Returns document content retriever for this document.

Returns:
document content retriever 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.

getDomProxy

@Deprecated
public DomCore getDomProxy()
Deprecated. 

DO NOT USE!!! For testing purposes only.

Returns:
domproxy

getListeners

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

Returns:
document listeners manager for this document.

getExportManager

public ExportManager getExportManager()
Returns the export manager for this document.

Returns:
the export 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.

getSplittedDoc

public sk.baka.ikslibs.splitted.SplittedDocHolder getSplittedDoc()
Returns object accessing the 'splitted' image of the document.

Returns:
A DomToSplitted for this document.

getDocumentModifyHelper

public DocumentModifyHelper getDocumentModifyHelper()
Returns clients Helper for modifying.

Returns:
DocumentModifyHelper instance


Copyright © 2003-2006 null. All Rights Reserved.