org.xanot.dtd
Class DefaultDtdModel

java.lang.Object
  extended by org.xanot.dtd.DefaultDtdModel
All Implemented Interfaces:
DtdModel

public class DefaultDtdModel
extends java.lang.Object
implements DtdModel

Implementation of the DTD model.

Author:
Ferdinand Neman (newm4n_at_gmail.com)

Field Summary
static java.lang.String DTD_PATTERN
          Main pattern of DTD element patterns.
static java.util.regex.Pattern pattern
          The pattern object compiled from DTD_PATTERN
 
Constructor Summary
DefaultDtdModel(java.io.File file)
          Create new instance of Dtd Model.
DefaultDtdModel(java.io.InputStream inputStream)
          Create new instance of Dtd Model.
DefaultDtdModel(java.lang.String path)
          Create new instance of Dtd model.
 
Method Summary
 void addDtdAttList(DtdAttList dtdAttList)
          Add new DtdAttList object into the DtdAttLists array list.
 void addDtdElement(DtdElement dtdElement)
          Add new DtdElement object into the DtdElements array list.
 int dtdAttListCount()
          Get numbers of attList element within the dtd file.
 int dtdElementCount()
          Get numbers of Element within the dtd file.
 DtdAttList getDtdAttListAt(int idx)
          Get attList model object at specific index.
 java.util.ArrayList<DtdAttList> getDtdAttLists()
          Get list of attList element of DTD.
 DtdElement getDtdElement(java.lang.String name)
          Get Element model object by giving its name
 DtdElement getDtdElementAt(int idx)
          Get Element model object at specific index.
 java.util.ArrayList<DtdElement> getDtdElements()
          Get list of elements element of DTD.
 void removeDtdAttList(DtdAttList dtdAttList)
          Remove an instance from DtdAttLists array list.
 void removeDtdElement(DtdElement dtdElement)
          Remove an instance from DtdElements array list.
 void setDtdAttLists(java.util.ArrayList<DtdAttList> dtdAttLists)
          Set DtdAttLists Collections.
 void setDtdElements(java.util.ArrayList<DtdElement> dtdElements)
          Set DtdElement Collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DTD_PATTERN

public static java.lang.String DTD_PATTERN
Main pattern of DTD element patterns. This pattern include elements of attlist and element.


pattern

public static java.util.regex.Pattern pattern
The pattern object compiled from DTD_PATTERN

Constructor Detail

DefaultDtdModel

public DefaultDtdModel(java.lang.String path)
                throws java.io.IOException
Create new instance of Dtd model.

Parameters:
path - Path to the dtd file.
Throws:
java.io.IOException - Thrown if some how the dtd file canot be readed.

DefaultDtdModel

public DefaultDtdModel(java.io.File file)
                throws java.io.IOException
Create new instance of Dtd Model.

Parameters:
file - DTD file object.
Throws:
java.io.IOException - Thrown if somehow the dtd file canot be readed.

DefaultDtdModel

public DefaultDtdModel(java.io.InputStream inputStream)
                throws java.io.IOException
Create new instance of Dtd Model.

Parameters:
inputStream - Input stream where streamed in data is a DTD data.
Throws:
java.io.IOException - Thrown if somehow problem raised because of streaming-in.
Method Detail

getDtdAttLists

public java.util.ArrayList<DtdAttList> getDtdAttLists()
Description copied from interface: DtdModel
Get list of attList element of DTD. the Att list is always in sequence as the dtd file have put it.

Specified by:
getDtdAttLists in interface DtdModel
Returns:
List of DtdAttList model objects.
See Also:
DtdModel.getDtdAttLists()

setDtdAttLists

public void setDtdAttLists(java.util.ArrayList<DtdAttList> dtdAttLists)
Set DtdAttLists Collections.

Parameters:
dtdAttLists - New DtdAttList object array list.

getDtdElements

public java.util.ArrayList<DtdElement> getDtdElements()
Description copied from interface: DtdModel
Get list of elements element of DTD. The Element is always in sequence as the dtd file have put it.

Specified by:
getDtdElements in interface DtdModel
Returns:
List of DtdElement model objects.
See Also:
DtdModel.getDtdElements()

setDtdElements

public void setDtdElements(java.util.ArrayList<DtdElement> dtdElements)
Set DtdElement Collection.

Parameters:
dtdElements - New DtdElement object array list.

addDtdAttList

public void addDtdAttList(DtdAttList dtdAttList)
Add new DtdAttList object into the DtdAttLists array list.

Parameters:
dtdAttList - Object to add.

addDtdElement

public void addDtdElement(DtdElement dtdElement)
Add new DtdElement object into the DtdElements array list.

Parameters:
dtdElement - Object to add.

removeDtdAttList

public void removeDtdAttList(DtdAttList dtdAttList)
Remove an instance from DtdAttLists array list.

Parameters:
dtdAttList - Instance to remove.

removeDtdElement

public void removeDtdElement(DtdElement dtdElement)
Remove an instance from DtdElements array list.

Parameters:
dtdElement - Instance to remove.

dtdAttListCount

public int dtdAttListCount()
Description copied from interface: DtdModel
Get numbers of attList element within the dtd file.

Specified by:
dtdAttListCount in interface DtdModel
Returns:
Number of attList element inside dtd.
See Also:
DtdModel.dtdAttListCount()

dtdElementCount

public int dtdElementCount()
Description copied from interface: DtdModel
Get numbers of Element within the dtd file.

Specified by:
dtdElementCount in interface DtdModel
Returns:
Number of Element inside dtd.
See Also:
DtdModel.dtdElementCount()

getDtdAttListAt

public DtdAttList getDtdAttListAt(int idx)
Description copied from interface: DtdModel
Get attList model object at specific index.

Specified by:
getDtdAttListAt in interface DtdModel
Parameters:
idx - Index
Returns:
DtdAttList object at specified index.
See Also:
DtdModel.getDtdAttListAt(int)

getDtdElementAt

public DtdElement getDtdElementAt(int idx)
Description copied from interface: DtdModel
Get Element model object at specific index.

Specified by:
getDtdElementAt in interface DtdModel
Parameters:
idx - Index
Returns:
DtdAttList object at specific index.
See Also:
DtdModel.getDtdElementAt(int)

getDtdElement

public DtdElement getDtdElement(java.lang.String name)
Description copied from interface: DtdModel
Get Element model object by giving its name

Specified by:
getDtdElement in interface DtdModel
Parameters:
name - Element name
Returns:
Element.
See Also:
DtdModel.getDtdElement(java.lang.String)


Copyright 2006 null. All Rights Reserved.