Schema to represent large array of numbers

I have some data that looks like this:

1 0.0000 0.0714 0.512 0.383
2 0.0000 0.1538 0.258 0.239
3 0.2500 0.0800 0.256 0.109
4 0.0000 0.1154 0.213 0.132
... ... ... ... ...
365 0.5000 0.0370 0.034 0.012

that I want to put in xml format.

The 'brute force' method would be:

1
0.0714
0.512
0.383
0.0

and so on for 365 days.

Another method would be to have one string per line
4 0.0000 0.1154 0.213 0.132
and then in the code parse the line into numbers.

Each of these 2 methods has advantages/disadvantages.
Are there any other better ways?

Comments

  • : I have some data that looks like this:
    :
    : 1 0.0000 0.0714 0.512 0.383
    : 2 0.0000 0.1538 0.258 0.239
    : 3 0.2500 0.0800 0.256 0.109
    : 4 0.0000 0.1154 0.213 0.132
    : ... ... ... ... ...
    : 365 0.5000 0.0370 0.034 0.012
    :
    : that I want to put in xml format.
    :
    : The 'brute force' method would be:
    :
    : 1
    : 0.0714
    : 0.512
    : 0.383
    : 0.0
    :
    : and so on for 365 days.
    :
    : Another method would be to have one string per line
    : 4 0.0000 0.1154 0.213 0.132
    : and then in the code parse the line into numbers.
    :
    : Each of these 2 methods has advantages/disadvantages.
    : Are there any other better ways?

    Your latter suggestion would make for a smaller file, but rather negates the purpose of using XML in the first place. If all the pertinent values are going to be a single string in your XML that needs to be parsed later, what's the point of using XML instead of the plain file?

    I would do one of the following:

    [code]


    0.0000
    0.0714
    0.512
    0.383

    ...

    [/code]

    Or perhaps:

    [code]


    ...

    [/code]

    As long as the days will always be in numerical order, I don't think you need to include the number in the data.


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

  • : [code]
    :
    :
    : ...
    :
    : [/code]
    I've never seen this before.
    What is the schema code for that?
  • : : [code]
    : :
    : :
    : : ...
    : :
    : : [/code]
    : I've never seen this before.
    : What is the schema code for that?

    I don't know about schemas, this is just basic XML. Any element in XML can have any number of attributes, which are name/value pairs, but the names have to be unique within a single element.

    Like an image tag in HTML:

    image

    The "src" attribute has a value of "foo.jpg".


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

    [code]
    $ select * from users where clue > 0
    no rows returned
    [/code]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories