From 40d6c33ff3af9b2faf0605d5213f5e999ac8a9e4 Mon Sep 17 00:00:00 2001 From: Tinny Ng <tng@apache.org> Date: Fri, 6 Dec 2002 18:24:46 +0000 Subject: [PATCH] Do not print the curly braces if the namespace URL is null. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@174479 13f79535-47bb-0310-9956-ffa450edef68 --- src/xercesc/internal/IGXMLScanner2.cpp | 18 ++++++++++-------- src/xercesc/internal/SGXMLScanner.cpp | 20 +++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp index 547ffe464..f4290e5c9 100644 --- a/src/xercesc/internal/IGXMLScanner2.cpp +++ b/src/xercesc/internal/IGXMLScanner2.cpp @@ -285,16 +285,18 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs // Its not valid for this element, so issue an error if we are // validating. // - XMLBufBid bbURI(&fBufMgr); - XMLBuffer& bufURI = bbURI.getBuffer(); - - getURIText(uriId, bufURI); - XMLBufBid bbMsg(&fBufMgr); XMLBuffer& bufMsg = bbMsg.getBuffer(); - bufMsg.append(chOpenCurly); - bufMsg.append(bufURI.getRawBuffer()); - bufMsg.append(chCloseCurly); + if (uriId != fEmptyNamespaceId) { + XMLBufBid bbURI(&fBufMgr); + XMLBuffer& bufURI = bbURI.getBuffer(); + + getURIText(uriId, bufURI); + + bufMsg.append(chOpenCurly); + bufMsg.append(bufURI.getRawBuffer()); + bufMsg.append(chCloseCurly); + } bufMsg.append(suffPtr); fValidator->emitError ( diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp index 102e916cf..9d6e97be0 100644 --- a/src/xercesc/internal/SGXMLScanner.cpp +++ b/src/xercesc/internal/SGXMLScanner.cpp @@ -884,7 +884,7 @@ void SGXMLScanner::scanEndTag(bool& gotData) XMLElementDecl* tempElement = topElem->fThisElement; const XMLCh* rawNameBuf = fQNameBuf.getRawBuffer(); - if ((topUri != uriId) || + if ((topUri != uriId) || (!XMLString::equals(tempElement->getBaseName(), &rawNameBuf[prefixColonPos + 1]))) { emitError @@ -2041,16 +2041,18 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs // Its not valid for this element, so issue an error if we are // validating. // - XMLBufBid bbURI(&fBufMgr); - XMLBuffer& bufURI = bbURI.getBuffer(); - - getURIText(uriId, bufURI); - XMLBufBid bbMsg(&fBufMgr); XMLBuffer& bufMsg = bbMsg.getBuffer(); - bufMsg.append(chOpenCurly); - bufMsg.append(bufURI.getRawBuffer()); - bufMsg.append(chCloseCurly); + if (uriId != fEmptyNamespaceId) { + XMLBufBid bbURI(&fBufMgr); + XMLBuffer& bufURI = bbURI.getBuffer(); + + getURIText(uriId, bufURI); + + bufMsg.append(chOpenCurly); + bufMsg.append(bufURI.getRawBuffer()); + bufMsg.append(chCloseCurly); + } bufMsg.append(suffPtr); fValidator->emitError ( -- GitLab