Monday 4 October 2010

XQJ: binding document or sequence in pipeline

Bad thing from Cocoon / SAX pipeline point of view.
I found no way to bind SAX events effectively. Two options are available:

  • SAXSource - you must buffer events and then send them out on parse() method on XMLReader.
  • Provide StAX stream.

Both require buffering of SAX events, which can be a trouble in case of large XMLs. It kills all the elegancy and small memory foot-print.

An alternative would be to use StAX pipelines, which makes XSLT for example less effective.

I hope I mess something in docs, but...


So I must abandon the idea of using XQJ with C3 and Sedna for a moment, additional reasons: Sedna doesn't support latest XQuery things XQJ is good for and available XQJ implementation has closed source.
I switch back to default Sedna API.

TinyOS smells even better than I suspected : TUnit

#define assertEquals(msg, expected, actual)\
  if ((expected) != (actual)) {\
    assertEqualsFailed(msg, ((uint32_t) expected), ((uint32_t) actual), unique(UQ_ASSERTION));\
  } else {\
    assertSuccess();\
  }


So this is some holiday!
expected and actual are evaluated twice!
If you put this macro inside some if-else without nesting in {} you will get very funny things!


Why not:

#define assertEquals(msg, expected, actual) ({\
uint32_t e = expected;\
uint32_t a = actual;\
  if (a != e) {\
    assertEqualsFailed(msg, e, a, unique(UQ_ASSERTION));\
  } else {\
    assertSuccess();\
  }\
})


Why?!

How to fix it? - use Contiki.