Re: [xml] Whitespace in Public IDs



On Wed, 14 Jul 2004, Peter Breitenlohner wrote:

On Fri, 9 Jul 2004, Daniel Veillard wrote:

 Sure, that would be welcome. The public entry points are in
include/libxml/catalog.h then patching them to do something like

static xmlChar *
xmlCatalogNormalizePublic(const xmlChar *pubid) {
  return(NULL if not needed or copy otherwise)
}

foo(const xmlChar *pubid) {
  xmlChar *normid;

  normid = xmlCatalogNormalizePublic(pubid);
  if (normid != NULL) pubid = normid;

  ....

  if (normid != NULL) xmlFree(normid);
}

 would be greatly appreciated :-)

Hi Daniel,

(3) A question: I suspect a Public Identifier containing whitespace only and
thus normalized to the empty string should be interpreted as NULL. Correct?

Hi Daniel,

attached 2 patches for "Public Identifier Normalization", please have a look.

The question (3) above still needs an answer. The present version of
xmlCatalogNormalizePublic replaces pubID's that are empty (or just
whitespace) by an empty string which is subsequently replaced by NULL. I
think the semantics of such pubID's is rather dubious; the only important
aspect probably is not to produce segmentation faults or memory leaks.

The first patch is for the code change in catalog.c

The second one contains two additional tests ("whitex" for an XML catalog and
"whites" for an SGML catalog) that I have used for testing. Please either
add them to the distribution, or incorporate them into the existing tests (I
didn't want to modify them), or just ignore them -- as you prefer.

regards
Peter Breitenlohner <peb mppmu mpg de>

Attachment: patch-03-norm-pubid-code
Description: Text document

Attachment: patch-04-norm-pubid-test
Description: Text document



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]