Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.merlotxml.merlot
Class XMLFile  view XMLFile download XMLFile.java

java.lang.Object
  extended byorg.merlotxml.merlot.XMLFile
All Implemented Interfaces:
MerlotConstants

public class XMLFile
extends java.lang.Object
implements MerlotConstants

An XML file. This provides an internface into a particular XML file, including its dtd and its file location. It provides methods for loading and parsing a file, saving a file, and accessing the content model in the dtd.

Version:
$Id: XMLFile.java,v 1.3 2002/01/16 17:46:25 flament Exp $

Field Summary
protected  boolean _dirty
          Status holder for marking the file as needing a save
protected  org.merlotxml.util.xml.ValidDocument _doc
          The parsed DOM document with validation
protected  org.w3c.dom.DocumentType _docType
          The document type (dtd)
protected  java.io.File _file
          The file on the filesystem
protected  boolean _new
          Status marker for brand new files so we can call saveas instead of save
protected  java.beans.PropertyChangeSupport _propchange
          property change delegate
 
Fields inherited from interface org.merlotxml.merlot.MerlotConstants
ACTION_MENU_ACCELERATOR, ACTION_MENU_ICON, ACTION_NAME, ACTION_SHORT_DESCRIPTION, ACTION_SMALL_ICON, AFTER, BEFORE, ERR, INTO, UI, XML
 
Constructor Summary
XMLFile()
          creates a new file with a blank Document tree
XMLFile(java.io.File f)
          Reads in the given filename to create the Document tree
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 boolean elementIsValid(org.w3c.dom.Element el, boolean checkChildren)
           
 void firePropertyChange(java.lang.String s, boolean ov, boolean nv)
           
 org.w3c.dom.DocumentType getDoctype()
           
 org.w3c.dom.Document getDocument()
          Returns the DOM document for this file
 org.merlotxml.util.xml.DTDDocument getDTD(java.lang.String name)
          Returns the main DTDDocument for this file
 java.util.Enumeration getDTDAttributes(java.lang.String elementName)
           
 org.merlotxml.util.xml.DTDCacheEntry getDTDCacheEntry()
          returns the DTDCacheEntry for this document.
 java.util.Enumeration getInsertableElements(org.w3c.dom.Element el, int index)
           
 java.lang.String getName()
           
 java.lang.String getPath()
           
 org.merlotxml.util.xml.ValidDocument getValidDocument()
          Returns the DOMLiaison ValidDocument wrapper for this file
 boolean isDirty()
           
 boolean isNew()
          returns the new property
protected  void parseDocument()
           
 void printRawXML(java.io.OutputStream s, boolean pretty)
           
 void save()
          Saves in the same file we opened
 void saveAs(java.io.File f)
          Saves to a new file
 void setDirty(boolean tf)
           
 void setNew(boolean tf)
          Sets the new property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_doc

protected org.merlotxml.util.xml.ValidDocument _doc
The parsed DOM document with validation


_docType

protected org.w3c.dom.DocumentType _docType
The document type (dtd)


_file

protected java.io.File _file
The file on the filesystem


_dirty

protected boolean _dirty
Status holder for marking the file as needing a save


_new

protected boolean _new
Status marker for brand new files so we can call saveas instead of save


_propchange

protected java.beans.PropertyChangeSupport _propchange
property change delegate

Constructor Detail

XMLFile

public XMLFile(java.io.File f)
        throws MerlotException
Reads in the given filename to create the Document tree


XMLFile

public XMLFile()
        throws MerlotException
creates a new file with a blank Document tree

Method Detail

getDocument

public org.w3c.dom.Document getDocument()
Returns the DOM document for this file


getValidDocument

public org.merlotxml.util.xml.ValidDocument getValidDocument()
Returns the DOMLiaison ValidDocument wrapper for this file


getDTD

public org.merlotxml.util.xml.DTDDocument getDTD(java.lang.String name)
Returns the main DTDDocument for this file


getDTDCacheEntry

public org.merlotxml.util.xml.DTDCacheEntry getDTDCacheEntry()
returns the DTDCacheEntry for this document. Useful to get access to the DTD plugin associated with this file


setNew

public void setNew(boolean tf)
Sets the new property


isNew

public boolean isNew()
returns the new property


getDoctype

public org.w3c.dom.DocumentType getDoctype()

parseDocument

protected void parseDocument()
                      throws MerlotException

printRawXML

public void printRawXML(java.io.OutputStream s,
                        boolean pretty)
                 throws MerlotException

getName

public java.lang.String getName()

getPath

public java.lang.String getPath()

getDTDAttributes

public java.util.Enumeration getDTDAttributes(java.lang.String elementName)

getInsertableElements

public java.util.Enumeration getInsertableElements(org.w3c.dom.Element el,
                                                   int index)

elementIsValid

public boolean elementIsValid(org.w3c.dom.Element el,
                              boolean checkChildren)

setDirty

public void setDirty(boolean tf)

isDirty

public boolean isDirty()

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)

firePropertyChange

public void firePropertyChange(java.lang.String s,
                               boolean ov,
                               boolean nv)

save

public void save()
          throws MerlotException
Saves in the same file we opened


saveAs

public void saveAs(java.io.File f)
            throws MerlotException
Saves to a new file