com.fg.xmleditor
Interface FXDocumentModel

All Superinterfaces:
FTreeModel, FXModel
All Known Implementing Classes:
FXDocumentModelImpl

public interface FXDocumentModel
extends FXModel

Interface extends XML editor data-model interface FXModel with methods, performing XML documents creating, loading and retrieval.

Version:
1.0
Author:
Felix Golubov

Method Summary
 void clear()
          Removes current XML document from data-model.
 java.lang.String[] getAvailableRootElementNames(java.lang.String ns)
          Returns an array of names of global non-abstract elements names for the given namespace.
 java.lang.String[] getAvailableRootNamespaces()
          Returns an array of namespaces which have global definitions of non-absract elements.
 org.w3c.dom.Document getDocument()
          Returns current XML document as a DOM Tree or null when data-model contains no document.
 java.net.URL getSchemaURL()
          Returns a URL of the current XML Schema document.
 void newDocument(java.net.URL schemaURL)
          Creates new empty XML document for the specified XML Schema for the first available root namespace and element name found.
 void newDocument(java.net.URL schemaURL, java.lang.String elementName)
          Creates a new empty XML document for specified XML Schema and name of the root element.
 void newDocument(java.net.URL schemaURL, java.lang.String ns, java.lang.String elementName)
          Creates a new empty XML document for specified XML Schema and namespace and name of the root element.
 java.util.List openDocument(java.net.URL schemaURL, org.w3c.dom.Document doc)
          Opens an existing XML document with specified XML Schema.
 java.util.List openDocument(java.net.URL schemaURL, org.xml.sax.InputSource src)
          Opens an existing XML document with specified XML Schema.
 java.util.List openDocument(java.net.URL schemaURL, java.net.URL docURL)
          Opens an existing XML document with specified XML Schema.
 void setDocumentChanged(boolean changed)
          Allows to set "changed" status for the current XML document programaticaly.
 
Methods inherited from interface com.fg.xmleditor.FXModel
addModelStatusListener, fireTreeModelDataChanged, getNodeMessage, getNSQualifiers, getRootElementName, getRootNamespace, getValidityMessage, insertInstance, isDocumentChanged, isDocumentValid, populateNode, removeInstance, removeModelStatusListener, setNodeValue, setNSQualifier, toggleSelectionChanged
 
Methods inherited from interface com.fg.ftree.FTreeModel
addTreeModelListener, getAllowsChildren, getChild, getChildCount, getRoot, removeTreeModelListener
 

Method Detail

getAvailableRootNamespaces

public java.lang.String[] getAvailableRootNamespaces()
Returns an array of namespaces which have global definitions of non-absract elements.

Returns:
an array of namespaces which have global definitions of non-absract elements.

getAvailableRootElementNames

public java.lang.String[] getAvailableRootElementNames(java.lang.String ns)
Returns an array of names of global non-abstract elements names for the given namespace.

Parameters:
ns - a namespace URI
Returns:
an array of names of global non-abstract elements names for given namespace.

newDocument

public void newDocument(java.net.URL schemaURL)
                 throws FXModelException
Creates new empty XML document for the specified XML Schema for the first available root namespace and element name found.

Parameters:
schemaURL - a URL of the XML Schema document
Throws:
FXModelException - when specified XML document can't be created

newDocument

public void newDocument(java.net.URL schemaURL,
                        java.lang.String elementName)
                 throws FXModelException
Creates a new empty XML document for specified XML Schema and name of the root element. Method tries to find a namespace, which contains definition of the required root element and throws FXModelException when no such namespace found.

Parameters:
schemaURL - a URL of the XML Schema document
elementName - a local name of the root XML element
Throws:
FXModelException - when specified XML document can't be created

newDocument

public void newDocument(java.net.URL schemaURL,
                        java.lang.String ns,
                        java.lang.String elementName)
                 throws FXModelException
Creates a new empty XML document for specified XML Schema and namespace and name of the root element.

Parameters:
schemaURL - a URL of the XML Schema document
ns - a namespace of the root XML element
elementName - a local name of the root XML element
Throws:
FXModelException - when specified XML document can't be created

openDocument

public java.util.List openDocument(java.net.URL schemaURL,
                                   org.w3c.dom.Document doc)
                            throws FXModelException
Opens an existing XML document with specified XML Schema. The XML document is passed as a DOM tree.

Parameters:
schemaURL - a URL of the XML Schema document
doc - a Document object, which holds existing XML document
Returns:
a list of the org.w3c.dom.Element elements, which have not been loaded because of the document structural invalidity or null if the whole document has been loaded successfully.
Throws:
FXModelException - when specified XML document can't be opened with the specified XML Schema.

openDocument

public java.util.List openDocument(java.net.URL schemaURL,
                                   java.net.URL docURL)
                            throws FXModelException
Opens an existing XML document with specified XML Schema. The XML document is specified by the URL parameter.

Parameters:
schemaURL - a URL of the XML Schema document
docURL - a URL of the XML document
Returns:
a list of the org.w3c.dom.Element elements, which have not been loaded because of the document structural invalidity or null if the whole document has been loaded successfully.
Throws:
FXModelException - when specified XML document can't be opened with the specified XML Schema.

openDocument

public java.util.List openDocument(java.net.URL schemaURL,
                                   org.xml.sax.InputSource src)
                            throws FXModelException
Opens an existing XML document with specified XML Schema. The XML document is specified by the InputSource parameter.

Parameters:
schemaURL - a URL of the XML Schema document
src - an InputSource for the XML document
Returns:
a list of the org.w3c.dom.Element elements, which have not been loaded because of the document structural invalidity or null if the whole document has been loaded successfully.
Throws:
FXModelException - when specified XML document can't be opened with the specified XML Schema.

setDocumentChanged

public void setDocumentChanged(boolean changed)
Allows to set "changed" status for the current XML document programaticaly. For example, the status can be reset to false after the current document is saved.

Parameters:
changed - a "changed" boolean value

getSchemaURL

public java.net.URL getSchemaURL()
Returns a URL of the current XML Schema document.

Returns:
a URL of the current XML Schema document

getDocument

public org.w3c.dom.Document getDocument()
Returns current XML document as a DOM Tree or null when data-model contains no document.

Returns:
a Document object.

clear

public void clear()
Removes current XML document from data-model.