From: Phlip <phl...@gm...> - 2007-01-02 06:34:41
|
> > sauce = "--- !map > > - a: > > - !omap > > - sku : BL394D > > - quantity : 4 > > - description : Basketball > > - b: two" > > o = YAML::parse(sauce) > > p o.emit > How close is YPath to working there? '/a/sku' should work, right? I got this to work: assert_equal 'BL394D', o.select('/0/a/0/0/sku')[0].value The technical problem is I can't tell if it follows the chain of Seq and Map objects that represent the OMap, or if there are too many redundant /0 segments. The esthetic problem is I'm trying to write a paper, and I need to show low-level elegance here. Curiously, '//a//sku' works correctly! I will proceed with that tweak... -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!! |