-
Challanging Question----How do i represent a matrix schema.
Can anybody suggest me that how do i represent a generic matrix schema.
For now consider it as 2x2 matrix.
c1 c2
r1 100 200
r2 300 400
Data is 100,200,300,400.
it will be better if u can suggest upto any level.ie NxN matrix.
Thanks in Advance
Manish.
-
Re: Challanging Question----How do i represent a matrix schema.
Hi Manish
Long time for me to be out of touch from the forum Guys!
Not much complex man:
Two ways:
1)
<rows>
<row>
<col>100</col>
<col>150</col>
<col>300</col>
..............
</row>
<row>
<col>150</col>
<col>250</col>
<col>230</col>
..............
</row>
.......
</rows>
This way has got the simplicity of having data in a free form - as-it-comes
basis, but drawback of indexing and addressing - you can't access the M[n,m]th
element.
2)
<cells>
<cell row="1" col="1">120</cell>
<cell row="1" col="2">220</cell>
<cell row="1" col="3">300</cell>
<cell row="2" col="1">250</cell>
<cell row="2" col="2">520</cell>
<cell row="2" col="3">100</cell>
<cell row="3" col="1">105</cell>
...
...
..
</cells>
This has the drawback of storage time (somewhat), but a good addressing and
indexing capabilities.
You can have n-number of solutions to it, but don't call them challanging

Rohit
-
Re: Challanging Question----How do i represent a matrix schema.
Hey Rohit,
I am VERY new to XML, so what I'm about to suggest may be way off, but
I thought I'd throw something out there for consideration.
Given the solution you've proposed in your point (2), could that be improved
upon to represent N-dimensional matrices by replacing the "row" and "col"
attributes of your <cell> element with this:
<!ATTLIST cell index NMTOKENS> ??
(I don't have my XML reference at hand...is that syntax correct? I mean an
attribute to the cell element named "index" that holds one or more NMTOKEN
items.)
You could then represent an N-dimensional matrix using cell elements such
as:
<matrix name="demo">
<cell index="3 7 1 1">...</cell>
-
Re: Challanging Question----How do i represent a matrix schema.
Rohit:
Method one works well for me. You could address the
individual elements using the element Indexes of a node list
ie:
set RowIndex = XMLDoc.SelectNodes("//rows[x]")
Set ColIndex = RowIndex.SelectNodes("//col[y]")
Then changing the values of x and y to address the
M(x,y)th element. Not as simple as iterating through
a recordset, but still allowing you to directly access
any given component.
Steve
"Rohit Wason" <rohitw@futuresoftindia.com> wrote:
>
>Hi Manish
>Long time for me to be out of touch from the forum Guys!
>Not much complex man:
>Two ways:
>1)
><rows>
> <row>
> <col>100</col>
> <col>150</col>
> <col>300</col>
> ..............
> </row>
>
> <row>
> <col>150</col>
> <col>250</col>
> <col>230</col>
> ..............
> </row>
> .......
></rows>
>This way has got the simplicity of having data in a free form - as-it-comes
>basis, but drawback of indexing and addressing - you can't access the M[n,m]th
>element.
>
>2)
><cells>
><cell row="1" col="1">120</cell>
><cell row="1" col="2">220</cell>
><cell row="1" col="3">300</cell>
><cell row="2" col="1">250</cell>
><cell row="2" col="2">520</cell>
><cell row="2" col="3">100</cell>
><cell row="3" col="1">105</cell>
>...
>...
>..
></cells>
>This has the drawback of storage time (somewhat), but a good addressing
and
>indexing capabilities.
>
>You can have n-number of solutions to it, but don't call them challanging
>
>Rohit
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks