org.merlotxml.util.xml
Interface GrammarDocument

All Known Implementing Classes:
DTDGrammarDocumentImpl, SchemaGrammarDocumentImpl

public interface GrammarDocument

Replaces DTDDocument and provides access to the grammars of DTDs and Schemas through a single interface. Provides access to the definitions of elements (complex types) and attributes (simple types).

Author:
Evert Hoff

Method Summary
 GrammarComplexType getGrammarComplexType(GrammarComplexType parent, java.lang.String name)
          Gets a complex type that is defined within the scope of a parent based on its name.
 GrammarComplexType getTopLevelGrammarComplexType(java.lang.String name)
          Gets a specific top level complex type.
 GrammarComplexType[] getTopLevelGrammarComplexTypes()
          Gets the elements that are defined in the top level.
 

Method Detail

getTopLevelGrammarComplexTypes

public GrammarComplexType[] getTopLevelGrammarComplexTypes()
Gets the elements that are defined in the top level. For DTDs, this is all elements. For Schemas, all the elements that are not defined within the scope of other elements. Remember that with Schemas, complex types might not always have names and more than one complex type with the same name might exist, as long as they are defined within the scopes of different parents. Thus, with Schemas a complex type can not be assumed to be unique by name within the whole XSD. This is why we need to work with complex types and not with elements.

Returns:
The top level elements.

getTopLevelGrammarComplexType

public GrammarComplexType getTopLevelGrammarComplexType(java.lang.String name)
Gets a specific top level complex type.

Parameters:
name - The name of a named, top level element.
Returns:
A top level element with this name.

getGrammarComplexType

public GrammarComplexType getGrammarComplexType(GrammarComplexType parent,
                                                java.lang.String name)
Gets a complex type that is defined within the scope of a parent based on its name.

Parameters:
parent - The parent element.
name - The child element name.
Returns:
The grammarComplexType value