From bf6a32033bfd155dc12d0e3aa9d44977a6ebaf6f Mon Sep 17 00:00:00 2001 From: Andy Heninger <andyh@apache.org> Date: Fri, 8 Sep 2000 22:01:31 +0000 Subject: [PATCH] DOMPrint incorrectly handled DOCTYPE declarations conatining both a public and system id. Problem reported by Jesse Pelton. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@172383 13f79535-47bb-0310-9956-ffa450edef68 --- samples/DOMPrint/DOMPrint.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/samples/DOMPrint/DOMPrint.cpp b/samples/DOMPrint/DOMPrint.cpp index 1e7c67026..57fed80b8 100644 --- a/samples/DOMPrint/DOMPrint.cpp +++ b/samples/DOMPrint/DOMPrint.cpp @@ -650,17 +650,27 @@ ostream& operator<<(ostream& target, DOM_Node& toWrite) *gFormatter << XMLFormatter::NoEscapes << gStartDoctype << nodeName; + DOMString id = doctype.getPublicId(); - if (id != 0) + { *gFormatter << XMLFormatter::NoEscapes << chSpace << gPublic - << id << chDoubleQuote; - - id = doctype.getSystemId(); - if (id != 0) + << id << chDoubleQuote; + id = doctype.getSystemId(); + if (id != 0) + { + *gFormatter << XMLFormatter::NoEscapes << chSpace + << chDoubleQuote << id << chDoubleQuote; + } + } + else { - *gFormatter << XMLFormatter::NoEscapes << chSpace << gSystem - << id << chDoubleQuote; + id = doctype.getSystemId(); + if (id != 0) + { + *gFormatter << XMLFormatter::NoEscapes << chSpace << gSystem + << id << chDoubleQuote; + } } id = doctype.getInternalSubset(); -- GitLab