Re: [xml] Generating XML from Schema definitions (again, sorry)

On 09 Aug 04:23, Daniel Veillard wrote:
}> In other words, what I'm doing is traversing the xsd schema doc and when
}> I come across a reference to an imported type or element I lookup that
}> namespace in the schemasImports hash and get the xmlSchemaImport struct
}> which contains the imported schema definition and it's document tree.
}  So you need a bit more than just the 2 calls below, access to internal data
}structures are also needed (which was expected !)

Yeah sure, but it's an "exposed" internal data structure. And everyone
knows that stuff's there to be taken advantage of. ;-)

}  Well _private is by definition a placeholder for users data, so I think
}it's not an abuse, it's an abuse when libxml2 (or libxslt) code use that

Ok, that's good. In theory though, if you liked it enough you could have
it and un-expose the bits I exposed.

}> The changes I made were to add declarations in schemasInternals.h for
}> two new functions in xmlschemas.c:
}> XMLPUBFUN xmlDocPtr XMLCALL             xmlSchemaImportGetDoc(void *imp);
}> XMLPUBFUN xmlSchemaPtr XMLCALL          xmlSchemaImportGetSchema(void *imp);
}  I'm a bit surprised by the fact that you pass a void * and not a type
}there, so I wonder what it's supposed to be, an internal type I guess.

That's because the real type is xmlSchemaImportPtr and that was defined
locally inside xmlschemas.c . I didn't want to drag out that definition
as it brings out heaps of other structs. I could have just defined a
single opaque typedef ptr, but it would have essentially been:

typedef void *xmlSchemaImportPtr;

so I sort of didn't really see the point. I guess it does give better
type checking, but I would then have to move the typedef out of xmlschemas.c
and into schemasInternals.h so I was just minimising impact on the code.

}> I also had to include xmlschemas.h in schemasInternals.h to ensure the
}> definition of xmlSchemaPtr, but I didn't think that was too unreasonable
}> for any other file which was including schemasInternals.h anyway. The
}> rest I can do with public functions.
}  I think that's the most problematic part, maybe some of the structures
}are now stable enough to be made public. We were very concerned about not
}exposing too much with Kasimier because we knew the implementation wasn't
}complete enough and we didn't want to expose internal bits to be able to 
}change the design if needed without having to break the ABI/API or go 
}though crazy compatibility exercises.

No, this is something already including schemasInternals.h is now required
to include xmlschemas.h, not the other way around. There is no additional
exposure other than what you have already inflicted upon yourself.



Callum Gibson @ home

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