TwiceAsNice
2019-02-18
|
Functions | |
LilXML * | newLilXML () |
Create a new lilxml parser. More... | |
void | delLilXML (LilXML *lp) |
Delete a lilxml parser. More... | |
void | delXMLEle (XMLEle *e) |
Delete an XML element. More... | |
XMLEle ** | parseXMLChunk (LilXML *lp, char *buf, int size, char errmsg[]) |
Process an XML chunk. More... | |
XMLEle * | readXMLEle (LilXML *lp, int c, char errmsg[]) |
Process an XML one char at a time. More... | |
XMLAtt * | findXMLAtt (XMLEle *e, const char *name) |
Find an XML attribute within an XML element. More... | |
XMLEle * | findXMLEle (XMLEle *e, const char *tag) |
Find an XML element within an XML element. More... | |
XMLEle * | nextXMLEle (XMLEle *ep, int first) |
Iterate an XML element for a list of nesetd XML elements. More... | |
XMLAtt * | nextXMLAtt (XMLEle *ep, int first) |
Iterate an XML element for a list of XML attributes. More... | |
XMLEle * | parentXMLEle (XMLEle *ep) |
Return the parent of an XML element. More... | |
XMLEle * | parentXMLAtt (XMLAtt *ap) |
Return the parent of an XML attribute. More... | |
char * | tagXMLEle (XMLEle *ep) |
Return the tag of an XML element. More... | |
char * | pcdataXMLEle (XMLEle *ep) |
Return the pcdata of an XML element. More... | |
char * | nameXMLAtt (XMLAtt *ap) |
Return the name of an XML attribute. More... | |
char * | valuXMLAtt (XMLAtt *ap) |
Return the value of an XML attribute. More... | |
int | pcdatalenXMLEle (XMLEle *ep) |
Return the number of characters in pcdata in an XML element. More... | |
int | nXMLEle (XMLEle *ep) |
Return the number of nested XML elements in a parent XML element. More... | |
int | nXMLAtt (XMLEle *ep) |
Return the number of XML attributes in a parent XML element. More... | |
XMLEle * | addXMLEle (XMLEle *parent, const char *tag) |
add an element with the given tag to the given element. More... | |
void | editXMLEle (XMLEle *ep, const char *pcdata) |
set the pcdata of the given element More... | |
XMLAtt * | addXMLAtt (XMLEle *ep, const char *name, const char *value) |
Add an XML attribute to an existing XML element. More... | |
void | rmXMLAtt (XMLEle *ep, const char *name) |
Remove an XML attribute from an XML element. More... | |
void | editXMLAtt (XMLAtt *ap, const char *str) |
change the value of an attribute to str. More... | |
char * | entityXML (char *str) |
return a string with all xml-sensitive characters within the passed string replaced with their entity sequence equivalents. More... | |
const char * | findXMLAttValu (XMLEle *ep, const char *name) |
Find an XML element's attribute value. More... | |
XMLEle * | readXMLFile (FILE *fp, LilXML *lp, char errmsg[]) |
Handy wrapper to read one xml file. More... | |
void | prXMLEle (FILE *fp, XMLEle *e, int level) |
Print an XML element. More... | |
int | sprXMLEle (char *s, XMLEle *ep, int level) |
sample print ep to string s. More... | |
int | sprlXMLEle (XMLEle *ep, int level) |
return number of bytes in a string guaranteed able to hold result of sprXLMEle(ep) (sans trailing \0@). More... | |
void | indi_xmlMalloc (void *(*newmalloc)(size_t size), void *(*newrealloc)(void *ptr, size_t size), void(*newfree)(void *ptr)) |
Add an XML attribute to an existing XML element.
ep | pointer to an XML element |
name | the name of the XML attribute to add. |
value | the value of the XML attribute to add. |
add an element with the given tag to the given element.
parent can be NULL to make a new root.
void delLilXML | ( | LilXML * | lp | ) |
Delete a lilxml parser.
lp | a pointer to a lilxml parser to be deleted. |
void delXMLEle | ( | XMLEle * | e | ) |
Delete an XML element.
change the value of an attribute to str.
ap | pointer to XML attribute |
str | new attribute value |
set the pcdata of the given element
ep | pointer to an XML element. |
pcdata | pcdata to set. |
char * entityXML | ( | char * | str | ) |
return a string with all xml-sensitive characters within the passed string replaced with their entity sequence equivalents.
N.B. caller must use the returned string before calling us again.
Find an XML attribute within an XML element.
e | a pointer to the XML element to search. |
name | the attribute name to search for. |
Find an XML element's attribute value.
ep | a pointer to an XML element. |
name | the name of the XML attribute to retrieve its value. |
Find an XML element within an XML element.
e | a pointer to the XML element to search. |
tag | the element tag to search for. |
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.
ap | a pointer to an XML attribute. |
LilXML * newLilXML | ( | ) |
Create a new lilxml parser.
Iterate an XML element for a list of XML attributes.
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. |
Iterate an XML element for a list of nesetd XML elements.
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. |
int nXMLAtt | ( | XMLEle * | ep | ) |
Return the number of XML attributes in a parent XML element.
ep | a pointer to an XML element. |
int nXMLEle | ( | XMLEle * | ep | ) |
Return the number of nested XML elements in a parent XML element.
ep | a pointer to an XML element. |
Return the parent of an XML attribute.
Return the parent of an XML element.
Process an XML chunk.
lp | a pointer to a lilxml parser. |
buf | buffer to process. |
size | size of buf |
errmsg | a buffer to store error messages if an error in parsing is encountered. |
int pcdatalenXMLEle | ( | XMLEle * | ep | ) |
Return the number of characters in pcdata in an XML element.
ep | a pointer to an XML element. |
char * pcdataXMLEle | ( | XMLEle * | ep | ) |
Return the pcdata of an XML element.
ep | a pointer to an XML element. |
void prXMLEle | ( | FILE * | fp, |
XMLEle * | e, | ||
int | level | ||
) |
Print an XML element.
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.
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. |
Handy wrapper to read one xml file.
fp | pointer to FILE to read. |
lp | pointer to lilxml parser. |
errmsg | a buffer to store error messages on failure. |
Remove an XML attribute from an XML element.
ep | pointer to an XML element. |
name | the name of the XML attribute to remove |
int sprlXMLEle | ( | XMLEle * | ep, |
int | level | ||
) |
return number of bytes in a string guaranteed able to hold result of sprXLMEle(ep) (sans trailing \0@).
N.B. set level = 0 on first call.
int sprXMLEle | ( | char * | s, |
XMLEle * | ep, | ||
int | level | ||
) |
sample print ep to string s.
N.B. s must be at least as large as that reported by sprlXMLEle()+1. N.B. set level = 0 on first call.
char * tagXMLEle | ( | XMLEle * | ep | ) |
Return the tag of an XML element.
ep | a pointer to an XML element. |
char * valuXMLAtt | ( | XMLAtt * | ap | ) |
Return the value of an XML attribute.
ap | a pointer to an XML attribute. |