Documentation
¶
Index ¶
- Constants
- type Attr
- type CharData
- type Name
- type Node
- type NodeSet
- func (p NodeSet) XGo_Any(name string) NodeSet
- func (p NodeSet) XGo_Attr__0(name string) string
- func (p NodeSet) XGo_Attr__1(name string) (val string, err error)
- func (p NodeSet) XGo_Child() NodeSet
- func (p NodeSet) XGo_Elem(name string) NodeSet
- func (p NodeSet) XGo_Enum() iter.Seq[NodeSet]
- func (p NodeSet) XGo_Select(name string) NodeSet
- func (p NodeSet) XGo_all() NodeSet
- func (p NodeSet) XGo_dump() NodeSet
- func (p NodeSet) XGo_first() (*Node, error)
- func (p NodeSet) XGo_hasAttr(name string) bool
- func (p NodeSet) XGo_int() (int, error)
- func (p NodeSet) XGo_ok() bool
- func (p NodeSet) XGo_one() NodeSet
- func (p NodeSet) XGo_single() NodeSet
- func (p NodeSet) XGo_text__0() string
- func (p NodeSet) XGo_text__1() (val string, err error)
Constants ¶
const (
XGoPackage = true
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CharData ¶
A CharData represents XML character data (raw text), in which XML escape sequences have been replaced by the characters they represent.
type Name ¶
A Name represents an XML name (Local) annotated with a name space identifier (Space). In tokens returned by [Decoder.Token], the Space identifier is given as a canonical URL, not the short prefix used in the document being parsed.
type Node ¶
Node represents a generic XML node with its name, attributes, and children.
func (*Node) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Node struct.
func (*Node) XGo_Any ¶
XGo_Any returns a NodeSet containing all descendant nodes (including the node itself) with the specified name. If name is "", it returns all nodes.
- .**.name
- .**.“element-name”
- .**.*
type NodeSet ¶
NodeSet represents a set of XML nodes.
func New ¶
New parses the XML document from the provided reader and returns a NodeSet containing the root node. If there is an error during parsing, the NodeSet's Err field is set.
func NodeSet_Cast ¶
NodeSet(seq) casts a NodeSet from a sequence of nodes.
func Source ¶
Source creates a NodeSet from various types of sources: - string: treated as an URL to read XML content from. - []byte: treated as raw XML content. - io.Reader: reads XML content from the reader. - *Node: creates a NodeSet containing the single provided node. - iter.Seq[*Node]: directly uses the provided sequence of nodes. - NodeSet: returns the provided NodeSet as is. If the source type is unsupported, it panics.
func (NodeSet) XGo_Any ¶
XGo_Any returns a NodeSet containing all descendant nodes (including the nodes themselves) with the specified name. If name is "", it returns all nodes.
- .**.name
- .**.“element-name”
- .**.*
func (NodeSet) XGo_Attr__0 ¶
XGo_Attr returns the value of the specified attribute from the first node in the NodeSet. It only retrieves the attribute from the first node.
- $name
- $“attr-name”
func (NodeSet) XGo_Attr__1 ¶
XGo_Attr returns the value of the specified attribute from the first node in the NodeSet. It only retrieves the attribute from the first node.
- $name
- $“attr-name”
func (NodeSet) XGo_Child ¶
XGo_Child returns a NodeSet containing all child nodes of the nodes in the NodeSet.
func (NodeSet) XGo_Elem ¶
XGo_Elem returns a NodeSet containing the child nodes with the specified name.
- .name
- .“element-name”
func (NodeSet) XGo_Select ¶
XGo_Select returns a NodeSet containing the nodes with the specified name.
- @name
- @"element-name"
func (NodeSet) XGo_all ¶
_all returns a NodeSet containing all nodes. It's a cache operation for performance optimization when you need to traverse the nodes multiple times.
func (NodeSet) XGo_hasAttr ¶
_hasAttr returns true if the first node in the NodeSet has the specified attribute. It returns false otherwise.
func (NodeSet) XGo_int ¶
_int retrieves the integer value from the text content of the first child text node. It only retrieves from the first node in the NodeSet.
func (NodeSet) XGo_one ¶
_one returns a NodeSet containing the first node. It's a performance optimization when you only need the first node (stop early).
func (NodeSet) XGo_single ¶
_single returns a NodeSet containing the single node. If there are zero or more than one nodes, it returns an error. ErrNotFound or ErrMultiEntities is returned accordingly.
func (NodeSet) XGo_text__0 ¶
_text retrieves the text content of the first child xml.CharData. It only retrieves from the first node in the NodeSet.
func (NodeSet) XGo_text__1 ¶
_text retrieves the text content of the first child xml.CharData. It only retrieves from the first node in the NodeSet.