A Decoder represents an XML parser reading a particular input stream. The parser assumes that its input is encoded in UTF-8.
| 146 | // A Decoder represents an XML parser reading a particular input stream. |
| 147 | // The parser assumes that its input is encoded in UTF-8. |
| 148 | type Decoder struct { |
| 149 | // Strict defaults to true, enforcing the requirements |
| 150 | // of the XML specification. |
| 151 | // If set to false, the parser allows input containing common |
| 152 | // mistakes: |
| 153 | // * If an element is missing an end tag, the parser invents |
| 154 | // end tags as necessary to keep the return values from Token |
| 155 | // properly balanced. |
| 156 | // * In attribute values and character data, unknown or malformed |
| 157 | // character entities (sequences beginning with &) are left alone. |
| 158 | // |
| 159 | // Setting: |
| 160 | // |
| 161 | // d.Strict = false |
| 162 | // d.AutoClose = xml.HTMLAutoClose |
| 163 | // d.Entity = xml.HTMLEntity |
| 164 | // |
| 165 | // creates a parser that can handle typical HTML. |
| 166 | // |
| 167 | // Strict mode does not enforce the requirements of the XML name spaces TR. |
| 168 | // In particular it does not reject name space tags using undefined prefixes. |
| 169 | // Such tags are recorded with the unknown prefix as the name space URL. |
| 170 | Strict bool |
| 171 | |
| 172 | // When Strict == false, AutoClose indicates a set of elements to |
| 173 | // consider closed immediately after they are opened, regardless |
| 174 | // of whether an end element is present. |
| 175 | AutoClose []string |
| 176 | |
| 177 | // Entity can be used to map non-standard entity names to string replacements. |
| 178 | // The parser behaves as if these standard mappings are present in the map, |
| 179 | // regardless of the actual map content: |
| 180 | // |
| 181 | // "lt": "<", |
| 182 | // "gt": ">", |
| 183 | // "amp": "&", |
| 184 | // "apos": "'", |
| 185 | // "quot": `"`, |
| 186 | Entity map[string]string |
| 187 | |
| 188 | // CharsetReader, if non-nil, defines a function to generate |
| 189 | // charset-conversion readers, converting from the provided |
| 190 | // non-UTF-8 charset into UTF-8. If CharsetReader is nil or |
| 191 | // returns an error, parsing stops with an error. One of the |
| 192 | // CharsetReader's result values must be non-nil. |
| 193 | CharsetReader func(charset string, input io.Reader) (io.Reader, error) |
| 194 | |
| 195 | // DefaultSpace sets the default name space used for unadorned tags, |
| 196 | // as if the entire XML stream were wrapped in an element containing |
| 197 | // the attribute xmlns="DefaultSpace". |
| 198 | DefaultSpace string |
| 199 | |
| 200 | r io.ByteReader |
| 201 | t TokenReader |
| 202 | buf bytes.Buffer |
| 203 | saved *bytes.Buffer |
| 204 | stk *stack |
| 205 | free *stack |
nothing calls this directly
no outgoing calls
no test coverage detected