Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.japisoft.dtdparser.node
Class RootDTDNode

    java.lang.Object
      |
      +--com.japisoft.dtdparser.node.DTDNode
            |
            +--com.japisoft.dtdparser.node.RootDTDNode

All Implemented Interfaces:
  XMLGenerator, XMLValidator

public class RootDTDNode
extends DTDNode
implements XMLValidator, XMLGenerator

Main node type for DTD document type.

Since:
  1.0
Version:
  1.0
Author:
  (c) 2002-2003 JAPISOFT
See Also:
  `XMLValidator`, `XMLGenerator`

Field Summary

Fields inherited from class com.japisoft.dtdparser.node.DTDNode
`ATTRIBUTE, COMMENT, ELEMENT, ELEMENT_REF, ELEMENT_SET, ENTITY, ROOT`

Fields inherited from interface com.japisoft.dtdparser.XMLGenerator
`ENCODING_EUC_JP, ENCODING_ISO_10646_UCS_2, ENCODING_ISO_10646_UCS_4, ENCODING_ISO_2022_JP, ENCODING_ISO_8859_1, ENCODING_ISO_8859_2, ENCODING_ISO_8859_3, ENCODING_ISO_8859_4, ENCODING_ISO_8859_5, ENCODING_ISO_8859_6, ENCODING_ISO_8859_7, ENCODING_ISO_8859_8, ENCODING_ISO_8859_9, ENCODING_Shift_JIS, ENCODING_UTF_16, ENCODING_UTF_8`

Constructor Summary
`RootDTDNode()`

Method Summary
`void` | `addDTDNode(DTDNode node)` Override for fast element access
`ElementDTDNode` | `getElementDeclaration(java.lang.String nodeName)`
`ElementDTDNode` | `getElementDefinitionByName(java.lang.String name)`
`EntityDTDNode` | `getEntityDeclaration(java.lang.String entityName)`
`EntityDTDNode` | `getEntityDefinitionByName(java.lang.String name)`
`java.lang.String` | `getEntityValue(java.lang.String name)`
`java.lang.String` | `getFirstElementName()`
`boolean` | `isAttributeValid(java.lang.String nodeName, java.lang.String attributeName)` Check if the nodeName supports this attribute
`boolean` | `isAttributeValid(java.lang.String nodeName, java.lang.String attributeName, java.lang.String attributeValue)` Check if the nodeName supports this attribute name and value
`boolean` | `isEntityValid(java.lang.String entityName)` Check if the entity name is declared ?
`boolean` | `isNodeDeclared(java.lang.String nodeName)` Check if the nodeName is declared ?
`boolean` | `isNodeValid(java.lang.String nodeParentName, java.lang.String previousNodeName, java.lang.String nodeName, int occurence)` Check if the nodeParent can have the nodeName as child after the 'previousNodeName', occurence is for the node count
`boolean` | `isPreservedComment()`
`void` | `preserveComment(boolean comment)` Save the comment node : By default to true
`void` | `writeDocument(java.io.PrintWriter output, java.lang.String root, java.lang.String dtdURI)` Generate a minimal valid XML document.
`void` | `writeDocument(java.io.PrintWriter output, java.lang.String encoding, java.lang.String rootNode, java.lang.String dtdURI)` Generate a minimal valid XML document.
`void` | `writeDTD(java.io.PrintWriter output)` Rewrite the DTD to the output stream : Note that comment node are always written in the DTD header only

Methods inherited from class com.japisoft.dtdparser.node.DTDNode
`getDTDNodeAt, getDTDNodeCount, getDTDNodeForType, getDTDNodeIndex, getDTDNodes, getDTDParentNode, getNodeComment, getNodeType, getRoot, isAttribute, isComment, isElement, isElementRef, isElementSet, isEmpty, isEntity, isRoot, removeDTDNode, setDTDParentNode, setNodeComment, setNodeType, setRoot`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RootDTDNode

    public RootDTDNode()

Method Detail

### getFirstElementName

    public java.lang.String getFirstElementName()

  Returns:
    the first element from the DTD definition

### isNodeDeclared

    public boolean isNodeDeclared(java.lang.String nodeName)

  Check if the nodeName is declared ?

### getEntityDeclaration

    public EntityDTDNode getEntityDeclaration(java.lang.String entityName)

  Returns:
    an entity declaration for this name or null if the entity is not declared

### getElementDeclaration

    public ElementDTDNode getElementDeclaration(java.lang.String nodeName)

  Returns:
    an element declaration for this name or null if the node is not declared

### isNodeValid

    public boolean isNodeValid(java.lang.String nodeParentName,
                               java.lang.String previousNodeName,
                               java.lang.String nodeName,
                               int occurence)

  Check if the nodeParent can have the nodeName as child after the 'previousNodeName', occurence is for the node count

  Specified by:
    `isNodeValid` in interface `XMLValidator`

### isEntityValid

    public boolean isEntityValid(java.lang.String entityName)

  Check if the entity name is declared ?

  Specified by:
    `isEntityValid` in interface `XMLValidator`

### isAttributeValid

    public boolean isAttributeValid(java.lang.String nodeName,
                                    java.lang.String attributeName)

  Check if the nodeName supports this attribute

  Specified by:
    `isAttributeValid` in interface `XMLValidator`

### isAttributeValid

    public boolean isAttributeValid(java.lang.String nodeName,
                                    java.lang.String attributeName,
                                    java.lang.String attributeValue)

  Check if the nodeName supports this attribute name and value

  Specified by:
    `isAttributeValid` in interface `XMLValidator`

### addDTDNode

    public void addDTDNode(DTDNode node)

  Override for fast element access

  Overrides:
    `addDTDNode` in class `DTDNode`

### getElementDefinitionByName

    public ElementDTDNode getElementDefinitionByName(java.lang.String name)

  Returns:
    a node definition for a name : `null` is returned for unknown element

### getEntityValue

    public java.lang.String getEntityValue(java.lang.String name)

  Returns:
    entity value : `null` is returned for unknown element

### getEntityDefinitionByName

    public EntityDTDNode getEntityDefinitionByName(java.lang.String name)

  Returns:
    the entity definition for the name

### preserveComment

    public void preserveComment(boolean comment)

  Save the comment node : By default to true

### isPreservedComment

    public boolean isPreservedComment()

  Returns:
    true if the comment node are preserved

### writeDocument

    public void writeDocument(java.io.PrintWriter output,
                              java.lang.String encoding,
                              java.lang.String rootNode,
                              java.lang.String dtdURI)
                       throws java.io.IOException

  Generate a minimal valid XML document. You may insert an encoding using the `ENCODING_...` constants

  Specified by:
    `writeDocument` in interface `XMLGenerator`
  Parameters:
    `output` - final document target
    `encoding` - use `ENCODING..`constants``
    `rootNode` - the root node for the generation
    `dtdURI` - dtd location
    `java.io.IOException`

### writeDocument

    public void writeDocument(java.io.PrintWriter output,
                              java.lang.String root,
                              java.lang.String dtdURI)
                       throws java.io.IOException

  Generate a minimal valid XML document.

  Specified by:
    `writeDocument` in interface `XMLGenerator`
  Parameters:
    `output` - final document target
    `root` - the root node for the generation
    `dtdURI` - dtd location
    `java.io.IOException`

### writeDTD

    public void writeDTD(java.io.PrintWriter output)
                  throws java.io.IOException

  Rewrite the DTD to the output stream : Note that comment node are always written in the DTD header only

    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD