svn commit: r1198862 - in /xalan/c/trunk/src/xalanc/XercesParserLiaison: XercesNamedNodeMapAttributeList.cpp XercesNamedNodeMapAttributeList.hpp
[email protected] Mon, 07 Nov 2011 18:34:50 -0000
| Newsgroups | gmane.text.xml.xalan.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: shathaway
Date: Mon Nov 7 18:34:50 2011
New Revision: 1198862
URL: http://svn.apache.org/viewvc?rev=1198862&view=rev
Log:
XALANC-719 Xerces Parser Liaison - errors on elements with no attributes
Modified:
xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.cpp
xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.hpp
Modified: xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.cpp?rev=1198862&r1=1198861&r2=1198862&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.cpp (original)
+++ xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.cpp Mon Nov 7 18:34:50 2011
@@ -48,9 +48,8 @@ const XMLCh XercesNamedNodeMapAttrib
XercesNamedNodeMapAttributeList::XercesNamedNodeMapAttributeList(const DOMNamedNodeMapType* theMap) :
ParentType(),
m_nodeMap(theMap),
- m_lastIndex(theMap->getLength() - 1)
+ m_attrCount(theMap->getLength())
{
- assert(theMap->getLength() != 0);
}
@@ -64,7 +63,7 @@ XercesNamedNodeMapAttributeList::~Xerces
XalanSize_t
XercesNamedNodeMapAttributeList::getLength() const
{
- return m_lastIndex + 1;
+ return m_attrCount;
}
@@ -72,9 +71,13 @@ XercesNamedNodeMapAttributeList::getLeng
const XMLCh*
XercesNamedNodeMapAttributeList::getName(const XalanSize_t index) const
{
- const DOMNodeType* const theAttribute = m_nodeMap->item(m_lastIndex - index);
- assert(theAttribute != 0);
+ if (m_attrCount == 0)
+ return 0;
+
+ if (index >= m_attrCount)
+ return 0;
+ const DOMNodeType* const theAttribute = m_nodeMap->item(index);
return theAttribute->getNodeName();
}
@@ -93,8 +96,13 @@ XercesNamedNodeMapAttributeList::getType
const XMLCh*
XercesNamedNodeMapAttributeList::getValue(const XalanSize_t index) const
{
- const DOMNodeType* const theAttribute = m_nodeMap->item(m_lastIndex - index);
- assert(theAttribute != 0);
+ if (m_attrCount == 0)
+ return 0;
+
+ if (index >= m_attrCount)
+ return 0;
+
+ const DOMNodeType* const theAttribute = m_nodeMap->item(index);
return theAttribute->getNodeValue();
}
Modified: xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.hpp?rev=1198862&r1=1198861&r2=1198862&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.hpp (original)
+++ xalan/c/trunk/src/xalanc/XercesParserLiaison/XercesNamedNodeMapAttributeList.hpp Mon Nov 7 18:34:50 2011
@@ -83,7 +83,7 @@ private:
// Data members...
const DOMNamedNodeMapType* const m_nodeMap;
- const XalanSize_t m_lastIndex;
+ const XalanSize_t m_attrCount;
static const XMLCh s_typeString[];
};