Thanks Morten for your quick reply.
actually i am passing the value 詳 細 仕 様 に and
when it reads the value in writeentityref, it is causing the invalid name
character.
i am using Japanese characters and when i save the characters in the XML
(encoding ISO-8859-1) and it saves the values 詳 細 etc (each
value ends with semicolon). then i open the saved file and read the entity
one by one. the writeEntityRef fails to read the entity for Japanese
characters.
When i use the English text and writeEntityref reads the entity value and
works fine.
any other pointers would be appreciated.
Thanks,
Vinod
"Morten Wennevik [C# MVP]" wrote:
Quote:
Hi Vinod,
>
You need to give us some more information. There is nothing stopping you
from writing the Japanese (or Chinese?) text as it is to an xml file,
provided you use a proper encoding for it. You seem to check for existance
of converted characters. What are you using as Regex pattern (value of
rxEnt)? How do you end up with a &x string from "詳細仕様に"?
>
--
Happy Coding!
Morten Wennevik [C# MVP]
>
>
"Vinod" wrote:
>
Quote:
Hi All,
I am facing an issue in the XmlTextWriter class in the dotnet 2.0.
This is the sample code
Actual XML is like this
<Name>詳細仕様に</Name>
code:
strvalue = "詳細仕様に"
public override void WriteString(string strValue)
{
int intPstn;
if(strValue.IndexOf("&") != -1)
{
intPstn = 0;
foreach(Match entMatch in rxEnt.Matches(strValue))
{
base.WriteString(strValue.Substring(intPstn, entMatch.Index - intPstn));
try
{
base.WriteEntityRef(entMatch.Value);
}
catch
{
base.WriteString(entMatch.Value);
}
intPstn = entMatch.Index + entMatch.Length;
}
base.WriteString(strValue.Substring(intPstn));
}
else
base.WriteString(strValue);
}
Here the base class is XmlTextWriter.
I am getting an error in base.WriteEntityRef as "Invalid name character in
詳" and please let me know how to resolve it.
Regards,
Vinod