[libxml++] DTD Directory and Default attribute from DTD



Hi Everyboby.

I'm just starting to use libxml++ for a research project (migrating form XERCES-C whose license is "supposed" to be GPL compatible, but the Apache Software Foundation is still not sure...).
For now, i just use the DOM parser to read a file and browsing the resulting tree.
I have two issues:

* directory issue when memory parsing :
the directory associated to a parse when memory/stream parsing is processed: if the DTD referenced in xml definition in memory is not in the working directory, a "file not found" exception is launched.
I have corrected this issue in my code by rewriting a parse_memory() method, adding a directory parameter and:
> context_->directory = (char*) xmlStrdup((xmlChar*)directory);
just before the parse_context() call (maybe a preprocessing is needed on char* directory in order to extract the directory from the entire file path)
Maybe it could be interesting to add this kind of features in the code

* default attribute value form DTD
When I parse a validated XML file with DOMParser, and i browse the resulting tree, calls to get_attribute(name) returns NULL when the attribute is not present in the XML, but has a default value in DTD. I don't if it is a normal behavior or if i forget to set some option (currently using set_validate() and set_substitute_entities()).
If it's a normal behavior, it could be interesting to add a fonction to get the value, defaulted if not present in XML. For now, i use a libxml call to xmlGetProp() instead of the xmlHasProp(). This returns a char string if attribute is present or defaulted, else returns NULL.

Please say if i get wrong somewhere.

Best regards,

Raphael.


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