Re: I'm wondering if this would be the proper application of XML, XSD and a datagrid
From: James (j_at_j.net)
Date: 09/20/04
- Next message: Zephryn Xirdal: "Re: żBug en el editor del VS NET 2003?"
- Previous message: Zephryn Xirdal: "żBug en el editor del VS NET 2003?"
- In reply to: Baavgai: "Re: I'm wondering if this would be the proper application of XML, XSD and a datagrid"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 20 Sep 2004 16:46:59 -0400
Thank's this was alot of help, I've answered inline.
"Baavgai" <brettmc@gmail.com> wrote in message
news:1095521375.765636.100290@k26g2000oda.googlegroups.com...
> While this does lend itself to a relational database model, it's also a
> perfectly acceptable XML design.
>
I was debating storing this data in the database with like a StoreMaster
table and a StoreBooks table but I want(ed) to learn about storing it in XML
files and reading them in to datasets and what role the XSD plays in all of
this.
Let's say there are 1000 stores with various amounts of books. I wouldn't
store this in one big file but rather several small files. I may still go
back to the database but I'm learning alot about XML and XSD right now.
> For a Microsoft DataSet, I'd actually opt for version one. It will be
> easier to manipulate in code. If you plan on having more than one
> store, I'd try something like this:
>
> <Stores>
> <Store Name="My Book Store">
> <Phone>555-555-5555</Phone>
> <Book book_id="1"><Title>Thermodynamics
> Unleashed</Title><Price>56.00</Price></Book>
> <Book book_id="2"><Title>CAD
> CAM</Title><Price>72.00</Price></Book>
> <Book book_id="3"><Title>Machine
> Design</Title><Price>56.00</Price></Book>
> </Store>
> </Stores>
>
> If there's really only one store, this might work better for you:
> <Store>
> <StoreInfo>
> <Name>My Book Store</Name>
> <Phone>555-555-5555</Phone>
> </StoreInfo>
> <Book book_id="1"><Title>Thermodynamics
> Unleashed</Title><Price>56.00</Price></Book>
> <Book book_id="2"><Title>CAD CAM</Title><Price>72.00</Price></Book>
> <Book book_id="3"><Title>Machine
> Design</Title><Price>56.00</Price></Book>
> </Store>
>
> Once you have your design the way you like it, use xsd.exe to make an
> instant xsd from it, e.g.
> xsd store.xml ( produces store.xsd, all read to go in a VS.NET project
> ) More info here:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpconXMLSchemaDefinitionToolXsdexe.asp
>
> Fire up VS.NET ( which I'm hoping you have, else run and get C#
> Express, it's a good IDE and free while in beta ). In your project,
> include your .xsd. In the visual thing, tell it book_id is the primary
> key of book. Of you don't have this toy, the following in the DataSet
> element of source will do the same: <xs:unique name="BookKey1"
> msdata:PrimaryKey="true"><xs:selector xpath=".//Book" /><xs:field
> xpath="@book_id" /></xs:unique>
>
> Now, when you play with your typed DataSet, you should be able to do
> something like dataSet.Book.FindBybook_id(2) to grab specific book.
>
> Hope this helps,
> Brett
Yes I have VS.net. Thanks it was a help, the big picture is becoming clearer
now
>
> James wrote:
> > Hi I'm James Newbie
> >
> > I'm going to use some xml from a previous posters because it's
> similiar to
> > mine
> >
> > <Store>
> > <Name> My Book Store</Name>
> > <Phone> 555-555-5555 </Phone>
> > <Book id="1" >
> > <Title>Thermodynamics Unleashed</Title>
> > <Price>56.00</Price>
> > </Book>
> > <Book id="2" >
> > <Title>CAD CAM</Title>
> > <Price>72.00</Price>
> > </Book>
> > <Book id="3" >
> > <Title>Machine Design</Title>
> > <Price>56.00</Price>
> > </Book>
> > </Store>
> >
> >
> > I was thinking of this instead
> >
> > <Store>
> > <Name> My Book Store</Name>
> > <Phone> 555-555-5555 </Phone>
> > <Books>
> > <Book id="1" >
> > <Title>Thermodynamics Unleashed</Title>
> > <Price>56.00</Price>
> > </Book>
> > <Book id="2" >
> > <Title>CAD CAM</Title>
> > <Price>72.00</Price>
> > </Book>
> > <Book id="3" >
> > <Title>Machine Design</Title>
> > <Price>56.00</Price>
> > </Book>
> > </Books>
> > </Store>
> >
> > Actually I was also thinking of this and the only advantage I can see
> (which
> > may not be one) is that when reading from an XMLDocument I can grab
> the
> > entire Books node and do what I need to.
> >
> > I'm starting to read about reading XML into a dataset using a schema
> and I'm
> > not sure how this example can work. When I think about a dataset I'm
> > thinking a big square shaped structure with rows and columns. Now the
> above
> > xml is not square so first that confuses me and I think this is where
> the
> > schema comes into play.
> >
> > Does the schema assist the data set and say for example put the Name
> and
> > Phone over here and then take all the books and keep them in a table?
> If
> > that is true would I be able to have a form that has two edit boxes,
> one for
> > Name and the other for Phone then a separate datagrid which would
> list all
> > the books?
> >
> > Any answers, thoughts, examples or otherwise are highly
> appreciated!!! I'm
> > reading about all of this and the examples say this is how you read
> an xml
> > file and this is how you read a schema but I'm not seeing some of the
> > details.
> >
> > Thanks alot!!!
> > James
>
- Next message: Zephryn Xirdal: "Re: żBug en el editor del VS NET 2003?"
- Previous message: Zephryn Xirdal: "żBug en el editor del VS NET 2003?"
- In reply to: Baavgai: "Re: I'm wondering if this would be the proper application of XML, XSD and a datagrid"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|