Problem in dealing with character entity refrences in XML

  • 13 years ago

    Hi,

    I tried to manipulating XML files using XmlTextReader which is somewhat new to me. My problem is when an input XML contains character entity references, e.g., ® -- vb.Net automatically resolves it into "®". My question would be: Could there be any way to alter vb.Net's behaviour in order to retain character entity references as it is after processing? How?

    Thanks in advance!

    =========
    Sample input:
    <doc>
    <p>Smithsonian Institution &#169;</p>
    <p>Science and Technology for Children&#174;</p>
    </doc>

    Current output:
    <doc>
    <p id="p1">Smithsonian Institution©</p>
    <p id="p2">Science and Technology for Children®</p>
    </doc>

    Desired output:
    <doc>
    <p id="p1">Smithsonian Institution&#183;</p>
    <p id="p2">Science and Technology for Children&#174;</p>
    </doc>






















  • 13 years ago
    ISO Latin code for Copyright symbol is &#169; and &#174; is for Registered. Thats why you are getting that symbol. Instead of & symbol use &amp; ?You will get desired output

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The difference between theory and practice is smaller in theory than in practice.”