XML Schema support

Martin Bjorklund <>
Wed Jan 11 10:41:17 CET 2006


Willem de Jong <> wrote:
> As I said, I would welcome your feedback:
> - do you think this might be of use

Yes!

> Then executing:
> Model = erlSom:compile(XSD, {"b", "http://www.example.com/PO1"}),
> erlSom:parse(XML, Model).
> 
> Will give you:
> {'b:PurchaseOrderType',"1999-10-20",
>                        {'b:USAddress',"US","Alice Smith","123 Maple Street"},
>                        {'b:USAddress',"US","Robert Smith","8 Oak Avenue"},
>                        "Hurry, my lawn is going wild"}

Just one small suggestion - instead of representing types as atoms
<nsprefix>:<name>, I suggest you represent it as a tuple
{NameSpace,Name}.  NameSpace could very well be the full URN as an
atom.  This makes it much easier for an application to actually use
the output and match on different elements.  Thus instead of
'b:USAddress', you would get
{'http://www.example.com/PO1','USAddress'}.

Do you generate reccord definitions also as part of the compilation?



/martin



More information about the erlang-questions mailing list