Releases: beevik/etree
Releases · beevik/etree
Release v1.6.0
Changes
- Added new iterator versions of existing functions that return slices of
Elementpointers:ChildElementsSeq,SelectElementsSeq,FindElementsSeq, andFindElementsPathSeq. - Improved performance of functions that return a single element.
- Because of its use of iterators, this package now requires go 1.23 or later.
Release v1.5.1
Fixes
- Fixed a bug in InsertChildAt.
Release v1.5.0
Changes
- Added
ElementfunctionCreateChild, which calls a continuation function
after creating and adding a child element.
Fixes
- Removed a potential conflict between two
ReadSettingsvalues. When
AttrSingleQuoteis true,CanonicalAttrValis forced to be false.
Release v1.4.1
Updates
- Minimal go version updated to 1.21.
- Default-initialized CharsetReader causes same result as NewDocument().
- When reading an XML document, attributes are parsed more efficiently.
Release v1.4.0
New Features
- Add
AutoCloseoption toReadSettings. - Add
ValidateInputtoReadSettings. - Add
NotNilfunction toElement. - Add
NextSiblingandPrevSiblingfunctions toElement.
Release v1.3.0
New Features
- Add support for double-quotes in filter path queries.
- Add
PreserveDuplicateAttrstoReadSettings. - Add
ReindexChildrentoElement.
Full Changelog: v1.2.0...v1.3.0
Release v1.2.0
New Features
- Add the ability to write XML fragments using Token WriteTo functions.
- Add the ability to re-indent an XML element as though it were the root of the document.
- Add a ReadSettings option to preserve CDATA blocks when reading an XML document.
Release v1.1.4
New Features
- Add the ability to preserve whitespace in leaf elements during indent.
- Add the ability to suppress a document-trailing newline during indent.
- Add choice of XML attribute quoting style (single-quote or double-quote).
Removed Features
- Removed the CDATA preservation change introduced in v1.1.3. It was implemented in a way that broke the ability to process XML documents encoded using non-UTF8 character sets.
Release v1.1.3
Release v1.1.3
- XML reads now preserve CDATA sections instead of converting them to standard character data.
Release v1.1.2
- Fixed a path parsing bug.
- The
Element.Textfunction now handles comments embedded between character data spans.
Release v1.1.1
- Updated go version in
go.modto 1.20
Release v1.1.0
New Features
- New attribute helpers.
- Added the
Element.SortAttrsmethod, which lexicographically sorts an element's attributes by key.
- Added the
- New
ReadSettingsproperties.- Added
Entityfor the support of custom entity maps.
- Added
- New
WriteSettingsproperties.- Added
UseCRLFto allow the output of CR-LF newlines instead of the default LF newlines. This is useful on Windows systems.
- Added
- Additional support for text and CDATA sections.
- The
Element.Textmethod now returns the concatenation of all consecutive character data tokens immediately following an element's opening tag. - Added
Element.SetCDatato replace the character data immediately following an element's opening tag with a CDATA section. - Added
Element.CreateCDatato create and add a CDATA section childCharDatatoken to an element. - Added
Element.CreateTextto create and add a child textCharDatatoken to an element. - Added
NewCDatato create a parentless CDATA sectionCharDatatoken. - Added
NewTextto create a parentless textCharDatatoken. - Added
CharData.IsCDatato detect if the token contains a CDATA section. - Added
CharData.IsWhitespaceto detect if the token contains whitespace inserted by one of the document Indent functions. - Modified
Element.SetTextso that it replaces a run of consecutive character data tokens following the element's opening tag (instead of just the first one).
- The
- New "tail text" support.
- Added the
Element.Tailmethod, which returns the text immediately following an element's closing tag. - Added the
Element.SetTailmethod, which modifies the text immediately following an element's closing tag.
- Added the
- New element child insertion and removal methods.
- Added the
Element.InsertChildAtmethod, which inserts a new child token before the specified child token index. - Added the
Element.RemoveChildAtmethod, which removes the child token at the specified child token index.
- Added the
- New element and attribute queries.
- Added the
Element.Indexmethod, which returns the element's index within its parent element's child token list. - Added the
Element.NamespaceURImethod to return the namespace URI associated with an element. - Added the
Attr.NamespaceURImethod to return the namespace URI associated with an element. - Added the
Attr.Elementmethod to return the element that an attribute belongs to.
- Added the
- New Path filter functions.
- Added
[local-name()='val']to keep elements whose unprefixed tag matches the desired value. - Added
[name()='val']to keep elements whose full tag matches the desired value. - Added
[namespace-prefix()='val']to keep elements whose namespace prefix matches the desired value. - Added
[namespace-uri()='val']to keep elements whose namespace URI matches the desired value.
- Added
Bug Fixes
- A default XML
CharSetReaderis now used to prevent failed parsing of XML documents using certain encodings. (Issue). - All characters are now properly escaped according to XML parsing rules. (Issue).
- The
Document.IndentandDocument.IndentTabsfunctions no longer insert empty stringCharDatatokens.
Deprecated
Element- The
InsertChildmethod is deprecated. UseInsertChildAtinstead. - The
CreateCharDatamethod is deprecated. UseCreateTextinstead.
- The
CharData- The
NewCharDatamethod is deprecated. UseNewTextinstead.
- The