org.apache.ws.jaxme.xs.util

Class DTDParser

public class DTDParser extends XSLogicalParser

A SAX parser converting a DTD into an instance of XML Schema.
Nested Class Summary
protected static classDTDParser.ChildToken
classDTDParser.DtdDeclHandler
Implementation of a {@link DeclHandler} for reading the element and attribute declarations.
classDTDParser.DTDAttribute
This class is used to collect the attributes in the DTD temporarily.
classDTDParser.DTDElement
This class is used to collect the elements in the DTD temporarily.
static classDTDParser.StringBufferReader
This class is similar to a StringReader, except that it allows to extend the input dynamically.
Method Summary
protected voidaddChildren(XsTTopLevelElement pElement, XsTExplicitGroup pGroup, DTDParser.ChildToken pToken, Locator pLocator)
Adds the childs to a group.
protected voidcreateAttribute(XsGAttrDecls pAttrDecls, DTDParser.DTDAttribute pAttribute)
Creates a new attribute.
protected XsTTopLevelElementcreateElement(XsESchema pSchema, String pName, String pModel, DTDParser.DTDAttribute[] pAttributes, Locator pLocator)
Creates an element named pName with the content model pModel and the attribute list pAttrs in the schema pSchema.
XSContextgetData()
protected StringgetDummyElementName()
LocatorgetLocator()
Returns the document locator.
protected StringgetMultiplicity(String pToken)
Returns a tokens multiplicity.
XsAnyURIgetTargetNamespace()
Returns the created schemas target namespace.
protected voidparse(XsESchema pSchema, InputSource pSource)
Parses the given {@link org.xml.sax.InputSource} and converts it into an instance of {@link org.apache.ws.jaxme.xs.xml.XsESchema}.
XSSchemaparse(InputSource pInputSource)
protected DTDParser.ChildTokenparseChildren(String pModel, Locator pLocator)
Converts a list of children into its tokens.
protected XsGAttrDeclsparseChildren(XsTTopLevelElement pElement, String pModel, Locator pLocator)
Parses a content model with children.
protected XsGAttrDeclsparseMixed(XsTTopLevelElement pElement, String pModel, Locator pLocator, boolean pHasAttributes)
Parses a mixed content model.
protected voidrunXMLReader(InputSource pSource)
Parses the given DTD, filling the parsers temporary map of elements.
voidsetLocator(Locator pLocator)
Sets the document locator.
protected voidsetMultiplicity(XsAGOccurs pOccurs, String pMultiplicity)
Sets the objects multiplicity.
voidsetTargetNamespace(XsAnyURI pTargetNamespace)
Sets the created schemas target namespace.

Method Detail

addChildren

protected void addChildren(XsTTopLevelElement pElement, XsTExplicitGroup pGroup, DTDParser.ChildToken pToken, Locator pLocator)
Adds the childs to a group.

createAttribute

protected void createAttribute(XsGAttrDecls pAttrDecls, DTDParser.DTDAttribute pAttribute)
Creates a new attribute.

createElement

protected XsTTopLevelElement createElement(XsESchema pSchema, String pName, String pModel, DTDParser.DTDAttribute[] pAttributes, Locator pLocator)
Creates an element named pName with the content model pModel and the attribute list pAttrs in the schema pSchema.

getData

public XSContext getData()

getDummyElementName

protected String getDummyElementName()

getLocator

public Locator getLocator()
Returns the document locator.

getMultiplicity

protected String getMultiplicity(String pToken)
Returns a tokens multiplicity.

getTargetNamespace

public XsAnyURI getTargetNamespace()
Returns the created schemas target namespace.

parse

protected void parse(XsESchema pSchema, InputSource pSource)
Parses the given {@link org.xml.sax.InputSource} and converts it into an instance of {@link org.apache.ws.jaxme.xs.xml.XsESchema}.

parse

public XSSchema parse(InputSource pInputSource)

parseChildren

protected DTDParser.ChildToken parseChildren(String pModel, Locator pLocator)
Converts a list of children into its tokens.

parseChildren

protected XsGAttrDecls parseChildren(XsTTopLevelElement pElement, String pModel, Locator pLocator)
Parses a content model with children. This content model is specified as follows:
   children ::= (choice | seq) ('?' | '*' | '+')?
   cp ::= (Name | choice | seq) ('?' | '*' | '+')?
   choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'
   seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
 

parseMixed

protected XsGAttrDecls parseMixed(XsTTopLevelElement pElement, String pModel, Locator pLocator, boolean pHasAttributes)
Parses a mixed content model. The mixed content model is specified as follows:
   Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*'
       | '(' S? '#PCDATA' S? ')' 
 

runXMLReader

protected void runXMLReader(InputSource pSource)
Parses the given DTD, filling the parsers temporary map of elements.

setLocator

public void setLocator(Locator pLocator)
Sets the document locator.

setMultiplicity

protected void setMultiplicity(XsAGOccurs pOccurs, String pMultiplicity)
Sets the objects multiplicity.

setTargetNamespace

public void setTargetNamespace(XsAnyURI pTargetNamespace)
Sets the created schemas target namespace.