G
Guest
Would anybody advise on the following code why it did run correctly in
Windows XP but did not run correctly in Windows Mobile ?
I am writing a C# program on Window Mobile 5.0 device to parse the content
of a XML file but exception raised when the program started.
The content of the XML file is:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE MessageCenter [
<!ENTITY message-center-connection SYSTEM
"MessageCenterConnection.xml"?>
]?>
<MessageCenter>
&message-center-connection;
<other-settings>
.........
</other-settings>
</MessageCenter>
The contain of the MessageCenterConnection.xml is
<connection>
<host>localhost</host>
<port>3550</port>
</connection>
The C# code used to parse the XML is:
protected XmlDocument xmlDoc = null;
xmlDoc = new XmlDocument();
try
{
XmlTextReader xmlTextReader = new XmlTextReader(xmlConfig);
xmlTextReader.EntityHandling = EntityHandling.ExpandEntities;
xmlDoc.Load(xmlTextReader);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
when the program was run under Windows Mobile, the following message was
displayed:
System.NotSupportedException: NotSupportedException
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode()
at System.Xml.XmlLoader.LoadDocSequence()
at System.Xml.XmlLoader.Load()
at System.Xml.XmlDocument.Load()
at
Symbol.Application.Framework.Configuration.ConfigTemplate.LoadConfigSettings()
at Symbol.MessageCenter.ConfigMessageCenter.ReadConfigFromXML()
at Symbol.MessageCenter.ConfigMessageCenter..ctor()
at Symbol.MessageCenter.Configuration..ctor()
at Symbol.MessageCenter.MessageCenter..ctor()
at Symbol.MessageCenter.Program.Main()
If I removed the
<!DOCTYPE MessageCenter [
<!ENTITY message-center-connection SYSTEM
"MessageCenterConnection.xml"?>
]?>
and
&message-center-connection;
from the XML, the program run correctly in WM5.0.
Windows XP but did not run correctly in Windows Mobile ?
I am writing a C# program on Window Mobile 5.0 device to parse the content
of a XML file but exception raised when the program started.
The content of the XML file is:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE MessageCenter [
<!ENTITY message-center-connection SYSTEM
"MessageCenterConnection.xml"?>
]?>
<MessageCenter>
&message-center-connection;
<other-settings>
.........
</other-settings>
</MessageCenter>
The contain of the MessageCenterConnection.xml is
<connection>
<host>localhost</host>
<port>3550</port>
</connection>
The C# code used to parse the XML is:
protected XmlDocument xmlDoc = null;
xmlDoc = new XmlDocument();
try
{
XmlTextReader xmlTextReader = new XmlTextReader(xmlConfig);
xmlTextReader.EntityHandling = EntityHandling.ExpandEntities;
xmlDoc.Load(xmlTextReader);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
when the program was run under Windows Mobile, the following message was
displayed:
System.NotSupportedException: NotSupportedException
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode()
at System.Xml.XmlLoader.LoadDocSequence()
at System.Xml.XmlLoader.Load()
at System.Xml.XmlDocument.Load()
at
Symbol.Application.Framework.Configuration.ConfigTemplate.LoadConfigSettings()
at Symbol.MessageCenter.ConfigMessageCenter.ReadConfigFromXML()
at Symbol.MessageCenter.ConfigMessageCenter..ctor()
at Symbol.MessageCenter.Configuration..ctor()
at Symbol.MessageCenter.MessageCenter..ctor()
at Symbol.MessageCenter.Program.Main()
If I removed the
<!DOCTYPE MessageCenter [
<!ENTITY message-center-connection SYSTEM
"MessageCenterConnection.xml"?>
]?>
and
&message-center-connection;
from the XML, the program run correctly in WM5.0.