| 907 | } |
| 908 | |
| 909 | void E57XmlParser::characters( const XMLCh *const chars, const XMLSize_t length ) |
| 910 | { |
| 911 | //??? use length to make ustring |
| 912 | #ifdef E57_VERBOSE |
| 913 | std::cout << "characters, chars=\"" << toUString( chars ) << "\" length=" << length << std::endl; |
| 914 | #else |
| 915 | E57_UNUSED( length ); |
| 916 | #endif |
| 917 | |
| 918 | // Get active element |
| 919 | ParseInfo &pi = stack_.top(); |
| 920 | |
| 921 | // Check if child text is allowed for current E57 element type |
| 922 | switch ( pi.nodeType ) |
| 923 | { |
| 924 | case TypeStructure: |
| 925 | case TypeVector: |
| 926 | case TypeCompressedVector: |
| 927 | case TypeBlob: |
| 928 | { |
| 929 | // If characters aren't whitespace, have an error, else ignore |
| 930 | ustring s = toUString( chars ); |
| 931 | if ( s.find_first_not_of( " \t\n\r" ) != std::string::npos ) |
| 932 | { |
| 933 | throw E57_EXCEPTION2( ErrorBadXMLFormat, "chars=" + toUString( chars ) ); |
| 934 | } |
| 935 | } |
| 936 | break; |
| 937 | default: |
| 938 | // Append to any previous characters |
| 939 | pi.childText += toUString( chars ); |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | void E57XmlParser::error( const SAXParseException &ex ) |
| 944 | { |