org.dspace.app.xmlui.wing.element
Class WingDocument

java.lang.Object
  extended by org.dspace.app.xmlui.wing.element.AbstractWingElement
      extended by org.dspace.app.xmlui.wing.element.WingDocument
All Implemented Interfaces:
WingElement, WingMergeableElement

public class WingDocument
extends AbstractWingElement
implements WingMergeableElement

A class representing a WingDocument. Documents contain three elements and they are all mandatory: meta, body, and options. Because they are all mandatory they are created at construction time. Note: We called the class "WingDocument" instead of just plain old "Document" so that it won't conflict with all the other documents out there like DOM's document.

Author:
Scott Phillips

Field Summary
static String A_VERSION
          The name of the version attribute
static String DOCUMENT_VERSION
          The document version Wing prefer
static String E_DOCUMENT
          The name of the document element
 
Fields inherited from class org.dspace.app.xmlui.wing.element.AbstractWingElement
context
 
Constructor Summary
WingDocument(WingContext context)
          Generate a new wing document element.
 
Method Summary
 void dispose()
          dispose
 Attributes merge(Attributes attributes)
          Notify the element that this document is being merged.
 WingMergeableElement mergeChild(String namespace, String localName, String qName, Attributes attributes)
          Merge the given event into this document.
 boolean mergeEqual(String namespace, String localName, String qName, Attributes attributes)
          Is this document the same as the given SAX event.
 Body setBody()
          Set the body element containing the structural elements associated with this document.
 Meta setMeta()
          Set the meta element of this Document containing all the metadata associated with this document.
 Options setOptions()
          Set the Options element containing the structural navigational structure associated with this document.
 void toSAX(ContentHandler contentHandler, LexicalHandler lexicalHandler, NamespaceSupport namespaces)
          Translate this document to SAX events.
 
Methods inherited from class org.dspace.app.xmlui.wing.element.AbstractWingElement
endElement, endElement, getWingContext, greater, lesser, require, require, requireFalse, requireTrue, restrict, sendCharacters, setWingContext, startElement, startElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

E_DOCUMENT

public static final String E_DOCUMENT
The name of the document element

See Also:
Constant Field Values

A_VERSION

public static final String A_VERSION
The name of the version attribute

See Also:
Constant Field Values

DOCUMENT_VERSION

public static final String DOCUMENT_VERSION
The document version Wing prefer

See Also:
Constant Field Values
Constructor Detail

WingDocument

public WingDocument(WingContext context)
             throws WingException
Generate a new wing document element.

Parameters:
context - (Required) The context this element is contained in.
Throws:
WingException
Method Detail

setMeta

public Meta setMeta()
             throws WingException
Set the meta element of this Document containing all the metadata associated with this document.

Returns:
The Meta element
Throws:
WingException

setBody

public Body setBody()
             throws WingException
Set the body element containing the structural elements associated with this document.

Returns:
The Body element.
Throws:
WingException

setOptions

public Options setOptions()
                   throws WingException
Set the Options element containing the structural navigational structure associated with this document.

Returns:
The Options element.
Throws:
WingException

mergeEqual

public boolean mergeEqual(String namespace,
                          String localName,
                          String qName,
                          Attributes attributes)
                   throws SAXException,
                          WingException
Is this document the same as the given SAX event. Note: this method will throw an error if the given event's document version number is out of bounds for this implementation of Wing.

Specified by:
mergeEqual in interface WingMergeableElement
Parameters:
namespace - The element's name space
localName - The local, unqualified, name for this element
qName - The qualified name for this element
attributes - The element's attributes
Returns:
True if this WingElement is equivalent to the given SAX Event.
Throws:
SAXException
WingException

mergeChild

public WingMergeableElement mergeChild(String namespace,
                                       String localName,
                                       String qName,
                                       Attributes attributes)
                                throws SAXException,
                                       WingException
Merge the given event into this document.

Specified by:
mergeChild in interface WingMergeableElement
Parameters:
namespace - The element's name space
localName - The local, unqualified, name for this element *
qName - The qualified name for this element
attributes - The element's attributes
Returns:
The child element
Throws:
SAXException
WingException

merge

public Attributes merge(Attributes attributes)
                 throws SAXException,
                        WingException
Notify the element that this document is being merged.

Specified by:
merge in interface WingMergeableElement
Returns:
The attributes for this merged element
Throws:
SAXException
WingException

toSAX

public void toSAX(ContentHandler contentHandler,
                  LexicalHandler lexicalHandler,
                  NamespaceSupport namespaces)
           throws SAXException
Translate this document to SAX events.

Specified by:
toSAX in interface WingElement
Parameters:
contentHandler - (Required) The registered contentHandler where SAX events should be routed too.
lexicalHandler - (Required) The registered lexicalHandler where lexical events (such as CDATA, DTD, etc) should be routed too.
namespaces - (Required) SAX Helper class to keep track of namespaces able to determine the correct prefix for a given namespace URI.
Throws:
SAXException

dispose

public void dispose()
dispose

Specified by:
dispose in interface WingElement
Overrides:
dispose in class AbstractWingElement


Copyright © 2012 DuraSpace. All Rights Reserved.