Check a known bug in .... hangon... *much muffled noises and irrational
searching*

  DOMDocumentTypeImpl::setOwnerDocument()

There you will find a row stating:

  systemId = docImpl->cloneString(internalSubset);

Wupps... BUG! We did the systemId cloning a couple of lines earlier which we
now trashes.
It should be this instead.

  internalSubset = docImpl->cloneString(internalSubset);

Then you will get your SYSTEM identifiers back.

PS: This was fixed quite a while ago and is present in the nightly build.

Regards

Erik Rydgren
Mandarinen systems AB
Sweden

-----Original Message-----
From: Claudio Bandaloukas (by way of Claudio Bandaloukas
<[EMAIL PROTECTED]>) [mailto:[EMAIL PROTECTED]]
Sent: den 16 december 2002 12:39
To: [EMAIL PROTECTED]
Subject: Serializer will not accept doctype?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

#include <std_pleading_for_help>

I am trying to create a new DOM and want to assign a DocType to it
- ----- code snippet ----

DOMImplementation* outputimpl =
DOMImplementationRegistry::getDOMImplementation(X("LS"));
DOMDocumentType* dt =

outputimpl->createDocumentType(X("listaprogetti"),0,X("progetto.dtd"));
outputDom = outputimpl->createDocument(
        0,                    // root element namespace URI.
        X("listaprogetti"),   // root element name
        dt); // document type object (DTD).
- --------------------------
The DOM is populated by copying nodes from another DOMDocument, and
 everything goes fine if I s/dt/0/ during document creation (thus creating a
 document without a doctype)

Then I want to print the DOM to a file...
- --------------------------------
DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(X("LS"));
DOMWriter* theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();

if (theSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent,
 true)) theSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent,
 true); if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
 true)) theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);

XMLFormatTarget *myFormTarget = new LocalFileFormatTarget(nomefile);
try{
        theSerializer->writeNode(myFormTarget, *inNode);
} (and catch stuff)
- -----------------------------------

Expected result:
Something like this :
- -----------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE listaprogetti SYSTEM "progetto.dtd">
<listaprogetti><progetto tipo="pt_xml" titolo="aaa con la crema">
                <studente cognome="bbb" compito="tutto"
matricola="gff327907889" nome="ccc"/>
                <funzione>deve saper gestire un messaggio tipico</funzione>
                <strumento>questo</strumento>
        </progetto></listaprogetti>
- -------------------------------------------------------

Obtained:
- -----------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE listaprogetti>
<listaprogetti><progetto tipo="pt_xml" titolo="aaa con la crema">
                <studente cognome="bbb" compito="tutto"
matricola="gff327907889" nome="ccc"/>
                <funzione>deve saper gestire un messaggio tipico</funzione>
                <strumento>questo</strumento>
        </progetto></listaprogetti>
- -------------------------------------------------------------
This is not good, the Serializer does not output the SYSTEM string... or I
am
doing something seriously wrong here! :-$

I also tried putting an empty (as in single space character) string in the
public identifier (with X(" "))
but I get this on the output file
- -------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE listaprogetti PUBLIC " "
- -------------------------------------------------
And an error from the error handler (thanks to the DOMCount authors btw :-)
The error message is "Unrecognized Node Type"

Ideas? Any hint will do! (since I have to deliver this for my paper in two
days and most of the work is done, but I am stuck with this piece of code!)

Running under gentoo with gcc 2.95 (with own-compiled xerces-src version
 2.1.0 successfuly)

Thanks in Advance for your help!
- --
  -| Claudio Bandaloukas |-
jabber-id: [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9/aiUUVSA8zPJkSYRAjY8AKDsOVs9q/UI+L51Gxsl1GXmZ1WJ+QCeJQfs
bboVETWrR1CL4L9bYRsD5B4=
=kXEV
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to