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.
|
What is the value passed to WriteEntityRef?
What do you want to achieve?
If you want to write a character reference to a character then use
WriteCharEntity e.g.
writer.WriteCharEntity('a')
if you want to write an entity reference then use WriteEntityRef and
pass in the name of the entity e.g.
writer.WriteEntityRef("apos")
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/