Re: [xml] Adding a DTD with attributes dynamically



On Wed, Dec 04, 2002 at 06:45:27PM +0100, Marius Kjeldahl wrote:
I wish to add the DTD to a dynamically created xml document. Does anybody know 
how it is done? For instance, I want to call functions in libxml that creates 
something like:

<?xml version="1.0"?>
<!DOCTYPE ThreeDSecure [
<!ATTLIST CRReq id ID #IMPLIED>
]>
<ThreeDSecure>
...

By using xmlCreateIntSubset I get the DOCTYPE line in ok, but I can not figure 
out how to add the ATTLIST entries.

Does anybody know if this is possible, and how?

  it is possible since the SAX callbacks do this.
It is not simple, you can look at the attributeDecl callback for example
in SAX.c
You may also parse the content "<!ATTLIST CRReq id ID #IMPLIED>"
with xmlParseDTD() or xmlIOParseDTD() and then add it as the child of
the document node.
In both case you will probably need to use your debugger and read some
of libxml code before getting a working version.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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