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 & 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??
Best Answer
Found that
XmlReader
is read-only and forward-only. so used thisIf any one with better example... i would appreciate..