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 static void GetXMLStringFromNode(ref string xmlStr, XmlNode node) { unsafe { var str = XmlSDK.RapidXmlNodeA_GetStringFromNode(node.CoreObject); xmlStr = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(str); XmlSDK.RapidXmlNodeA_FreeString(str); } }
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); } }