You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2003/11/12 06:22:00 UTC

DO NOT REPLY [Bug 24634] New: - DOMWriter fails to write SYSTEM identifier

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24634>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24634

DOMWriter fails to write SYSTEM identifier

           Summary: DOMWriter fails to write SYSTEM identifier
           Product: Xerces-C++
           Version: 2.1.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: rmacedon@aol.com


Recently moved from version 2.0.1 Xerces to 2.1.0. In order to show exactly the 
error I have, I have modified CreateDomDocument sample and pasted the most 
important parts here for your inspection. In 2.0.1, it writes an xml file 
called test.xml with the following header:
<?xml version="1.0" encoding="UTF-16" standalone="no" ?><!DOCTYPE company 
SYSTEM "company.dtd">

In 2.1.0 version, the SYSTEM "company.dtd" is left out as follows:
<?xml version="1.0" encoding="UTF-16" standalone="no" ?><!DOCTYPE company>

Here is the modified code to use to show. The SYSTEM dtd no longer gets gets 
written out. I hope this is enough info. Thanks!!!!!!!

      XMLCh *buffer;
      xmlout.open("test.xml",ios::out | ios::app | 0666 );

        DOMImplementation* impl =  
DOMImplementationRegistry::getDOMImplementation(X("Core"));

	DOMWriter *theSerializer = ((DOMImplementationLS *)impl)-
>createDOMWriter();

	DOMDocumentType *docType = impl->createDocumentType(X("company"),0,X
("company.dtd"));

        DOMDocument* doc = impl->createDocument(
                    0,                    // root element namespace URI.
                    X("company"),         // root element name
                    docType);                   // document type object (DTD)

	XMLFormatTarget *myFormTarget = new LocalFileFormatTarget("test.xml");

        DOMElement* rootElem = doc->getDocumentElement();

        DOMElement*  prodElem = doc->createElement(X("product"));
        rootElem->appendChild(prodElem);

        DOMText*    prodDataVal = doc->createTextNode(X("Xerces-C"));
        prodElem->appendChild(prodDataVal);

        DOMElement*  catElem = doc->createElement(X("category"));
        rootElem->appendChild(catElem);

        catElem->setAttribute(X("idea"), X("great"));

        DOMText*    catDataVal = doc->createTextNode(X("XML Parsing Tools"));
        catElem->appendChild(catDataVal);

        DOMElement*  devByElem = doc->createElement(X("developedBy"));
        rootElem->appendChild(devByElem);

        DOMText*    devByDataVal = doc->createTextNode(X("Apache Software 
Foundation"));
        devByElem->appendChild(devByDataVal);

        //
        // Now count the number of elements in the above DOM tree.
        //

	buffer = theSerializer->writeToString(*doc);
        xmlout<<XMLString::transcode(buffer)<<endl;
        xmlout.close();
        unsigned int elementCount = doc->getElementsByTagName(X("*"))->getLength
();
        cout << "The tree just created contains: " << elementCount
             << " elements." << endl;

        doc->release();

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org