bahamut8348 / superobject

Automatically exported from code.google.com/p/superobject
0 stars 1 forks source link

Path resolution on TSuperObject #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please review the following results when quoting path expressions that may
or may not include namespace notation.

Test #5 shows the expected results. It would be nice if #3 or #4 produced
the same results, but I'm not sure what the SOT path spec says about pseudo
namespaces. 

I was hoping that quoted or escaped path notation from via the root SO
would work.

--- 1

    str := '{ "ns_h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns_h'];

    iso.AsString => [{"color":"red"},{"color":"blue"}]

--- 2

    str := '{ "ns_h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['"ns_h"'];

    iso.AsString => ns_h

--- 3

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['"ns:h"'];

    iso.AsString => ns:h

--- 4

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns:h'];

    iso => nil

--- 5

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp.AsObject['ns:h'];

    iso.AsString => [{"color":"red"},{"color":"blue"}]

--- 6

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp.AsObject['"ns:h"'];

    iso => nil

--- 7

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns:h[0].color'];

    iso => nil

--- 8

    str := '{ "ns_h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns_h[0].color'];

    iso.AsString => red

--- 9

    str := '{ "ns:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns\:h'];

    iso => nil

--- 10

    str := '{ "ns\:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns\:h'];

    iso => nil

--- 11

    str := '{ "ns\:h": [ { "color": "red" }, { "color": "blue" } ] }';
    resp := SO(str);
    iso := resp['ns:h'];

    iso => nil

Original issue reported on code.google.com by willi...@codics.com on 8 Mar 2010 at 4:35