[Xmlstorage-commits] SF.net SVN: xmlstorage: [75] trunk/c++
Brought to you by:
martinfuchs
|
From: <mar...@us...> - 2008-01-30 23:05:55
|
Revision: 75
http://xmlstorage.svn.sourceforge.net/xmlstorage/?rev=75&view=rev
Author: martinfuchs
Date: 2008-01-30 15:05:56 -0800 (Wed, 30 Jan 2008)
Log Message:
-----------
allow UTF-8 encoded umlaut characters in tag names
Modified Paths:
--------------
trunk/c++/xmlstorage.cpp
trunk/c++/xs-native.cpp
Modified: trunk/c++/xmlstorage.cpp
===================================================================
--- trunk/c++/xmlstorage.cpp 2008-01-19 18:00:57 UTC (rev 74)
+++ trunk/c++/xmlstorage.cpp 2008-01-30 23:05:56 UTC (rev 75)
@@ -2,7 +2,7 @@
//
// XML storage C++ classes version 1.2
//
- // Copyright (c) 2004, 2005, 2006, 2007 Martin Fuchs <mar...@gm...>
+ // Copyright (c) 2004, 2005, 2006, 2007, 2008 Martin Fuchs <mar...@gm...>
//
/// \file xmlstorage.cpp
@@ -534,18 +534,33 @@
}
+const char* get_xmlsym_end_utf8(const char* p)
+{
+ for(; *p; ++p) {
+ char c = *p;
+
+ if (c == '\xC3') // UTF-8 escape character
+ ++p; //TODO only continue on umlaut characters
+ else if (!isalnum(c) && c!='_' && c!='-')
+ break;
+ }
+
+ return p;
+}
+
+
void DocType::parse(const char* p)
{
while(isspace((unsigned char)*p)) ++p;
const char* start = p;
- while(isxmlsym(*p)) ++p;
+ p = get_xmlsym_end_utf8(p);
_name.assign(start, p-start);
while(isspace((unsigned char)*p)) ++p;
start = p;
- while(isxmlsym(*p)) ++p;
+ p = get_xmlsym_end_utf8(p);
std::string keyword(p, p-start); // "PUBLIC" or "SYSTEM"
while(isspace((unsigned char)*p)) ++p;
Modified: trunk/c++/xs-native.cpp
===================================================================
--- trunk/c++/xs-native.cpp 2008-01-19 18:00:57 UTC (rev 74)
+++ trunk/c++/xs-native.cpp 2008-01-30 23:05:56 UTC (rev 75)
@@ -93,7 +93,7 @@
_buffer_str.erase();
}
- void append(char c)
+ void append(int c)
{
size_t wpos = _wptr-_buffer;
@@ -103,7 +103,7 @@
_wptr = _buffer + wpos;
}
- *_wptr++ = c;
+ *_wptr++ = static_cast<char>(c);
}
const std::string& str(bool utf8) // returns UTF-8 encoded buffer content
@@ -148,8 +148,7 @@
if (*q == '?')
++q;
- while(isxmlsym(*q))
- ++q;
+ q = get_xmlsym_end_utf8(q);
#ifdef XS_STRING_UTF8
return XS_String(p, q-p);
@@ -174,8 +173,7 @@
else if (*p == '?')
++p;
- while(isxmlsym(*p))
- ++p;
+ p = get_xmlsym_end_utf8(p);
// read attributes from buffer
while(*p && *p!='>' && *p!='/') {
@@ -184,8 +182,7 @@
const char* attr_name = p;
- while(isxmlsym(*p))
- ++p;
+ p = get_xmlsym_end_utf8(p);
if (*p != '=')
break; //@TODO error handling
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|