Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/beevik/etree
/ functions
Functions
270 in github.com/beevik/etree
⨍
Functions
270
◇
Types & classes
46
↓ 37 callers
Function
NewDocument
NewDocument creates an XML document without a root element.
etree.go:299
↓ 25 callers
Function
checkStrEq
(t *testing.T, got, want string)
etree_test.go:35
↓ 23 callers
Method
Error
Error returns the string describing a path error.
path.go:99
↓ 23 callers
Method
WriteToString
WriteToString serializes this document into a string.
etree.go:476
↓ 19 callers
Method
CreateElement
CreateElement creates a new element with the specified tag (i.e., name) and adds it as the last child of element 'e'. The tag may include a prefix fol
etree.go:764
↓ 17 callers
Method
ReadFromString
ReadFromString reads XML from the string 's' into this document.
etree.go:401
↓ 14 callers
Function
newDocumentFromString
(t *testing.T, s string)
etree_test.go:20
↓ 12 callers
Function
spaceDecompose
spaceDecompose breaks a namespace:tag identifier at the ':' and returns the two parts.
helpers.go:262
↓ 11 callers
Method
Index
()
etree.go:216
↓ 11 callers
Method
Text
Text returns all character data immediately following the element's opening tag.
etree.go:633
↓ 10 callers
Method
Indent
Indent modifies the document's element tree by inserting character data tokens containing newlines and spaces for indentation. The amount of indentati
etree.go:488
↓ 10 callers
Method
Root
Root returns the root element of the document. It returns nil if there is no root element.
etree.go:325
↓ 10 callers
Method
SelectElement
SelectElement returns the first child element with the given 'tag' (i.e., name). The function returns nil if no child element matching the tag is foun
etree.go:1056
↓ 9 callers
Method
FindElement
FindElement returns the first element matched by the XPath-like 'path' string. The function returns nil if no child element is found using the path. I
etree.go:1088
↓ 9 callers
Method
SetText
SetText replaces all character data immediately following an element's opening tag with the requested string.
etree.go:657
↓ 8 callers
Method
CreateAttr
CreateAttr creates an attribute with the specified 'key' and 'value' and adds it to this element. If an attribute with same key already exists on this
etree.go:1438
↓ 8 callers
Method
addChild
addChild adds a child token to the element e.
etree.go:1428
↓ 8 callers
Function
newCharData
newCharData creates a character data token and binds it to a parent element. If parent is nil, the CharData token remains unbound.
etree.go:1563
↓ 8 callers
Method
setIndex
(index int)
etree.go:220
↓ 8 callers
Function
spaceMatch
spaceMatch returns true if namespace a is the empty string or if namespace a equals namespace b.
helpers.go:251
↓ 7 callers
Method
RemoveChildAt
RemoveChildAt removes the child token appearing in slot 'index' of this element's list of child tokens. The removed child token is then returned. If t
etree.go:871
↓ 6 callers
Method
CreateCData
CreateCData creates a CharData token containing a CDATA section with 'data' as its content and adds it to the end of this element's list of child toke
etree.go:1585
↓ 6 callers
Method
CreateComment
CreateComment creates a comment token using the specified 'comment' string and adds it as the last child token of this element.
etree.go:1693
↓ 6 callers
Method
CreateProcInst
CreateProcInst creates an XML processing instruction token with the specified 'target' and instruction 'inst'. It is then added as the last child toke
etree.go:1824
↓ 6 callers
Method
FindElements
FindElements returns a slice of elements matched by the XPath-like 'path' string. The function returns nil if no child element is found using the path
etree.go:1104
↓ 6 callers
Method
IndentWithSettings
IndentWithSettings modifies the document's element tree by inserting character data tokens containing newlines and indentation. The behavior of the in
etree.go:507
↓ 6 callers
Function
NewIndentSettings
NewIndentSettings creates a default IndentSettings record.
etree.go:173
↓ 6 callers
Method
Parent
()
etree.go:215
↓ 6 callers
Function
newDocumentFromString2
(t *testing.T, s string, settings ReadSettings)
etree_test.go:24
↓ 5 callers
Method
setParent
(parent *Element)
etree.go:219
↓ 4 callers
Method
AddChild
AddChild adds the token 't' as the last child of the element. If token 't' was already the child of another element, it is first removed from its pare
etree.go:793
↓ 4 callers
Function
NewElement
NewElement creates an unparented element with the specified tag (i.e., name). The tag may include a namespace prefix followed by a colon.
etree.go:532
↓ 4 callers
Method
RemoveChild
RemoveChild attempts to remove the token 't' from this element's list of child tokens. If the token 't' was a child of this element, then it is remove
etree.go:861
↓ 4 callers
Method
WriteTo
(w Writer, s *WriteSettings)
etree.go:217
↓ 4 callers
Function
checkIntEq
(t *testing.T, got, want int)
etree_test.go:49
↓ 4 callers
Function
checkTokenIsolation
checkTokenIsolation re-reads the XML string 's', which is expected to contain a lone root element 't' holding a single token. It confirms that the tok
etree_test.go:829
↓ 4 callers
Method
len
()
helpers.go:62
↓ 3 callers
Method
ChildElements
ChildElements returns all elements that are children of this element.
etree.go:1035
↓ 3 callers
Method
CreateCharData
CreateCharData creates a CharData token containing simple text data and adds it to the end of this element's list of child tokens. Deprecated: Create
etree.go:1594
↓ 3 callers
Method
CreateDirective
CreateDirective creates an XML directive token with the specified 'data' value and adds it as the last child token of this element.
etree.go:1757
↓ 3 callers
Method
CreateText
CreateText creates a CharData token containing simple text data and adds it to the end of this element's list of child tokens.
etree.go:1578
↓ 3 callers
Method
FindElementsPathSeq
FindElementsPathSeq returns an iterator over elements matched by the 'path' object.
etree.go:1123
↓ 3 callers
Method
IndentTabs
IndentTabs modifies the document's element tree by inserting CharData tokens containing newlines and tabs for indentation. One tab is used per indenta
etree.go:498
↓ 3 callers
Method
Index
Index returns the index of this element within its parent element's list of child tokens. If this element has no parent, then the function returns -1.
etree.go:1386
↓ 3 callers
Method
InsertChildAt
InsertChildAt inserts the token 't' into this element's list of child tokens just before the requested 'index'. If the index is greater than or equal
etree.go:834
↓ 3 callers
Method
IsWhitespace
IsWhitespace returns true if this CharData token contains only whitespace.
etree.go:1618
↓ 3 callers
Function
MustCompilePath
MustCompilePath creates an optimized version of an XPath-like string that can be used to query elements in an element tree. Panics if an error occurs
path.go:118
↓ 3 callers
Method
Parent
Parent returns this element's parent element. It returns nil if this element has no parent.
etree.go:1379
↓ 3 callers
Method
Read
(p []byte)
helpers.go:89
↓ 3 callers
Method
ReadFromBytes
ReadFromBytes reads XML from the byte slice 'b' into the this document.
etree.go:390
↓ 3 callers
Method
SelectElementsSeq
SelectElementsSeq returns an iterator over all child elements with the given 'tag' (i.e., name). The tag may include a namespace prefix followed by a
etree.go:1072
↓ 3 callers
Method
WriteTo
WriteTo serializes the document out to the writer 'w'. The function returns the number of bytes written and any error encountered.
etree.go:445
↓ 3 callers
Method
add
(value E)
helpers.go:42
↓ 3 callers
Function
checkIndexes
(t *testing.T, e *Element)
etree_test.go:82
↓ 3 callers
Function
escapeString
escapeString writes an escaped version of a string to the writer.
helpers.go:332
↓ 3 callers
Function
newComment
NewComment creates a comment token and sets its parent element to 'parent'.
etree.go:1679
↓ 3 callers
Function
newDirective
newDirective creates an XML directive and binds it to a parent element. If parent is nil, the Directive remains unbound.
etree.go:1743
↓ 3 callers
Function
newElement
newElement is a helper function that creates an element and binds it to a parent element if possible.
etree.go:539
↓ 3 callers
Function
newProcInst
newProcInst creates an XML processing instruction and binds it to a parent element. If parent is nil, the ProcInst remains unbound.
etree.go:1808
↓ 3 callers
Method
readFrom
ReadFrom reads XML from the reader 'ri' and stores the result as a new child of this element.
etree.go:909
↓ 3 callers
Method
replaceText
replaceText is a helper function that replaces a series of chardata tokens starting at index i with the requested text.
etree.go:705
↓ 3 callers
Method
updatePeekBuf
()
helpers.go:197
↓ 3 callers
Function
validateXML
validateXML determines if the data read from the reader 'r' contains well-formed XML according to the rules set by the go xml package.
etree.go:413
↓ 2 callers
Method
Bytes
()
helpers.go:88
↓ 2 callers
Function
CompilePath
CompilePath creates an optimized version of an XPath-like string that can be used to query elements in an element tree.
path.go:105
↓ 2 callers
Method
Copy
Copy creates a recursive, deep copy of the element and all its attributes and children. The returned element has no parent but can be parented to a an
etree.go:558
↓ 2 callers
Method
FindElementPath
FindElementPath returns the first element matched by the 'path' object. The function returns nil if no element is found using the path.
etree.go:1094
↓ 2 callers
Method
FindElementsPath
FindElementsPath returns a slice of elements matched by the 'path' object.
etree.go:1117
↓ 2 callers
Method
FindElementsSeq
FindElementsSeq returns an iterator over elements matched by the XPath-like 'path' string. This function uses Go's iterator support for memory-efficie
etree.go:1112
↓ 2 callers
Method
FullTag
FullTag returns the element e's complete tag, including namespace prefix if present.
etree.go:564
↓ 2 callers
Method
NamespaceURI
NamespaceURI returns the XML namespace URI associated with this attribute. The function returns the empty string if the attribute is unprefixed or if
etree.go:1512
↓ 2 callers
Method
ReadFrom
ReadFrom reads XML from the reader 'r' into this document. The function returns the number of bytes read and any error encountered.
etree.go:362
↓ 2 callers
Method
ReadFromFile
ReadFromFile reads XML from a local file at path 'filepath' into this document.
etree.go:378
↓ 2 callers
Method
RemoveAttr
RemoveAttr removes the first attribute of this element whose key matches 'key'. It returns a copy of the removed attribute if a match is found. If no
etree.go:1469
↓ 2 callers
Method
SelectAttrValue
SelectAttrValue finds an element attribute matching the requested 'key' and returns its value if found. If no matching attribute is found, the functio
etree.go:1024
↓ 2 callers
Method
SelectElements
SelectElements returns a slice of all child elements with the given 'tag' (i.e., name). The tag may include a namespace prefix followed by a colon.
etree.go:1065
↓ 2 callers
Method
SetCData
SetCData replaces all character data immediately following an element's opening tag with a CDATA section.
etree.go:663
↓ 2 callers
Method
SetRoot
SetRoot replaces the document's root element with the element 'e'. If the document already has a root element when this function is called, then the e
etree.go:338
↓ 2 callers
Method
Unindent
Unindent modifies the document's element tree by removing character data tokens containing only whitespace. Other than the removal of indentation, def
etree.go:524
↓ 2 callers
Method
Write
(p []byte)
helpers.go:232
↓ 2 callers
Method
addAttr
addAttr is a helper function that adds an attribute to an element. Returns the index of the added attribute.
etree.go:1454
↓ 2 callers
Method
apply
(p *pather)
path.go:163
↓ 2 callers
Function
checkDocEq
(t *testing.T, doc *Document, expected string)
etree_test.go:70
↓ 2 callers
Method
dup
(parent *Element)
etree.go:218
↓ 2 callers
Method
empty
()
helpers.go:17
↓ 2 callers
Method
findLocalNamespaceURI
findLocalNamespaceURI finds the namespace URI corresponding to the requested prefix.
etree.go:583
↓ 2 callers
Function
getIndentFunc
(s *IndentSettings)
etree.go:185
↓ 2 callers
Method
indent
indent recursively inserts proper indentation between an XML element's child tokens.
etree.go:1247
↓ 2 callers
Function
isWhitespace
isWhitespace returns true if the byte slice contains only whitespace characters.
helpers.go:240
↓ 2 callers
Function
newDecoder
newDecoder creates an XML decoder for the reader 'r' configured using the provided read settings.
etree.go:431
↓ 2 callers
Method
peek
()
helpers.go:33
↓ 2 callers
Method
pop
()
helpers.go:25
↓ 2 callers
Method
remove
()
helpers.go:52
↓ 2 callers
Method
traverse
traverse follows the path from the element e, yielding elements that match the path's selectors and filters using iterators.
path.go:128
↓ 1 callers
Method
ChildElementsSeq
ChildElementsSeq returns an iterator over all child elements of this element.
etree.go:1041
↓ 1 callers
Method
CreateChild
CreateChild performs the same task as CreateElement but calls a continuation function after the child element is created, allowing additional actions
etree.go:784
↓ 1 callers
Method
Element
Element returns a pointer to the element containing this attribute.
etree.go:1505
↓ 1 callers
Method
FullKey
FullKey returns this attribute's complete key, including namespace prefix if present.
etree.go:1497
↓ 1 callers
Method
GetPath
GetPath returns the absolute path of the element. The absolute path is the full path from the document's root.
etree.go:1148
↓ 1 callers
Method
GetRelativePath
GetRelativePath returns the path of this element relative to the 'source' element. If the two elements are not part of the same element tree, then the
etree.go:1167
next →
1–100 of 270, ranked by callers