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 2002/12/17 03:40:33 UTC

DO NOT REPLY [Bug 15427] New: - DOMWriter dose not flush the output stream

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=15427>.
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=15427

DOMWriter dose not flush the output stream

           Summary: DOMWriter dose not flush the output stream
           Product: Xerces-C++
           Version: 2.1.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: smartnoho@yahoo.com


When call DOMWriter::writeNode, only part of content is write to the output 
stream.
The following is the code which will show the bug.

void test7(DOMImplementationLS * impl, DOMDocument *doc)
{
	cout << "test7...serialize..." << endl;

	boost::shared_ptr<DOMWriter> serializer(impl->createDOMWriter(), 
XMLRelease<DOMWriter>());
	if (serializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, 
true))
		serializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, 
true);
	if (serializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
		serializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);

	boost::shared_ptr<XMLFormatTarget> formTarget(new StdOutFormatTarget());

	cout << "unnormalized..." << endl;
	DOMElement * root = doc->getDocumentElement();
	try{
		serializer->writeNode(formTarget.get(), *root);
	}
	catch (const XMLException& toCatch) {
		cerr << "Exception message is: \n"
			<< toCatch.getMessage() << endl;
		return;
	}
	catch (const DOMException& toCatch) {
		cerr << "Exception message is: \n"
			<< toCatch.msg << endl;
		return;
	}
	catch (...) {
		cerr << "Unexpected Exception" << endl;
		return;
	}

	cout << endl << "normalized..." << endl;
	doc->normalize();
	try{
		serializer->writeNode(formTarget.get(), *root);
	}
	catch (const XMLException& toCatch) {
		cerr << "Exception message is: \n"
			<< toCatch.getMessage() << endl;
		return;
	}
	catch (const DOMException& toCatch) {
		cerr << "Exception message is: \n"
			<< toCatch.msg << endl;
		return;
	}
	catch (...) {
		cerr << "Unexpected Exception" << endl;
		return;
	}

	cout << endl;

	cout << "test7..." << endl << endl;
}

The following content is the output of function 'test7' on my computer(Windows 
2000 + SP3, VC 6)
test7...serialize...
unnormalized...
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNames
paceSchemaLocation="system.property.xsd">
        <licence>
                <productId/>
                <functionList>
                        <function>
                                <functionId/>
                                <functionName/>
                                <functionDescription/>
                        </function>
                        <function>
                                <functionId/>
                                <functionName/>
                                <functionDescription/>
                        </function>
                </functionList>
                <licenceKey/>
        </licence>
        <capability>
                <maxDevices>16</maxDevices>
                <maxTrendHours>72</maxTrendHours>
                <maxDisclosureHours>72</maxDisc
normalized...
losureHours>
        </capability>
        <HL7>
                <port>13130</port>
        </HL7>
        <dataExport>
                <path>d:\</path>
        </dataExport>
</configuration><configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-insta
nce" xsi:noNamespaceSchemaLocation="system.property.xsd">
        <licence>
                <productId/>
                <functionList>
                        <function>
                                <functionId/>
                                <functionName/>
                                <functionDescription/>
                        </function>
                        <function>
                                <functionId/>
                                <functionName/>
                                <functionDescription/>
                        </function>
                </functionList>
                <licenceKey
test7...

/>
        </licence>
        <capability>
                <maxDevices>16</maxDevices>
                <maxTrendHours>72</maxTrendHours>
                <maxDisclosureHours>72</maxDisclosureHours>
        </capability>
        <HL7>
                <port>13130</port>
        </HL7>
        <dataExport>
                <path>d:\</path>
        </dataExport>
</configuration>

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