Hi, I ended up parsing the text myself. Mike NSan wrote:
Hi there,I'm trying for a while to obtain the XML content of a file without spaces. I have a XML file with the following content: <script> <command> <createDocument> <name>MyDocument</name> <type>Text</type> </createDocument> </command> <command> <createFile> <name>MyFile</name> <type>File</type> </createFile> </command> </script> It happens that I need to obtain the name and type values from the XML but I'm getting the content with white spaces. Here is the code I'm trying to use: Code: ( text ) void MySAX2Handler::startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs) { outStream.clear(); char* message = XMLString::transcode(localname); std::cout << "I saw element: "<< message << std::endl; XMLString::release(&message);} void MySAX2Handler::fatalError(const SAXParseException& exception){ char* message = XMLString::transcode(exception.getMessage()); std::cout << "Fatal Error: " << message << " at line: " << exception.getLineNumber() << std::endl; }void MySAX2Handler::characters(const XMLCh* const chars, constunsigned int length) { char* message = XMLString::transcode(chars); std::cout << "Characters: " << message << " Lenght: " << length << std::endl; if (XMLString::compareIString(chars,XMLUni::fgZeroLen String) != 0) { outStream << message; } XMLString::release(&message); }void MySAX2Handler::endElement(const XMLCh* const uri, const XMLCh*const localname, const XMLCh* const qname) { std::cout << "EndElement - OutStream: " << outStream.str() << std::endl; } But I'm still getting the outStream value from the endElement with white spaces. I would really appreciate if you can help me to solve this problem. Thank you. San
-- Michael Case Software Engineer High Energy Group Department of Physics UC Davis One Shields Avenue Davis, CA 95616 530-754-7226
