private static extern RCODE xflaim_Db_exportXMLToString( IntPtr pDb, IntPtr pStartNode, eExportFormatType eFormat, out IntPtr ppszStr);
//----------------------------------------------------------------------------- // exportXMLToString //----------------------------------------------------------------------------- /// <summary> /// Export XML to a string. /// </summary> /// <param name="startNode"> /// The node in the XML document to export. All of its sub-tree will be exported. /// </param> /// <param name="eFormat"> /// Formatting to use when exporting. /// </param> /// <returns> /// Returns a string containing the exported XML. /// </returns> public string exportXMLToString( DOMNode startNode, eExportFormatType eFormat) { RCODE rc; IntPtr pszStr; string sXML; IntPtr pStartNode = (startNode != null) ? startNode.getNode() : IntPtr.Zero; if ((rc = xflaim_Db_exportXMLToString( m_pDb, pStartNode, eFormat, out pszStr)) != 0) { throw new XFlaimException( rc); } sXML = Marshal.PtrToStringAnsi( pszStr); m_dbSystem.freeUnmanagedMem( pszStr); return( sXML); }
private static extern RCODE xflaim_Db_exportXML( IntPtr pDb, IntPtr pStartNode, [MarshalAs(UnmanagedType.LPStr)] string sFileName, eExportFormatType eFormat);
//----------------------------------------------------------------------------- // exportXML //----------------------------------------------------------------------------- /// <summary> /// Export XML to a text file. /// </summary> /// <param name="startNode"> /// The node in the XML document to export. All of its sub-tree will be exported. /// </param> /// <param name="sFileName"> /// File the XML is to be exported to. File will be overwritten. /// </param> /// <param name="eFormat"> /// Formatting to use when exporting. /// </param> public void exportXML( DOMNode startNode, string sFileName, eExportFormatType eFormat) { RCODE rc; IntPtr pStartNode = (startNode != null) ? startNode.getNode() : IntPtr.Zero; if ((rc = xflaim_Db_exportXML( m_pDb, pStartNode, sFileName, eFormat)) != 0) { throw new XFlaimException( rc); } }