Documentation ¶
Overview ¶
Package xpathadapter implements an xpath.NodeNavigator.
We use this library for XPath queries:
github.com/antchfx/xpath
Package xpathadapter implements an adapter to enable antchfx/xpath to access a styled tree, where nodes are of type styledtree.Node (the latter is the default implementation for a styled tree). For a possible usage of this package, refer to package dom (type dom.XPath).
For a description of the various methods of interface xpath.NodeNavigator please refer to the documentation of antchfx/xpath. It is not replicated here.
BSD License ¶
Copyright (c) 2017–18, Norbert Pillmayer ¶
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of Norbert Pillmayer nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
- func CurrentNode(nav xpath.NodeNavigator) (*tree.Node, error)
- func T() tracing.Trace
- type NodeNavigator
- func (nav *NodeNavigator) Copy() xpath.NodeNavigator
- func (nav *NodeNavigator) LocalName() string
- func (nav *NodeNavigator) MoveTo(other xpath.NodeNavigator) bool
- func (nav *NodeNavigator) MoveToChild() bool
- func (nav *NodeNavigator) MoveToFirst() bool
- func (nav *NodeNavigator) MoveToNext() bool
- func (nav *NodeNavigator) MoveToNextAttribute() bool
- func (nav *NodeNavigator) MoveToParent() bool
- func (nav *NodeNavigator) MoveToPrevious() bool
- func (nav *NodeNavigator) MoveToRoot()
- func (nav *NodeNavigator) NodeType() xpath.NodeType
- func (*NodeNavigator) Prefix() string
- func (nav *NodeNavigator) String() string
- func (nav *NodeNavigator) Value() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentNode ¶
func CurrentNode(nav xpath.NodeNavigator) (*tree.Node, error)
CurrentNode implements dom.NodeExtractorFunc
Types ¶
type NodeNavigator ¶
type NodeNavigator struct {
// contains filtered or unexported fields
}
func NewNavigator ¶
func NewNavigator(node *styledtree.StyNode) *NodeNavigator
NewNavigator creates a new xpath.NodeNavigator for a styled tree.
func (*NodeNavigator) Copy ¶
func (nav *NodeNavigator) Copy() xpath.NodeNavigator
func (*NodeNavigator) LocalName ¶
func (nav *NodeNavigator) LocalName() string
func (*NodeNavigator) MoveTo ¶
func (nav *NodeNavigator) MoveTo(other xpath.NodeNavigator) bool
func (*NodeNavigator) MoveToChild ¶
func (nav *NodeNavigator) MoveToChild() bool
func (*NodeNavigator) MoveToFirst ¶
func (nav *NodeNavigator) MoveToFirst() bool
func (*NodeNavigator) MoveToNext ¶
func (nav *NodeNavigator) MoveToNext() bool
func (*NodeNavigator) MoveToNextAttribute ¶
func (nav *NodeNavigator) MoveToNextAttribute() bool
func (*NodeNavigator) MoveToParent ¶
func (nav *NodeNavigator) MoveToParent() bool
func (*NodeNavigator) MoveToPrevious ¶
func (nav *NodeNavigator) MoveToPrevious() bool
func (*NodeNavigator) MoveToRoot ¶
func (nav *NodeNavigator) MoveToRoot()
func (*NodeNavigator) NodeType ¶
func (nav *NodeNavigator) NodeType() xpath.NodeType
func (*NodeNavigator) Prefix ¶
func (*NodeNavigator) Prefix() string
func (*NodeNavigator) String ¶
func (nav *NodeNavigator) String() string
func (*NodeNavigator) Value ¶
func (nav *NodeNavigator) Value() string