fr.tireme.schemadoc.xs2dtd.SDDTD
Class DTDHandler

java.lang.Object
  extended by fr.tireme.schemadoc.xs2dtd.SDDTD.DTDHandler

public class DTDHandler
extends java.lang.Object

Enable the creation of objects needed by the XS2DTDHandler structure as defines in DTDHandler. The class is used by DTDProcessor which is the main process builder. This class enables an abstraction level that keeps the XS2DTDHandler structure fully private in its implementation.

Author:
florent

Constructor Summary
DTDHandler(java.lang.String localxs2DTDHandler)
          Constructor for the DTDBuilder object
 
Method Summary
 void addAny()
          Adds ANY node
 void addAttribute()
          Adds an Attribute Node to the current Node
 void addAttributes()
          Adds an Attributes Node.
 void addAttributeTypeContent()
          Adds an AttributeTypeContent Node to the current Node, and makes it become the current Node.
 void addCdata()
          Adds a cdata Node to the current Node
 void addChildren()
          Adds a Children Node to the current Node, and makes it become the current Node.
 void addChoice(java.lang.String occurs)
          Adds a Choice Node with its occurence to the current Node
 void addComment(int category)
          Adds a predefined comment given the specified category to the contextual comment Node
 void addComment(java.lang.String commentary, int category)
          Adds a text commentary into a predefined comment given the specified category to the contextual comment Node
 void addCommentTo(org.w3c.dom.Node node, java.lang.String value, int category)
          Adds a text commentary into a predefined comment given the specified category to the contextual comment Node
 void addContentModel()
          Adds a ContentModel Node to the current Node
 void addContentModel(boolean usedInMixedContent)
          Adds a ContentModel Node to the current Node
 void addDeclarations()
          Adds a Declarations node
 void addDefaultValue(java.lang.String def_)
          Adds a default node
 void addDtd()
          Adds an dtd Node to the current Node
 void addElementDecl()
          Adds an ElementDecl Node to the current Node
 void addElementRef(java.lang.String name, java.lang.String targetNamespace, java.lang.String occurs)
          Adds an ElementRef Node to the current Node, with the name and targetnamespace attributes, and makes it become the current Node.
 void addEmpty()
          Adds EMPTY node
 void addEnum()
          Adds an enum Node to the current Node
 void addEnumItem(java.lang.String value)
          Adds an EnumItem Node with his value to the current Node
 void addExternalRef()
          Adds an ExternalRef Node to the current Node, and makes it become the current Node.
 void addExternalRef(java.lang.String id_)
          Adds an ExternalRef Node to the current Node, and makes it become th current Node.
 void addFixedValue(java.lang.String fixed_)
          Adds a default node
 void addGlobalProperties()
          Adds a GlobalProperties node
 void addId()
          Adds an id Node to the current Node
 void addIdref()
          Adds an idref Node to the current Node
 void addIdrefs()
          Adds an idrefs Node to the current Node
 void addLostFacetsComment(java.util.List lostFacets)
          Adds lost facets node
 void addMixed()
          Adds a Mixed Node to the current Node, and makes it become the current Node.
 void addNmtoken()
          Adds an nmtoken Node to the current Node
 void addNmtokens()
          Adds an nmtokens Node to the current Node
 void addNodeComment(org.w3c.dom.Node domElement)
          Adds DOM Node commentary to the contextual comment Node
 void addNodeComment(org.w3c.dom.Node nodeComment, int category)
          Adds a DOM node into a predefined comment given the specified category to the contextual comment Node
 void addNodeComment(org.w3c.dom.Node nodeComment, java.lang.String value, int category)
          Adds a DOM node into a predefined comment given the specified category to the contextual comment Node
 void addNsDef(java.lang.String prefix_, java.lang.String namespace_)
          Adds an NsDef node to the top nsDefsNode node
 void addNsDefs()
          Create the nsDefsNode node
 void addPeDef()
          Adds a PeDef Node to the current Node, and makes it become the current Node.
 void addPeRef(QName qName, java.lang.String id_, java.lang.String occurs)
          Adds a PeRef Node to the current Node, with the name and targetnamespace attributes, and makes it become the current Node.
 void addPeRef(QName qName, java.lang.String id_, java.lang.String occurs, boolean suspicious)
          Adds a PeRef Node to the current Node, with the name and targetnamespace attributes.
 void addPublicEntitySetName(java.lang.String dtdPublicName_)
          Adds public set entity name node
 void addqName(QName qName, java.lang.String id_)
          Adds a qName Node to the current Node, with the name and targetnamespace attributes
 void addQualificationScope(java.lang.String elemQualif_, java.lang.String attQualif_)
           
 void addSchema(SDSchema schema_)
          Store the given schema
 void addSchemaOrigin(SDElement element)
          Adds a schemaOrigin node {element schema's id/element's name}
 void addSDProperties()
           
 void addSDProperty(java.lang.String propName, java.lang.String propValue)
           
 void addSequence()
          Adds a Sequence Node
 void addSequence(java.lang.String occurs)
          Adds a Sequence Node with its occurence to the current Node
 void addSystemLocation(java.lang.String dtdLocation_)
          Adds systemLocation node
 void addTargetNamespace(java.lang.String targetNS_)
          Adds a targetNamespace xsFileProperties's child
 void addTextComment(java.lang.String commentary)
          Adds a commentary to the contextual comment Node
 void addTextCommentTo(org.w3c.dom.Node node, java.lang.String commentary)
          Adds a commentary to the given comment Node
 void addUse(java.lang.String kind)
          Adds a use Node to the current Node
 void addXS2DTDHandler(SDSchema schema_)
          Adds an xs2dtdHandler node
 void addxs2dtdHandlerRef(java.lang.String xs2dtdHandlerRef_)
          Adds xs2dtdhandler node
 void addXsFileProperties(java.lang.String fileLocation_)
          Adds a xsFileProperties node
 void addXsProperties()
          Adds xsProperties node
 void appendNsDef(java.lang.String prefix_, java.lang.String namespace_)
          Append a new NsDef node to the top nsDefsNode node
 void emptyContentModel()
          Empty the current content model
 org.w3c.dom.Node getCurrentNode()
          Gets the current node
 org.w3c.dom.Document getDocument()
          Returns the DOM representation of the intermediate XML format
 java.lang.String getImportPrefix(java.lang.String namespace)
          Retrieve the prefix attached to the given namespace
 SDSchema getRootSchema()
          Gets the root schema
 SDSchema getSchema(java.lang.String key)
          Gets a schema given the specified key
 boolean isCurrentNodeContentModel()
          Returns true if the node name of the current node is equal to Symbols.CONTENTMODEL_ELT_NAME
 boolean isParentNodeDeclarations()
          Returns true if the node name of the parent node is equal to Symbols.DECLARATIONS_ELT_NAME
 void placeComment()
          Creates a comment element or move an existing one.
 void placeComment(org.w3c.dom.Node node)
          Creates a comment element or moved an existing one.
 void setCurrentNode(org.w3c.dom.Node node_)
          Reassigns the current node
 void setRootSchema(SDSchema schema_)
          Sets the root schema
 void up()
          Ends the current Node.
 void updateNamespaces(SDSchema schema_)
          Updates targetNamespaces of XS2DTDHandler root.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTDHandler

public DTDHandler(java.lang.String localxs2DTDHandler)
           throws javax.xml.parsers.ParserConfigurationException
Constructor for the DTDBuilder object

Parameters:
localxs2DTDHandler -
Throws:
javax.xml.parsers.ParserConfigurationException
Method Detail

updateNamespaces

public void updateNamespaces(SDSchema schema_)
Updates targetNamespaces of XS2DTDHandler root. Manages conflicts.

Parameters:
schema_ -

getImportPrefix

public java.lang.String getImportPrefix(java.lang.String namespace)
Retrieve the prefix attached to the given namespace

Parameters:
namespace -
Returns:
String - prefix or null

getDocument

public org.w3c.dom.Document getDocument()
Returns the DOM representation of the intermediate XML format

Returns:
Document - DOM document

setRootSchema

public void setRootSchema(SDSchema schema_)
Sets the root schema

Parameters:
schema_ -

getRootSchema

public SDSchema getRootSchema()
Gets the root schema

Returns:
SDSchema - schema

addSchema

public void addSchema(SDSchema schema_)
Store the given schema

Parameters:
schema_ -
Throws:
Xs2dtdException

getSchema

public SDSchema getSchema(java.lang.String key)
Gets a schema given the specified key

Parameters:
key -
Returns:
SDSchema - schema

setCurrentNode

public void setCurrentNode(org.w3c.dom.Node node_)
Reassigns the current node

Parameters:
node_ - - new node

getCurrentNode

public org.w3c.dom.Node getCurrentNode()
Gets the current node

Returns:
Node - current node

addXS2DTDHandler

public void addXS2DTDHandler(SDSchema schema_)
                      throws Xs2dtdException
Adds an xs2dtdHandler node

Parameters:
schema_ -
Throws:
Xs2dtdException - void -

addGlobalProperties

public void addGlobalProperties()
                         throws Xs2dtdException
Adds a GlobalProperties node

Throws:
Xs2dtdException - void -

addDeclarations

public void addDeclarations()
                     throws Xs2dtdException
Adds a Declarations node

Throws:
Xs2dtdException - void -

addElementDecl

public void addElementDecl()
                    throws Xs2dtdException
Adds an ElementDecl Node to the current Node

Throws:
Xs2dtdException

addContentModel

public void addContentModel()
                     throws Xs2dtdException
Adds a ContentModel Node to the current Node

Throws:
Xs2dtdException

emptyContentModel

public void emptyContentModel()
                       throws Xs2dtdException
Empty the current content model

Throws:
Xs2dtdException

isCurrentNodeContentModel

public boolean isCurrentNodeContentModel()
Returns true if the node name of the current node is equal to Symbols.CONTENTMODEL_ELT_NAME

Returns:
boolean -

isParentNodeDeclarations

public boolean isParentNodeDeclarations()
Returns true if the node name of the parent node is equal to Symbols.DECLARATIONS_ELT_NAME

Returns:
boolean -

addContentModel

public void addContentModel(boolean usedInMixedContent)
                     throws Xs2dtdException
Adds a ContentModel Node to the current Node

Parameters:
usedInMixedContent - - true if used in mixed
Throws:
Xs2dtdException

addAttributes

public void addAttributes()
                   throws Xs2dtdException
Adds an Attributes Node.

Throws:
Xs2dtdException

addSequence

public void addSequence(java.lang.String occurs)
                 throws Xs2dtdException
Adds a Sequence Node with its occurence to the current Node

Parameters:
occurs - - The resolved occurence.
Throws:
Xs2dtdException

addSequence

public void addSequence()
                 throws Xs2dtdException
Adds a Sequence Node

Throws:
Xs2dtdException

addChoice

public void addChoice(java.lang.String occurs)
               throws Xs2dtdException
Adds a Choice Node with its occurence to the current Node

Parameters:
occurs - - The resolved occurence.
Throws:
Xs2dtdException

addPeDef

public void addPeDef()
              throws Xs2dtdException
Adds a PeDef Node to the current Node, and makes it become the current Node.

Throws:
Xs2dtdException

addPeRef

public void addPeRef(QName qName,
                     java.lang.String id_,
                     java.lang.String occurs,
                     boolean suspicious)
              throws Xs2dtdException
Adds a PeRef Node to the current Node, with the name and targetnamespace attributes. Adds suspiciousLocalName attribute if necessary

Parameters:
qName - - Its contains the name and targetnamespace
id_ - - ID
occurs - - The feature to be added to the PeRef attribute
suspicious - - true if localName of reference is suspicious
Throws:
Xs2dtdException

addPeRef

public void addPeRef(QName qName,
                     java.lang.String id_,
                     java.lang.String occurs)
              throws Xs2dtdException
Adds a PeRef Node to the current Node, with the name and targetnamespace attributes, and makes it become the current Node.

Parameters:
qName - - Its contains the name and targetnamespace
id_ - - ID
occurs - - The feature to be added to the PeRef attribute
Throws:
Xs2dtdException

addElementRef

public void addElementRef(java.lang.String name,
                          java.lang.String targetNamespace,
                          java.lang.String occurs)
                   throws Xs2dtdException
Adds an ElementRef Node to the current Node, with the name and targetnamespace attributes, and makes it become the current Node.

Parameters:
name - - The name of the element
targetNamespace - - The targetNamespace of the element
occurs - - The feature to be added to the ElementRef attribute
Throws:
Xs2dtdException

addXsProperties

public void addXsProperties()
                     throws Xs2dtdException
Adds xsProperties node

Throws:
Xs2dtdException - void -

addXsFileProperties

public void addXsFileProperties(java.lang.String fileLocation_)
                         throws Xs2dtdException
Adds a xsFileProperties node

Parameters:
fileLocation_ - - file Location
Throws:
Xs2dtdException - void -

addTargetNamespace

public void addTargetNamespace(java.lang.String targetNS_)
                        throws Xs2dtdException
Adds a targetNamespace xsFileProperties's child

Parameters:
targetNS_ - - targetNamespace
Throws:
Xs2dtdException - void -

addQualificationScope

public void addQualificationScope(java.lang.String elemQualif_,
                                  java.lang.String attQualif_)
                           throws Xs2dtdException
Parameters:
elemQualif_ -
attQualif_ -
Throws:
Xs2dtdException

addSDProperty

public void addSDProperty(java.lang.String propName,
                          java.lang.String propValue)
                   throws Xs2dtdException
Parameters:
propName -
propValue -
Throws:
Xs2dtdException

addSDProperties

public void addSDProperties()
                     throws Xs2dtdException
Throws:
Xs2dtdException

addNsDefs

public void addNsDefs()
               throws Xs2dtdException
Create the nsDefsNode node

Throws:
Xs2dtdException

addNsDef

public void addNsDef(java.lang.String prefix_,
                     java.lang.String namespace_)
              throws Xs2dtdException
Adds an NsDef node to the top nsDefsNode node

Parameters:
prefix_ - - Namespsace prefix
namespace_ - - Namespsace
Throws:
Xs2dtdException

appendNsDef

public void appendNsDef(java.lang.String prefix_,
                        java.lang.String namespace_)
                 throws Xs2dtdException
Append a new NsDef node to the top nsDefsNode node

Parameters:
prefix_ - - Namespsace prefix
namespace_ - - Namespsace
Throws:
Xs2dtdException

addExternalRef

public void addExternalRef(java.lang.String id_)
                    throws Xs2dtdException
Adds an ExternalRef Node to the current Node, and makes it become th current Node.

Parameters:
id_ -
Throws:
Xs2dtdException

addExternalRef

public void addExternalRef()
                    throws Xs2dtdException
Adds an ExternalRef Node to the current Node, and makes it become the current Node.

Throws:
Xs2dtdException

addSystemLocation

public void addSystemLocation(java.lang.String dtdLocation_)
                       throws Xs2dtdException
Adds systemLocation node

Parameters:
dtdLocation_ - - path
Throws:
Xs2dtdException

addPublicEntitySetName

public void addPublicEntitySetName(java.lang.String dtdPublicName_)
                            throws Xs2dtdException
Adds public set entity name node

Parameters:
dtdPublicName_ - - dtd public name value
Throws:
Xs2dtdException

addxs2dtdHandlerRef

public void addxs2dtdHandlerRef(java.lang.String xs2dtdHandlerRef_)
                         throws Xs2dtdException
Adds xs2dtdhandler node

Parameters:
xs2dtdHandlerRef_ - - the handler id
Throws:
Xs2dtdException

addMixed

public void addMixed()
              throws Xs2dtdException
Adds a Mixed Node to the current Node, and makes it become the current Node.

Throws:
Xs2dtdException

addChildren

public void addChildren()
                 throws Xs2dtdException
Adds a Children Node to the current Node, and makes it become the current Node.

Throws:
Xs2dtdException

up

public void up()
Ends the current Node. Its parent becomes the new current Node.


placeComment

public void placeComment()
                  throws Xs2dtdException
Creates a comment element or move an existing one.

Throws:
Xs2dtdException

placeComment

public void placeComment(org.w3c.dom.Node node)
                  throws Xs2dtdException
Creates a comment element or moved an existing one.

Parameters:
node -
Throws:
Xs2dtdException

addTextComment

public void addTextComment(java.lang.String commentary)
                    throws Xs2dtdException
Adds a commentary to the contextual comment Node

Parameters:
commentary - - the commentary to add
Throws:
Xs2dtdException

addTextCommentTo

public void addTextCommentTo(org.w3c.dom.Node node,
                             java.lang.String commentary)
                      throws Xs2dtdException
Adds a commentary to the given comment Node

Parameters:
node - - node to which the comment is added
commentary - - the commentary to add
Throws:
Xs2dtdException

addComment

public void addComment(int category)
                throws Xs2dtdException
Adds a predefined comment given the specified category to the contextual comment Node

Parameters:
category - - comment category
Throws:
Xs2dtdException

addComment

public void addComment(java.lang.String commentary,
                       int category)
                throws Xs2dtdException
Adds a text commentary into a predefined comment given the specified category to the contextual comment Node

Parameters:
commentary - - the commentary to add
category - - comment category
Throws:
Xs2dtdException

addCommentTo

public void addCommentTo(org.w3c.dom.Node node,
                         java.lang.String value,
                         int category)
                  throws Xs2dtdException
Adds a text commentary into a predefined comment given the specified category to the contextual comment Node

Parameters:
node - - node to which the comment is added
value - - the value of the predefined comment' attribute
category - - comment category
Throws:
Xs2dtdException

addNodeComment

public void addNodeComment(org.w3c.dom.Node nodeComment,
                           java.lang.String value,
                           int category)
                    throws Xs2dtdException
Adds a DOM node into a predefined comment given the specified category to the contextual comment Node

Parameters:
nodeComment - - node comment
value - - possible predefined comment's attribute value
category - - comment category
Throws:
Xs2dtdException

addNodeComment

public void addNodeComment(org.w3c.dom.Node nodeComment,
                           int category)
                    throws Xs2dtdException
Adds a DOM node into a predefined comment given the specified category to the contextual comment Node

Parameters:
nodeComment - - node comment
category - - comment category
Throws:
Xs2dtdException

addNodeComment

public void addNodeComment(org.w3c.dom.Node domElement)
                    throws Xs2dtdException
Adds DOM Node commentary to the contextual comment Node

Parameters:
domElement - - the DOM Node to add
Throws:
Xs2dtdException

addLostFacetsComment

public void addLostFacetsComment(java.util.List lostFacets)
                          throws Xs2dtdException
Adds lost facets node

Parameters:
lostFacets - - list of String facet
Throws:
Xs2dtdException

addAttributeTypeContent

public void addAttributeTypeContent()
                             throws Xs2dtdException
Adds an AttributeTypeContent Node to the current Node, and makes it become the current Node.

Throws:
Xs2dtdException

addAttribute

public void addAttribute()
                  throws Xs2dtdException
Adds an Attribute Node to the current Node

Throws:
Xs2dtdException

addDtd

public void addDtd()
            throws Xs2dtdException
Adds an dtd Node to the current Node

Throws:
Xs2dtdException

addEnum

public void addEnum()
             throws Xs2dtdException
Adds an enum Node to the current Node

Throws:
Xs2dtdException

addEnumItem

public void addEnumItem(java.lang.String value)
                 throws Xs2dtdException
Adds an EnumItem Node with his value to the current Node

Parameters:
value - - the enumeration value
Throws:
Xs2dtdException

addId

public void addId()
           throws Xs2dtdException
Adds an id Node to the current Node

Throws:
Xs2dtdException

addAny

public void addAny()
            throws Xs2dtdException
Adds ANY node

Throws:
Xs2dtdException

addEmpty

public void addEmpty()
              throws Xs2dtdException
Adds EMPTY node

Throws:
Xs2dtdException

addIdref

public void addIdref()
              throws Xs2dtdException
Adds an idref Node to the current Node

Throws:
Xs2dtdException

addIdrefs

public void addIdrefs()
               throws Xs2dtdException
Adds an idrefs Node to the current Node

Throws:
Xs2dtdException

addNmtoken

public void addNmtoken()
                throws Xs2dtdException
Adds an nmtoken Node to the current Node

Throws:
Xs2dtdException

addNmtokens

public void addNmtokens()
                 throws Xs2dtdException
Adds an nmtokens Node to the current Node

Throws:
Xs2dtdException

addCdata

public void addCdata()
              throws Xs2dtdException
Adds a cdata Node to the current Node

Throws:
Xs2dtdException

addUse

public void addUse(java.lang.String kind)
            throws Xs2dtdException
Adds a use Node to the current Node

Parameters:
kind - - attribute value
Throws:
Xs2dtdException

addDefaultValue

public void addDefaultValue(java.lang.String def_)
                     throws Xs2dtdException
Adds a default node

Parameters:
def_ - - default value
Throws:
Xs2dtdException

addFixedValue

public void addFixedValue(java.lang.String fixed_)
                   throws Xs2dtdException
Adds a default node

Parameters:
fixed_ - - default value
Throws:
Xs2dtdException

addqName

public void addqName(QName qName,
                     java.lang.String id_)
              throws Xs2dtdException
Adds a qName Node to the current Node, with the name and targetnamespace attributes

Parameters:
qName - - Its contains the name and the targetnamespace
id_ - - ID
Throws:
Xs2dtdException

addSchemaOrigin

public void addSchemaOrigin(SDElement element)
                     throws Xs2dtdException
Adds a schemaOrigin node {element schema's id/element's name}

Parameters:
element - - element
Throws:
Xs2dtdException