Changeset 258

Show
Ignore:
Timestamp:
08/09/2006 08:39:06 PM
Author:
shiva
Message:

Eliminate XML character set sanitizing and trust that VSS character set is in the declared encoding.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Ken/ssphys-trusted-encoding/SSPhys/Formatter.cpp

    r196 r258  
    5454    : m_pCurrentFileNode (NULL) 
    5555  { 
     56    // patch this line to match your VSS DB's locale 
    5657    TiXmlDeclaration decl ("1.0", "windows-1252", ""); 
    57     if (NULL == setlocale (LC_ALL, ".1252")) 
    58       std::cerr << "WARNING: unable to correctly set the windows-1252 locale" << std::endl; 
    5958    m_Document.InsertEndChild (decl); 
    6059  } 
  • branches/Ken/ssphys-trusted-encoding/SSPhysLib/XML.cpp

    r157 r258  
    55#include "StdAfx.h" 
    66#include "XML.h" 
    7  
    8 class CValidXMLChar 
    9 { 
    10 public: 
    11   bool operator () (char c) 
    12   { 
    13     unsigned char uc = static_cast <unsigned char> (c); 
    14     bool b = true; 
    15     if ( (uc < 0x20 && uc != 0x09 && uc != 0x0A && uc != 0x0D) 
    16       || (uc >= 0x7f && uc <= 0x84) 
    17       || (uc >= 0x86 && uc <= 0x9f) ) 
    18     { 
    19       m_bInvalidOccured = true; 
    20       return true; 
    21     } 
    22     return false; 
    23   } 
    24   bool m_bInvalidOccured; 
    25 }; 
    26  
    27 std::string sanitizeForXML (const std::string& input) 
    28 { 
    29   std::string output (input); 
    30   CValidXMLChar validXMLChar; 
    31   std::replace_if (output.begin (), output.end (), validXMLChar, '_'); 
    32   return output; 
    33 } 
    34  
    35 // --------------------------------------------------------------- 
    367 
    378XMLNode::XMLNode (XMLNode* pParent, std::string name, AttribMap attrib) 
     
    4617  for (; itor != attrib.end (); ++itor) 
    4718  { 
    48     m_Node.SetAttribute(itor->first, sanitizeForXML (itor->second)); 
     19    m_Node.SetAttribute(itor->first, itor->second); 
    4920  } 
    5021} 
     
    6233void XMLNode::SetText (std::string text) 
    6334{ 
    64   TiXmlText xmlText (sanitizeForXML (text)); 
     35  TiXmlText xmlText (text); 
    6536  m_Node.InsertEndChild(xmlText); 
    6637} 
     
    8253void XMLText::SetValue (std::string value) 
    8354{ 
    84   m_Text.SetValue (sanitizeForXML (value)); 
     55  m_Text.SetValue (value); 
    8556} 
    86  
    87  
  • branches/Ken/ssphys-trusted-encoding/utils/tinyxml.cpp

    r195 r258  
    128128                        ++i; 
    129129                } 
    130                 else if (isprint (c)) 
     130                else 
    131131                { 
     132                        // just pass these through, since we've 
     133                        // declared an encoding that presumably allows 
     134                        // them 
     135                        *outString += (char) c; // somewhat more efficient function call. 
    132136                        //char realc = (char) c; 
    133137                        //outString->append( &realc, 1 ); 
    134                         *outString += (char) c; // somewhat more efficient function call. 
    135                         ++i; 
    136                 } 
    137                 else 
    138                 { 
    139                         // in any other case, we drop this character 
    140138                        ++i; 
    141139                } 

These ads are automatically generated by Google based on the content of this page. Revenue from these ads helps to pay for hosting fees of this site; however, these ads do not constitute an endorsement by PumaCode.org.