shithub: xml-9atom

ref: 524f6890a72aa3629cc91ecf5c505ffa52f7eda4
dir: /xml.h/

View raw version

#pragma lib "libxml.a"

typedef struct Xml Xml;
typedef struct Attr Attr;
typedef struct Elem Elem;
typedef struct Ns Ns;

typedef struct Xtree Xtree;
typedef struct Xblock Xblock;

#pragma incomplete Xtree
#pragma incomplete Xblock

enum {
	Fcrushwhite = 1,
	Fstripnamespace = 2,
};

struct Xml {
	Elem	*root;			/* root of tree */
	char	*doctype;		/* DOCTYPE structured comment, or nil */
	Ns  	*ns;
	struct {
		Xtree	*root;
		Xblock	*active;
		int	blksiz;
	} alloc;
};

struct Elem {
	Elem	*next;			/* next element at this hierarchy level */
	Elem	*child;		/* first child of this node */
	Elem	*parent;		/* parent of this node */
	Attr	*attrs;		/* linked list of atributes */
	char	*name;			/* element name */
	char	*pcdata;		/* pcdata following this element */
	Ns  	*ns;
	int	line;			/* Line number (for errors) */
};

struct Attr {
	Attr	*next;			/* next atribute */
	Elem	*parent;		/* parent element */
	char	*name;			/* atributes name (nil for coments) */
	char	*value;		/* atributes value */
	Ns  	*ns;
};

struct Ns {
	char	*name;
	char	*decl;
	Ns  	*next;
};

extern int xmldebug;

Attr*	xmlattr(Xml *, Attr **, Elem *, char *, char *);
Elem*	xmlelem(Xml *, Elem **, Elem *, char *);
Elem*	xmlfind(Xml *, Elem *, char *);
void	xmlfree(Xml *);
char*	xmlstrdup(Xml*, char *, int);
void*	xmlcalloc(Xml *, int, int);
void*	xmlmalloc(Xml *, int);
void	_Xheapstats(void);
void	_Xheapfree(Xml *);
Elem*	xmllook(Elem *, char *, char *, char *);
Xml*	xmlnew(int);
Xml*	xmlparse(int, int, int);
void	xmlprint(Xml *, int);
char*	xmlvalue(Elem *, char *);
Ns* 	xmlfindns(Xml *, char *);
Ns* 	xmladdns(Xml *, char *, char *);