[xml] Problem adding DTD at runtime



Hello,

I'm trying to add a DTD at runtine to my XML. I use the following code (I hope you can read the Delphi syntax)

dtd := XMLParseDTD(nil, 'mydtd.dtd');
if (rootNode^.ns=nil) or (rootNode^.ns^.prefix=nil) then
  dtd^.name := rootNode^.name
else
  dtd^.name := PChar(rootNode^.ns^.prefix+':'+rootNode^.name);
xmlDoc^.intSubset := dtd;
if (xmlDoc^.children=nil) then
  xmlAddChild(xmlNodePtr(xmlDoc), xmlNodePtr(dtd))
else
  xmlAddPrevSibling(xmlDoc^.children, xmlNodePtr(dtd));

My problem is that I get an Access Violation in XMLFreeDoc(xmlDoc) after the DTD has been added. Am I missing 
something?  The DTD is added allright because it shows up in a call to xmlDocMemoryDump.

I have another question as well. Is it possible to add a DTD from memory (<!ATTLIST SOAP-ENV:Body wsu:Id ID 
#IMPLIED>)?

Thanks,
Erik F. Andersen



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