Human readable XML
-
I use the MSXML IXMLDOMDocument to load and save settings of a Visual C++ Project. My code looks like this:
//create an instance of the parser hr = Document.CoCreateInstance(__uuidof(DOMDocument)); if (FAILED(hr) || (Document.p == NULL)) throw (IDS_XML_CANT_CREATE_XML_PARSER); // load the xml document file VARIANT_BOOL Success = false; hr = Document->load(CComVariant(m_szFilename), &Success); if (FAILED(hr) || !Success) throw (IDS_XML_SETTINGS_CANT_LOAD_SETTINGS);
Everything works fine and is square with the MSDN recommandations. But I still have a tiny problem: I decided to use XML in order to allow my users to manually edit the conf file but right now, the parser writes everything on a single row, making it hard to read. :eek: It is important to tell the parser to write tabs, spaces and linefeeds ... but how ??? :confused: -
I use the MSXML IXMLDOMDocument to load and save settings of a Visual C++ Project. My code looks like this:
//create an instance of the parser hr = Document.CoCreateInstance(__uuidof(DOMDocument)); if (FAILED(hr) || (Document.p == NULL)) throw (IDS_XML_CANT_CREATE_XML_PARSER); // load the xml document file VARIANT_BOOL Success = false; hr = Document->load(CComVariant(m_szFilename), &Success); if (FAILED(hr) || !Success) throw (IDS_XML_SETTINGS_CANT_LOAD_SETTINGS);
Everything works fine and is square with the MSDN recommandations. But I still have a tiny problem: I decided to use XML in order to allow my users to manually edit the conf file but right now, the parser writes everything on a single row, making it hard to read. :eek: It is important to tell the parser to write tabs, spaces and linefeeds ... but how ??? :confused:Look for the whitespace settings (options). carraige returns and line feeds are just child text nodes. Your users should be able to add the linefeed text manually and not impact your reading the data back in as a last option. "I will find a new sig someday."