| 92 | } |
| 93 | |
| 94 | char* processClose(char c, const char* element, char* scan, int32_t argc, const char** argv, |
| 95 | FastXml::Callback* iface, bool& isError) |
| 96 | { |
| 97 | AttributePairs attr(argc, argv); |
| 98 | isError = true; // by default, if we return null it's due to an error. |
| 99 | if(c == '/' || c == '?') |
| 100 | { |
| 101 | char* slash = const_cast<char*>(static_cast<const char*>(strchr(element, c))); |
| 102 | if(slash) |
| 103 | *slash = 0; |
| 104 | |
| 105 | if(c == '?' && strcmp(element, "xml") == 0) |
| 106 | { |
| 107 | if(!iface->processXmlDeclaration(attr, 0, mLineNo)) |
| 108 | return NULL; |
| 109 | } |
| 110 | else |
| 111 | { |
| 112 | if(!iface->processElement(element, 0, attr, mLineNo)) |
| 113 | { |
| 114 | mError = "User aborted the parsing process"; |
| 115 | return NULL; |
| 116 | } |
| 117 | |
| 118 | pushElement(element); |
| 119 | |
| 120 | const char* close = popElement(); |
| 121 | |
| 122 | if(!iface->processClose(close, mStackIndex, isError)) |
| 123 | { |
| 124 | return NULL; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | if(!slash) |
| 129 | ++scan; |
| 130 | } |
| 131 | else |
| 132 | { |
| 133 | scan = skipNextData(scan); |
| 134 | char* data = scan; // this is the data portion of the element, only copies memory if we encounter line feeds |
| 135 | char* dest_data = 0; |
| 136 | while(*scan && *scan != '<') |
| 137 | { |
| 138 | if(getCharType(scan) == CT_END_OF_LINE) |
| 139 | { |
| 140 | if(*scan == '\r') |
| 141 | mLineNo++; |
| 142 | dest_data = scan; |
| 143 | *dest_data++ = ' '; // replace the linefeed with a space... |
| 144 | scan = skipNextData(scan); |
| 145 | while(*scan && *scan != '<') |
| 146 | { |
| 147 | if(getCharType(scan) == CT_END_OF_LINE) |
| 148 | { |
| 149 | if(*scan == '\r') |
| 150 | mLineNo++; |
| 151 | *dest_data++ = ' '; // replace the linefeed with a space... |
nothing calls this directly
no test coverage detected