初始化项目
This commit is contained in:
25
trunk/goutil/xmlUtil/gxpath/xpath/node.go
Normal file
25
trunk/goutil/xmlUtil/gxpath/xpath/node.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package xpath
|
||||
|
||||
// A Node is an element node that can navigating to
|
||||
// an node attribute and another node.
|
||||
//type Node interface{}
|
||||
|
||||
// A type of XPath node.
|
||||
type NodeType int
|
||||
|
||||
const (
|
||||
// A root node of the XML document or node tree.
|
||||
RootNode NodeType = iota
|
||||
|
||||
// An element, such as <element>.
|
||||
ElementNode
|
||||
|
||||
// An attribute, such as id='123'.
|
||||
AttributeNode
|
||||
|
||||
// The text content of a node.
|
||||
TextNode
|
||||
|
||||
// A comment node, such as <!-- my comment -->
|
||||
CommentNode
|
||||
)
|
||||
43
trunk/goutil/xmlUtil/gxpath/xpath/xpath.go
Normal file
43
trunk/goutil/xmlUtil/gxpath/xpath/xpath.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package xpath
|
||||
|
||||
// NodeNavigator provides cursor model for navigating XML data.
|
||||
type NodeNavigator interface {
|
||||
// NodeType returns the XPathNodeType of the current node.
|
||||
NodeType() NodeType
|
||||
|
||||
// LocalName gets the Name of the current node.
|
||||
LocalName() string
|
||||
|
||||
// Prefix returns namespace prefix associated with the current node.
|
||||
Prefix() string
|
||||
|
||||
// Value gets the value of current node.
|
||||
Value() string
|
||||
|
||||
// Copy does a deep copy of the NodeNavigator and all its components.
|
||||
Copy() NodeNavigator
|
||||
|
||||
// MoveToRoot moves the NodeNavigator to the root node of the current node.
|
||||
MoveToRoot()
|
||||
|
||||
// MoveToParent moves the NodeNavigator to the parent node of the current node.
|
||||
MoveToParent() bool
|
||||
|
||||
// MoveToNextAttribute moves the NodeNavigator to the next attribute on current node.
|
||||
MoveToNextAttribute() bool
|
||||
|
||||
// MoveToChild moves the NodeNavigator to the first child node of the current node.
|
||||
MoveToChild() bool
|
||||
|
||||
// MoveToFirst moves the NodeNavigator to the first sibling node of the current node.
|
||||
MoveToFirst() bool
|
||||
|
||||
// MoveToNext moves the NodeNavigator to the next sibling node of the current node.
|
||||
MoveToNext() bool
|
||||
|
||||
// MoveToPrevious moves the NodeNavigator to the previous sibling node of the current node.
|
||||
MoveToPrevious() bool
|
||||
|
||||
// MoveTo moves the NodeNavigator to the same position as the specified NodeNavigator.
|
||||
MoveTo(NodeNavigator) bool
|
||||
}
|
||||
Reference in New Issue
Block a user