Re: [xml] most simple example code for xmllib (for real beginners)



On Fri, Apr 12, 2002 at 10:47:34AM +0200, Andre Krause wrote:
dear xmllib developers,
i have written (better modified your "real example" gjobs) a most simple example program how to load xml 
data with libxml. i think my example is a little more understandable for real beginners. maybe the code 
needs some more comments, what do you think ?
greetings from germany!
(code also avaiable under www.andre-krause.net/xml )

-------schnipp ----------------------------------

<?xml version="1.0"?> 
<root>
      <matrix>
              <r>     <c>1.2</c>      <c>3.5</c>      <c>-1.2</c> </r>
              <r>     <c>2.4</c>      <c>1.9</c>      <c>11.8</c> </r>
              <r>     <c>-4.7</c>     <c>6.5</c>      <c>-0.6</c> </r>
      </matrix>


Just one small comment :
I would use <e> (element) instead of <c>. It is not really a column.
Doing this you could also store the transposed matrix just by exchanging
rows and columns.
It might also be a good idea to add a index attribute to <r>, <c>, and
<e> (lets think of sparse matrices):

<matrix default="0">
        <r index="1"> <e index="1">1.0</e> </r>
        <r index="2"> <e index="2">1.0</e> </r>
</matrix>

==

  1  0
 
  0  1
 

This would also show the handling of attributes.


I did not check all the code but this seems to be nice.


Cheers,
Henning



-- 
Henning Follmann          |   hfollmann itcfollmann com
it consulting             |  http://www.itcfollmann.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]