Klasse XMLParser
- Autor:
- rsoika
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic StringfindAttribute(String content, String name) This method parses a xml tag for a single named attribute.findAttributes(String content) This method parses a xml tag for attributes.findNoEmptyTags(String content, String tag) This method finds no-empty tags by name inside a string and returns a list with all tags including the tag itself.findNoEmptyXMLTags(String content, String tag) This method finds no-empty tags by name inside a string and returns the embedded XML content.This method find specific tags inside a string and returns a list with all tags.static StringfindTagValue(String content, String tag) This method returns the tag value of a single tag.static StringfindTagValueOld(String content, String tag) Veraltet.findTagValues(String content, String tag) This method returns all tag values within a string with multiple xml tags.static booleanisXMLContent(String content) Test if a given String is XML Contentstatic ItemCollectionparseItemStructure(String xmlContent) This method parses the xml content of a item element and returns a new ItemCollection containing all item values.static ItemCollectionThis method parses the xml content of a XML tag and returns a new ItemCollection containing all embedded tags.static List<ItemCollection> parseTagList(String content, String tag) This method parses the xml content and returns a list of ItemCollection elements for each tag with the given tag name
-
Konstruktordetails
-
XMLParser
public XMLParser()
-
-
Methodendetails
-
findAttributes
This method parses a xml tag for attributes. The method returns a Map with all attributes found in the content string e.g.- returns Map: {field=a, number=1}
- Parameter:
content-- Gibt zurück:
-
findAttribute
This method parses a xml tag for a single named attribute. The method returns the value of the attribute found in the content string e.g.- returns "abc"
- Parameter:
content-- Gibt zurück:
-
findTags
This method find specific tags inside a string and returns a list with all tags.e.g. an empty tag:
<date field="abc" />or a tag with content:
<date field="abc">def</date>Note: In case of complex XML with not empty tags use the method 'findNoEmptyTags'
- Parameter:
content- - XML datatag- - XML tag- Gibt zurück:
-
findNoEmptyTags
This method finds no-empty tags by name inside a string and returns a list with all tags including the tag itself.e.g.:
<date field="abc">def</date>Note: To find also empty tags use 'findTags'
- Parameter:
content- - XML datatag- - XML tag- Gibt zurück:
-
findNoEmptyXMLTags
This method finds no-empty tags by name inside a string and returns the embedded XML content. The method returns a list of xml tags including the tag itself.e.g.:
<date field="abc">def</date>Note: To find also empty tags use 'findTags'
- Parameter:
content- - XML datatag- - XML tag- Gibt zurück:
-
isXMLContent
Test if a given String is XML Content- Parameter:
content-- Gibt zurück:
-
findTagValues
This method returns all tag values within a string with multiple xml tags. E.g.<date>2016-12-31</date>...<date>2016-11-30</date>returns
2016-12-31|2016-12-31- Parameter:
content- - XML datatag- - XML tag- Gibt zurück:
-
findTagValue
This method returns the tag value of a single tag. The method returns the first match! Use findTagValues to parse all tag values in a string with multiple tags.E.g.
<date>2016-12-31</date>...<date>2016-11-30</date>returns
2016-12-31- Parameter:
content- - XML datatag- - XML tag- Gibt zurück:
- Siehe auch:
-
findTagValueOld
Veraltet. -
parseItemStructure
This method parses the xml content of a item element and returns a new ItemCollection containing all item values. Each tag is evaluated as the item name. MultiValues are currently not supported. Example:<item> <modelversion>1.0.0</modelversion> <task>1000</task> <event>10</event> </item>- Parameter:
evalItemCollection-- Löst aus:
PluginException
-
parseTag
This method parses the xml content of a XML tag and returns a new ItemCollection containing all embedded tags. Each tag is evaluated as the item name. The tag value is returned as a item value.MultiValues are currently not supported.
Example:
The tag 'code' of:
<code> <modelversion>1.0.0</modelversion> <task>1000</task> <event>10</event> </code>Returns an ItemCollection with 3 items (modelversion, task and event)
- Parameter:
evalItemCollection-- Löst aus:
PluginException
-
parseTagList
This method parses the xml content and returns a list of ItemCollection elements for each tag with the given tag nameExample:
The tag 'code' of:
<code> <modelversion>1.0.0</modelversion> <task>1000</task> <event>10</event> </code> <code> <modelversion>2.0.0</modelversion> <task>2000</task> <event>20</event> </code>Returns a List with two ItemCollections each with 3 items (modelversion, task and event)
- Parameter:
evalItemCollection-- Löst aus:
PluginException
-