[sane-devel] sane-desc to xml (new patch)

Henning Meier-Geinitz henning@meier-geinitz.de
Fri, 9 Jul 2004 18:50:08 +0200


Hi,

On Mon, Jul 05, 2004 at 11:45:47AM +0200, Jose Gato wrote:
> Hi again, I have a new patch for the XML output of sane-desc:
> 
> - Now the XML document have a XML root.
> - New tag for the document marked as "new".
> - Some bug fixed...
> 
> I have being using the XML output for make a perl parser and have all
> the information in a sql database so I think the xml is correct.

It's in CVS now with some changes. See below for comments. Please test
if I haven't broken anything.

> -   Copyright (C) 2002-2004 Henning Meier-Geinitz <henning@meier-geinitz.de>
> +   Copyright (C) 2002, 2003 Henning Meier-Geinitz <henning@meier-geinitz.de>

I didn't apply this part of the patch obviously :-)

> +static char *
> +clean_string(char *c)
> +{
> +  /*not avoided characters*/
> +
> +  char *aux;
> +  
> +  
> +  aux=malloc(strlen(c)*sizeof(char)+100);

Oh, if *c has quite a lot of "illegal" chars that could break. I used
strlen(c)*sizeof(char)*6 now (length of longest encoding). If you know
something nicer...

> @@ -1622,82 +1667,88 @@
>    backend_entry *be;
>  
>    be = first_backend;
> +  printf("<backends>\n");
>    while (be) 
>      {
>        url_entry *url = be->url;
>        type_entry *type = be->type;
>  
> +      clean_string(be->name);

I've removed that last line. Please correct me if it was intentional.

Bye,
  Henning