| 1 | Release 1.7.1 |
| 2 | ============= |
| 3 | |
| 4 | **Changes** |
| 5 | |
| 6 | * Improve efficiency of `Element.Text` and `Element.Tail`. |
| 7 | |
| 8 | Release 1.7.0 |
| 9 | ============= |
| 10 | |
| 11 | **Breaking changes** |
| 12 | |
| 13 | * To address a security issue, it was necessary to add a `MaxDepth` option to |
| 14 | `ReadSettings` to limit the depth of XML trees during parsing. A generous |
| 15 | default value of 1024 was chosen to avoid breaking most existing code. |
| 16 | However, if your code is processing XML hierarchies with a depth greater |
| 17 | than 1024, you will need to assign your `Document` a `ReadSettings` that has |
| 18 | a `MaxDepth` set to a higher value. |
| 19 | |
| 20 | **Security Fixes** |
| 21 | |
| 22 | * Limited the depth of XML trees processed by all `ReadFrom` functions during |
| 23 | parsing. |
| 24 | * Fixed a `CompilePath` index-out-of-range panic that could be caused by a |
| 25 | missing path filter key. |
| 26 | * Sanitized the contents of XML text, comment, ProcInst and Directive tokens |
| 27 | provided by the user. |
| 28 | |
| 29 | |
| 30 | Release 1.6.0 |
| 31 | ============= |
| 32 | |
| 33 | **Changes** |
| 34 | |
| 35 | * Added new iterator versions of existing functions that return slices of |
| 36 | `Element` pointers: `ChildElementsSeq`, `SelectElementsSeq`, |
| 37 | `FindElementsSeq`, and `FindElementsPathSeq`. |
| 38 | * Improved performance of functions that return a single element. |
| 39 | * Because of its use of iterators, this package now requires go 1.23 or later. |
| 40 | |
| 41 | Release 1.5.1 |
| 42 | ============= |
| 43 | |
| 44 | **Fixes** |
| 45 | |
| 46 | * Fixed a bug in `InsertChildAt`. |
| 47 | |
| 48 | Release 1.5.0 |
| 49 | ============= |
| 50 | |
| 51 | **Changes** |
| 52 | |
| 53 | * Added `Element` function `CreateChild`, which calls a continuation function |
| 54 | after creating and adding a child element. |
| 55 | |
| 56 | **Fixes** |
| 57 | |
| 58 | * Removed a potential conflict between two `ReadSettings` values. When |
| 59 | `AttrSingleQuote` is true, `CanonicalAttrVal` is forced to be false. |
| 60 | |
| 61 | Release 1.4.1 |
| 62 | ============= |
| 63 | |
| 64 | **Changes** |
| 65 | |
| 66 | * Minimal go version updated to 1.21. |
| 67 | * Default-initialized CharsetReader causes same result as NewDocument(). |
| 68 | * When reading an XML document, attributes are parsed more efficiently. |
| 69 | |
| 70 | Release v1.4.0 |
| 71 | ============== |
| 72 | |
| 73 | **New Features** |
| 74 | |
| 75 | * Add `AutoClose` option to `ReadSettings`. |
| 76 | * Add `ValidateInput` to `ReadSettings`. |
| 77 | * Add `NotNil` function to `Element`. |
| 78 | * Add `NextSibling` and `PrevSibling` functions to `Element`. |
| 79 | |
| 80 | Release v1.3.0 |
| 81 | ============== |
| 82 | |
| 83 | **New Features** |
| 84 | |
| 85 | * Add support for double-quotes in filter path queries. |
| 86 | * Add `PreserveDuplicateAttrs` to `ReadSettings`. |
| 87 | * Add `ReindexChildren` to `Element`. |
| 88 | |
| 89 | Release v1.2.0 |
| 90 | ============== |
| 91 | |
| 92 | **New Features** |
| 93 | |
| 94 | * Add the ability to write XML fragments using Token WriteTo functions. |
| 95 | * Add the ability to re-indent an XML element as though it were the root of |
| 96 | the document. |
| 97 | * Add a ReadSettings option to preserve CDATA blocks when reading and XML |
| 98 | document. |
| 99 | |
| 100 | Release v1.1.4 |
| 101 | ============== |
| 102 | |
| 103 | **New Features** |
| 104 | |
| 105 | * Add the ability to preserve whitespace in leaf elements during indent. |
| 106 | * Add the ability to suppress a document-trailing newline during indent. |
| 107 | * Add choice of XML attribute quoting style (single-quote or double-quote). |
| 108 | |
| 109 | **Removed Features** |
| 110 | |
| 111 | * Removed the CDATA preservation change introduced in v1.1.3. It was |
| 112 | implemented in a way that broke the ability to process XML documents |
| 113 | encoded using non-UTF8 character sets. |
| 114 | |
| 115 | Release v1.1.3 |
| 116 | ============== |
| 117 | |
| 118 | * XML reads now preserve CDATA sections instead of converting them to |
| 119 | standard character data. |
| 120 | |
| 121 | Release v1.1.2 |
| 122 | ============== |
| 123 | |
| 124 | * Fixed a path parsing bug. |
| 125 | * The `Element.Text` function now handles comments embedded between |
| 126 | character data spans. |
| 127 | |
| 128 | Release v1.1.1 |
| 129 | ============== |
| 130 | |
| 131 | * Updated go version in `go.mod` to 1.20 |
| 132 | |
| 133 | Release v1.1.0 |
| 134 | ============== |
| 135 | |
| 136 | **New Features** |
| 137 | |
| 138 | * New attribute helpers. |
| 139 | * Added the `Element.SortAttrs` method, which lexicographically sorts an |
| 140 | element's attributes by key. |
| 141 | * New `ReadSettings` properties. |
| 142 | * Added `Entity` for the support of custom entity maps. |
| 143 | * New `WriteSettings` properties. |
| 144 | * Added `UseCRLF` to allow the output of CR-LF newlines instead of the |
| 145 | default LF newlines. This is useful on Windows systems. |
| 146 | * Additional support for text and CDATA sections. |
| 147 | * The `Element.Text` method now returns the concatenation of all consecutive |
| 148 | character data tokens immediately following an element's opening tag. |
| 149 | * Added `Element.SetCData` to replace the character data immediately |
| 150 | following an element's opening tag with a CDATA section. |
| 151 | * Added `Element.CreateCData` to create and add a CDATA section child |
| 152 | `CharData` token to an element. |
| 153 | * Added `Element.CreateText` to create and add a child text `CharData` token |
| 154 | to an element. |
| 155 | * Added `NewCData` to create a parentless CDATA section `CharData` token. |
| 156 | * Added `NewText` to create a parentless text `CharData` |
| 157 | token. |
| 158 | * Added `CharData.IsCData` to detect if the token contains a CDATA section. |
| 159 | * Added `CharData.IsWhitespace` to detect if the token contains whitespace |
| 160 | inserted by one of the document Indent functions. |
| 161 | * Modified `Element.SetText` so that it replaces a run of consecutive |
| 162 | character data tokens following the element's opening tag (instead of just |
| 163 | the first one). |
| 164 | * New "tail text" support. |
| 165 | * Added the `Element.Tail` method, which returns the text immediately |
| 166 | following an element's closing tag. |
| 167 | * Added the `Element.SetTail` method, which modifies the text immediately |
| 168 | following an element's closing tag. |
| 169 | * New element child insertion and removal methods. |
| 170 | * Added the `Element.InsertChildAt` method, which inserts a new child token |
| 171 | before the specified child token index. |
| 172 | * Added the `Element.RemoveChildAt` method, which removes the child token at |
| 173 | the specified child token index. |
| 174 | * New element and attribute queries. |
| 175 | * Added the `Element.Index` method, which returns the element's index within |
| 176 | its parent element's child token list. |
| 177 | * Added the `Element.NamespaceURI` method to return the namespace URI |
| 178 | associated with an element. |
| 179 | * Added the `Attr.NamespaceURI` method to return the namespace URI |
| 180 | associated with an element. |
| 181 | * Added the `Attr.Element` method to return the element that an attribute |
| 182 | belongs to. |
| 183 | * New Path filter functions. |
| 184 | * Added `[local-name()='val']` to keep elements whose unprefixed tag matches |
| 185 | the desired value. |
| 186 | * Added `[name()='val']` to keep elements whose full tag matches the desired |
| 187 | value. |
| 188 | * Added `[namespace-prefix()='val']` to keep elements whose namespace prefix |
| 189 | matches the desired value. |
| 190 | * Added `[namespace-uri()='val']` to keep elements whose namespace URI |
| 191 | matches the desired value. |
| 192 | |
| 193 | **Bug Fixes** |
| 194 | |
| 195 | * A default XML `CharSetReader` is now used to prevent failed parsing of XML |
| 196 | documents using certain encodings. |
| 197 | ([Issue](https://github.com/beevik/etree/issues/53)). |
| 198 | * All characters are now properly escaped according to XML parsing rules. |
| 199 | ([Issue](https://github.com/beevik/etree/issues/55)). |
| 200 | * The `Document.Indent` and `Document.IndentTabs` functions no longer insert |
| 201 | empty string `CharData` tokens. |
| 202 | |
| 203 | **Deprecated** |
| 204 | |
| 205 | * `Element` |
| 206 | * The `InsertChild` method is deprecated. Use `InsertChildAt` instead. |
| 207 | * The `CreateCharData` method is deprecated. Use `CreateText` instead. |
| 208 | * `CharData` |
| 209 | * The `NewCharData` method is deprecated. Use `NewText` instead. |
| 210 | |
| 211 | |
| 212 | Release v1.0.1 |
| 213 | ============== |
| 214 | |
| 215 | **Changes** |
| 216 | |
| 217 | * Added support for absolute etree Path queries. An absolute path begins with |
| 218 | `/` or `//` and begins its search from the element's document root. |
| 219 | * Added [`GetPath`](https://godoc.org/github.com/beevik/etree#Element.GetPath) |
| 220 | and [`GetRelativePath`](https://godoc.org/github.com/beevik/etree#Element.GetRelativePath) |
| 221 | functions to the [`Element`](https://godoc.org/github.com/beevik/etree#Element) |
| 222 | type. |
| 223 | |
| 224 | **Breaking changes** |
| 225 | |
| 226 | * A path starting with `//` is now interpreted as an absolute path. |
| 227 | Previously, it was interpreted as a relative path starting from the element |
| 228 | whose |
| 229 | [`FindElement`](https://godoc.org/github.com/beevik/etree#Element.FindElement) |
| 230 | method was called. To remain compatible with this release, all paths |
| 231 | prefixed with `//` should be prefixed with `.//` when called from any |
| 232 | element other than the document's root. |
| 233 | * [**edit 2/1/2019**]: Minor releases should not contain breaking changes. |
| 234 | Even though this breaking change was very minor, it was a mistake to include |
| 235 | it in this minor release. In the future, all breaking changes will be |
| 236 | limited to major releases (e.g., version 2.0.0). |
| 237 | |
| 238 | Release v1.0.0 |
| 239 | ============== |
| 240 | |
| 241 | Initial release. |