3 Copyright (C) 2003 Elwood C. Downey
6 This library is free software;
7 you can redistribute it and / or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation;
11 version 2.1 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT
ANY WARRANTY;
15 without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License
for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with
this library;
21 if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
302 extern void indi_xmlMalloc(
void *(*newmalloc)(
size_t size),
void *(*newrealloc)(
void *ptr,
size_t size),
303 void (*newfree)(
void *ptr));
int nXMLEle(XMLEle *ep)
Return the number of nested XML elements in a parent XML element.
XMLEle * findXMLEle(XMLEle *e, const char *tag)
Find an XML element within an XML element.
XMLEle * parentXMLAtt(XMLAtt *ap)
Return the parent of an XML attribute.
XMLEle * shallowCloneXMLEle(XMLEle *ele)
return a surface copy of a node. Don't copy childs or cdata.
LilXML * newLilXML()
Create a new lilxml parser.
char * entityXML(char *str)
return a string with all xml-sensitive characters within the passed string replaced with their entity...
XMLEle * parentXMLEle(XMLEle *ep)
Return the parent of an XML element.
XMLEle * readXMLFile(FILE *fp, LilXML *lp, char errmsg[])
Handy wrapper to read one xml file.
size_t sprXMLCDataOffset(XMLEle *root, XMLEle *child, int level)
return exact position of cdata of child in printed representation of root N.B. set level = 0 on first...
int nXMLAtt(XMLEle *ep)
Return the number of XML attributes in a parent XML element.
XMLAtt * findXMLAtt(XMLEle *e, const char *name)
Find an XML attribute within an XML element.
XMLAtt * nextXMLAtt(XMLEle *ep, int first)
Iterate an XML element for a list of XML attributes.
size_t 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....
const char * findXMLAttValu(XMLEle *ep, const char *name)
Find an XML element's attribute value.
XMLEle ** parseXMLChunk(LilXML *lp, char *buf, int size, char errmsg[])
Process an XML chunk.
void prXMLEle(FILE *fp, XMLEle *e, int level)
Print an XML element.
XMLAtt * addXMLAtt(XMLEle *ep, const char *name, const char *value)
Add an XML attribute to an existing XML element.
char * pcdataXMLEle(XMLEle *ep)
Return the pcdata of an XML element.
void editXMLEle(XMLEle *ep, const char *pcdata)
set the pcdata of the given element
XMLEle * cloneXMLEle(XMLEle *ep, int(*replace)(void *self, XMLEle *source, XMLEle **replace), void *self)
clone (deep) a xmlEle. Optional replacement function can be passed, to replace a whole subtree instea...
char * tagXMLEle(XMLEle *ep)
Return the tag of an XML element.
void rmXMLAtt(XMLEle *ep, const char *name)
Remove an XML attribute from an XML element.
XMLEle * nextXMLEle(XMLEle *ep, int first)
Iterate an XML element for a list of nesetd XML elements.
size_t sprlXMLEle(XMLEle *ep, int level)
return number of bytes in a string guaranteed able to hold result of sprXLMEle(ep) (sans trailing \0@...
void indi_xmlMalloc(void *(*newmalloc)(size_t size), void *(*newrealloc)(void *ptr, size_t size), void(*newfree)(void *ptr))
char * nameXMLAtt(XMLAtt *ap)
Return the name of an XML attribute.
void delXMLEle(XMLEle *e)
delXMLEle Delete XML element.
XMLEle * readXMLEle(LilXML *lp, int c, char errmsg[])
Process an XML one char at a time.
void editXMLAtt(XMLAtt *ap, const char *str)
change the value of an attribute to str.
void delLilXML(LilXML *lp)
Delete a lilxml parser.
XMLEle * setXMLEleTag(XMLEle *ep, const char *tag)
Update the tag of an element.
XMLEle * addXMLEle(XMLEle *parent, const char *tag)
add an element with the given tag to the given element. parent can be NULL to make a new root.
int pcdatalenXMLEle(XMLEle *ep)
Return the number of characters in pcdata in an XML element.
char * valuXMLAtt(XMLAtt *ap)
Return the value of an XML attribute.