Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / November 2007

Tip: Looking for answers? Try searching our database.

How to read this XML file ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sagaert Johan - 26 Nov 2007 07:02 GMT
Hi

I want to put the data from this xml file into a dataset
How can i do that , i tried XmlTextReader without luck

Johan

<?xml version = "1.0" ?>
<?xml:stylesheet type="text/xsl" href="Bill of Materials-PCB_Project1.xsl"?>
<!DOCTYPE GRID [
 <!ELEMENT GRID (BANDS, COLUMNS, ROWS*)>
 <!ATTLIST GRID ExportVersion CDATA #REQUIRED>
 <!ELEMENT BANDS (BAND*)>
 <!ELEMENT BAND EMPTY>
 <!ATTLIST BAND Index CDATA #REQUIRED>
 <!ATTLIST BAND Caption CDATA #IMPLIED>
 <!ELEMENT COLUMNS (COLUMN*)>
 <!ELEMENT COLUMN EMPTY>
 <!ATTLIST COLUMN Name CDATA #REQUIRED>
 <!ATTLIST COLUMN Caption CDATA #IMPLIED>
 <!ATTLIST COLUMN Index CDATA #REQUIRED>
 <!ATTLIST COLUMN BandIndex CDATA #REQUIRED>
 <!ATTLIST COLUMN RowIndex CDATA #REQUIRED>
 <!ATTLIST COLUMN ColIndex CDATA #REQUIRED>
 <!ATTLIST COLUMN Width CDATA #IMPLIED>
 <!ELEMENT GROUP (GROUP*, ROW*)>
 <!ATTLIST GROUP GroupText CDATA #IMPLIED>
 <!ELEMENT ROWS (ROW*)>
 <!ELEMENT ROW EMPTY>
 <!ATTLIST ROW MainGridColumn8 CDATA #IMPLIED>
 <!ATTLIST ROW MainGridColumn16 CDATA #IMPLIED>
 <!ATTLIST ROW MainGridColumn17 CDATA #IMPLIED>
 <!ATTLIST ROW MainGridColumn29 CDATA #IMPLIED>
 <!ATTLIST ROW MainGridColumn39 CDATA #IMPLIED>
 <!ATTLIST ROW MainGridColumn56 CDATA #IMPLIED>
 <!ATTLIST ROW MainGridColumn15 CDATA #IMPLIED>
 <!ATTLIST ROW MainGridColumn36 CDATA #IMPLIED>
 <!ATTLIST ROW MainGridColumn52 CDATA #IMPLIED>
]>
<GRID ExportVersion="1.0">
 <BANDS>
   <BAND Index="0" Caption=""></BAND>
 </BANDS>
 <COLUMNS>
   <COLUMN Name="MainGridColumn8" Caption="Comment" Index="0" BandIndex="0"
RowIndex="0" ColIndex="0" Width="100"></COLUMN>
   <COLUMN Name="MainGridColumn16" Caption="Description" Index="1"
BandIndex="0" RowIndex="0" ColIndex="1" Width="100"></COLUMN>
   <COLUMN Name="MainGridColumn17" Caption="Designator" Index="2"
BandIndex="0" RowIndex="0" ColIndex="2" Width="100"></COLUMN>
   <COLUMN Name="MainGridColumn29" Caption="Footprint" Index="3"
BandIndex="0" RowIndex="0" ColIndex="3" Width="100"></COLUMN>
   <COLUMN Name="MainGridColumn39" Caption="LibRef" Index="4" BandIndex="0"
RowIndex="0" ColIndex="4" Width="100"></COLUMN>
   <COLUMN Name="MainGridColumn56" Caption="Quantity" Index="5"
BandIndex="0" RowIndex="0" ColIndex="5" Width="100"></COLUMN>
   <COLUMN Name="MainGridColumn15" Caption="deel" Index="6" BandIndex="0"
RowIndex="0" ColIndex="6" Width="100"></COLUMN>
   <COLUMN Name="MainGridColumn36" Caption="levid" Index="7" BandIndex="0"
RowIndex="0" ColIndex="7" Width="100"></COLUMN>
   <COLUMN Name="MainGridColumn52" Caption="prijs" Index="8" BandIndex="0"
RowIndex="0" ColIndex="8" Width="100"></COLUMN>
 </COLUMNS>
 <ROWS>
   <ROW MainGridColumn8="Res1" MainGridColumn16="Resistor"
MainGridColumn17="R1&#34;" MainGridColumn29="axial" MainGridColumn39="Res1"
MainGridColumn56="1" MainGridColumn15="10K" MainGridColumn36="aty"
MainGridColumn52="10"></ROW>
   <ROW MainGridColumn8="Res1" MainGridColumn16="Resistor"
MainGridColumn17="R2" MainGridColumn29="AXIAL-0.3" MainGridColumn39="Res1"
MainGridColumn56="1" MainGridColumn15="" MainGridColumn36=""
MainGridColumn52=""></ROW>
   <ROW MainGridColumn8="aviaa" MainGridColumn16="Resistor"
MainGridColumn17="R3" MainGridColumn29="axial" MainGridColumn39="Res1"
MainGridColumn56="1" MainGridColumn15="22K" MainGridColumn36="farn"
MainGridColumn52="25"></ROW>
   <ROW MainGridColumn8="Res1" MainGridColumn16="Resistor"
MainGridColumn17="R4" MainGridColumn29="AXIAL-0.3" MainGridColumn39="Res1"
MainGridColumn56="1" MainGridColumn15="" MainGridColumn36=""
MainGridColumn52=""></ROW>
   <ROW MainGridColumn8="47K" MainGridColumn16="Resistor"
MainGridColumn17="R45" MainGridColumn29="AXIAL-0.3" MainGridColumn39="Res1"
MainGridColumn56="1" MainGridColumn15="" MainGridColumn36=""
MainGridColumn52=""></ROW>
   <ROW MainGridColumn8="27C512" MainGridColumn16=""
MainGridColumn17="U&#63;" MainGridColumn29="DIP-28"
MainGridColumn39="27C512" MainGridColumn56="1" MainGridColumn15="10K"
MainGridColumn36="aty" MainGridColumn52="10"></ROW>
 </ROWS>
</GRID>
Michael Nemtsev [MVP] - 26 Nov 2007 08:01 GMT
Hello Sagaert,

What did you try and where you failed?

---
WBR,
Michael  Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour 

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

SJ> I want to put the data from this xml file into a dataset How can i
SJ> do that , i tried XmlTextReader without luck
SJ>
Peter Bromberg [C# MVP] - 26 Nov 2007 12:47 GMT
DataSet ds = new DataSet();
ds.ReadXml(System.Environment.CurrentDirectory + @"\XmlFile1.xml");
--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com

> Hi
>
[quoted text clipped - 86 lines]
>   </ROWS>
> </GRID>
Sagaert Johan - 26 Nov 2007 15:28 GMT
Hi

it complains
The ':' character, hexadecimal value 0x3A, cannot be included in a name.
Line 2, position 6.

Maybe the XML does not follow the rules of the game...

> DataSet ds = new DataSet();
> ds.ReadXml(System.Environment.CurrentDirectory + @"\XmlFile1.xml");
[quoted text clipped - 103 lines]
>>   </ROWS>
>> </GRID>
Martin Honnen - 26 Nov 2007 15:39 GMT
> it complains
> The ':' character, hexadecimal value 0x3A, cannot be included in a name.
> Line 2, position 6.
>
> Maybe the XML does not follow the rules of the game...

Yes, you need <?xml-stylesheet instead of <?xml:stylesheet you have below:

>>> <?xml:stylesheet type="text/xsl" href="Bill of
>>> Materials-PCB_Project1.xsl"?>

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.