1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
   |  
//
// dll écrite à partir du wizard .NET -> Bibliothèque de classes.
// Compilée /clr
//
// ----- .h (extrait) -----
 
using namespace System;
using namespace System::IO;
using namespace System::Xml;
using namespace Microsoft::Win32;
 
namespace BdrXml_dll
{
   public __gc class CXmlAccess
   {
   public:
      CXmlAccess(void);
      ~CXmlAccess(void);
 
      XmlDocument *m_xmlDoc;
 
      // retourne dans RetValue la valeur lue pour le noeud Key
      // dans le fichier File.
      bool ReadString(String *File, String *Key, String* &RetValue);
   }
};
 
// ----- .cpp (extrait) -----
 
#include "BdrXml_dll.h"
using namespace BdrXml_dll;
 
bool CXmlAccess::ReadString(String *File, String *Key, String *&RetValue)
{
   m_xmlDoc = new XmlDocument();
   m_xmlDoc->Load(File);
   XmlNode *n = m_xmlDoc->SelectSingleNode(Key);
   RetValue = n->InnerText;
   return(true);
} | 
Partager