|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDTDDoc.ExtendedDTD
public class ExtendedDTD
An object of this class represents a full DTD. That is, the result of
interpretation of a DTD file and all the other files it includes.
A DTD defines a bunch of elements and attributes (and small other things
as well). A DTD file can includes other DTD's file. Therefore some
pieces, although defined in some other files, are defined in the
DTD represented by this
. We call such pieces "external".
One of the goals of this class is to improve over Mark Wutka's DTD class so
that one can know if an element/attribute is "external" or not.
Constructor Summary | |
---|---|
ExtendedDTD(File dtdFilePath,
Logger log,
boolean getAroundNetBeanComments)
Build all the information needed to make a ExtendedDTD out of a "normal" DTD. |
Method Summary | |
---|---|
static Set |
collectDeclaredChildren(com.wutka.dtd.DTDElement element)
Collects the elements that appear in the definition of a given element (its "children"). |
String |
getDoctype()
Returns the doctype of the DTD (see the doctype tag). |
String |
getEffectiveEncoding()
Get the effective encoding of the file: either the encoding specified in the file, or the default encoding (UTF-8) if not specified |
com.wutka.dtd.DTDElement |
getElementByName(com.wutka.dtd.DTDName name)
|
com.wutka.dtd.DTDElement |
getElementByName(String name)
|
String |
getElementOrigin(com.wutka.dtd.DTDElement element)
Gives the file name of the DTD where a given element is defined. |
Map |
getElements()
Return all the DTDElements of the DTD (a transparent wrapper around the same function in Wutka's library). |
Collection |
getElementsCollection()
|
String |
getEncoding()
Get the encoding specified in the file, if any. |
Map |
getEntities()
Return all the DTDEntities of the DTD (a transparent wrapper around the same function in Wutka's library). |
List |
getItems()
Return all the DTDItems of the DTD (a transparent wrapper around the same function in Wutka's library). |
Set |
getParents(String sonName)
Gets the parents of an element. |
com.wutka.dtd.DTDElement |
getRootElement()
Returns the root elements of the DTD, as defined by the \@root tag. |
File |
getSystemPath()
Returns the full path to the original DTD. |
String |
getTitle()
Returns the title of the DTD (see the @title tag). |
static String |
getUniqueId(com.wutka.dtd.DTDAttlist attList,
com.wutka.dtd.DTDAttribute attribute)
Gives a unique id for an attribute in a DTD. |
static String |
getUniqueId(com.wutka.dtd.DTDElement element)
Gives a unique id for an element of a DTD. |
static String |
getUniqueId(com.wutka.dtd.DTDElement element,
com.wutka.dtd.DTDAttribute attribute)
Gives a unique id for an attribute in a DTD. |
boolean |
isExternal(com.wutka.dtd.DTDAttlist attList)
Determine if an attributes list is defined in this DTD. |
boolean |
isExternal(com.wutka.dtd.DTDElement element)
Tells if an element is declared in a DTD outside the one represented in this . |
boolean |
isRoot(com.wutka.dtd.DTDElement element)
Check if an element is root, that is, if it has no parent. |
com.wutka.dtd.DTDAttlist |
locateAttributesList(com.wutka.dtd.DTDAttribute attribute)
|
void |
setRootElement(com.wutka.dtd.DTDElement element)
Setter for the root elements of the DTD. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtendedDTD(File dtdFilePath, Logger log, boolean getAroundNetBeanComments) throws IOException
dtdFilePath
- Path to the original DTD.
IOException
Method Detail |
---|
public String getEncoding()
null
if no encoding was setgetEffectiveEncoding()
public String getEffectiveEncoding()
null
)public String getTitle()
public String getDoctype()
public List getItems()
public Map getElements()
public Collection getElementsCollection()
public com.wutka.dtd.DTDElement getElementByName(String name)
public com.wutka.dtd.DTDElement getElementByName(com.wutka.dtd.DTDName name)
public Map getEntities()
public com.wutka.dtd.DTDElement getRootElement()
public void setRootElement(com.wutka.dtd.DTDElement element)
element
- The root element.public File getSystemPath()
public boolean isExternal(com.wutka.dtd.DTDElement element)
this
.
element
- element to be checked for externality
public boolean isExternal(com.wutka.dtd.DTDAttlist attList)
attList
- attributes list to look for.
public String getElementOrigin(com.wutka.dtd.DTDElement element)
element
- element to be checked
null
if the element is
not part of the DTD.public static String getUniqueId(com.wutka.dtd.DTDAttlist attList, com.wutka.dtd.DTDAttribute attribute)
attList
- The attributes list the attibute is part of.attribute
- The attribute for which we seek the id.
public static String getUniqueId(com.wutka.dtd.DTDElement element, com.wutka.dtd.DTDAttribute attribute)
element
- The element to which the attribute belongs.attribute
- The attribute to get the id for.
getUniqueId( DTDAttlist attList, DTDAttribute attribute)
public static String getUniqueId(com.wutka.dtd.DTDElement element)
element
- The element.
public com.wutka.dtd.DTDAttlist locateAttributesList(com.wutka.dtd.DTDAttribute attribute)
public Set getParents(String sonName)
sonName
- The name of the element to look for.
public boolean isRoot(com.wutka.dtd.DTDElement element)
element
- The element to check.
public static Set collectDeclaredChildren(com.wutka.dtd.DTDElement element)
Special definitions such as ANY, EMPTY and PCDATA are ignored.
element
- The element.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |