public class VocabTranslator
extends java.lang.Object
Constructor and Description |
---|
VocabTranslator() |
Modifier and Type | Method and Description |
---|---|
char |
addElem(java.lang.String elem)
Adds a new XML element to the translator
|
void |
DTDtoXML(java.lang.String dtdFile,
java.lang.String dtdXmlFile)
Create and XML file from a DTD by keeping only element names and
translating words into characters (attributes, PCDATA and "Any" are not
treated) E.g. the following DTD:
|
char |
getChar(java.lang.String elem)
Get the character associated to the XML element
|
java.lang.String |
getElem(char c)
Returns the XML element associated to the character
|
org.jdom.Document |
translateDTD(com.wutka.dtd.DTD dtd)
transform a DTD to an XML document while translating words into
characters (attributes, PCDATA and "Any" are not treated) E.g. the
following DTD:
|
org.jdom.Element |
translateDTDElement(com.wutka.dtd.DTDElement elem)
transform a DTD element to an XML element by translating words into
characters (attributes, PCDATA and "Any" are not treated)
|
java.lang.String |
translateDTDItem(com.wutka.dtd.DTDItem item)
transform a DTD element's content to a string while translating it into a
character (attributes, PCDATA and "Any" are not treated)
|
public char getChar(java.lang.String elem) throws java.lang.NullPointerException, VocabTranslatorException
elem
- XML elementjava.lang.NullPointerException
- if the element is nullVocabTranslatorException
public java.lang.String getElem(char c) throws java.lang.NullPointerException
c
- character for which the XML element is neededjava.lang.NullPointerException
- if the element is nullpublic char addElem(java.lang.String elem) throws java.lang.NullPointerException, xmlVocabularySizeTooBig
elem
- element to be associated character to be associatedjava.lang.NullPointerException
- if the element or the character is nullxmlVocabularySizeTooBig
- if no more association can be addedpublic void DTDtoXML(java.lang.String dtdFile, java.lang.String dtdXmlFile) throws anyNotTreatedInDTDException, java.net.MalformedURLException, java.io.IOException, java.lang.NullPointerException, xmlVocabularySizeTooBig
dtdFile
- DTD file to be transformeddtdXmlFile
- XML file containing the translated DTDanyNotTreatedInDTDException
- if a DTD element's content is of "Any" typejava.io.IOException
java.net.MalformedURLException
xmlVocabularySizeTooBig
java.lang.NullPointerException
public org.jdom.Document translateDTD(com.wutka.dtd.DTD dtd) throws anyNotTreatedInDTDException
dtd
- DTD to be transformedanyNotTreatedInDTDException
- if a DTD element's content is of "Any" typepublic org.jdom.Element translateDTDElement(com.wutka.dtd.DTDElement elem) throws anyNotTreatedInDTDException
item
- DTD element to be transformed e.g. total
(totalClient+,(totalPanier|totalUnite)*)anyNotTreatedInDTDException
- if the DTD element is of "Any" typepublic java.lang.String translateDTDItem(com.wutka.dtd.DTDItem item) throws anyNotTreatedInDTDException
item
- DTD element's content to be transformed e.g.
(totalClient*,(totalPanier|totalUnite)*)anyNotTreatedInDTDException
- if the DTD element is of "Any" type