"Fossies" - the Fresh Open Source Software Archive

Member "rpm2html-1.11.2/rdf_api.h" (16 Nov 2002, 3630 Bytes) of package /linux/privat/rpm2html-1.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "rdf_api.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * rdf_api.h : interface definitions to read and write RDF schemas
    3  *
    4  * See Copyright for the status of this software.
    5  *
    6  * $Id: rdf_api.h,v 1.12 2002/11/16 11:34:15 veillard Exp $
    7  */
    8 
    9 #ifndef __RDF_API_H__
   10 #define __RDF_API_H__
   11 #include <libxml/parser.h>
   12 #include <libxml/tree.h>
   13 #include "rdf.h"
   14 
   15 /*
   16  * An RDF schema is basically an XML document.
   17  */
   18 typedef xmlDocPtr rdfSchema;
   19 
   20 /*
   21  * An RDF namespace is an XML namespace/Ns
   22  */
   23 typedef xmlNsPtr rdfNamespace;
   24 
   25 /*
   26  * Any RDF element is an XML element.
   27  */
   28 typedef xmlNodePtr rdfElement;
   29 
   30 /*
   31  * An RDF description is an RDF element and usually
   32  * a direct child of the root for simple descriptions.
   33  */
   34 typedef rdfElement rdfDescription;
   35 
   36 /*
   37  * The value of an element can be either:
   38  *   - A piece of Text : char *         RDF_LEAF
   39  *   - A collection tag :
   40  *       - Bag,                 RDF_BAG
   41  *       - Seq                  RDF_SEQ
   42  *       - Alt                  RDF_ALT
   43  *   - An rdfDescription            RDF_DESC
   44  */
   45 
   46 #define RDF_LEAF    1
   47 #define RDF_BAG     2
   48 #define RDF_SEQ     3
   49 #define RDF_ALT     4
   50 #define RDF_DESC    5
   51 
   52 /*
   53  * An RDF Bag is and RDF element with possibly multiple child
   54  */
   55 typedef rdfElement rdfBag;
   56 
   57 /*
   58  * An RDF Seq is and RDF element an enumeration of childs
   59  */
   60 typedef rdfElement rdfSeq;
   61 
   62 /*
   63  * Basic routines reading/writing an RDF file.
   64  */
   65 rdfSchema rdfRead(const char *filename);
   66 void rdfWrite(rdfSchema rdf, const char *filename);
   67 void rdfWriteMemory(rdfSchema rdf, char **buffer, int *size);
   68 
   69 /*
   70  * An RDF schema is a collection of RDF descriptions.
   71  */
   72 rdfSchema rdfNewSchema(void);
   73 void rdfDestroySchema(rdfSchema rdf);
   74 rdfDescription rdfFirstDescription(rdfSchema schema);
   75 rdfDescription rdfNextDescription(rdfDescription desc);
   76 rdfDescription rdfAddDescription(rdfSchema schema, const char *id,
   77                                  const char *about);
   78 char *rdfGetDescriptionId(rdfSchema schema, rdfDescription desc);
   79 char *rdfGetDescriptionAbout(rdfSchema schema, rdfDescription desc);
   80 char *rdfGetElementResource(rdfSchema schema, rdfElement elem);
   81 #define rdfGetDescriptionHref(s, d) rdfGetDescriptionAbout((s), (d))
   82 void rdfSetElementResource(rdfSchema schema, rdfElement elem, const char *URI);
   83 
   84 /*
   85  * Namespace handling.
   86  */
   87 rdfNamespace rdfNewNamespace(rdfSchema rdf, const char *url, const char *ns);
   88 rdfNamespace rdfGetNamespace(rdfSchema rdf, const char *href);
   89 rdfNamespace rdfGetRdfNamespace(rdfSchema rdf);
   90 
   91 /*
   92  * Routines to read/write values, which can be either final ones or
   93  * subtree.
   94  */
   95 int rdfGetValue(rdfDescription desc, const char *property,
   96                 rdfNamespace ns, char **value, rdfElement *elem);
   97 void rdfSetValue(rdfDescription desc, const char *property,
   98                 rdfNamespace ns, const char *value);
   99 void rdfSetTree(rdfDescription desc, const char *property,
  100                 rdfNamespace ns, rdfElement elem);
  101 void rdfRemoveProperty(rdfDescription desc, const char *property,
  102                        rdfNamespace ns);
  103 
  104 /*
  105  * Routines to read/write bags
  106  */
  107 rdfBag rdfBagCreate(rdfSchema schema, rdfDescription desc,
  108                     const char *property, rdfNamespace ns);
  109 rdfElement rdfBagAddValue(rdfBag bag, const char *property, 
  110                     rdfNamespace ns, const char *value, rdfElement elem);
  111 
  112 /*
  113  * Routines to walk bags and sequences.
  114  */
  115 rdfElement rdfFirstChild(rdfElement bag);
  116 rdfElement rdfNextElem(rdfElement desc);
  117 
  118 /*
  119  * Direct access to Element values.
  120  */
  121 int rdfElemGetType(rdfElement elem);
  122 char *rdfElemGetValue(rdfElement elem);
  123 char *rdfElemGetPropertyName(rdfElement elem);
  124 rdfNamespace rdfElemGetNamespace(rdfElement elem);
  125 void rdfElemSetValue(rdfElement elem, const char *value);
  126 
  127 #endif /* __RDF_API_H__ */