func NewNode(nodePtr unsafe.Pointer, document Document) (node Node) { if nodePtr == nil { return nil } xmlNode := &XmlNode{ Ptr: (*C.xmlNode)(nodePtr), Document: document, valid: true, } nodeType := NodeType(C.getNodeType((*C.xmlNode)(nodePtr))) switch nodeType { default: node = xmlNode case XML_ATTRIBUTE_NODE: node = &AttributeNode{XmlNode: xmlNode} case XML_ELEMENT_NODE: node = &ElementNode{XmlNode: xmlNode} case XML_CDATA_SECTION_NODE: node = &CDataNode{XmlNode: xmlNode} case XML_COMMENT_NODE: node = &CommentNode{XmlNode: xmlNode} case XML_PI_NODE: node = &ProcessingInstructionNode{XmlNode: xmlNode} case XML_TEXT_NODE: node = &TextNode{XmlNode: xmlNode} } return }
func (xmlNode *XmlNode) NodeType() (nodeType NodeType) { nodeType = NodeType(C.getNodeType(xmlNode.Ptr)) return }
func (xmlNode *XmlNode) NodeType() (nodeType int) { nodeType = int(C.getNodeType(xmlNode.Ptr)) return }