#### Backslash "\" is being added to XML Attributes, Is there a way to get rid off it?

I have not encountering this problem 'till I got VS.NET 2003. Check my xml
below how the backlash is added. I tried all possible ways to replace it but
nothing happens. Any help will greatly appreciated.

<SESSION_INFO_ID ID=\"434674640\">
<TEL_NBR VALUE=\"2532668900\">
<PRODUCT hcid=\"1600\"></PRODUCT>
<PRODUCT hcid=\"1700\"></PRODUCT>
</TEL_NBR>
</SESSION_INFO_ID>


 0
5/4/2004 3:37:48 PM
dotnet.xml 7266 articles. 0 followers.

8 Replies
525 Views

Similar Articles

[PageSpeed] 4

Pete wrote:

> I have not encountering this problem 'till I got VS.NET 2003. Check my xml
> below how the backlash is added. I tried all possible ways to replace it but
> nothing happens. Any help will greatly appreciated.
>
> <SESSION_INFO_ID ID=\"434674640\">
>      <TEL_NBR VALUE=\"2532668900\">
>           <PRODUCT hcid=\"1600\"></PRODUCT>
>           <PRODUCT hcid=\"1700\"></PRODUCT>
>      </TEL_NBR>
> </SESSION_INFO_ID>

Most likely that's visual effect produced by Visual Studio. It's
property inspector and debugging windows "feature".

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

 0
Oleg
5/4/2004 4:45:57 PM
As I said below I never encounter this in previous version. I used this xml
to pass to my stored procedure and due to that character it breaks the sp.

Here is the code snipet how I build the xml

StringWriter strWriter = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(strWriter);

writer.WriteAttributeString("session_info_id", "434674640");

.......

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:OG2FQ7eMEHA.3012@tk2msftngp13.phx.gbl...
> Pete wrote:
>
> > I have not encountering this problem 'till I got VS.NET 2003. Check my
xml
> > below how the backlash is added. I tried all possible ways to replace it
but
> > nothing happens. Any help will greatly appreciated.
> >
> > <SESSION_INFO_ID ID=\"434674640\">
> >      <TEL_NBR VALUE=\"2532668900\">
> >           <PRODUCT hcid=\"1600\"></PRODUCT>
> >           <PRODUCT hcid=\"1700\"></PRODUCT>
> >      </TEL_NBR>
> > </SESSION_INFO_ID>
>
> Most likely that's visual effect produced by Visual Studio. It's
> property inspector and debugging windows "feature".
>
> --
> Oleg Tkachenko [XML MVP]
> http://blog.tkachenko.com


 0
5/4/2004 5:02:34 PM
I don't want to argue with you but have you tried that class and writing
attributes?

Even my xsl transformation wouldn't recognize this crap.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:e32lF2fMEHA.3660@TK2MSFTNGP10.phx.gbl...
> Pete wrote:
>
> > As I said below I never encounter this in previous version. I used this
xml
> > to pass to my stored procedure and due to that character it breaks the
sp.
> >
> > Here is the code snipet how I build the xml
> >
> > StringWriter strWriter = new StringWriter();
> > XmlTextWriter writer = new XmlTextWriter(strWriter);
> >
> > writer.WriteAttributeString("session_info_id", "434674640");
>
> I don't believe this code produces that XML with slashes. As I said most
> likely that's visual effect - there are no slashes in XML, but Visual
> Studio .NET has a "feature" of showing slashes before quotes in property
> inspector and debug windows.
> Make sure there are really those slashes in XML - output it to console
> or file.
>
> --
> Oleg Tkachenko [XML MVP]
> http://blog.tkachenko.com


 0
5/4/2004 6:01:08 PM
Pete wrote:

> As I said below I never encounter this in previous version. I used this xml
> to pass to my stored procedure and due to that character it breaks the sp.
>
> Here is the code snipet how I build the xml
>
> StringWriter strWriter = new StringWriter();
> XmlTextWriter writer = new XmlTextWriter(strWriter);
>
> writer.WriteAttributeString("session_info_id", "434674640");

I don't believe this code produces that XML with slashes. As I said most
likely that's visual effect - there are no slashes in XML, but Visual
Studio .NET has a "feature" of showing slashes before quotes in property
inspector and debug windows.
Make sure there are really those slashes in XML - output it to console
or file.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

 0
Oleg
5/4/2004 6:31:14 PM
Pete wrote:

> I don't want to argue with you but have you tried that class and writing
> attributes?

Well, have I tried XmlTextWriter? Sure :) It writes wellformed XML with
no backslashes whatsoever. It's a class from System.Xml namespace, you
can trust it.
Provide more info, may be reproducible sample etc. Should be some silly
error somewhere.

> Even my xsl transformation wouldn't recognize this crap.

What do you mean exactly? Any exceptions?

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

 0
Oleg
5/4/2004 7:18:19 PM
Put this in your aspx.
StringWriter strWriter = new StringWriter();

XmlTextWriter writer = new XmlTextWriter(strWriter);

writer.WriteStartElement("SESSION_INFO_ID");

writer.WriteStartElement("TEL_NBR");

writer.WriteAttributeString("VALUE=","4258009000"

writer.WriteAttributeString("EXTN=","9000");

writer.WriteAttributeString("NAME=","Oleg Tkachenko XML MVP")

writer.WriteEndElement();

writer.WriteEndElement();

string input = strWriter.ToString();

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:uZECZQgMEHA.3664@TK2MSFTNGP10.phx.gbl...
> Pete wrote:
>
> > I don't want to argue with you but have you tried that class and writing
> > attributes?
>
> Well, have I tried XmlTextWriter? Sure :) It writes wellformed XML with
> no backslashes whatsoever. It's a class from System.Xml namespace, you
> can trust it.
> Provide more info, may be reproducible sample etc. Should be some silly
> error somewhere.
>
> > Even my xsl transformation wouldn't recognize this crap.
>
> What do you mean exactly? Any exceptions?
>
> --
> Oleg Tkachenko [XML MVP]
> http://blog.tkachenko.com


 0
5/4/2004 11:58:09 PM
Pete wrote:

> Put this in your aspx.

Here is the result:

<SESSION_INFO_ID><TEL_NBR VALUE=="4258009000" EXTN=="9000" NAME=="Oleg
Tkachenko XML MVP" /></SESSION_INFO_ID>

No backslashes. Well, those == is definitely not well-formed. That's
known limitation of XmlTextWriter - it doesn't check names for validity.
See
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcustomizedxmlwritercreation.asp?frame=true

> writer.WriteAttributeString("EXTN=","9000");

This is obviously wrong. First argument of WriteAttributeString is "The
local name of the attribute". Use
writer.WriteAttributeString("EXTN","9000");

> writer.WriteEndElement();

Here you better close XmlTextWriter to flush the content:

writer.Close();
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

 0
Oleg
5/5/2004 8:00:49 AM
Thanks!!

I run a profiler and the xml passes to the sp doesn't have backslashes. You
were right it was just a visual effect.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:uaBxb6mMEHA.2468@TK2MSFTNGP11.phx.gbl...
> Pete wrote:
>
> > Put this in your aspx.
>
> Here is the result:
>
> <SESSION_INFO_ID><TEL_NBR VALUE=="4258009000" EXTN=="9000" NAME=="Oleg
> Tkachenko XML MVP" /></SESSION_INFO_ID>
>
> No backslashes. Well, those == is definitely not well-formed. That's
> known limitation of XmlTextWriter - it doesn't check names for validity.
> See
>
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcustomizedxmlwrite
rcreation.asp?frame=true
>
> > writer.WriteAttributeString("EXTN=","9000");
>
> This is obviously wrong. First argument of WriteAttributeString is "The
> local name of the attribute". Use
> writer.WriteAttributeString("EXTN","9000");
>
> > writer.WriteEndElement();
>
> Here you better close XmlTextWriter to flush the content:
>
> writer.Close();
> --
> Oleg Tkachenko [XML MVP]
> http://blog.tkachenko.com


 0
5/5/2004 2:09:39 PM

Similar Artilces:

Backslash "\" is being added to XML Attributes, Is there a way to get rid off it?
I have not encountering this problem 'till I got VS.NET 2003. Check my xml below how the backlash is added. I tried all possible ways to replace it but nothing happens. Any help will greatly appreciated. <SESSION_INFO_ID ID=\"434674640\"> <TEL_NBR VALUE=\"2532668900\"> <PRODUCT hcid=\"1600\"></PRODUCT> <PRODUCT hcid=\"1700\"></PRODUCT> </TEL_NBR> </SESSION_INFO_ID> Pete wrote: > I have not encountering this problem 'till I got VS.NET 2003. Check my xml > belo...

Can't get past A:\backup.pst prompt!!!!!!!!!!!!
After IMPORTING some fresh data from one PC to another via a floppy disc, the second PC continually comes up with "can't find a:\backup.pst" I have tried everytrick in the book but it refuses to let me in! I even burnt a CD-R with another backup on it but no way, Outlook won't even look at it! If I put the original floppy back in the slot, it says it can't access data on it! Grrrrrrrrrrr! In anger, I uninstalled Outlook, prowled the registry for anything called ".pst" and deleted it, did likewise with the "search" application, reinstalled Outllok but e...

How to get C:\Windows\Temp directory path in a computer?
I use VC++ MFC 4.2. I need to get the C:\Windows\Temp on each computer on which my application run. I will save a Temporary data there. I have tried this: LPITEMIDLIST lpItemIDList = NULL; CString sDir; if( SUCCEEDED( SHGetSpecialFolderLocation( NULL, CSIDL_WINDOWS, &lpItemIDList ) ) ) { char cWinPath[MAX_PATH + 1] = { NULL }; SHGetPathFromIDList( lpItemIDList, cWinPath ); sDir.Format( "%s%s", cWinPath, "\\Temp" ); } return sDir; } but it was error, I guess the VC 4.2 is not support CSIDL_WINDOWS because I read on MSDN Library it was mentioned "Ve...

Get Help with Microsoft Office From Paid Experts!!\
Hi Everyone, My name is Richard Day. I have just launched my new Online Consulting Firm. My firm does something that has never been done before - Bring Computing Experts and customers together online, in a cost-effective one-on-one environment. The environment of the firm is based around a forum. The forum style allows users to browse the questions and answers of other members of the forums before you ask your own questions. Please Visit us at www.TheEnterKey.com. We currently offer expert help in the following fields: - WEB LANGUAGES (HTML & XHTML, Javascript, XML, CSS, Perl, PHP...

Easiest way to set message size and\or mailbox size
I am trying to "selectively" set message size and\or mailbox size on mailboxes in our organization (Exchange 2003 SP2). I would like to be able to use Groups to do this with members in each group sharing the same limits. I have just discovered ADModify, but can't seem to figure out a way to apply changes to members of a group. I would like to avoid using Mailbox stores as the means of assigning limits, but also want to avoid having to apply limits at the individual mailbox level (even with ADModify). Is there any way that I can apply Exchange attribute changes to all t...

Getting VISTA Control panel\Programs look and feel....
Hi All, In one of my application development, I need to present the information similar to how VISTA shows in Programs (which is under Control Panel). I could not get what has been done to get this look? If you go to "Control Panel" and then if you go to "Programs" in that, it has "Programs and Features" option. Just below the "Programs and Features" it has various options "Uninstall a program", "Turn windows features on or off" etc. It appears to me that it is a list control. But in the rows there is a line (seperator kind ...

attribute wrapped with "\"?
I have some code that is building an XmlDataDocument: XmlElement elem = xdd.CreateElement("parameter"); XmlAttribute attr = xdd.CreateAttribute("name"); attr.Value = parameterName; elem.Attributes.Append(attr); elem.InnerText = parameterValue; xdd.DocumentElement.AppendChild(elem); When I create attributes, the xml contains "\" around the attribute values. Why is this? xdd.InnerXml returns.... "<parameters><parameter name=\"CompanyId\">0</parameter></parameters>" xdd.OuterXml returns... "<parameters>&...

How to get files and folders name of windows\\system32 directory for Windows XP 64 bit OS by programming
Hi All , I am creating the SDI application for showing the Operating system's drive explorer tree. This is working fine for all operating system from Win 2K to XP for 32 Bit. But If I check it for Windows XP 64 bit operating system then It is showing strange behave , my all hierarchy of files and folders is coming properly but Files and folder of C:\windows\system32 directory are not coming properly , here it is showing the files and folders of C:\windows\systemWOW64 directory. How to show the actual files and folder of C:\\Windows\\system32 directory ???????? I am using ...

Is there any way to get OWA 2K3 to remember my domain\user name?
Is there any way to configure OWA so that after a user logins once, future use of OWA loads the same login in the Domain\User Name field? Right now , every time a user launches OWA, that user needs to enter both the user name and password. Is there no way to configure OWA to use a cookie or something to load the last used Domain\User Name? Thanks. Gus I believe that would be more a function of IE on each machine than of OWA. -- Matthew Tisdel South Carolina "Gus" wrote: > Is there any way to configure OWA so that after a user logins once, > future use of OWA loads the s...

how to make sure a xsl document has valid xsl syntax? i tried loading it into an xml document but that doesnt show syntax errors inside attributes such as "foo/bar" vs "bar\foo"
how to make sure a xsl document has valid xsl syntax? i tried loading it into an xml document but that doesnt show syntax errors inside attributes such as "foo/bar" vs "bar\foo" Daniel wrote: > how to make sure a xsl document has valid xsl syntax? i tried loading it > into an xml document but that doesnt show syntax errors inside attributes > such as "foo/bar" vs "bar\foo" System.XML performs only checks for the well-formedness of Documents, not for validity. You need a Schema for XSLT wich defines Regular Expressions to check for "sy...

Hi I am working with CRM 3.0. I want to make an attribute with a link to my local directory (like C:\CRM\Contact1), I also want to autocreate that directory when I am creating a new contact. Is it possible to do? How do I do it? Lars Do it in the CallOut, PostCreate. You can develop assembly that subscribe to the PostCreate of Contact, but be aware of the security context. By default, Callout is run under Network services account. Gunady Lars D wrote: > Hi > > I am working with CRM 3.0. > > I want to make an attribute with a link to my local directory (like > C:\C...

Could not find file "c:\inetpub\wwwroot\help\help_toc.xml".
Anyone had this error before ? And what is the solution.... I do not have this file. Microsoft CRM Unhandled Error Details: Could not find file "c:\inetpub\wwwroot\help\help_toc.xml". Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileNotFoundException: Could not find file "c:\inetpub\wwwroot\help\help_toc.xml". Source Error: An unhandled exception was generated during the execution of the...

Message
I recently totally re-installed all of my programs as well as Windows XP, when I re-installed Office 2003, and downloaded my old settings, using the Save My Settings wizard, I now get two "error" messages, although the box does not say error. I get a box that says Microsoft Office Outlook and then the following (part of which I am going to truncate) C:\documents and settings\Tom.....\Microsoft shared\geography\mpoai9.dll is not a valid office add-in. I also get a similar one as shown in the subject line above. I can NOT get rid of these. I have tried the repair, as wel...

AD <-> SQL Hirearchies \ Nodes
Hello All... As part of our migration to Active Directory Win 2003, we are considering ‘interfacing’ our Active directory user \ group schema with our business intelligence (SQL) location hierarchy. The UK location hierarchy is has +- 3000 leaf level nodes and is 6 levels deep. There are many other international location hierarchies. When a user logs into any of our reporting web applications, the web session will be able to obtain real time information only on the locations that he\she has rights to see. Other considerations, • On the lowest level, we w...

How to display 5.5 hours instead of 5.30 when adding \ subtracting
when adding or subtracting times (13:00-08:30) how do i get the answer formatted to show answer as 4.5 instead of 04:30 Try formatting the result as NUMBER, instead of Date or Time. Format>Cells>Number tab Category: Number Decimal Places: 2 Does that help? *********** Regards, Ron "excel novice" wrote: > when adding or subtracting times (13:00-08:30) how do i get the answer > formatted to show answer as 4.5 instead of 04:30 If 4:30 is in A1, then use =A1*24 and format the cell as Number with 2 decimals Excel keeps time as a fraction of a day. -- Bernard V Lien...

Adding table field for G\L Journal Entries
I am a new Dynamics GP 10 user. Our old G\L system allowed for 2 description fields for G\L Journal entries. One field was 39 characters long and the other was 50 characters long. I am using the Scribe Adapter for GP to migrate history information from our old in-house developed G\L system o Dynamics GP. There is a Description field of 31 characters in the Dynamics GP Transaction Line. Can I add 2 new fields to the appropriate table that handles journal entries? I would like to add a Description1 field of 39 characters and a Description 2 field of 50 characters. This would allow us to m...

using backslash ( \ ) inside Parameter
Hi I am trying to use backslash as a part of a parameter at stored procedure. And I am getting syntax error. For instance, to execute like this.. EXEC spSetupPermissions CORP\ABC, Sale with parameter I have set up like this.. CREATE PROC [dbo].[spSetupPermissions] @USERNAME varchar(50), @DEPARTMENT varchar(12) AS IF @DEPARTMENT = 'Sale' BEGIN EXEC Sale.dbo.sp_addlogin @loginame= @USERNAME EXEC Sale.dbo.sp_addrolemember 'db_owner', @USERNAME END ......etc... I should I go about doing this? I would appreciate if anyone would give...

how do i get c:\b57xp32.sys its not in my computer
i cant get on the internet and when i try this message comes up...c:\b57xp32.sys comes up Is this somehow related to Outlook or is this an internet connectivity issue? "jim a" <jim a@discussions.microsoft.com> wrote in message news:A0C873C2-DAA7-482C-B55F-0BF5E64D66EE@microsoft.com... > i cant get on the internet and when i try this message comes > up...c:\b57xp32.sys comes up jim a wrote: > i cant get on the internet and when i try this message comes > up...c:\b57xp32.sys comes up Is there a reason why you want this malware? ...