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(str ing strValue)
{
int intPstn;
if(strValue.Ind exOf("&") != -1)
{
intPstn = 0;
foreach(Match entMatch in rxEnt.Matches(s trValue))
{
base.WriteStrin g(strValue.Subs tring(intPstn, entMatch.Index - intPstn));
try
{
base.WriteEntit yRef(entMatch.V alue);
}
catch
{
base.WriteStrin g(entMatch.Valu e);
}
intPstn = entMatch.Index + entMatch.Length ;
}
base.WriteStrin g(strValue.Subs tring(intPstn)) ;
}
else
base.WriteStrin g(strValue);
}
Here the base class is XmlTextWriter.
I am getting an error in base.WriteEntit yRef as "Invalid name character in
詳" and please let me know how to resolve it.
Regards,
Vinod 3 3073
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:
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(str ing strValue)
{
int intPstn;
if(strValue.Ind exOf("&") != -1)
{
intPstn = 0;
foreach(Match entMatch in rxEnt.Matches(s trValue))
{
base.WriteStrin g(strValue.Subs tring(intPstn, entMatch.Index - intPstn));
try
{
base.WriteEntit yRef(entMatch.V alue);
}
catch
{
base.WriteStrin g(entMatch.Valu e);
}
intPstn = entMatch.Index + entMatch.Length ;
}
base.WriteStrin g(strValue.Subs tring(intPstn)) ;
}
else
base.WriteStrin g(strValue);
}
Here the base class is XmlTextWriter.
I am getting an error in base.WriteEntit yRef as "Invalid name character in
詳" and please let me know how to resolve it.
Regards,
Vinod
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:
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:
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(str ing strValue)
{
int intPstn;
if(strValue.Ind exOf("&") != -1)
{
intPstn = 0;
foreach(Match entMatch in rxEnt.Matches(s trValue))
{
base.WriteStrin g(strValue.Subs tring(intPstn, entMatch.Index - intPstn));
try
{
base.WriteEntit yRef(entMatch.V alue);
}
catch
{
base.WriteStrin g(entMatch.Valu e);
}
intPstn = entMatch.Index + entMatch.Length ;
}
base.WriteStrin g(strValue.Subs tring(intPstn)) ;
}
else
base.WriteStrin g(strValue);
}
Here the base class is XmlTextWriter.
I am getting an error in base.WriteEntit yRef as "Invalid name character in
詳" and please let me know how to resolve it.
Regards,
Vinod
Hi Vinod,
What Regex pattern are you matching against? Your code uses an integer
value intPstn which you set at the end of each foreach loop, and you use this
value when the loop ends, but the integer would then only contain the
calculated value from the very last loop. Is this by design? It would
always be the index of the last value + the length of the last value.
--
Happy Coding!
Morten Wennevik [C# MVP]
"Vinod" wrote:
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:
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:
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(str ing strValue)
{
int intPstn;
>
if(strValue.Ind exOf("&") != -1)
{
intPstn = 0;
>
foreach(Match entMatch in rxEnt.Matches(s trValue))
{
base.WriteStrin g(strValue.Subs tring(intPstn, entMatch.Index - intPstn));
>
try
{
base.WriteEntit yRef(entMatch.V alue);
}
catch
{
base.WriteStrin g(entMatch.Valu e);
}
>
intPstn = entMatch.Index + entMatch.Length ;
}
>
base.WriteStrin g(strValue.Subs tring(intPstn)) ;
}
else
base.WriteStrin g(strValue);
}
>
>
Here the base class is XmlTextWriter.
>
I am getting an error in base.WriteEntit yRef as "Invalid name character in
詳" and please let me know how to resolve it.
>
Regards,
Vinod
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Safalra |
last post by:
The idea here is relatively simple: a java program (I'm using JDK1.4
if that makes a difference) that loads an HTML file, removes invalid
characters (or replaces them in the case of common ones like
Microsoft's 'smartquotes'), and outputs the file.
The problem is these files will be on disk, so the program won't have
the character encoding information from the server.
Questions:
|
by: aklsdjfh |
last post by:
I'm no expert in asp and vbscript but not a total beginner. I've got some
VBScript in an asp page which is generating a forumla for use in Lotus Notes
replication.
The line that it is objecting to is
<% if user2 <> "" then response.write("| @IsMember("" & LCase(user2) &
"";@LowerCase(@Name(;AssignedTo)))") end if %>
i.e. if the string user2 is "Mike" I expect the HTML to be
|...
|
by: SHC |
last post by:
Hi all,
I ran the attached volcanoes.xml (with geology.dtd) in the Module of Access
2003.
I got the following error:
Microsoft Office Access
You have error Invalid Character in
content model.
|OK|
Please help and advise me what is wrong in my source code and how to correct
|
by: kevin |
last post by:
When I try to select one of the following enums, I see "A name was started
with an invalid character." in the tooltip (Intellisence) and under the
Summary heading (object browser). Other enums seem to behave normally. I
even removed the <remarks/> comment with no change in behavior.
When I build I see the following warning for each enum value:
warning CS1570: XML comment on
'CreditorMigration.SourceAndDestination.PayerToUs' has badly...
|
by: Anders Jansson |
last post by:
Hi all.
I have 2 problems when I try to open and convert an ASP.NET VS 2003
web-applikation in VS 2005.
In VS 2003 I have no problems at all!
First: One subfolder with will not be converted! The converted web project
are missing this subfolder completely.
39 errors are displayed in the Conversion Report saying: ERROR: Unable to
get local copy of file <file>. Why? All files are there and readable!!
| |
by: Middletree |
last post by:
Teaching myself ASP.NET, using Microsoft Press book called ASP.NET 2.0 by
George Shepherd.
Ch. 2, it says to type the following code:
<%@ Page Language="C#" %>
<html>
|
by: Eric |
last post by:
When I run my script it gives error on the following line:
strEmail = Right(strEmail, (Len(strEmail) - 1))
I enclose my code and the sample text file too
Thanks,
-----------------------------------------------------------------------------
Option Compare Database
Option Explicit
Private Sub Command26_Click()
|
by: Eric |
last post by:
When I run my script it gives error on the following line:
strEmail = Right(strEmail, (Len(strEmail) - 1))
I enclose my code and the sample text file too
Thanks,
-----------------------------------------------------------------------------
Option Compare Database
Option Explicit
Private Sub Command26_Click()
|
by: =?Utf-8?B?Vmlub2Q=?= |
last post by:
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>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |