[Home] [By Thread] [By Date] [Recent Entries]
At 02:02 PM 3/5/2005, Bob Foster wrote: >Andrew Jeavons wrote: >>> From your description I'd guess that every verb/attribute combination >>>and interaction has been hardcoded. If so, you might get the best >>>bang for your buck by "acquiring" (training/hiring) someone who can >>>help you re-write your existing XSLT. >>Exactly. Which is totally brain dead. That's what set me on my search for >>the BNF tool. Even with my minimal XSLT knowledge seeing the SAME code >>over and over again made me very worried..... >>The XSLT was done by external contractors, soon to be ex-contractors now >>if I can help it. I know that I can make a parser out of Bison and Flex >>with a fifth or less code >>which will do far more than the XSLT does and be readable (well to me >>anyway....) > >That's what you think you know, but it isn't correct in general. BNF can >only do a surface syntax scan; you'll have to escape to a programming >language to do any sort of semantic check. XSLT is far more powerful. >That's not saying that the contractors' stylesheet actually uses any of >this power, but it's there. Reasonable point. Yes, BNF provides a validity checking mechanism but I still have to write C/C++ or whatever to do anything concrete with the elements I parse. And C et al are not great languages for these kinds of job it is true. >Plus, you seem to be missing this major point: Before you can teach your >BNF to parse your XML application language, you first have to teach it to >parse XML. This is a much bigger PITA than you imagine. Yes and no. When I look at the XML language we have it is very (very) simple, which is why I was aghast it taking 2666 lines of *ANYTHING* (XSLT, C et al) to parse it. And also looking at other systems I've written/worked on that use BNF parsers I'm pretty certain it isn't a huge job. 20+ years of hacking code around...:-) So while I accept your point about XSLT being badly used in this case, I do know for an absolute fact I can write a shorter parser in Bison, but it does seem clear now that the problem isn't so much using XSLT for the parsing as the way it has been done... > The virtue of using existing schema languages is that they already know > how to deal with the ins and outs of XML syntax, so you write grammars > and rules at a much higher level than BNF. Very true. What wasn't clear to me was that systems like XSLT could write higher order grammars. This code was the first XSLT I had seriously looked at and it didn't give a good impression ! >As a parser-aware person, you should find RELAX NG compact syntax easy to >understand and able to express what you need. If there is something you >can't say, you can add Schematron assertions to the same schema. I'd >strongly recommend you check it out. Thanks, I'll check it out, I appreciate the comments/information. andrew >Bob Foster >http://xmlbuddy.com/ > > Andrew Jeavons www.andrewjeavons.com +1 513 871 8278
|

Cart



