| | 1 | = XML notes = |
| | 2 | |
| | 3 | BOINC originally used a line-oriented parser with primitives like |
| | 4 | {{{ |
| | 5 | parse_str(tag, buf, len); |
| | 6 | }}} |
| | 7 | This is not a general XML parser; |
| | 8 | it's able to parse only the XML generated by BOINC itself. |
| | 9 | For example, it can parse |
| | 10 | {{{ |
| | 11 | <file> |
| | 12 | <url>http://foo.bar</url> |
| | 13 | </fil> |
| | 14 | }}} |
| | 15 | but not |
| | 16 | {{{ |
| | 17 | <file><url>http://foo.bar</url></file> |
| | 18 | }}} |
| | 19 | or |
| | 20 | {{{ |
| | 21 | <file> |
| | 22 | <url> |
| | 23 | http://foo.bar |
| | 24 | </url> |
| | 25 | </file> |
| | 26 | }}} |
| | 27 | |
| | 28 | More recently, we added a better parser (class XML_PARSER). |
| | 29 | However, much of the code still uses the old parser. |
| | 30 | |
| | 31 | == XML encoding == |
| | 32 | |
| | 33 | Both of the parsers decode XML entities when parsing strings. |
| | 34 | |
| | 35 | The functions that generate XML don't generally encode XML entities in strings. |
| | 36 | Most strings are generated by BOINC itself and will never contain special characters. |
| | 37 | The following fields may contain special characters, |
| | 38 | and are XML-encoded by the functions that generate XML: |
| | 39 | |
| | 40 | {{{ |
| | 41 | client: |
| | 42 | PROJECT::user_name, team_name |
| | 43 | FILE_INFO::url |
| | 44 | APP_INIT_DATA::user_name, team_name |
| | 45 | PROXY_INFO::http_user_name, http_user_passwd, socks5_user_name, socks5_passwd |
| | 46 | HOST_INFO::p_vendor, p_model, os_name, os_version, serialnum |
| | 47 | |
| | 48 | server (db_dump and db_purge): |
| | 49 | USER::name, url |
| | 50 | TEAM::name, url, name_hteml, description |
| | 51 | RESULT::stderr_out |
| | 52 | }}} |
| | 53 | |
| | 54 | In addition, the RESULT::stderr_out (client) is enclosed in <![CDATA[ ...]]> |