Implement new utility functions for testing validity of name and token characters.
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 647901b..2c06a46 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -136,12 +136,7 @@
return 0;
}
- while( *p && (
- XMLUtil::IsAlphaNum( (unsigned char) *p )
- || *p == '_'
- || *p == ':'
- || (*p == '-' && p>start ) // can be in a name, but not lead it.
- || (*p == '.' && p>start ) )) { // can be in a name, but not lead it.
+ while( *p && ( p == start ? XMLUtil::IsNameStartChar( *p ) : XMLUtil::IsNameChar( *p ) )) {
++p;
}
@@ -1357,7 +1352,7 @@
}
// attribute.
- if ( XMLUtil::IsAlpha( *p ) ) {
+ if (XMLUtil::IsNameStartChar( *p ) ) {
XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute();
attrib->_memPool = &_document->_attributePool;
attrib->_memPool->SetTracked();