public XmlNode FindNode(string name) { unsafe { if (CoreObject.Pointer == IntPtr.Zero) { return(null); } var node = XmlSDK.RapidXmlNodeA_first_node(CoreObject, name); while (node.Pointer != IntPtr.Zero) { int pNeedFreeStr = 0; var strPtr = XmlSDK.RapidXmlNodeA_name(node, ref pNeedFreeStr); var nodeName = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(strPtr); if (pNeedFreeStr == 1) { XmlSDK.RapidXmlNodeA_FreeString(strPtr); } if (name == nodeName) { var nd = new XmlNode(node); nd.mHolder = mHolder; return(nd); } node = XmlSDK.RapidXmlNodeA_next_sibling(node); } return(null); } }
public List <XmlNode> FindNodes(string name, FNodeFinderCondition condition = null) { unsafe { List <XmlNode> nodeList = new List <XmlNode>(); if (mCoreObject.Pointer == IntPtr.Zero) { return(nodeList); } XmlNode.NativePointer node = XmlSDK.RapidXmlNodeA_first_node(mCoreObject, name); while (mCoreObject.Pointer != IntPtr.Zero && node.Pointer != IntPtr.Zero) { int pNeedFreeStr = 0; var strPtr = XmlSDK.RapidXmlNodeA_name(node, ref pNeedFreeStr); var nodeName = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(strPtr); if (pNeedFreeStr == 1) { XmlSDK.RapidXmlNodeA_FreeString(strPtr); } if (name == nodeName) { XmlNode nd = new XmlNode(node); nd.mHolder = mHolder; bool bCancel = false; if (condition != null) { if (condition(nd, ref bCancel)) { nodeList.Add(nd); } } else { nodeList.Add(nd); } if (bCancel) { break; } } node = XmlSDK.RapidXmlNodeA_next_sibling(node); } return(nodeList); } }
public List <XmlNode> GetNodes() { unsafe { var nodeList = new List <XmlNode>(); if (CoreObject.Pointer == IntPtr.Zero) { return(nodeList); } for (var node = XmlSDK.RapidXmlNodeA_first_node(CoreObject, null); node.Pointer != IntPtr.Zero; node = XmlSDK.RapidXmlNodeA_next_sibling(node)) { var nd = new XmlNode(node); nd.mHolder = mHolder; nodeList.Add(nd); } return(nodeList); } }
public XmlNode FindNode(FOnFindNode onFind) { unsafe { if (CoreObject.Pointer == IntPtr.Zero) { return(null); } var node = XmlSDK.RapidXmlNodeA_first_node(CoreObject, null); while (node.Pointer != IntPtr.Zero) { var nd = new XmlNode(node); nd.mHolder = mHolder; if (onFind(nd)) { return(nd); } node = XmlSDK.RapidXmlNodeA_next_sibling(node); } return(null); } }