[Haskell-cafe] hxt: How to Unpickle Multiple Adjacent Elements

Jimmy Lu gongchuo.lu at gmail.com
Sun Jan 4 23:15:28 UTC 2015


With xml element having DTD like following:

    <!ELEMENT entry ((art*, formula?, table?), hw, hsl?, (pr | altpr)?, (ahw, hsl?, (pr | altpr)?)*, vr?, fl?, lb*, in*, ((dx) | (cx?, def?))?, dro*, dxnl*, uro*, syns*)>

I want to unpickle the sequence

    hw, hsl?, (pr | altpr)?, (ahw, hsl?, (pr | altpr)?)*

into Haskell data type [Headword] where

    data Headword = Hw { hwText       :: String
                       , hwSl         :: Maybe String
                       , hwPr         :: Maybe Pronunciation

However in the hxt pickle API I cannot found a way to extract a sequence
of adjacent elements.  Is there any one knowing how to do it?


Jimmy Lu

More information about the Haskell-Cafe mailing list