Re: xmldocument " and "

From: Rick Strahl [MVP] (rickstrahl_at_hotmail.com)
Date: 03/06/04


Date: Sat, 6 Mar 2004 13:57:48 -1000

Martin,

That's because the escaped entity is " not &qout;

+++ Rick ---

-- 
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"martin" <marc_no_spam_1234@hotmail.com> wrote in message
news:Ooxtf#8AEHA.1700@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I would be extremly grateful for some help on producing an xml fragemt.
>
> The fragment that I wish to produce should look like this
>
> <Addresses>
>     <Address>&qout;Somebody's Name&quot; &lt;me@mydomain.com&gt;</Address>
> </Addresses>
>
> This looks simple enough however I am having great difficulty getting the
> string "&quot;" to appear in the above fragment.
> The & sign alway get escaped to &amp; so the line &quot; always appears as
> &amp;quot; which is not what I require.
> If I put in a " sign then the quote sign actually gets placed in the xml
and
> does not get escaped to &quot; at all.
>
> any help is producing a fragment in the above format whould be greatly
> appreciated.
>
> cheers
>
> martin.
>
> PS.   to demonstate what I mean I have included the code below that can be
> run from a console application/
>
> Imports System.IO
>
> Imports System.Xml
>
> Module Module1
>
> Sub Main()
>
> Dim xmlDoc As New XmlDocument
>
> Dim xmlElemAddress As XmlNode
>
> Dim root As XmlElement
>
> Try
>
> xmlDoc.LoadXml("<Addresses/>")
>
> xmlElemAddress = xmlDoc.CreateNode(XmlNodeType.Element, "Address", "")
>
> xmlElemAddress.InnerText = "&quot;Somebody's Name&quot; <me@mydomain.com>"
>
> root = xmlDoc.DocumentElement
>
> root.AppendChild(xmlElemAddress)
>
> xmlDoc.Save(Console.Out)
>
> Catch ex As Exception
>
> Console.WriteLine("***ERROR***")
>
> Console.WriteLine(ex.Message.ToString())
>
> Finally
>
> End Try
>
> End Sub
>
>
>


Relevant Pages

  • Re: xmldocument &quot; and "
    ... > I would be extremly grateful for some help on producing an xml fragemt. ... > any help is producing a fragment in the above format whould be greatly ... > Dim xmlDoc As New XmlDocument ...
    (microsoft.public.dotnet.framework.aspnet)
  • xmldocument &quot; and "
    ... I would be extremly grateful for some help on producing an xml fragemt. ... The fragment that I wish to produce should look like this ... Dim xmlDoc As New XmlDocument ...
    (microsoft.public.dotnet.framework.aspnet)
  • XSLT.Transform not working with namespaces definition in XML nodes
    ... Below is a fragment of this XML. ... stylesheet for this, a cutdown fragment is below, but the transform does not ... Dim xPathDoc As New Xml.XPath.XPathDocument ...
    (microsoft.public.dotnet.xml)
  • RE: using myXslDoc.Transform
    ... and xml file ... Dim strXML As String = SqlHelper.ExecuteScalar(cn, ... ' get xsl file from database and load xsl file ...
    (microsoft.public.dotnet.xml)
  • RE: ASP.Net app cannot read XML with Anonymous Authentication disabled
    ... ASP.Net app cannot read XML with Anonymous Authentication ... | Dim ProjReader As XmlReader = Nothing ... | Dim ProjURL As String = Session ... | 'Get XML Data for Projector and load in Projector Dropdown ...
    (microsoft.public.dotnet.framework.aspnet.security)

Quantcast