kstars
Functions to parse, process, and search XML.
Functions | |
| void | delLilXML (LilXML *lp) |
| void | delXMLEle (XMLEle *e) |
| XMLAtt * | findXMLAtt (XMLEle *e, const char *name) |
| const char * | findXMLAttValu (XMLEle *ep, char *name) |
| XMLEle * | findXMLEle (XMLEle *e, const char *tag) |
| void | indi_xmlMalloc (void *(*newmalloc)(size_t size), void *(*newrealloc)(void *ptr, size_t size), void(*newfree)(void *ptr)) |
| char * | nameXMLAtt (XMLAtt *ap) |
| LilXML * | newLilXML (void) |
| XMLAtt * | nextXMLAtt (XMLEle *ep, int first) |
| XMLEle * | nextXMLEle (XMLEle *ep, int first) |
| int | nXMLAtt (XMLEle *ep) |
| int | nXMLEle (XMLEle *ep) |
| XMLEle * | parentXMLAtt (XMLAtt *ap) |
| XMLEle * | parentXMLEle (XMLEle *ep) |
| int | pcdatalenXMLEle (XMLEle *ep) |
| char * | pcdataXMLEle (XMLEle *ep) |
| void | prXMLEle (FILE *fp, XMLEle *e, int level) |
| XMLEle * | readXMLEle (LilXML *lp, int c, char errmsg[]) |
| XMLEle * | readXMLFile (FILE *fp, LilXML *lp, char errmsg[]) |
| char * | tagXMLEle (XMLEle *ep) |
| char * | valuXMLAtt (XMLAtt *ap) |
Function Documentation
| void delLilXML | ( | LilXML * | lp | ) |
Delete a lilxml parser.
- Parameters:
-
lp a pointer to a lilxml parser to be deleted.
| void delXMLEle | ( | XMLEle * | e | ) |
Delete an XML element.
- Returns:
- a pointer to the XML Element to be deleted.
Find an XML attribute within an XML element.
- Parameters:
-
e a pointer to the XML element to search. name the attribute name to search for.
- Returns:
- A pointer to the XML attribute if found or NULL on failure.
| const char* findXMLAttValu | ( | XMLEle * | ep, | |
| char * | name | |||
| ) |
Find an XML element's attribute value.
- Parameters:
-
ep a pointer to an XML element. name the name of the XML attribute to retrieve its value.
- Returns:
- the value string of an XML element on success. NULL on failure.
Find an XML element within an XML element.
- Parameters:
-
e a pointer to the XML element to search. tag the element tag to search for.
- Returns:
- A pointer to the XML element if found or NULL on failure.
| void indi_xmlMalloc | ( | void *(*)(size_t size) | newmalloc, | |
| void *(*)(void *ptr, size_t size) | newrealloc, | |||
| void(*)(void *ptr) | newfree | |||
| ) |
| char* nameXMLAtt | ( | XMLAtt * | ap | ) |
Return the name of an XML attribute.
- Parameters:
-
ap a pointer to an XML attribute.
- Returns:
- the name string of the attribute.
| LilXML* newLilXML | ( | void | ) |
Create a new lilxml parser.
- Returns:
- a pointer to the lilxml parser on sucess. NULL on failure.
Iterate an XML element for a list of XML attributes.
- Parameters:
-
ep a pointer to the XML element to iterate. first the index of the starting XML attribute. Pass 1 to start iteration from the beginning of the XML element. Pass 0 to get the next attribute thereater.
- Returns:
- On success, a pointer to the next XML attribute is returned. NULL when there are no more attributes.
Iterate an XML element for a list of nesetd XML elements.
- Parameters:
-
ep a pointer to the XML element to iterate. first the index of the starting XML element. Pass 1 to start iteration from the beginning of the XML element. Pass 0 to get the next element thereater.
- Returns:
- On success, a pointer to the next XML element is returned. NULL when there are no more elements.
| int nXMLAtt | ( | XMLEle * | ep | ) |
Return the number of XML attributes in a parent XML element.
- Parameters:
-
ep a pointer to an XML element.
- Returns:
- the number of XML attributes within the XML element.
| int nXMLEle | ( | XMLEle * | ep | ) |
Return the number of nested XML elements in a parent XML element.
- Parameters:
-
ep a pointer to an XML element.
- Returns:
- the number of nested XML elements.
Return the parent of an XML attribute.
- Returns:
- a pointer to the XML element parent.
Return the parent of an XML element.
- Returns:
- a pointer to the XML element parent.
| int pcdatalenXMLEle | ( | XMLEle * | ep | ) |
Return the number of characters in pcdata in an XML element.
- Parameters:
-
ep a pointer to an XML element.
- Returns:
- the length of the pcdata string.
| char* pcdataXMLEle | ( | XMLEle * | ep | ) |
Return the pcdata of an XML element.
- Parameters:
-
ep a pointer to an XML element.
- Returns:
- the pcdata string on success.
| void prXMLEle | ( | FILE * | fp, | |
| XMLEle * | e, | |||
| int | level | |||
| ) |
Print an XML element.
- Parameters:
-
fp a pointer to FILE where the print output is directed. e the XML element to print. level the printing level, set to 0 to print the whole element.
Process an XML one char at a time.
- Parameters:
-
lp a pointer to a lilxml parser. c one character to process. errmsg a buffer to store error messages if an error in parsing is encounterd.
- Returns:
- When the function parses a complete valid XML element, it will return a pointer to the XML element. A NULL is returned when parsing the element is still in progress, or if a parsing error occurs. Check errmsg for errors if NULL is returned.
Handy wrapper to read one xml file.
- Parameters:
-
fp pointer to FILE to read. lp pointer to lilxml parser. errmsg a buffer to store error messages on failure.
- Returns:
- root element else NULL with report in errmsg[].
| char* tagXMLEle | ( | XMLEle * | ep | ) |
Return the tag of an XML element.
- Parameters:
-
ep a pointer to an XML element.
- Returns:
- the tag string.
| char* valuXMLAtt | ( | XMLAtt * | ap | ) |
Return the value of an XML attribute.
- Parameters:
-
ap a pointer to an XML attribute.
- Returns:
- the value string of the attribute.
KDE 3.5 API Reference