I have a few questions about DTD ENTITY. I would appreciate any help.
1. Is there any equivalent of this in xsd? Suppose I want to use the
same string in multiple places in an xml file, is it possible to do
without DTD entities?
e.g. Consider two elements like this which are present in my xml file.
<AddValue>value 1</AddValue>
<CheckValue>val ue1</CheckValue>
By defining <!ENTITY val "value1"> I can use
<AddValue>&val; </AddValue>
and <CheckValue>&va l;</CheckValue>.
This will make sure that I can change value1 to value2 in just one
place and the other references will pick it up.
But everyone says that DTD is outdated. So is there any other way to
achieve this in XML?
2. If I have a code like above in an XML file and I use
XmlDataDocument Doc = new XmlDataDocument ();
Doc.Load(file); //where file is the name of the xml file
All the entity references are correctly resolved.
However, if I have the xml document stored as a string and then I use
XmlDataDocument Doc = new XmlDataDocument ();
Doc.LoadXml(szX mlString); //where szXmlString is the string that
contains
//the xml text
the code throws an exception. Why is that? Is there a way around it?
Thanks in advance.