[Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Arun Suresh

Hi..

I am currently working on a project where basically we do a lot of XML
validation and digestion. For example :
We recieve an XML document A, if the document passes schema validation, we
do some business level validations, then from A, we create XML digests B, C
and D.
Our code-base is written completely in Java. We had earlier tried using
XSLT, but it became too unwieldy to manage (we ended up making calls to
other Java classes from the XSLT engine)

The problem we are facing right now is that we have huge hierarchies of
Validators, Digestors and Contexts. It just doesnt look right. I just cant
help but wonder if theres a better way of doing this...

I have been trying to get my hands dirty with Haskell for a couplo weeks
now. all the while keeping the problem at hand in the back of my mind.. I
just dont seem to be see how applying functional programming concepts can
help in this scenario.. Was wondering if somebody could probably give me
some pointers..

Regards
Arun
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Duncan Coutts
On Thu, 2007-03-22 at 14:04 +0530, Arun Suresh wrote:

 I am currently working on a project where basically we do a lot of XML
 validation and digestion. For example :
 We recieve an XML document A, if the document passes schema
 validation, we do some business level validations, then from A, we
 create XML digests B, C and D. 
 Our code-base is written completely in Java. We had earlier tried
 using XSLT, but it became too unwieldy to manage (we ended up making
 calls to other Java classes from the XSLT engine)
 
 The problem we are facing right now is that we have huge hierarchies
 of Validators, Digestors and Contexts. It just doesnt look right. I
 just cant help but wonder if theres a better way of doing this... 

You're not the only one.

 I have been trying to get my hands dirty with Haskell for a couplo
 weeks now. all the while keeping the problem at hand in the back of my
 mind.. I just dont seem to be see how applying functional programming
 concepts can help in this scenario.. Was wondering if somebody could
 probably give me some pointers.. 

Chet Murthy gave a talk on this topic at POPL this year:

Advanced Programming Languages in Enterprise Software: A
lambda-calculus theorist wanders into an enterprise datacenter

The slides of the talk are available though sadly you don't get Chet's
entertaining commentary.

www.classes.cs.uchicago.edu/archive/2007/winter/51091-1/papers/Murthy-popl07.pdf

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Andrew Wagner

Hi Arun,
Your problem description seems a little vague - which is
understandable, considering how embedded in your business model it is.
As for general recommendations, I'm no guru, but I would suggest
looking at the existing XML libraries in Haskell [1], and if that's
not powerful enough, check out parsec[2] for building a custom parser.
I think to get more specific recommendations, you would need to give
more details about the problem. Hope this helps somewhat. Andrew

[1]: 
http://www.haskell.org/haskellwiki/Libraries_and_tools/Web_programming#XML_2
[2]: http://www.cs.uu.nl/people/daan/download/parsec/parsec.html


On 3/22/07, Arun Suresh [EMAIL PROTECTED] wrote:

Hi..

I am currently working on a project where basically we do a lot of XML
validation and digestion. For example :
We recieve an XML document A, if the document passes schema validation, we
do some business level validations, then from A, we create XML digests B, C
and D.
Our code-base is written completely in Java. We had earlier tried using
XSLT, but it became too unwieldy to manage (we ended up making calls to
other Java classes from the XSLT engine)

The problem we are facing right now is that we have huge hierarchies of
Validators, Digestors and Contexts. It just doesnt look right. I just cant
help but wonder if theres a better way of doing this...

I have been trying to get my hands dirty with Haskell for a couplo weeks
now. all the while keeping the problem at hand in the back of my mind.. I
just dont seem to be see how applying functional programming concepts can
help in this scenario.. Was wondering if somebody could probably give me
some pointers..

Regards
Arun






___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Chris Eidhof
Don't spend too much time on the various libraries though. I tried  
some simple things with Haskell and XML, but I found it really hard  
to actually parse a simple document. You really don't want to write  
your own parser.


The only tool that worked for me was HXT, which is based on arrows.  
These are pretty hard to grasp right away, but really powerful. I  
really like the way they are used in HXT, but it still feels a bit  
weird sometimes.


Good luck, and keep us posted.

-chris

On Mar 22, 2007, at 7:52 AM, Andrew Wagner wrote:


Hi Arun,
Your problem description seems a little vague - which is
understandable, considering how embedded in your business model it is.
As for general recommendations, I'm no guru, but I would suggest
looking at the existing XML libraries in Haskell [1], and if that's
not powerful enough, check out parsec[2] for building a custom parser.
I think to get more specific recommendations, you would need to give
more details about the problem. Hope this helps somewhat. Andrew

[1]: http://www.haskell.org/haskellwiki/Libraries_and_tools/ 
Web_programming#XML_2

[2]: http://www.cs.uu.nl/people/daan/download/parsec/parsec.html


On 3/22/07, Arun Suresh [EMAIL PROTECTED] wrote:

Hi..

I am currently working on a project where basically we do a lot of  
XML

validation and digestion. For example :
We recieve an XML document A, if the document passes schema  
validation, we
do some business level validations, then from A, we create XML  
digests B, C

and D.
Our code-base is written completely in Java. We had earlier tried  
using
XSLT, but it became too unwieldy to manage (we ended up making  
calls to

other Java classes from the XSLT engine)

The problem we are facing right now is that we have huge  
hierarchies of
Validators, Digestors and Contexts. It just doesnt look right. I  
just cant

help but wonder if theres a better way of doing this...

I have been trying to get my hands dirty with Haskell for a couplo  
weeks
now. all the while keeping the problem at hand in the back of my  
mind.. I
just dont seem to be see how applying functional programming  
concepts can
help in this scenario.. Was wondering if somebody could probably  
give me

some pointers..

Regards
Arun






___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] XML Validation and Digestion in Haskell

2007-03-22 Thread Chris Eidhof

Hey Aron,

I think you intended to CC Haskell Café as well. HaXml has support  
for DtdToHaskell, but HXT supports validating with a Relax NG  
validator. I guess the best way to figure it out is thoroughly read  
the documentation.


-chris

On Mar 22, 2007, at 10:40 PM, Arun Suresh wrote:


thanks for the feedback you guyz..

First off.. I went through the HaXml documentation.. It looks  
pretty promising..
and as far as HXT is concerned.. I guess ill be spending the  
weekend grappling with the concept of Arrows and monads in general :)


I dont know if HXT or HaXml offers it.. but I was wondering if  
either of them provides some sort of schema compilation facility..  
(a la XmlBeans.. for those from the Java world).. basically I was  
wondering if given an XML schema, is there a utility that will  
generate a Haskell type hierarchy from the same ??


regards
Arun


On 3/23/07, Chris Eidhof  [EMAIL PROTECTED] wrote:Don't spend too  
much time on the various libraries though. I tried

some simple things with Haskell and XML, but I found it really hard
to actually parse a simple document. You really don't want to write
your own parser.

The only tool that worked for me was HXT, which is based on arrows.
These are pretty hard to grasp right away, but really powerful. I
really like the way they are used in HXT, but it still feels a bit
weird sometimes.

Good luck, and keep us posted.

-chris

On Mar 22, 2007, at 7:52 AM, Andrew Wagner wrote:

 Hi Arun,
 Your problem description seems a little vague - which is
 understandable, considering how embedded in your business model  
it is.

 As for general recommendations, I'm no guru, but I would suggest
 looking at the existing XML libraries in Haskell [1], and if that's
 not powerful enough, check out parsec[2] for building a custom  
parser.

 I think to get more specific recommendations, you would need to give
 more details about the problem. Hope this helps somewhat. Andrew

 [1]: http://www.haskell.org/haskellwiki/Libraries_and_tools/
 Web_programming#XML_2
 [2]: http://www.cs.uu.nl/people/daan/download/parsec/parsec.html


 On 3/22/07, Arun Suresh  [EMAIL PROTECTED] wrote:
 Hi..

 I am currently working on a project where basically we do a lot of
 XML
 validation and digestion. For example :
 We recieve an XML document A, if the document passes schema
 validation, we
 do some business level validations, then from A, we create XML
 digests B, C
 and D.
 Our code-base is written completely in Java. We had earlier tried
 using
 XSLT, but it became too unwieldy to manage (we ended up making
 calls to
 other Java classes from the XSLT engine)

 The problem we are facing right now is that we have huge
 hierarchies of
 Validators, Digestors and Contexts. It just doesnt look right. I
 just cant
 help but wonder if theres a better way of doing this...

 I have been trying to get my hands dirty with Haskell for a couplo
 weeks
 now. all the while keeping the problem at hand in the back of my
 mind.. I
 just dont seem to be see how applying functional programming
 concepts can
 help in this scenario.. Was wondering if somebody could probably
 give me
 some pointers..

 Regards
 Arun






 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe