fr.tireme.schemadoc.xs2dtd.SDDTD
Class DTDHandlerDOMUtils

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

public class DTDHandlerDOMUtils
extends java.lang.Object

DOM utilities dedicated to fr.tireme.schemadoc.xs2dtd.SDDTD.DTDHandler class

Author:
niemaz

Constructor Summary
DTDHandlerDOMUtils(org.w3c.dom.Document doc_)
           
 
Method Summary
 java.util.List getFirstPEWithLocalName(org.w3c.dom.Node node, java.lang.String localName_)
          Gets first encountered PE, either a PeDef or a PeRef, with given localName
 java.lang.String getHandlerID(org.w3c.dom.Node elem)
          Gets the root ID attribute value (xs2dtdHanlder top node) of the given node
 java.lang.String getHandlerID(java.lang.String name_)
          Gets the root ID attribute value (xs2dtdHanlder top node) of the node identified by the given name
 java.lang.String getID(org.w3c.dom.Node node_)
          Gets the id attribute value of the element identified by the given name
 java.lang.String getID(java.lang.String name_)
          Gets the id attribute value of the element identified by the given name
 org.w3c.dom.Node getIncludeNodeWithID(java.lang.String includeID_)
          Gets the according include Node
 java.lang.String getLocalName(org.w3c.dom.Node node_)
          Gets the localName of this node, if any
 org.w3c.dom.Node getNodeWithID(java.lang.String id_)
          Gets the DOM element which id match the given id
 org.w3c.dom.NodeList getPeDefs()
          Gets all the peDef nodes
 java.util.List<org.w3c.dom.Node> getPeDefsEndingWith(java.lang.String localNameEnd)
          Gets all the peDefs which localName ends with the given String parameter
 java.util.List getPeNodesWithLocalName(org.w3c.dom.Node node, java.lang.String localName_)
          Searches for peDef and peRef nodes.
 org.w3c.dom.Node getXs2dtdHandlerNodeWithID(java.lang.String id_)
          Gets the xs2dtdHanlder node which id match the given id
 boolean isChildUnique(org.w3c.dom.Node parentNode, java.lang.String localName_, java.lang.String nameSpace_)
          Searches for child nodes with the same localName & namespace in the parent node
 boolean isElemDeclUnique(java.lang.String localName_, java.lang.String nameSpace_)
          Searches for elements with the same localName & namespace
 boolean isFirst(org.w3c.dom.Node peDef1, org.w3c.dom.Node peDef2)
          Is this (first param) peDef node first?
 boolean isIDUnique(java.lang.String id_)
          Searches for peRefs and 'localName' nodes which have the given ID
 boolean isPeDefPeRefed(java.lang.String peDefLocalName)
          Gets if the given peDef is referenced by a peRef somewhere ...
 void removeEmptyComments()
          Remove empty comments from generated DTDHandler
 void removeUnRefedForMixedGroups()
          Remove unused created 'formixed' group declarations
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTDHandlerDOMUtils

public DTDHandlerDOMUtils(org.w3c.dom.Document doc_)
Method Detail

getHandlerID

public java.lang.String getHandlerID(org.w3c.dom.Node elem)
                              throws Xs2dtdException
Gets the root ID attribute value (xs2dtdHanlder top node) of the given node

Parameters:
elem - - node
Returns:
String - id
Throws:
Xs2dtdException

getHandlerID

public java.lang.String getHandlerID(java.lang.String name_)
                              throws Xs2dtdException
Gets the root ID attribute value (xs2dtdHanlder top node) of the node identified by the given name

Parameters:
name_ - - name
Returns:
String - id
Throws:
Xs2dtdException

isIDUnique

public boolean isIDUnique(java.lang.String id_)
                   throws Xs2dtdException
Searches for peRefs and 'localName' nodes which have the given ID

Parameters:
id_ - - ID
Returns:
boolean - false if found, false true
Throws:
Xs2dtdException

isChildUnique

public boolean isChildUnique(org.w3c.dom.Node parentNode,
                             java.lang.String localName_,
                             java.lang.String nameSpace_)
                      throws Xs2dtdException
Searches for child nodes with the same localName & namespace in the parent node

Parameters:
parentNode -
localName_ -
nameSpace_ -
Returns:
boolean - false if found, true otherwise
Throws:
Xs2dtdException

isElemDeclUnique

public boolean isElemDeclUnique(java.lang.String localName_,
                                java.lang.String nameSpace_)
                         throws Xs2dtdException
Searches for elements with the same localName & namespace

Parameters:
localName_ -
nameSpace_ -
Returns:
boolean - false if found, true otherwise
Throws:
Xs2dtdException

getNodeWithID

public org.w3c.dom.Node getNodeWithID(java.lang.String id_)
                               throws Xs2dtdException
Gets the DOM element which id match the given id

Parameters:
id_ -
Returns:
Node - node
Throws:
Xs2dtdException

getXs2dtdHandlerNodeWithID

public org.w3c.dom.Node getXs2dtdHandlerNodeWithID(java.lang.String id_)
                                            throws Xs2dtdException
Gets the xs2dtdHanlder node which id match the given id

Parameters:
id_ -
Returns:
Node - xs2dtdHanlder node
Throws:
Xs2dtdException

isPeDefPeRefed

public boolean isPeDefPeRefed(java.lang.String peDefLocalName)
                       throws Xs2dtdException
Gets if the given peDef is referenced by a peRef somewhere ...

Parameters:
peDefLocalName - - peDef local name
Returns:
boolean - true if peRef found, false otherwise
Throws:
Xs2dtdException

getPeDefs

public org.w3c.dom.NodeList getPeDefs()
                               throws Xs2dtdException
Gets all the peDef nodes

Returns:
NodeList - list of peDefs
Throws:
Xs2dtdException

getFirstPEWithLocalName

public java.util.List getFirstPEWithLocalName(org.w3c.dom.Node node,
                                              java.lang.String localName_)
                                       throws Xs2dtdException
Gets first encountered PE, either a PeDef or a PeRef, with given localName

Parameters:
node - - parent node
localName_ -
Returns:
List -
Throws:
Xs2dtdException

getPeNodesWithLocalName

public java.util.List getPeNodesWithLocalName(org.w3c.dom.Node node,
                                              java.lang.String localName_)
                                       throws Xs2dtdException
Searches for peDef and peRef nodes.

Parameters:
node -
localName_ -
Returns:
- list of peDefs and peRefs
Throws:
Xs2dtdException

getLocalName

public java.lang.String getLocalName(org.w3c.dom.Node node_)
                              throws Xs2dtdException
Gets the localName of this node, if any

Parameters:
node_ -
Returns:
String - localName
Throws:
Xs2dtdException

getID

public java.lang.String getID(java.lang.String name_)
                       throws Xs2dtdException
Gets the id attribute value of the element identified by the given name

Parameters:
name_ -
Returns:
String - id
Throws:
Xs2dtdException

getID

public java.lang.String getID(org.w3c.dom.Node node_)
                       throws Xs2dtdException
Gets the id attribute value of the element identified by the given name

Parameters:
node_ -
Returns:
String - id
Throws:
Xs2dtdException

isFirst

public boolean isFirst(org.w3c.dom.Node peDef1,
                       org.w3c.dom.Node peDef2)
                throws Xs2dtdException
Is this (first param) peDef node first?

Parameters:
peDef1 - - peDef node
peDef2 - - peDef node
Returns:
Node - peDef node
Throws:
Xs2dtdException

getIncludeNodeWithID

public org.w3c.dom.Node getIncludeNodeWithID(java.lang.String includeID_)
                                      throws Xs2dtdException
Gets the according include Node

Parameters:
includeID_ -
Returns:
Node - node
Throws:
Xs2dtdException

removeEmptyComments

public void removeEmptyComments()
                         throws Xs2dtdException
Remove empty comments from generated DTDHandler

Throws:
Xs2dtdException

getPeDefsEndingWith

public java.util.List<org.w3c.dom.Node> getPeDefsEndingWith(java.lang.String localNameEnd)
                                                     throws Xs2dtdException
Gets all the peDefs which localName ends with the given String parameter

Parameters:
localNameEnd - - to match with the end of localNames
Returns:
List - list of detected peDefs node
Throws:
Xs2dtdException

removeUnRefedForMixedGroups

public void removeUnRefedForMixedGroups()
                                 throws Xs2dtdException
Remove unused created 'formixed' group declarations

Throws:
Xs2dtdException