Documentation ¶
Index ¶
- type Cursor
- func (c *Cursor) BeginElement(name xml.Name)
- func (c *Cursor) ClearBookmark(bookmark interface{})
- func (c *Cursor) ComparePosition(c2 Cursor) int
- func (c *Cursor) CurrentToken() parser.Token
- func (c *Cursor) InsertElement(name xml.Name)
- func (c *Cursor) InsertElementWithText(name xml.Name, text string)
- func (c *Cursor) InsertText(text string)
- func (c *Cursor) IsAtSamePositionAs(c2 Cursor) bool
- func (c *Cursor) IsLeftOf(c2 Cursor) bool
- func (c *Cursor) IsRightOf(c2 Cursor) bool
- func (c *Cursor) NewCursor() Cursor
- func (c *Cursor) Pop()
- func (c *Cursor) Push()
- func (c *Cursor) SetBookmark(bookmark interface{})
- func (c *Cursor) ToEndToken() parser.Token
- func (c *Cursor) ToFirstBookmark(bookmark interface{}) bool
- func (c *Cursor) ToFirstChild() bool
- func (c *Cursor) ToFirstChildByName(name xml.Name) bool
- func (c *Cursor) ToNextBookmark(bookmark interface{}) bool
- func (c *Cursor) ToNextSibling() bool
- func (c *Cursor) ToNextSiblingByName(name xml.Name) bool
- func (c *Cursor) ToNextToken() parser.Token
- func (c *Cursor) ToPreviousToken() parser.Token
- func (c *Cursor) ToStartDoc()
- func (c *Cursor) ToStartToken() parser.Token
- func (c *Cursor) Xml() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor allow to navigate and modify an XML [Document]
func (*Cursor) BeginElement ¶
BeginElement create a start and end token and place the cursor between
func (*Cursor) ClearBookmark ¶
func (c *Cursor) ClearBookmark(bookmark interface{})
ClearBookmark remove a bookmark to current cursor location if already present.
func (*Cursor) ComparePosition ¶
ComparePosition return a negative, null or positive number according to relative positions of c and c2.
- > 0 : c is right of c2
- = 0 : c is at same position than c2
- < 0 : c is left of c2
func (*Cursor) CurrentToken ¶
CurrentToken retrieve current token
func (*Cursor) InsertElement ¶
InsertElement create a start and end token and place the cursor after
func (*Cursor) InsertElementWithText ¶
InsertElementWithText create a start, text end token and place the cursor after
func (*Cursor) InsertText ¶
InsertText create a text token and place the cursor after
func (*Cursor) IsAtSamePositionAs ¶
IsAtSamePositionAs report if c and c2 are at the same position
func (*Cursor) NewCursor ¶
NewCursor create a new cursor from the Cursor at the same position and same document
func (*Cursor) SetBookmark ¶
func (c *Cursor) SetBookmark(bookmark interface{})
SetBookmark add a bookmark to current cursor location if not already present.
func (*Cursor) ToEndToken ¶
ToEndToken move to the end token matching the current start token Return parser.None if the cursor is not on a parser.Start token
func (*Cursor) ToFirstBookmark ¶
ToFirstBookmark move to first bookmark and report if the Cursor moved
func (*Cursor) ToFirstChild ¶
ToFirstChild move to first child and report if the Cursor moved
func (*Cursor) ToFirstChildByName ¶
ToFirstChildByName move to first child with the given name and report if the Cursor moved
func (*Cursor) ToNextBookmark ¶
ToNextBookmark move to next bookmark and report if the Cursor moved Technically, it moves to the first bookmark after the current cursor position.
func (*Cursor) ToNextSibling ¶
ToNextSibling move to next sibling and report if the Cursor moved
func (*Cursor) ToNextSiblingByName ¶
ToNextSiblingByName move to next sibling with the given name and report if the Cursor moved
func (*Cursor) ToNextToken ¶
ToNextToken move to next token and return it
func (*Cursor) ToPreviousToken ¶
ToPreviousToken move to previous token
func (*Cursor) ToStartDoc ¶
func (c *Cursor) ToStartDoc()
ToStartDoc move cursor to start of document, NOT the first start element
func (*Cursor) ToStartToken ¶
ToStartToken move to the start token, works anywhere between tokens