Followup: You have a Dtd2Haskell tool, but DTDs are very inexpressive and the result is string based types.
Is there a tool for converting e.g. relaxNG into haskell types? Then we get direct support for e.g. doubles or URLs. I know there is a relaxNG validator written in haskell, but that is not the same thing... -Alex- http://www.thaiopensource.com/relaxng/derivative.html On Thu, 28 Oct 2004, Malcolm Wallace wrote: > "S. Alexander Jacobson" <[EMAIL PROTECTED]> writes: > > > Is there a good entry point into HaXml? > > I've now spent some time trying to understand it > > and feel like I've gotten nowhere. > > It is a large package with many diverse facilities, so I'm not > surprised. I take it you have read the ICFP'99 paper linked to from > the HaXml webpage? To give a fuller answer, it would be helpful to > know more about your specific XML needs. > > > The Haddock documentation enumerates what each > > function does, but I still don't know how to > > produce a valid XML document? > > Where does your document come from? Has it been parsed already, > then manipulated, and you want to spit it out again? Or are you > trying to generate a fresh document from nothing? Or perhaps you > have some existing Haskell data-structure you want to convert to XML > for external representation only? > > > For example, this is obviously the wrong way to > > go: > > > > simp2 = document $ Document (Prolog Nothing [] Nothing []) [] $ > > Elem "root" [("attr",AttValue [Left "v\"al"])] > > [CString False "<<<<<>>&&&"] > > > > Because, it produces the obviously wrong: > > > > <root attr="v"al"><<<<<>>&&&</root> > > Ah. Escaping of special characters within text is a separate > issue. It need only be done once, just before output. > See Text.XML.HaXml.Escape - specifically you want something like > > simp2 = document $ Document (Prolog Nothing [] Nothing []) [] $ > xmlEscape stdXmlEscaper $ > Elem "root" [("attr",AttValue [Left "v\"al"])] > [CString False "<<<<<>>&&&"] > > > I assume/hope that the combinators properly > > encode/escape attribute values and CDATA, > > No, at the moment they don't. You can always do it one-shot at the > end, as in the example above, although it would probably be better > from a correctness point of view if the combinators did as you suggest. > > > And once I've done so, is there a way to put PIs > > in via the combinators > > Currently, there are no combinators specifically for generating PIs > (simply because no-one has asked for them before), but it would be > extremely easy to add. For instance: > > mkPI :: String -> String -> CFilter > mkPI pitarget str = \t-> [ CMisc (PI (pitarget,str)) ] > > Regards, > Malcolm > ______________________________________________________________ S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
