|
FTP-Server API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--setup.XMLTag
The class represents a Tag as fx. <TAG>. The whole idea, is to make a dynamical XML-structure.
Typically the class is made through an XMLParser, by instantiating the XMLParser, and using its "main-tag"
XMLParser parser = new XMLParser(new File("setup.conf"));
Some of the classes documentation builds on the following example.
XMLTag xml = parser.XML;
#Serversetup
<Server>
Port 21
</Server>
#Users on the server!
<Users>
<User>
name Kenneth Vindum
login lkv
pass pkv
</User>
<User>
name John Doe
login lsr
pass psr
</User>
</Users>
Field Summary | |
String |
tagName
The name of the tag |
Constructor Summary | |
XMLTag(String tagName)
Set-constructor. |
Method Summary | |
void |
addComment(String comment)
Adds a comment to the tag. |
protected void |
addCommentFromFile(String comment)
Adds a comment to the tag while reading a file. |
void |
addOption(String optionName,
String optionValue)
Adds an option to a Tag. |
void |
addTag(XMLTag newTag)
Adds a new tag to this tag. |
protected XMLTag |
addTagFromFile(String tagName)
Adds a sub-Tag to this tag. |
protected boolean |
endTag(String tagName)
Ends a tag, that has been readen from a file. |
String |
getOptionValue(String optionName)
Gets the value of an option in this tag. |
XMLTag |
getParent()
The tag, that this tag has been addd to. |
String |
getQuickOptionValue(String optionName)
Quick way to find a value from tag-string of a certain syntax (Users.User.name) |
XMLTag[] |
getSubTags()
Returns all the subTags of this class. |
XMLTag |
getTagLike(String tagName)
Finds the first tag, that has the passed name. |
XMLTag[] |
getTagsLike(String tagName)
Finds all tags, that has the passed Name, Syntax (Users.User). |
String |
getXMLString()
Henter hele XML strukturen fra dette tag og nedefter (i sub-Tags). |
void |
removeOption(String optionName)
Deletes an option from the Tag. |
boolean |
removeTag(XMLTag oldTag)
Removes a tag from this tag. |
void |
setOptionValue(String optionName,
String optionValue)
Sets the value of an option in this tag. |
void |
setQuickOptionValue(String optionName,
String optionValue)
Sets the value of an option. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public String tagName
Constructor Detail |
public XMLTag(String tagName)
tagName
- The name of the tagMethod Detail |
public void addOption(String optionName, String optionValue)
optionName
- The options nameoptionValue
- The options valuepublic void removeOption(String optionName) throws NoSuchOptionException
optionName
- The name of the option that should be deleted!
NoSuchOptionException
public void addComment(String comment)
comment
- The commentprotected void addCommentFromFile(String comment)
comment
- The commentpublic void setOptionValue(String optionName, String optionValue) throws NoSuchOptionException
optionName
- the name of an optionoptionValue
- The new value of this option
NoSuchOptionException
- If the option are not found, an exception is thrown.public void setQuickOptionValue(String optionName, String optionValue) throws NoSuchTagException
optionName
- the options name (and XMLTags to it)optionValue
- The new value of this option
NoSuchTagException
- If the option are not found, an exception is thrown.public String getOptionValue(String optionName) throws NoSuchOptionException
optionName
- The name of the option witch value is requested.
NoSuchOptionException
- If the option are not found, an exception is thrown.public String getQuickOptionValue(String optionName) throws NoSuchTagException
optionName
- The path from this tag, to the wished tag, along with the optionName (Users.User.name)
NoSuchTagException
- if one of the tags, or the option are not found, an exception is thrownpublic XMLTag[] getTagsLike(String tagName) throws NoSuchTagException
tagName
- the tags name
NoSuchTagException
- If no tags are found with the passed name.public XMLTag getTagLike(String tagName) throws NoSuchTagException
tagName
- the name of tag that is searched for
NoSuchTagException
- If the tag are not found.public XMLTag[] getSubTags()
public String getXMLString()
protected XMLTag addTagFromFile(String tagName)
tagName
- The name of the sub-Tag
public XMLTag getParent()
public void addTag(XMLTag newTag)
newTag
- the new tag.public boolean removeTag(XMLTag oldTag)
oldTag
- the tag that is to be removedprotected boolean endTag(String tagName)
tagName
- The name of the tag, that shall be ended.
|
FTP-Server API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |