Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

XMLCommon.h

Go to the documentation of this file.
00001 /******************************************************************
00002         ANet_Daemon/Common/XMLCommon.h
00003         XML accessor functions
00004         
00005         Part of the run-time wrapper of the ANet project.
00006         
00007         Distributed under GPL: http://www.gnu.org/copyleft/gpl.html
00008 ******************************************************************/
00009 
00010 #ifndef XML_COMMON
00011 #define XML_COMMON
00012 
00013 #include "ANetCommon.h"
00014 #include "Memory.h"
00015 
00032 typedef struct ANetAttribute {
00033   UInt8 *name;
00034   UInt8 *value;
00035 } ANetAttribute;
00036 
00037 typedef struct ANetAttribListItem {
00038   struct ANetAttribListItem *next;
00039   ANetAttribute attribute;
00040 } ANetAttribListItem;
00041 
00042 typedef struct ANetTag {
00043   UInt8 *name; // C string
00044   struct ANetTag *parent;
00045   void *children; // typecast to ANetTagListItem*
00046   ANetAttribListItem *attributes;
00047 } ANetTag;
00048 
00049 typedef struct ANetTagListItem {
00050   struct ANetTagListItem *next;
00051   ANetTag tag;
00052 } ANetTagListItem;
00053 
00054 typedef UInt32 ANetAttributeID;
00055 typedef UInt32 ANetTagID;
00056 // TagIDs are used to "hide" the implementation of the XML parser.
00057 // Initially, they are all typecasted pointers, but later on
00058 // they won't point directly to a memory location.
00059 
00060 
00061 // XML ACCESSORS
00062 
00063 UInt32 ANetGetTagName(ANetTagID tagID, UInt8 *nameBuffer, UInt16 maxNameSize);
00064 // You *MUST* allocate memory yourself for nameBuffer
00065 
00066 UInt32 ANetGetParent(ANetTagID tagID, ANetTagID *parent);
00067 
00068 UInt32 ANetGetNthChild(ANetTagID tagID, UInt32 n, ANetTagID *child);
00069 UInt32 ANetGetNbrChildren(ANetTagID tagID, UInt32 *nbr);
00070 UInt32 ANetFindChildren(ANetTagID root, UInt8 *name, UInt8 *ID);
00071 // ID is the tag's ID, as defined in the DTD file.
00072 // This function can only be used if the tag does have IDs.
00073 
00074 UInt32 ANetGetNthAttribute(ANetTagID tagID, UInt32 n, ANetAttributeID atribute);
00075 UInt32 ANetGetNbrAttributes(ANetTagID tagID, UInt32 *nbr);
00076 UInt32 ANetFindAttribute(ANetTagID tagID, UInt8 *name, ANetAttributeID attribute);
00077 UInt32 ANetFindValue(ANetTagID tagID, UInt8 *name, UInt8 *value,
00078                      UInt16 maxValueSize);
00079 
00080 UInt32 ANetGetAttributeName(ANetAttributeID attribID, UInt8 *name,
00081                             UInt16 maxNameSize);
00082 UInt32 ANetGetAttributeValue(ANetAttributeID attribID, UInt8 *value,
00083                              UInt16 maxValueSize);
00084 
00085 // XML CREATORS / DESTRUCTORS
00086 
00087 UInt32 ANetCreateTag(ANetTagID parent, UInt8 *name, ANetTagID *newTagID);
00088 UInt32 ANetRemoveTag(ANetTagID parent, ANetTagID toRemove);
00089 
00090 UInt32 ANetAddAttribute(ANetTagID tagID, UInt8 *name, UInt8 *value,
00091                         ANetAttributeID *newAttributeID);
00092 UInt32 ANetRemoveAttribute(ANetTagID tagID, ANetAttributeID toRemove);
00093 
00094 // Note that access rights for XML tags and attributes are implicit,
00095 // including for newly created tags or attributes.
00096 
00097 #endif
00098 

Generated on Sun Dec 23 15:20:37 2001 for ANet by doxygen 1.2.12 written by Dimitri van Heesch, © 1997-2001

SourceForge
Logo