Changeset 124

Show
Ignore:
Timestamp:
02/23/2006 05:58:10 AM
Author:
luedi
Message:

removed invalid XML characters from output

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ssphys/SSPhys/Formatter.cpp

    r123 r124  
    5555  { 
    5656    TiXmlDeclaration decl ("1.0", "windows-1252", ""); 
     57    setlocale (LC_ALL, ".1252"); 
    5758    m_Document.InsertEndChild (decl); 
    5859  } 
  • trunk/ssphys/SSPhys/ssphys.vcproj

    r110 r124  
    365365                                        Name="VCCustomBuildTool" 
    366366                                        Description="Performing Custom Build Step on ..\$(InputFileName)" 
    367                                         CommandLine="SubWCRev .. ..\$(InputFileName) ..\version.h
     367                                        CommandLine="SubWCRev .. ..\$(InputFileName) ..\version.h

    368368                                        Outputs="..\version.h" 
    369369                                /> 
     
    375375                                        Name="VCCustomBuildTool" 
    376376                                        Description="Performing Custom Build Step on ..\$(InputFileName)" 
    377                                         CommandLine="SubWCRev .. ..\$(InputFileName) ..\version.h
     377                                        CommandLine="SubWCRev .. ..\$(InputFileName) ..\version.h

    378378                                        Outputs="..\version.h" 
    379379                                /> 
  • trunk/ssphys/SSPhysLib/SSPhysLib.vcproj

    r121 r124  
    209209                                </FileConfiguration> 
    210210                        </File> 
     211                        <File 
     212                                RelativePath=".\XML.cpp" 
     213                                > 
     214                        </File> 
    211215                </Filter> 
    212216                <Filter 
  • trunk/ssphys/SSPhysLib/XML.h

    r123 r124  
    2121{ 
    2222public: 
     23  XMLNode (XMLNode* pParent, std::string name, AttribMap attrib); 
     24 
    2325  template <class T> 
    2426  XMLNode (XMLNode* pParent, std::string name, const T& element) 
    2527    : m_Node (name), m_pParent (pParent) 
    2628  { 
    27     TiXmlText text (boost::lexical_cast<std::string>(element)); 
    28     m_Node.InsertEndChild(text); 
    29   } 
    30  
    31   XMLNode (XMLNode* pParent, std::string name, AttribMap attrib) 
    32     : m_Node (name), m_pParent (pParent) 
    33   { 
    34     AttribMap::iterator itor = attrib.begin (); 
    35     for (; itor != attrib.end (); ++itor) 
    36     { 
    37       m_Node.SetAttribute(itor->first, itor->second); 
    38     } 
     29    SetText (boost::lexical_cast<std::string>(element)); 
    3930  } 
    4031 
     
    4334    : m_Node (name), m_pParent (pParent) 
    4435  { 
    45     AttribMap::iterator itor = attrib.begin (); 
    46     for (; itor != attrib.end (); ++itor) 
    47     { 
    48       m_Node.SetAttribute(itor->first, itor->second); 
    49     } 
    50     TiXmlText text (boost::lexical_cast<std::string>(element)); 
    51     m_Node.InsertEndChild(text); 
     36    SetAttributes (attrib); 
     37    SetText (boost::lexical_cast<std::string>(element)); 
    5238  } 
    5339 
    54   int AddChild (XMLNode* pChild) 
    55   { 
    56     m_Node.InsertEndChild(pChild->m_Node); 
    57     return 0; 
    58   } 
     40  ~XMLNode (); 
    5941 
     42  void AddChild (XMLNode* pChild); 
    6043  void AddText (XMLText* pContent); 
    6144 
    62   ~XMLNode () 
    63   { 
    64     if (m_pParent)  
    65       m_pParent->AddChild (this); 
    66   } 
     45  void SetAttributes (AttribMap attrib); 
     46  void SetText (std::string text); 
    6747 
    6848public: 
     
    9575    : m_Text (""), m_pParent (pParent) 
    9676  { 
    97     m_Text.SetValue (boost::lexical_cast<std::string>(element)); 
     77    SetValue (boost::lexical_cast<std::string>(element)); 
    9878  } 
    99   ~XMLText () 
    100   { 
    101     if (m_pParent) 
    102       m_pParent->AddText(this); 
    103   } 
     79 
     80  ~XMLText (); 
     81 
     82  void SetValue (std::string value); 
     83 
    10484public: 
    10585  XMLNode* m_pParent; 
     
    10787}; 
    10888 
    109  
    110 inline void XMLNode::AddText (XMLText* pContent) 
    111 { 
    112     m_Node.InsertEndChild(pContent->m_Text); 
    113 } 
    114  
    11589#endif // !defined(AFX_XML_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_) 
  • trunk/ssphys/utils/tinyxml.cpp

    r121 r124  
    9696                        outString->append( entity[4].str, entity[4].strLength ); 
    9797                        ++i; 
    98                 } 
    99                 else if ( c < 32 ) 
     98    } 
     99    else if ( c == 0x0d && ( (int)str.length() - 1 ) 
     100                         && str[i+1] == 0x0a) 
     101    { 
     102      // insert \n 
     103                        *outString += '\n'; 
     104                        ++i; 
     105      ++i; 
     106    } 
     107    else if (isspace (c)) 
     108    { 
     109      // pass through unchagend 
     110                        *outString += (char) c; // somewhat more efficient function call. 
     111                        ++i; 
     112    } 
     113                else if (iscntrl (c)) // ( c < 32) 
    100114                { 
    101115                        // Easy pass at non-alpha/numeric/symbol 
     
    114128                        ++i; 
    115129                } 
    116                 else 
     130                else if (isprint (c)) 
    117131                { 
    118132                        //char realc = (char) c; 

PumaCode.org recommends CVSDude for fast, professional Subversion and Trac hosting:

CVSDude.com

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