Hi, I greatly appreciate your responses.
The application that generates the XML data does not declare the namespace
also in the document because during successive restarts of the application
the XML data will continue to get appended to the existing file itself.
I am afraid my original question, "whether it is possible to
programmatically take care of the XML Namespace declaration inside of the
viewer application", still remains unanswered.
Sample XML Data file:
<log4net:event
logger='Debug'
timestamp='2004-12-07T13:25:00.1590000+05:30'
level='DEBUG'
thread='2852'
domain='domain-Elind.CSF.UnitTests.exe'
username='ELIND\senthilss'>
<log4net:message>
<log4net:Object>System.String</log4net:Object>
<log4net:Field Name='String' Value='Severity [Debug] is set.'/>
</log4net:message>
</log4net:event>
<log4net:event
logger='Debug'
timestamp='2004-12-07T13:25:00.2527500+05:30'
level='DEBUG'
thread='2852'
domain='domain-Elind.CSF.UnitTests.exe'
username='ELIND\senthilss'>
<log4net:message>
<log4net:Object>Elind.CSF.UnitTests.BaseClass</log4net:Object>
<log4net:Field Name='ibc' Value='-1'/>
<log4net:Field Name='sbc' Value='Some String in BaseClass'/>
<log4net:Node Name='InData'>
<log4net:SubField Name='SomeLine' Value='zyxw'/>
</log4net:Node>
<log4net:Node Name='OutData'>
<log4net:SubField Name='SomeLine' Value='fed cba'/>
</log4net:Node>
<log4net:Field Name='i' Value='-2'/>
</log4net:message>
</log4net:event>
C# viewer code snippet:
public class frmLogViewer : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid logView;
DataSet logXMLDataSet = new DataSet("LogViewer");
logXMLDataSet.ReadXml("Data.xml");
logView.DataSource = logXMLDataSet;
}
I am new to XML, and to ask the question once again, Is there any way I can
avoid tampering the Data file for the sake of getting the XML namespace
declaration into the Data Viewer application?
Thanks,
Senthil SS.
"Bjoern Hoehrmann" wrote:
* Oleg Tkachenko [MVP] wrote in microsoft.public.dotnet.xml: My application produces XML Data files which have XML namespace qualified XML
elements (nodes), but the namespace itself is not declared in the data file.
That means that's malformed XML. Fix it, that's the solution. And better
use standard XML API such as XmlTextWriter class to create XML - it
always knows better how to produce well-formed XML.
Missing namespace declarations do not render XML documents malformed,
they are still well-formed but not namespace-well-formed. An XML pro-
cessor that does not support XML Namespaces would not fail to pro-
cess such resources. That does not help here though (unless you can
disable namespace support for System.Xml), so fixing the document one
way or the other is probably the best approach.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/