HelpDataXmlParser

class HelpDataXmlParser

This class will help to parse the helpdata.xml which is located in /assets folder.

It will use an XmlPullParser instance to parse the file. This file includes links to all help resources which will be accessible via the help tab. The file has the following structure: // Indicate that this file contains resource links. However, this tag is necessary for android studio to not show any errors. // Indicates the beginning of a help resource item ... // One helpitem can contain many tags. Every contains a tag of a fragment for which the help resource will be shown in help tab. ... // Contains resource name of the text resource that contains the title of this particular help item. ... // Contains resource name of the text resource that contains the text for this particular help resource. ... // Contains resource name of the image resource that contains the image for this particular help resource. // marks the end of the helpitem // marks end of file

Constructors

HelpDataXmlParser
Link copied to clipboard
fun HelpDataXmlParser()

Types

Companion
Link copied to clipboard
object Companion

Properties

namespace
Link copied to clipboard
private val namespace: String? = null
Indicates that I won't use XML namespaces in this class.

Functions

parse
Link copied to clipboard
fun parse(inputStream: InputStream?): List<HelpDataTagged>
Initializes XmlPullParser, starts parsing process and invokes readXml
readHelpItem
Link copied to clipboard
private fun readHelpItem(parser: XmlPullParser): HelpDataTagged
Parses contents of one helpItem.
readImgRes
Link copied to clipboard
private fun readImgRes(parser: XmlPullParser): String
Parse the resource name of the help item's title image.
readTagList
Link copied to clipboard
private fun readTagList(parser: XmlPullParser): FragmentStatus
Parse a tag.
readText
Link copied to clipboard
private fun readText(parser: XmlPullParser): String
Reads the text between opening and closing XML tags.
readTextRes
Link copied to clipboard
private fun readTextRes(parser: XmlPullParser): String
Parse the resource name of the help item's help text.
readTitleRes
Link copied to clipboard
private fun readTitleRes(parser: XmlPullParser): String
Parse the resource name of the help item's titile.
readXml
Link copied to clipboard
private fun readXml(parser: XmlPullParser): List<HelpDataTagged>
Process the Xml file.
skip
Link copied to clipboard
private fun skip(parser: XmlPullParser)
Skips all xml tags which are not important.