Profil von Uni EraThe Unified EraBlogListen Extras Hilfe

Blog


    About ecmax.xobj

    A sub project, 'xobj', as part of project ecmax, is in development right now. Its goal is to implement a simple set of XmlCursor api like Apache XmlBeans.

    The ecmax.xobj project is based on the Streaming API for Xml(StAX) and its open source RI from BEA.


    Switching to DOM from xmlBeans

    ecmax's e4x impl is replaced with a dom-based impl delivered by David Caldwell. Now, the speed is at least 50% faster than before, the size of release package is smaller than half of the old one which contains even a simplified xmlBeans impl.

    Change log of ecmax:
    -----------------------------------------------
     1, 'like' expr.
     2, big decimal instead of double.
     3, defered xml and joint xml
     4, xml + number redefined.
     5, xml.idx_from_1 expr for xml.
     6, xml.ns:name expr for xml.
    -7, change summary for xml.

    New Changes

    The pervious proposal of ecmax.change was disposed, and the idea about sequence change(whole updated once its length changed) is also removed.

    To prepare to suggest the new proposal, one new promotion for e4x has been done in ecmax to support elements-accessing via 'xml.index_form_1' style.

    It's remarkable that the 'a.1' expression in ecmax is not equal to the same expression but the 'a[1]' expression in xpath or sdo.

    It's notable also that the new promotion has no side-effect upon
    the specifications about DecimalLiteral at chapter 7.8.3 of ecma-262.

    Finally, for example:

    x = <a><aa>bbb</aa></a>;

    print(x.1.toXMLString());  // x.1 is equivalent to x[0]
    print(x[0].toXMLString());
    print(1.+.2);              // equivalent to 1.0+0.2

    ------------------------------------------------------------------
    System.out - <a>
      <aa>bbb</aa>
    </a>
    System.out - <a>
      <aa>bbb</aa>
    </a>
    System.out - 1.2

    Sophisticated Change Tracing

    x = <a id="1" value="a" lock='true'>
      text in a.
      <b id='b1' value='b'>text in b</b>
      string in a.
      <c id='b1'>text in c</c>
    </a>;
    x = new SDO(x);

    x.@id = 2;
    delete x.@value;
    x.@name='A';
    x.b.* = 'new text in b.';
    x.b.c.@a = 'ca';             // cause element <c> created.
    x.b.@name='b';
    x.b.@id='b2';
    x.*[3] = 'new string in a.'; // cause length of x.* changed.
    x.*[3] = <bd>aaaa</bd>;
    x.*[3] = '<dd>
    eeeeeeee</dd>';
    //delete x.*[3];

    print(x);

    ------------------------------------------------------------------

    logUpdate(N'.@id', 2, L'1') called.
    logDelete(N'.@value', L'a') called.
    logCreate(N'.@name', 'A') called.
    logUpdate(N'.b.*', 'new text in b.', L'text in b') called.
    logCreate(N'.b.c', L'') called.
    logCreate(N'.b.c.@a', 'ca') called.
    logCreate(N'.b.@name', 'b') called.
    logUpdate(N'.b.@id', 'b2', L'b1') called.
    logUpdate(N'.*', L{3}, L{4}) called.
    logCreate(N'.*.3', X'aaaa') called.
    logUpdate(N'.*.3', '<dd>eeeeeeee</dd>', X'aaaa') called.

    System.out - <a id="2" lock="true" name="A">
      text in a.
      <b id="b2" value="b" name="b">
        new text in b.
        <c a="ca"/>
      </b>
      string in a.new string in a.
      <dd>eeeeeeee</dd>
    </a>


    Note: in ecmax.sdo, if a sequence's length has been changed by some operation(but not append() operation, updated at 2007-4-16), it must be marked whole updated, instead of marking the changed element(s) within this sequence.

    Differences between .[] and .()


    Q: A new filter operator .[] has been introduced into E4X in ecmax to coexist with the old filter .(), but what's the difference between them?

    A: Generally in the two aspects:

    1, when applied to common xml object, .[] behaves as the same as .(), and the extended syntax in .[] does no effect.

    2, when applied to deferred xml object, .[] returns the same deferred xml object with internal changes, but .() may return a newer xml object or changes it 'instant' from defered.