Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3314466
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:14:10+00:00 2026-05-17T22:14:10+00:00

Background I’m reading and writing an XML document using reader and writer, with filtering

  • 0

Background
I’m reading and writing an XML document using reader and writer, with filtering logic in between the read and write operations to determine which parts read should be written back out (effectively it strips some tags out) …

My choice of implementation currently is the following using: XmlNodeReader, XmlWriter and XmlNodeType

using System.Xml;

// Read every node
using (XmlNodeReader reader = new XmlNodeReader(xmlFragment)) {

    // But write out only nodes I want
    using (XmlWriter writer = XmlTextWriter.Create(sb, writerSettings)) {

        while (reader.Read()) {

            //... with filtering logic here to choose what is to be written.

            //  I do want to write out all entity references
            if (XmlNodeType.EntityReference == reader.NodeType)
                ; // but how do I do that here?
        }
    }
}

Problem
When I encounter an entity reference with the reader I get an empty string “” in reader.Value however it’s really an   value in the XML source that has been encountered. So it’s detected, but not available for me to have.

Apparently a Speciality or Edge Case:
I found the following MSDN article that indicates entity references are somewhat special while parsing, but I have been unable to use it toward a working solution. It seems sparse on details – I would prefer there be a code sample to supplement it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:14:11+00:00Added an answer on May 17, 2026 at 10:14 pm

    You may refer this link: http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.name.aspx

    Hope this helps!!

    XmlReader.Name Property
    When overridden in a derived class, gets
    the qualified name of the current
    node.node.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I'm using Google's protobuf , and I would like to read/write several gigabytes
Background I am writing and using a very simple CGI-based (Perl) content management tool
Background: writing an automated release script to export changed files between versions from SVN
Background: At my company we are developing a bunch applications that are using the
Background: I'm writing an installation for a SharePoint component. In addition to getting the
Background: I'm working on a system where the developers seem to be using a
Background I'm using SendKeys() to send keyboard commands to the active window, but I'm
Background: I'm using a delegation technique to abstract access to arbitrary object methods, but
Background: On a recent website, I'm using a jQuery driven dropdown menu in addition
Background: I have a little video playing app with a UI inspired by the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.