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

  • SEARCH
  • Home
  • 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 7519047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:50:23+00:00 2026-05-30T01:50:23+00:00

I m looking for some good example of reading a well-formed and valid xml

  • 0

I m looking for some good example of reading a well-formed and valid xml file (having external dtd attached to it) using XmlReader of c#

Have googled it and gone through books but cannot find a good and well explained example.

this is the XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Catalog SYSTEM "marketplace_feed_v2.dtd">
<Catalog>
<Category>
<Name>Arts &amp; Entertainment</Name>
<Site>
<Id>ABC CORP</Id>
<PopularityRank>1</PopularityRank>
<Title><![CDATA[Some Description]]></Title>
<Description><![CDATA[Don't Have A Website? Create A Money Making Website]]></Description>
<HasRecurringProducts>true</HasRecurringProducts>
<Gravity>432.74</Gravity>
<PercentPerSale>75.0</PercentPerSale>
<PercentPerRebill>45.0</PercentPerRebill>
<AverageEarningsPerSale>28.14599</AverageEarningsPerSale>
<InitialEarningsPerSale>25.3445</InitialEarningsPerSale>
<TotalRebillAmt>28.55413</TotalRebillAmt>
<Referred>95.0</Referred>
<Commission>75</Commission>
<ActivateDate>2009-06-29</ActivateDate>
</Site>
</Categoty>
<Category><Site>....</Site></Category></Catalog>

This is the DTD File:

<!ELEMENT Catalog ( Category* ) >
<!ELEMENT Category ( Name, Site*, Category* ) >
<!ELEMENT Commission ( #PCDATA ) >
<!ELEMENT Description ( #PCDATA ) >
<!ELEMENT InitialEarningsPerSale ( #PCDATA ) >
<!ELEMENT AverageEarningsPerSale ( #PCDATA ) >
<!ELEMENT TotalRebillAmt ( #PCDATA ) >
<!ELEMENT HasRecurringProducts ( #PCDATA ) >
<!ELEMENT Gravity ( #PCDATA ) >
<!ELEMENT Id ( #PCDATA ) >
<!ELEMENT Name ( #PCDATA ) >
<!ELEMENT PercentPerSale ( #PCDATA ) >
<!ELEMENT PercentPerRebill ( #PCDATA ) >
<!ELEMENT PopularityRank ( #PCDATA ) >
<!ELEMENT ActivateDate ( #PCDATA ) >
<!ELEMENT Site ( Commission? | Site+ | InitialEarningsPerSale? | AverageEarningsPerSale? | TotalRebillAmt? | Gravity? | Id+ | PercentPerSale? | PercentPerRebill? | PopularityRank+ | Title+ | HasRecurringProducts | ActivateDate? )* >
<!ELEMENT Title ( #PCDATA ) >

can anybody help me with an example??

  • 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-30T01:50:23+00:00Added an answer on May 30, 2026 at 1:50 am

    Found that XmlReader is read-only and forward-only.
    so used this

    StreamReader stream = new StreamReader(filePath);
    XmlReader reader = XmlReader.Create(stream, settings);
            while (reader.Read())
            {
                reader.MoveToContent();
                // Parse the file and display each of the nodes.
                while (reader.Read())
                {
                    reader.MoveToElement();
                    if (reader.Name.Equals("Category") && reader.NodeType != XmlNodeType.EndElement)
                    {
                        Response.Write("<b>" + reader.Name + "</b>" + "<br/>");
                    }
                    else if (reader.Name.Equals("Name") && reader.NodeType != XmlNodeType.EndElement)
                    {
                        Response.Write("<span style='color:#1884A5'>" + reader.Name + "</span>" + " : ");
                        Response.Write(reader.ReadElementString() + "<br/>");
                    }
             }
    

    If any one with better example… i would appreciate..

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

Sidebar

Related Questions

I'm looking for some good comprehensive reading material on when JavaScript passes something by
I've been running Checkstyle on some code and looking for a good example to
I'm looking for good example of school websites that I can get some inspiration
I'm looking for some good/proven examples of UI designs for a time entry system
I am looking for some good links with best practices and sample code on
I'm looking for some good references for learning how to model 2d physics in
I'm looking for some good ideas for a simple 3d graphics program as my
Looking for good project methodologies.Anyone got some good reference links..want to share.
I'm looking to learn Windows PowerShell. Can someone give me some really good references
I'm currently looking for a good (free) tool to do some PL/SQL development on

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.