Just out of curiosity, if you're using managed code, why aren't you using the System.XML classes?
-----Original Message----- From: Javier Gálvez Guerrero [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 28, 2007 11:03 AM To: [email protected] Subject: Re: How to parse using DOM Hi there. Now I can compile the source code file where I have implemented (or tried it...) the DOM parser, some errors have appeared. As they seem quite simple I hope you could help me again: The method in file.cpp is like this (I have followed the guidelines <http://xerces.apache.org/xerces-c/program-dom.html>on Xerces site, except for the exception treatment...): void contents_manager::load_guide(String^ xml_path){ XMLPlatformUtils::Initialize(); XercesDOMParser* parser = new XercesDOMParser(); parser->parse(xml_path); DOMNode* root = parser->getDocument(); //child_aux1 will be the first child of root DOMNode* child_aux1, child_aux2, child_aux3, child_aux4, child_aux5, child_aux6, child_aux7; // Compiling errors referring to this line //... In file.h this is included: #include "../include/gincludes.h" #include "../content/content.h" #include <xercesc/dom/DOM.hpp> #include <xercesc/dom/DOMImplementation.hpp> #include <xercesc/dom/DOMImplementationLS.hpp> #include <xercesc/dom/DOMWriter.hpp> #include <xercesc/util/PlatformUtils.hpp> #include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/dom/DOM.hpp> #include <xercesc/util/XMLString.hpp> #include <xercesc/util/PlatformUtils.hpp> using namespace System; XERCES_CPP_NAMESPACE_USE // class definition... Then, when compiling a lot of errors appear saying that it can not be done as I am working with abstracts, referring to the previous red line... 1>.\contents_manager.cpp(17) : error C2259: xercesc_2_8::DOMNode' : no se puede crear una instancia de una clase abstract 1> debido a los siguientes miembros: 1> 'const XMLCh *xercesc_2_8::DOMNode::getNodeName(void) const' : es abstracto 1> D:\Ser teleco mola\IPTV\Aplicación\Desarrollo\dIPTV\xercesc_2_8_0\include\xercesc/dom/DOMNode.hpp(246) : vea la declaración de 'xercesc_2_8::DOMNode::getNodeName' 1> 'const XMLCh *xercesc_2_8::DOMNode::getNodeValue(void) const' : es abstracto 1> D:\Ser teleco mola\IPTV\Aplicación\Desarrollo\dIPTV\xercesc_2_8_0\include\xercesc/dom/DOMNode.hpp(255) : vea la declaración de 'xercesc_2_8::DOMNode::getNodeValue' 1> 'short xercesc_2_8::DOMNode::getNodeType(void) const' : es abstracto ... Any idea of what I need to do regarding this error? By the way, as you may have seen on the arguments of my method, the name/path of the XML file is received with String^ type, so, as I need to have a char* as an argument for parse->parse(file_name), how can I parse it? Thank you very much, Javi 2007/11/28, Sven Bauhan <[EMAIL PROTECTED]>: > > > This is not true. std::string and UTF-8 are fully compatible, as long > as > > you make no assumptions about chopping things up at arbitrary indices, > or > > the relationship of Unicode code points and UTF-8 code units. At any > rate, > > with a double-byte or multi-byte locale code page, you'd have the same > > issues. > > > I do not really understand what you want to say here. As far as I know > std::string stores strings in single byte units. In UTF-8 the units have > variable length between 1 and 4 bytes. So I cannot see a match here. > I thought to use UTF-8 with the STL you need something like > std::basic_string<UTFChar>. > > Could you tell me, how to transcode the XMLChar* correctly using UTF-8? > > Sven >
