diff options
Diffstat (limited to '')
| -rw-r--r-- | src/xmlreader.h | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/xmlreader.h b/src/xmlreader.h index 19791c4..708a386 100644 --- a/src/xmlreader.h +++ b/src/xmlreader.h | |||
| @@ -9,7 +9,24 @@ | |||
| 9 | namespace Bu | 9 | namespace Bu |
| 10 | { | 10 | { |
| 11 | /** | 11 | /** |
| 12 | * An Xml 1.1 reader. I've decided to write this, this time, based on the | ||
| 13 | * official W3C reccomendation, now included with the source code. I've | ||
| 14 | * named the productions in the parser states the same as in that document, | ||
| 15 | * which may make them easier to find, etc, although possibly slightly less | ||
| 16 | * optimized than writing my own reduced grammer. | ||
| 12 | * | 17 | * |
| 18 | * Below I will list differences between my parser and the official standard | ||
| 19 | * as I come up with them. | ||
| 20 | * - Encoding and Standalone headings are ignored for the moment. (4.3.3, | ||
| 21 | * 2.9) | ||
| 22 | * - The standalone heading attribute can have any standard whitespace | ||
| 23 | * before it (the specs say only spaces, no newlines). (2.9) | ||
| 24 | * - Since standalone is ignored, it is currently allowed to have any | ||
| 25 | * value (should be restricted to "yes" or "no"). (2.9) | ||
| 26 | * - Currently only UTF-8 / ascii are parsed. | ||
| 27 | * - [optional] The content of comments is thrown away. (2.5) | ||
| 28 | * - The content of processing instruction blocks is parsed properly, but | ||
| 29 | * thrown away. (2.6) | ||
| 13 | */ | 30 | */ |
| 14 | class XmlReader | 31 | class XmlReader |
| 15 | { | 32 | { |
| @@ -40,11 +57,21 @@ namespace Bu | |||
| 40 | void XMLDecl(); | 57 | void XMLDecl(); |
| 41 | 58 | ||
| 42 | /** | 59 | /** |
| 43 | * Misc things...? | 60 | * Misc things, Includes Comments and PIData (Processing Instructions). |
| 44 | */ | 61 | */ |
| 45 | void Misc(); | 62 | void Misc(); |
| 46 | 63 | ||
| 47 | /** | 64 | /** |
| 65 | * Comments | ||
| 66 | */ | ||
| 67 | void Comment(); | ||
| 68 | |||
| 69 | /** | ||
| 70 | * Processing Instructions | ||
| 71 | */ | ||
| 72 | void PI(); | ||
| 73 | |||
| 74 | /** | ||
| 48 | * Whitespace eater. | 75 | * Whitespace eater. |
| 49 | */ | 76 | */ |
| 50 | void S(); | 77 | void S(); |
| @@ -64,6 +91,30 @@ namespace Bu | |||
| 64 | */ | 91 | */ |
| 65 | void Eq(); | 92 | void Eq(); |
| 66 | 93 | ||
| 94 | /** | ||
| 95 | * Read in an attribute value. | ||
| 96 | */ | ||
| 97 | FString AttValue(); | ||
| 98 | |||
| 99 | /** | ||
| 100 | * Read in the name of something. | ||
| 101 | */ | ||
| 102 | FString Name(); | ||
| 103 | |||
| 104 | /** | ||
| 105 | * Encoding decleration in the header | ||
| 106 | */ | ||
| 107 | void EncodingDecl(); | ||
| 108 | |||
| 109 | /** | ||
| 110 | * Standalone decleration in the header | ||
| 111 | */ | ||
| 112 | void SDDecl(); | ||
| 113 | |||
| 114 | bool isS( unsigned char c ) | ||
| 115 | { | ||
| 116 | return ( c == 0x20 || c == 0x9 || c == 0xD || c == 0xA ); | ||
| 117 | } | ||
| 67 | }; | 118 | }; |
| 68 | } | 119 | } |
| 69 | 120 | ||
