diff --git a/ChangeLog b/ChangeLog index c286cf46..1724138f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Aug 23 01:38:42 CEST 2001 Daniel Veillard + + * doc/catalog.html doc/xml.html: added documentation about + Catalog support, misses an API description + * doc/html/*: reextracted the API pages + Wed Aug 22 18:27:47 CEST 2001 Daniel Veillard * include/libxml/catalog.h catalog.c xmlIO.c HTMLparser.c: diff --git a/catalog.c b/catalog.c index fba077b4..3ec98f8a 100644 --- a/catalog.c +++ b/catalog.c @@ -2182,6 +2182,13 @@ int xmlCatalogAdd(const xmlChar *type, const xmlChar *orig, const xmlChar *replace) { int res = -1; + if ((xmlDefaultXMLCatalogList == NULL) && + (xmlStrEqual(type, BAD_CAST "catalog"))) { + xmlDefaultXMLCatalogList = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL, + orig, xmlCatalogDefaultPrefer); + return(0); + } + if (!xmlCatalogInitialized) xmlInitializeCatalog(); diff --git a/doc/catalog.html b/doc/catalog.html new file mode 100644 index 00000000..a93d2f28 --- /dev/null +++ b/doc/catalog.html @@ -0,0 +1,315 @@ + + + + Libxml Catalog support + + + + + +

Libxml Catalog support

+ +

Location: http://xmlsoft.org/catalog.html

+ +

Libxml home page: http://xmlsoft.org/

+ +

Mailing-list archive: http://mail.gnome.org/archives/xml/

+ +

Version: $Revision:$

+ +

Table of Content:

+
    +
  1. General overview
  2. +
  3. The definition
  4. +
  5. Using catalogs
  6. +
  7. Some examples
  8. +
  9. How to tune catalog usage
  10. +
  11. How to debug catalog processing
  12. +
  13. How to create and maintain catalogs
  14. +
  15. The implementor corner quick review of the + API
  16. +
  17. Other resources
  18. +
+ +

General overview

+ +

What is a catalog ? Basically it's a lookup mechanism which is used when +an entity (a file or a remote resource) reference another entity. The catalog +lookup is inserted between the moment the reference is recognized by the +software (XML parser, stylesheet processing, or even images referenced for +inclusion in a rendering) and the time where loading that resource is +actually started.

+ +

It is basically used for 3 things:

+ + +

The definitions

+ +

Libxml, as of 2.4.3 implements 2 kind of catalogs:

+ + +

+ +

Using catalog

+ +

In a normal environment libxml will by default check the presence of a +catalog in /etc/xml/catalog, and assuming it has been correctly populated, +the processing is completely transparent to the document user. To take a +concrete example, suppose you are authoring a DocBook document, this one +starts with the following DOCTYPE definition:

+
<?xml version='1.0'?>
+<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN"
+                         "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">
+
+
+ +

When validating the document with libxml, the catalog will be +automatically consulted to lookup the public identifier "-//Norman Walsh//DTD +DocBk XML V3.1.4//EN" and the system identifier +"http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd", and if these entities have +been installed on your system and the catalogs actually point to them, libxml +will fetch them from the local disk.

+ +

Note: Really don't use this +DOCTYPE example it's a really old version, but is fine as an example.

+ +

Libxml will check the catalog each time that it is requested to load an +entity, this include DTD, external parsed entities, stylesheets, etc ... If +your system is correctly configured all the authoring phase and processing +should use only local files, even if your document stay portable because it +uses the canonical public and system ID, referencing the remote document.

+ +

Some examples:

+ +

Here is a couple of fragments from XML Catalogs used in libxml early +regression tests in test/catalogs :

+
<?xml version="1.0"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
+       "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
+            uri="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/>
+...
+ +

This is the beginning of a catalog for DocBook 4.1.2, XML Catalogs are +written in XML, there is a specific namespace for catalog elements +"urn:oasis:names:tc:entity:xmlns:xml:catalog". The first entry in this +catalog is a public mapping it allows to associate a Public +Identifier with an URI.

+
...
+    <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/"
+                   rewritePrefix="file:///usr/share/xml/docbook/"/>
+...
+ +

A rewriteSystem is a very powerful instruction, it says that +any URI starting with a given prefix should be looked at another URI +constructed by replacing the prefix with an new one. In effect this acts like +a cache system for a full area of the Web. In practice it is extremely useful +with a file prefix if you have installed a copy of those resources on your +local system.

+
...
+<delegatePublic publicIdStartString="-//OASIS//DTD XML Catalog //"
+                catalog="file:///usr/share/xml/docbook.xml"/>
+<delegatePublic publicIdStartString="-//OASIS//ENTITIES DocBook XML"
+                catalog="file:///usr/share/xml/docbook.xml"/>
+<delegatePublic publicIdStartString="-//OASIS//DTD DocBook XML"
+                catalog="file:///usr/share/xml/docbook.xml"/>
+<delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/"
+                catalog="file:///usr/share/xml/docbook.xml"/>
+<delegateURI uriStartString="http://www.oasis-open.org/docbook/"
+                catalog="file:///usr/share/xml/docbook.xml"/>
+...
+ +

Delegation is the core features which allows to build a tree of catalogs, +easier to maintain than a single catalog, based on Public Identifier, System +Identifier or URI prefixes it instruct the catalog software to lookup entries +in another resource. This feature allow to build hierarchies of catalogs, the +set of entries presented should be sufficient to redirect the resolution of +all DocBook references to the specific catalog in +/usr/share/xml/docbook.xml this one in turn could delegate all +references for DocBook 4.2.1 to a specific catalog installed at the same time +as the DocBook resources on the local machine.

+ +

How to tune catalog usage:

+ +

The user can change the default catalog behaviour by redirecting queries +to its own set of catalogs, this can be done by setting the +XML_CATALOG_FILES environment variable to a list of catalogs, an +empty one should desactivate loading the default +/etc/xml/catalog default catalog.

+ +

@@More options are likely to be provided in the future@@

+ +

How to debug catalog processing:

+ +

Setting up the XML_DEBUG_CATALOG environment variable will +make libxml output debugging informations for each catalog operations, for +example:

+
orchis:~/XML -> xmllint --memory --noout test/ent2
+warning: failed to load external entity "title.xml"
+orchis:~/XML -> export XML_DEBUG_CATALOG=
+orchis:~/XML -> xmllint --memory --noout test/ent2
+Failed to parse catalog /etc/xml/catalog
+Failed to parse catalog /etc/xml/catalog
+warning: failed to load external entity "title.xml"
+Catalogs cleanup
+orchis:~/XML -> 
+ +

The test/ent2 references an entity, running the parser from memory makes +the base URI unavailable and the the "title.xml" entity cannot be loaded. +Setting up the debug environment variable allows to detect that an attempt is +made to load the /etc/xml/catalog but since it's not present the +resolution fails.

+ +

But the most advanced way to debug XML catalog processing is to use the +xmlcatalog command shipped with libxml2, it allows to load +catalogs and make resolution queries to see what is going on. This is also +used for the regression tests:

+
orchis:~/XML -> ./xmlcatalog test/catalogs/docbook.xml "-//OASIS//DTD DocBook XML V4.1.2//EN"
+http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
+orchis:~/XML -> 
+ +

For debugging what is going on, adding one -v flags increase the verbosity +level to indicate the processing done (adding a second flag also indicate +what elements are recognized at parsing):

+
orchis:~/XML -> ./xmlcatalog -v test/catalogs/docbook.xml "-//OASIS//DTD DocBook XML V4.1.2//EN"
+Parsing catalog test/catalogs/docbook.xml's content
+Found public match -//OASIS//DTD DocBook XML V4.1.2//EN
+http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
+Catalogs cleanup
+orchis:~/XML -> 
+ +

A shell interface is also available to debug and process multiple queries +(and for regression tests):

+
orchis:~/XML -> ./xmlcatalog -shell test/catalogs/docbook.xml "-//OASIS//DTD DocBook XML V4.1.2//EN"
+> help   
+Commands available:
+public PublicID: make a PUBLIC identifier lookup
+system SystemID: make a SYSTEM identifier lookup
+resolve PublicID SystemID: do a full resolver lookup
+add 'type' 'orig' 'replace' : add an entry
+del 'values' : remove values
+dump: print the current catalog state
+debug: increase the verbosity level
+quiet: decrease the verbosity level
+exit:  quit the shell
+> public "-//OASIS//DTD DocBook XML V4.1.2//EN"
+http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
+> quit
+orchis:~/XML -> 
+ +

This should be sufficient for most debugging purpose, this was actually +used heavilly to debug the XML Catalog implementation itself.

+ +

How to create and maintain catalogs:

+ +

Basically XML Catalogs are XML files, you can either use XML tools to +manage them or use xmlcatalog for this. The basic step is +to create a catalog the -create option provide this facility:

+
orchis:~/XML -> ./xmlcatalog --create tst.xml
+<?xml version="1.0"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
+         "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"/>
+orchis:~/XML -> 
+ +

By default xmlcatalog does not overwrite the original catalog and save the +result on the standard output, this can be overrident using the -noout +option. The -add command allows to add entries in the +catalog:

+
orchis:~/XML -> ./xmlcatalog --noout --create --add "public" "-//OASIS//DTD DocBook XML V4.1.2//EN" http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd tst.xml
+orchis:~/XML -> cat tst.xml
+<?xml version="1.0"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+<public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
+        uri="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/>
+</catalog>
+orchis:~/XML -> 
+ +

The -add option will always take 3 parameters even if some of +the XML Catalog constructs (like nextCatalog) will have only a single +argument, just pass a third empty string, it will be ignored.

+ +

Similary the -del option remove matching entries from the +catalog:

+
orchis:~/XML -> ./xmlcatalog --del "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" tst.xml
+<?xml version="1.0"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"/>
+orchis:~/XML -> 
+ +

The catalog is now empty. Note that the maching of -del is +exact and would have worked in a similar fashion with the Public ID +string.

+ +

This is rudimentary but should be sufficient to manage a not too complex +catalog tree of resources.

+ +

The implementor corner quick review of the +API:

+ +

@@TODO@@

+ +

Other resources

+ +

The XML Catalog specification is relatively recent so there isn't much +litterature to point at:

+ + +

If you have suggestions for corrections or additions, simply contact +me:

+ +

Daniel Veillard

+ +

$Id:$

+ + diff --git a/doc/html/index.sgml b/doc/html/index.sgml index dea1ad81..016ec7e1 100644 --- a/doc/html/index.sgml +++ b/doc/html/index.sgml @@ -73,6 +73,7 @@ + @@ -188,6 +189,8 @@ + + @@ -207,7 +210,6 @@ - @@ -295,7 +297,6 @@ - @@ -360,6 +361,7 @@ + @@ -400,7 +402,9 @@ + + @@ -504,6 +508,8 @@ + + @@ -575,9 +581,12 @@ + + + @@ -790,16 +799,35 @@ + + + + + + + + + + + + + + + + + + + diff --git a/doc/html/libxml-catalog.html b/doc/html/libxml-catalog.html index 6d97a4bd..af6005c3 100644 --- a/doc/html/libxml-catalog.html +++ b/doc/html/libxml-catalog.html @@ -122,7 +122,7 @@ NAME="LIBXML-CATALOG" >

Name

Synopsis

XML_CATALOGS_NAMESPACE +#define XML_CATALOG_PI +enum xmlCatalogPrefer; +enum xmlCatalogAllow; +void xmlInitializeCatalog (void); int xmlLoadCatalogFILE *out); +xmlChar* xmlCatalogResolve (const xmlChar *pubID, + const xmlChar *sysID); +xmlChar* xmlCatalogResolveSystem (const xmlChar *sysID); +xmlChar* xmlCatalogResolvePublic (const xmlChar *pubID); +xmlChar* xmlCatalogResolveURI (const xmlChar *URI); +int xmlCatalogAdd (const xmlChar *type, + const xmlChar *orig, + const xmlChar *replace); +int xmlCatalogRemove (const xmlChar *value); +void xmlCatalogFreeLocal (void *catalogs); +void* xmlCatalogAddLocal (void *catalogs, + const xmlChar *URL); +xmlChar* xmlCatalogLocalResolve (void *catalogs, + const xmlChar *pubID, + const xmlChar *sysID); +xmlChar* xmlCatalogLocalResolveURI (void *catalogs, + const xmlChar *URI); +int xmlCatalogSetDebug (int level); +xmlCatalogPrefer xmlCatalogSetDefaultPrefer (xmlCatalogPrefer prefer); +void xmlCatalogSetDefaults (xmlCatalogAllow allow); +xmlCatalogAllow xmlCatalogGetDefaults (void); const xmlChar

Description

Details


XML_CATALOG_PI

#define     XML_CATALOG_PI


enum xmlCatalogPrefer

typedef enum {
+    XML_CATA_PREFER_NONE = 0,
+    XML_CATA_PREFER_PUBLIC = 1,
+    XML_CATA_PREFER_SYSTEM
+} xmlCatalogPrefer;


enum xmlCatalogAllow

typedef enum {
+    XML_CATA_ALLOW_NONE = 0,
+    XML_CATA_ALLOW_GLOBAL = 1,
+    XML_CATA_ALLOW_DOCUMENT = 2,
+    XML_CATA_ALLOW_ALL = 3
+} xmlCatalogAllow;


xmlInitializeCatalog ()

void        xmlInitializeCatalog            (void);

Do the catalog initialization. +TODO: this function is not thread safe, catalog initialization should +preferably be done once at startup


Load the catalog and makes its definitions effective for the default external entity loader. It will recuse in CATALOG entries. TODO: this function is not thread safe, catalog initialization should -be done once at startup


Load the catalogs and makes their definitions effective for the default external entity loader. TODO: this function is not thread safe, catalog initialization should -be done once at startup




xmlCatalogGetSystem ()

xmlCatalogResolve ()

const xmlChar* xmlCatalogGetSystem          (const *    xmlCatalogResolve               (const xmlChar *pubID,
+                                             const xmlChar *sysID);

Try to lookup the resource associated to a system ID

Do a complete resolution lookup of an External Identifier

pubID : the public ID stringsysID :the resource name if found or NULL otherwise.the URI of the resource or NULL if not found, it must be freed +by the caller.

xmlCatalogResolveSystem ()

xmlChar*    xmlCatalogResolveSystem         (const xmlChar *sysID);

Try to lookup the catalog resource for a system ID

sysID : the public ID string
Returns :the system ID if found or NULL otherwise, the value returned +must be freed by the caller.


xmlCatalogResolvePublic ()

xmlChar*    xmlCatalogResolvePublic         (const xmlChar *pubID);

Try to lookup the system ID associated to a public ID

pubID : the public ID string
Returns :the system ID if found or NULL otherwise, the value returned +must be freed by the caller.


xmlCatalogResolveURI ()

xmlChar*    xmlCatalogResolveURI            (const xmlChar *URI);

Do a complete resolution lookup of an URI

URI : 
Returns :the URI of the resource or NULL if not found, it must be freed +by the caller.


xmlCatalogAdd ()

int         xmlCatalogAdd                   (const xmlChar *type,
+                                             const xmlChar *orig,
+                                             const xmlChar *replace);

Add an entry in the catalog, it may overwrite existing but +different entries.

type : the type of record to add to the catalog
orig : the system, public or prefix to match
replace : the replacement value for the match
Returns :0 if successful, -1 otherwise


xmlCatalogRemove ()

int         xmlCatalogRemove                (const xmlChar *value);

Remove an entry from the catalog

value : the value to remove
Returns :0 if successful, -1 otherwise


xmlCatalogFreeLocal ()

void        xmlCatalogFreeLocal             (void *catalogs);

Free up the memory associated to the catalog list

catalogs : a document's list of catalogs


xmlCatalogAddLocal ()

void*       xmlCatalogAddLocal              (void *catalogs,
+                                             const xmlChar *URL);

Add the new entry to the catalog list

catalogs : a document's list of catalogs
URL : the URL to a new local catalog


xmlCatalogLocalResolve ()

xmlChar*    xmlCatalogLocalResolve          (void *catalogs,
+                                             const xmlChar *pubID,
+                                             const xmlChar *sysID);

Do a complete resolution lookup of an External Identifier using a +document's private catalog list

catalogs : a document's list of catalogs
pubID : the public ID string
sysID : the system ID string
Returns :the URI of the resource or NULL if not found, it must be freed +by the caller.


xmlCatalogLocalResolveURI ()

xmlChar*    xmlCatalogLocalResolveURI       (void *catalogs,
+                                             const xmlChar *URI);

Do a complete resolution lookup of an URI using a +document's private catalog list

catalogs : a document's list of catalogs
URI : 
Returns :the URI of the resource or NULL if not found, it must be freed +by the caller.


xmlCatalogSetDebug ()

int         xmlCatalogSetDebug              (int level);

Used to set the debug level for catalog operation, 0 disable +debugging, 1 enable it

level : the debug level of catalogs required
Returns :the previous value of the catalog debugging level


xmlCatalogSetDefaultPrefer ()

xmlCatalogPrefer xmlCatalogSetDefaultPrefer (xmlCatalogPrefer prefer);

Allows to set the preference between public and system for deletion +in XML Catalog resolution. C.f. section 4.1.1 of the spec +Values accepted are XML_CATA_PREFER_PUBLIC or XML_CATA_PREFER_SYSTEM

prefer : the default preference for delegation
Returns :the previous value of the default preference for delegation


xmlCatalogSetDefaults ()

void        xmlCatalogSetDefaults           (xmlCatalogAllow allow);

Used to set the user preference w.r.t. to what catalogs should +be accepted

allow : 


xmlCatalogGetDefaults ()

xmlCatalogAllow xmlCatalogGetDefaults       (void);

Used to get the user preference w.r.t. to what catalogs should +be accepted

Returns :the current xmlCatalogAllow value


xmlCatalogGetSystem ()

const xmlChar* xmlCatalogGetSystem          (const xmlChar *sysID);

Try to lookup the system ID associated to a public ID +DEPRECATED, use xmlCatalogResolveSystem()

sysID : 
Returns :the system ID if found or NULL otherwise.


Try to lookup the system ID associated to a public ID

Try to lookup the system ID associated to a public ID +DEPRECATED, use
xmlCatalogResolvePublic()

Name

Synopsis

Description

Details











This is a generic signature for the XML shell input function

  a string prompt a string which will be freed by the Shell


This is a generic signature for the XML shell functions

  a shell context  a string argument  a first node  a second node an int, negative returns indicating errors

Name

Synopsis

Description

Details



















Name

Synopsis

Description

Details


Take a block of chars in the original encoding and try to convert +it to an UTF-8 block of chars out.

  a pointer ot an array of bytes to store the UTF-8 result  the lenght of out  a pointer ot an array of chars in the original encoding  the lenght of in the number of byte written, or -1 by lack of space, or -2 +if the transcoding failed. +The value of inlen after return is the number of octets consumed +as the return value is positive, else unpredictiable. +The value of outlen after return is the number of ocetes consumed.

Take a block of UTF-8 chars in and try to convert it to an other +encoding. +Note: a first call designed to produce heading info is called with +in = NULL. If stateful this should also initialize the encoder state

  a pointer ot an array of bytes to store the result  the lenght of out  a pointer ot an array of UTF-8 chars  the lenght of in the number of byte written, or -1 by lack of space, or -2 +if the transcoding failed. +The value of inlen after return is the number of octets consumed +as the return value is positive, else unpredictiable. +The value of outlen after return is the number of ocetes consumed.



























Name

Synopsis

Description

Details




















Name

Synopsis

htmlEntityDescPtr; const htmlElemDescPtr htmlElemDesc* htmlTagLookup (const (const xmlChar *tag); const htmlEntityDescPtr htmlEntityDesc* htmlEntityLookup (const (const xmlChar *name); const htmlEntityDescPtr htmlEntityDesc* htmlEntityValueLookup - (unsigned int value); +> (unsigned int value); int htmlIsAutoClosedhtmlNodePtr elem); -htmlEntityDescPtr htmlEntityDesc* htmlParseEntityRef ( (htmlParserCtxtPtr ctxt, @@ -395,7 +394,7 @@ HREF="libxml-htmlparser.html#HTMLPARSERCTXTPTR" >

Description

Details














const htmlElemDescPtr htmlTagLookup         (const htmlElemDesc* htmlTagLookup           (const xmlChar *tag);


const htmlEntityDescPtr htmlEntityLookup    (const htmlEntityDesc* htmlEntityLookup      (const xmlChar *name);


const htmlEntityDescPtr htmlEntityValueLookup
-                                            (unsigned int value);
htmlEntityDesc* htmlEntityValueLookup (unsigned int value);




htmlEntityDescPtr htmlParseEntityRef        (const htmlEntityDesc* htmlParseEntityRef    (htmlParserCtxtPtr ctxt,
@@ -1297,7 +1295,7 @@ HREF="libxml-tree.html#XMLCHAR"
 >














Name

Synopsis

Description

Details

















Name

Synopsis

Description

Details

A callback for the xmlNanoFTPList command +Note that only one of year and day:minute are specified

  user provided data for the callback  the file name (including "->" when links are shown)  the attribute string  the owner string  the group string  the file size  the link count  the year  the month  the day  the hour  the minute

A callback for the xmlNanoFTPGet command

  the user provided context  the data received  its size in bytes





















Name

Synopsis

Description

Details



  The proxy URL used to initialize the proxy context

  The URL to load  the filename where the content should be saved  if available the Content-Type information will be +returned at that location -1 in case of failure, 0 incase of success. The contentType, +if provided must be freed by the caller

  The URL to load  the HTTP method to use  the input string if any  the Content-Type information IN and OUT  the extra headers

  The URL to load  the HTTP method to use  the input string if any  the Content-Type information IN and OUT  the redirected URL OUT  the extra headers

  The URL to load  if available the Content-Type information will be +returned at that location

  The URL to load  if available the Content-Type information will be +returned at that location  if availble the redirected URL will be returned

Get the latest HTTP return code received

  the HTTP context the HTTP return code for the request.

Get the authentication header of an HTTP context

  the HTTP context the stashed value of the WWW-Authenticate or Proxy-Authenticate +header.

  the HTTP context  a buffer  the buffer length the number of byte read. 0 is an indication of an end of connection. +-1 indicates a parameter error.

  the HTTP context  the filename where the content should be saved -1 in case of failure, 0 incase of success.

  the HTTP context xmlParseMemory (char *buffer, +> (const char *buffer, int size); xmlPedanticParserDefault (int val); +int xmlLineNumbersDefault (int val); xmlDocPtr xmlRecoverMemory (char *buffer, +> (const char *buffer, int size); xmlSAXHandlerPtr sax, - char *buffer, + const char *buffer, int size, int recovery); xmlNodePtr *list); +> *lst); int xmlParseExternalEntityxmlNodePtr *list); +> *lst); int xmlParseCtxtExternalEntityxmlNodePtr *list); +> *lst); void xmlDefaultSAXHandlerInit

Description

Details










xmlLineNumbersDefault ()

int         xmlLineNumbersDefault           (int val);

Set and return the previous value for enabling line numbers in elements +contents. This may break on old application and is turned off by default.

val : int 0 or 1
Returns :the last value for 0 for no substitution, 1 for substitution.



xmlDocPtr xmlRecoverMemory (char *buffer, +> xmlRecoverMemory (const char *buffer, int size);








xmlSAXHandlerPtr sax, - char *buffer, + const char *buffer, int size, int recovery);






xmlSAXParseDTD ()

xmlDtdPtr   xmlSAXParseDTD                  (xmlSAXHandlerPtr sax,
-                                             const xmlChar *ExternalID,
-                                             const xmlChar *SystemID);

Load and parse an external subset.

sax : the SAX handler block
ExternalID : a NAME* containing the External ID of the DTD
SystemID : a NAME* containing the URL to the DTD
Returns :the resulting xmlDtdPtr or NULL in case of error.


xmlSAXParseDTD ()

xmlDtdPtr   xmlSAXParseDTD                  (xmlSAXHandlerPtr sax,
+                                             const xmlChar *ExternalID,
+                                             const xmlChar *SystemID);

Load and parse an external subset.

sax : the SAX handler block
ExternalID : a NAME* containing the External ID of the DTD
SystemID : a NAME* containing the URL to the DTD
Returns :the resulting xmlDtdPtr or NULL in case of error.


xmlIOParseDTD ()


xmlNodePtr *list); *lst);

listlst :

xmlNodePtr *list); *lst);

listlst :

xmlNodePtr *list); *lst);

listlst :






















Name

Synopsis

Description

Details



Macro to check the following production in the XML spec

[2] Char ::= x9 | xA | xD | [x20-xD7FF] | [xE000-xFFFD] +| [x10000-x10FFFF] +any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.

  an UNICODE value (int)

Macro to check the following production in the XML spec

[3] S ::= (x20 | x9 | xD | xA)+

  an UNICODE value (int)

Macro to check the following production in the XML spec

[85] BaseChar ::= ... long list see REC ...

  an UNICODE value (int)

Macro to check the following production in the XML spec

[88] Digit ::= ... long list see REC ...

  an UNICODE value (int)

Macro to check the following production in the XML spec

[87] CombiningChar ::= ... long list see REC ...

  an UNICODE value (int)

Macro to check the following production in the XML spec

[89] Extender ::= x00B7 | x02D0 | x02D1 | x0387 | x0640 | +x0E46 | x0EC6 | x3005 | [x3031-x3035] | +[x309D-x309E] | [x30FC-x30FE]

  an UNICODE value (int)

Macro to check the following production in the XML spec

[86] Ideographic ::= [x4E00-x9FA5] | x3007 | [x3021-x3029]

  an UNICODE value (int)

Macro to check the following production in the XML spec

[84] Letter ::= BaseChar | Ideographic

  an UNICODE value (int)

Macro to check the following production in the XML spec

[13] PubidChar ::= x20 | xD | xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]

  an UNICODE value (int)

Skips the end of line chars

  and UTF8 string pointer

Skips to the next '>' char

  and UTF8 string pointer

Skips to the next '<' char

  and UTF8 string pointer





































































































Name

Synopsis

Description

Details





































Name

Synopsis

xmlNodePtr; +#define XML_GET_CONTENT (n) +#define XML_GET_LINE (n) struct xmlDocxmlBufferPtr buf); -int xmlBufferUse (const xmlBufferPtr buf); void xmlBufferSetAllocationSchemexmlAttrPtr attr); int xmlRemoveNode (xmlNodePtr node); -int xmlUnsetProp (

Description

Details



xmlChar

typedef unsigned char xmlChar;

This is a basic byte in an UTF-8 encoded string. +It's unsigned allowing to pinpoint case where char * are assigned +to xmlChar * (possibly making serialization back impossible).




xmlNotationPtr

a DTD Notation definition


xmlNotationPtr

typedef xmlNotation *xmlNotationPtr;





xmlEnumerationPtr

list structure used when there is an enumeration in DTDs


xmlEnumerationPtr

typedef xmlEnumeration *xmlEnumerationPtr;



xmlAttributePtr

an Attribute declaration in a DTD


xmlAttributePtr

typedef xmlAttribute *xmlAttributePtr;





xmlElementContentPtr

an XML Element content as stored after parsing an element definition +in a DTD.


xmlElementContentPtr

typedef xmlElementContent *xmlElementContentPtr;




xmlElementPtr

an XML Element declaration from a DTD


xmlElementPtr

typedef xmlElement *xmlElementPtr;



xmlNsType

typedef xmlElementType xmlNsType;

xmlNsType



xmlNsPtr

An XML namespace. +Note that prefix == NULL is valid, it defines the default namespace +within the subtree (until overriden).

xmlNsType is unified with xmlElementType


xmlNsPtr

typedef xmlNs *xmlNsPtr;



xmlDtdPtr

An XML DtD, as defined by <!DOCTYPE ... There is actually one for +the internal subset and for the external subset


xmlDtdPtr

typedef xmlDtd *xmlDtdPtr;



xmlAttrPtr

A attribute on an XML node.


xmlAttrPtr

typedef xmlAttr *xmlAttrPtr;



xmlIDPtr

An XML ID instance.


xmlIDPtr

typedef xmlID *xmlIDPtr;



xmlRefPtr

An XML IDREF instance.


xmlRefPtr

typedef xmlRef *xmlRefPtr;




xmlBufferPtr

A buffer structure


xmlBufferPtr

typedef xmlBuffer *xmlBufferPtr;



xmlNodePtr

A node in an XML tree.


xmlNodePtr

typedef xmlNode *xmlNodePtr;


XML_GET_CONTENT()

#define     XML_GET_CONTENT(n)

macro to extract the content pointer of a node

n : 


XML_GET_LINE()

#define     XML_GET_LINE(n)

macro to extract the line number of an element node

n : 



xmlDocPtr

An XML document.


xmlDocPtr

typedef xmlDoc *xmlDocPtr;




  allocation method to use

 the current allocation scheme

 the new structure.

  initial size of buffer the new structure.

  the buffer to resize  the desired size 0 in case of problems, 1 otherwise

  the buffer to free

  the file output  the buffer to dump the number of xmlChar written

  the buffer to dump  the xmlChar string  the number of xmlChar to add

  the buffer  the xmlChar string  the number of xmlChar to add

  the buffer to dump  the xmlChar string

  the buffer to dump  the C char string

  the buffer to dump  the number of xmlChar to remove the number of xmlChar removed, or -1 in case of failure.

  the buffer  the minimum free size to allocate the new available space or -1 in case of error

  the buffer

Function to extract the content of a buffer

  the buffer the internal content

xmlBufferUse ()

int         xmlBufferUse                    (const xmlBufferPtr buf);

buf : 
Returns : 


  the buffer to free  allocation scheme to use

Function to get the length of a buffer

  the buffer  the length of data in the internal content

  the document pointer  the DTD name  the external (PUBLIC) ID  the system ID a pointer to the new DTD structure

  the document pointer  the DTD name  the external ID  the system ID a pointer to the new DTD structure

  the document pointer a pointer to the DTD structure or NULL if not found

  the DTD structure to free up

  the document carrying the namespace  the URI associated  the prefix for the namespace NULL this functionnality had been removed

  the element carrying the namespace  the URI associated  the prefix for the namespace returns a new namespace pointer or NULL

  the namespace pointer

  the first namespace pointer

Creates a new XML document

  xmlChar string giving the version of XML "1.0" a new document

  pointer to the document +@:

  the document  the name of the attribute  the value of the attribute a pointer to the attribute

  the holding node  the name of the attribute  the value of the attribute a pointer to the attribute

  the holding node  the namespace  the name of the attribute  the value of the attribute a pointer to the attribute

  the first property in the list

  an attribute

  the element where the attribute will be grafted  the attribute  a new xmlAttrPtr, or NULL in case of error.

  the element where the attributes will be grafted  the first attribute  a new xmlAttrPtr, or NULL in case of error.

  the dtd  a new xmlDtdPtr, or NULL in case of error.

  the document  if 1 do a recursive copy.  a new xmlDocPtr, or NULL in case of error.

  the document  namespace if any  the node name  the XML text content if any a pointer to the new node object.

  the document  namespace if any  the node name  the text content if any a pointer to the new node object.

  namespace if any  the node name a pointer to the new node object.

  the parent node  a namespace if any  the name of the child  the XML content of the child if any. a pointer to the new node object.

  the parent node  a namespace if any  the name of the child  the text content of the child if any. a pointer to the new node object.

  the document  the text content a pointer to the new node object.

  the text content a pointer to the new node object.

  the processing instruction name  the PI content a pointer to the new node object.

  the document  the text content  the text len. a pointer to the new node object.

  the text content  the text len. a pointer to the new node object.

  the document  the comment content a pointer to the new node object.

  the comment content a pointer to the new node object.

  the document  the CData block content content  the length of the block a pointer to the new node object.

  the document  the char ref string, starting with # or "&# ... ;" a pointer to the new node object.

  the document  the reference name, or the reference string with & and ; a pointer to the new node object.

  the node  if 1 do a recursive copy.  a new xmlNodePtr, or NULL in case of error.

  the node  if 1 do a recursive copy.  a new xmlNodePtr, or NULL in case of error.

  the first node in the list.  a new xmlNodePtr, or NULL in case of error.

  the document owning the fragment a pointer to the new node object.

  the document the xmlNodePtr for the root or NULL

  the parent node the last child or NULL if none.

  the node 1 yes, 0 no

  the node 1 yes, 0 no

  the document  the new document root element the old root element if any was found

  the node being changed  the new tag name

  the parent node  the child node the child or NULL in case of error.

  the parent node  the first node in the list the last child or NULL in case of error.

  the old node  the node the old node

  the child node  the new node the new element or NULL in case of error.

  the child node  the new node the new element or NULL in case of error.

  the child node  the new node the new element or NULL in case of error.

  the node

  the first text node  the second text node being merged the first text node augmented

  the node  the content  content lenght

  the first node in the list

  the node

  the top element  the document

  the document

  the document  the current node  the namespace prefix the namespace pointer or NULL.

  the document  the current node  the namespace value the namespace pointer or NULL.

  the document  the current node an NULL terminated array of all the xmlNsPtr found +that need to be freed by the caller or NULL if no +namespace if defined

  a node in the document  a namespace pointer

  the namespace  a new xmlNsPtr, or NULL in case of error.

  the first namespace  a new xmlNsPtr, or NULL in case of error.

  the node  the attribute name  the attribute value the attribute pointer.

  the node  the attribute name the attribute value or NULL if not found. +It's up to the caller to free the memory.

  the node  the attribute name the attribute or the attribute declaration or NULL if +neither was found.

  the node  the attribute name  the URI of the namespace the attribute or the attribute declaration or NULL +if neither was found.

  the node  the namespace definition  the attribute name  the attribute value the attribute pointer.

  the node  the attribute name  the URI of the namespace the attribute value or NULL if not found. +It's up to the caller to free the memory.

  the document  the value of the attribute a pointer to the first child

  the document  the value of the text  the length of the string value a pointer to the first child

  the document  a Node list  should we replace entity contents or show their external form a pointer to the string copy, the calller must free it.

  the document  a Node list  should we replace entity contents or show their external form a pointer to the string copy, the calller must free it.

  the node being modified  the new value of the content

  the node being modified  the new value of the content  the size of content

  the node being modified  extra content

  the node being modified  extra content  the size of content

  the node being read a new xmlChar * or NULL if no content is available. +It's up to the caller to free the memory.

  the node being checked a pointer to the lang value, or NULL if not found +It's up to the caller to free the memory.

  the node being changed  the langage description

  the node being checked -1 if xml:space is not inheried, 0 if "default", 1 if "preserve"

  the node being changed

  the document the node pertains to  the node being checked a pointer to the base URL, or NULL if not found +It's up to the caller to free the memory.

  the node being changed  the new base URI

 0 if success and -1 in case of error.

xmlRemoveNode ()

int         xmlRemoveNode                   (xmlNodePtr node);

node : 
Returns : 


  the node  the attribute name 0 if successful, -1 if not found

  the node  the namespace definition  the attribute name 0 if successful, -1 if not found

  the XML buffer  the string to add

  the XML buffer  the string to add

  the XML buffer output  the string to add

  the XML buffer output  the string to add

  the document  a node defining the subtree to reconciliate the number of namespace declarations created or -1 in case of error.

  the document  OUT: the memory pointer  OUT: the memory lenght  should formatting spaces been added

  the document  OUT: the memory pointer  OUT: the memory lenght

  Document to generate XML text from  Memory pointer for allocated XML text  Length of the generated XML text  Character encoding to use when generating XML text

  Document to generate XML text from  Memory pointer for allocated XML text  Length of the generated XML text  Character encoding to use when generating XML text  should formatting spaces been added

  the FILE*  the document  the number of byte written or -1 in case of failure.

  the FILE * for the output  the document  the current node

  the filename (or URL)  the document  the number of byte written or -1 in case of failure.

  the filename (or URL)  the document  should formatting spaces been added  the number of byte written or -1 in case of failure.

  the XML buffer output  the document  the current node  the imbrication level for indenting  is formatting allowed

  the filename or URL to output  the document being saved  the name of the encoding to use or NULL.  should formatting spaces be added.

  the filename (or URL)  the document  the name of an encoding (or NULL)  the number of byte written or -1 in case of failure.

  the document 0 (uncompressed) to 9 (max compression)

  the document  the compression ratio

 0 (uncompressed) to 9 (max compression)

  the compression ratio

Name

Synopsis

xmlParseURI (const char *str); +> (const char *URI); int xmlParseURIReference

Description

Details


xmlURIPtr

typedef xmlURI *xmlURIPtr;


the new structure or NULL in case of error 

the URI instance found in the document  the base value a new URI string (to be freed by the caller) or NULL in case -of error. 

xmlURIPtr xmlParseURI (const char *str); xmlParseURI (const char *URI);

strURI : the URI string to analyze a newly build xmlURIPtr or NULL in case of error 

pointer to an URI structure  the string to analyze 0 or the error code 

pointer to an xmlURI a new string (to be deallocated by caller) 

a FILE* for the output  pointer to an xmlURI 

string to escape  exception list string of chars not to escape a new escaped string or NULL in case of error. 

the string to unescape  the lenght in bytes to unescape (or <= 0 to indicate full string)  optionnal destination buffer an copy of the string, but unescaped 

pointer to the path string 0 or an error code 

the string of the URI to escape an copy of the string, but escaped - -25 May 2001 -Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly -according to RFC2396. -- Carl Douglas 

pointer to an xmlURI 

Name

Synopsis

xmlElementContentPtr cur); void xmlSnprintfElementContent (char *buf, + int size, + xmlElementContentPtr content, + int glob); +void xmlSprintfElementContent (char *buf, @@ -858,6 +868,28 @@ HREF="libxml-tree.html#XMLCHAR" >xmlChar *name); xmlAttributePtr xmlGetDtdQAttrDesc (xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name, + const xmlChar *prefix); +xmlNotationPtr xmlElementPtr xmlGetDtdQElementDesc (xmlDtdPtr dtd, + const xmlChar *name, + const xmlChar *prefix); +xmlElementPtr xmlGetDtdElementDesc (

Description

Details





















xmlSnprintfElementContent ()

void        xmlSnprintfElementContent       (char *buf,
+                                             int size,
+                                             xmlElementContentPtr content,
+                                             int glob);

This will dump the content of the element content definition +Intended just for the debug routine

buf : an output buffer
size : the buffer size
content : An element table
glob : 1 if one must print the englobing parenthesis, 0 otherwise


This will dump the content of the element content definition -Intended just for the debug routine

Deprecated, unsafe, use xmlSnprintfElementContent









































xmlGetDtdQAttrDesc ()

xmlAttributePtr xmlGetDtdQAttrDesc          (xmlDtdPtr dtd,
+                                             const xmlChar *elem,
+                                             const xmlChar *name,
+                                             const xmlChar *prefix);

Search the Dtd for the description of this qualified attribute on +this element.

dtd : a pointer to the DtD to search
elem : the element name
name : the attribute name
prefix : the attribute namespace prefix
Returns :the xmlAttributePtr if found or NULL



xmlGetDtdQElementDesc ()

xmlElementPtr xmlGetDtdQElementDesc         (xmlDtdPtr dtd,
+                                             const xmlChar *name,
+                                             const xmlChar *prefix);

Search the Dtd for the description of this element

dtd : a pointer to the DtD to search
name : the element name
prefix : the element namespace prefix
Returns :the xmlElementPtr if found or NULL




Name

Synopsis

Description

Details

Name

Synopsis

Description

Details









Name

Synopsis

xmlIOHTTPOpenW (const char *post_uri, int compression); +void xmlRegisterHTTPPostCallbacks (void); int xmlSaveFileTo

Description

Details






xmlParserInputBufferPtr

typedef xmlParserInputBuffer *xmlParserInputBufferPtr;







xmlOutputBufferPtr

typedef xmlOutputBuffer *xmlOutputBufferPtr;



  the charset encoding if known the new parser input or NULL

  a C string containing the URI or filename  the charset encoding if known the new parser input or NULL

  a C string containing the URI or filename  the charset encoding if known the new parser input or NULL

  a FILE*   the charset encoding if known the new parser input or NULL

  a file descriptor number  the charset encoding if known the new parser input or NULL

  the memory input  the length of the memory block  the charset encoding if known the new parser input or NULL

  an I/O read function  an I/O close function  an I/O handler  the charset encoding if known the new parser input or NULL

  a buffered parser input  indicative value of the amount of chars to read the number of chars read and stored in the buffer, or -1 +in case of error.

  a buffered parser input  indicative value of the amount of chars to read the number of chars read and stored in the buffer, or -1 +in case of error.

  a buffered parser input  the size in bytes of the array.  an char array the number of chars read and stored in the buffer, or -1 +in case of error.

  a buffered parser input

  the path to a file a new allocated string containing the directory, or NULL.

  the xmlInputMatchCallback  the xmlInputOpenCallback  the xmlInputReadCallback  the xmlInputCloseCallback the registered handler number or -1 in case of error


  the encoding converter or NULL the new parser output or NULL

  a C string containing the URI or filename  the encoding converter or NULL  the compression ration (0 none, 9 max). the new output or NULL

  a FILE*   the encoding converter or NULL the new parser output or NULL

  a file descriptor number  the encoding converter or NULL the new parser output or NULL

  an I/O write function  an I/O close function  an I/O handler the new parser output or NULL

  a buffered parser output  the size in bytes of the array.  an char array the number of chars immediately written, or -1 +in case of error.

  a buffered parser output  a zero terminated C string the number of chars immediately written, or -1 +in case of error.

  a buffered output the number of byte written or -1 in case of error.

  a buffered output the number of byte written or -1 in case of error.

  the xmlOutputMatchCallback  the xmlOutputOpenCallback  the xmlOutputWriteCallback  the xmlOutputCloseCallback the registered handler number or -1 in case of error

  The destination URI for the document  The compression desired for the document.

xmlRegisterHTTPPostCallbacks ()

void        xmlRegisterHTTPPostCallbacks    (void);

By default, libxml submits HTTP output requests using the "PUT" method. +Calling this method changes the HTTP output method to use the "POST" +method instead.


  an output I/O buffer  the document  the encoding if any assuming the i/O layer handles the trancoding  the number of byte written or -1 in case of failure.

  an output I/O buffer  the document  the encoding if any assuming the i/O layer handles the trancoding  should formatting spaces been added  the number of byte written or -1 in case of failure.

  the XML buffer output  the document  the current node  the imbrication level for indenting  is formatting allowed  an optional encoding string

  the HTML buffer output  the document  the encoding string

Name

Synopsis

Description

Details














Wrapper for the malloc() function used in the XML library

  number of bytes to allocate

Wrapper for the realloc() function used in the XML library

  pointer to the existing allocated area  number of bytes to allocate

Wrapper for the strdup() function, xmlStrdup() is usually preferred

  pointer to the existing string



Name

Synopsis

xmlXPathCompExprPtr; -void (typedef *xmlXPathFunction) (xmlXPathParserContextPtr ctxt, - int nargs); +>xmlXPathFunction (); +int xmlXPathIsNaN (double val); +int xmlXPathIsInf (double val); #define xmlXPathNodeSetGetLength

Description

Details
















an XPath evaluation function, the parameters are on thei XPath context stack

  an XPath parser context  the number of arguments passed to the function








void        (*xmlXPathFunction)             (xmlXPathParserContextPtr ctxt,
-                                             int nargs);
typedef xmlXPathFunction ();

An XPath function +The arguments (if any) are popped out of the context stack +and the result is pushed on the stack.

Returns : 


xmlXPathIsNaN ()

int         xmlXPathIsNaN                   (double val);

Provides a portable isnan() function to detect whether a double +is a NotaNumber. Based on trio code +http://sourceforge.net/projects/ctrio/

ctxtval :  a double valuenargs :Returns : 1 if the value is a NaN, 0 otherwise

xmlXPathIsInf ()

int         xmlXPathIsInf                   (double val);

Provides a portable isinf() function to detect whether a double +is a +Infinite or -Infinite. Based on trio code +http://sourceforge.net/projects/ctrio/

val : a double value
Returns :1 vi the value is +Infinite, -1 if -Infinite, 0 otherwise


Implement a functionnality similar to the DOM NodeList.length

  a node-set

Implements a functionnality similar to the DOM NodeList.item()

  a node-set  index of a node in the set

Checks whether ns is empty or not

  a node-set
































Name

Synopsis

xmlXPathVariableLookupFunc f, void *varCtxt); +typedef xmlXPathFunction (); +void xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, + xmlXPathFuncLookupFunc f, + void *funcCtxt); void xmlXPatherrorxmlXPathCompExprPtr comp, int depth); +int xmlXPathNodeSetContains (xmlNodeSetPtr cur, + xmlNodePtr val); xmlNodeSetPtr

Description

Details

Raises an error.

  an XPath parser context  an xmlXPathError code

Raises an XPATH_INVALID_ARITY error

  an XPath parser context

Raises an XPATH_INVALID_TYPE error

  an XPath parser context

Get the error code of an XPath context

  an XPath parser context

Check if an XPath error was raised

  an XPath parser context

Get the document of an XPath context

  an XPath parser context

Get the context node of an XPath context

  an XPath parser context






Pushes the boolean val on the context stack

  an XPath parser context  a boolean

Pushes true on the context stack

  an XPath parser context

Pushes false on the context stack

  an XPath parser context

Pushes the double val on the context stack

  an XPath parser context  a double

Pushes the string str on the context stack

  an XPath parser context  a string

Pushes an empty string on the stack

  an XPath parser context

Pushes the node-set ns on the context stack

  an XPath parser context  a node-set

Pushes an empty node-set on the context stack

  an XPath parser context

Pushes user data on the context stack

  an XPath parser context  user data

Check if the current value on the XPath stack is a node set or +an XSLT value tree

  an XPath parser context

Empties a node-set

  a node-set


Macro to raise an XPath error and return

  the error code

Macro to raise an XPath error and return 0

  the error code

Macro to check that the value on top of the XPath stack is of a given +type.

  the XPath type

Macro to check that the value on top of the XPath stack is of a given +type. return(0) in case of failure

  the XPath type

Macro to check that the number of args passed to an XPath function matches

  the number of expected args





xmlXPathFunction ()

typedef     xmlXPathFunction                ();

An XPath function +The arguments (if any) are popped out of the context stack +and the result is pushed on the stack.

Returns : 


xmlXPathRegisterFuncLookup ()

void        xmlXPathRegisterFuncLookup      (xmlXPathContextPtr ctxt,
+                                             xmlXPathFuncLookupFunc f,
+                                             void *funcCtxt);

Registers an external mecanism to do function lookup.

ctxt : the XPath context
f : the lookup function
funcCtxt : 





xmlXPathNodeSetContains ()

int         xmlXPathNodeSetContains         (xmlNodeSetPtr cur,
+                                             xmlNodePtr val);

checks whether cur contains val

cur : the node-set
val : the node
Returns :true (1) if cur contains val, false (0) otherwise














































































































Name

Synopsis

Description

Details























  • libxml Internationalization support
  • libxml Input/Output interfaces
  • libxml Memory interfaces
  • +
  • libxml Catalog support
  • a short introduction about DTDs and libxml
  • the libxslt page
  • @@ -160,7 +161,8 @@ follow the instructions. Do not send code, I won't debug it version, and that the problem still shows up in those
  • check the list archives to see if the problem was reported already, in this case - there is probably a fix available, similary check the registered + there is probably a fix available, similary check the registered open bugs
  • make sure you can reproduce the bug with xmllint or one of the test programs found in source in the distribution
  • @@ -202,9 +204,9 @@ database::

  • provide new documentations pieces (translations, examples, etc ...)
  • Check the TODO file and try to close one of the items
  • take one of the points raised in the archive or the bug database and - provide a fix. Get in touch with - me before to avoid synchronization problems and check that the - suggested fix will fit in nicely :-)
  • + provide a fix. Get in touch with me + before to avoid synchronization problems and check that the suggested + fix will fit in nicely :-)

    Downloads

    @@ -1670,6 +1672,6 @@ Gnome CVS base under gnome-xml/example

    Daniel Veillard

    -

    $Id: xml.html,v 1.105 2001/08/15 13:12:39 veillard Exp $

    +

    $Id: xml.html,v 1.106 2001/08/17 12:01:21 veillard Exp $

    diff --git a/xmlcatalog.c b/xmlcatalog.c index eb2fa6a0..a66888d6 100644 --- a/xmlcatalog.c +++ b/xmlcatalog.c @@ -26,6 +26,7 @@ static int shell = 0; static int noout = 0; +static int create = 0; static int add = 0; static int del = 0; static int verbose = 0; @@ -275,6 +276,7 @@ static void usage(const char *name) { printf("Usage : %s [options] catalogfile entities...\n", name); printf("\tParse the catalog file and query it for the entities\n"); printf("\t--shell : run a shell allowing interactive queries\n"); + printf("\t--create : create a new catalog\n"); printf("\t--add 'type' 'orig' 'replace' : add an entry\n"); printf("\t--del 'values' : remove values\n"); printf("\t--noout: avoid dumping the result on stdout\n"); @@ -308,6 +310,9 @@ int main(int argc, char **argv) { (!strcmp(argv[i], "--shell"))) { shell++; noout = 1; + } else if ((!strcmp(argv[i], "-create")) || + (!strcmp(argv[i], "--create"))) { + create++; } else if ((!strcmp(argv[i], "-add")) || (!strcmp(argv[i], "--add"))) { i += 3; @@ -335,7 +340,11 @@ int main(int argc, char **argv) { } else if (argv[i][0] == '-') continue; filename = argv[i]; - xmlLoadCatalog(argv[i]); + if (!create) { + xmlLoadCatalog(argv[i]); + } else { + xmlCatalogAdd(BAD_CAST "catalog", BAD_CAST argv[i], NULL); + } break; } @@ -367,17 +376,6 @@ int main(int argc, char **argv) { } } - if (noout) { - FILE *out; - - out = fopen(filename, "w"); - if (out == NULL) { - fprintf(stderr, "could not open %s for saving\n", filename); - noout = 0; - } else { - xmlCatalogDump(out); - } - } } else if (shell) { usershell(); } else { @@ -406,6 +404,21 @@ int main(int argc, char **argv) { } } } + if ((add) || (del) || (create)) { + if (noout) { + FILE *out; + + out = fopen(filename, "w"); + if (out == NULL) { + fprintf(stderr, "could not open %s for saving\n", filename); + noout = 0; + } else { + xmlCatalogDump(out); + } + } else { + xmlCatalogDump(stdout); + } + } /* * Cleanup and check for memory leaks