From: Martin Q. <mar...@lo...> - 2007-10-14 19:54:24
|
Hello William, What I have in mind is a sort of meta-tag, not needing to be specifyied in the DTD. Maybe a better way to express what I meant is to use this kind of notation: [FOREACH[A][list of elements][text to dupplicate]] just the same way we have [CDADAT[text to protect]] or we had the if construct in SGML (can't remember the syntax right now). But that's so awful, that's incredible. Or, you're right, maybe the solution is to do a new generator in the spirit of fleXML, but dedicated to xsl transformations. After all, these tags for kinda interpreting the XML are all part of the XSLT standard. They are a bit verbose in my taste, but that's the way every body does this out there. The name wouldn't even be hard to find: fleXSLT ;) And once it's done, having a bit of xslt embeeded within the xml should be doable, I guess. But before that, I'm more concerned about the missing rules. I know better understand what you said to me about 2 years ago. The parsers never jam nowadays, but the default rule is not very appropriate.=20 My last change set in the code was to have an elegant error message when a starting tag was misplaced. Previous one was somehting like "char '<' found when expecting </mytag>". Now, it's "Starting tag <something> not allowed here". That's a bit better, but I'd like to have both of the information ("Starting tag <something> found when expecting </mytag>"). For this I'll have to explicit much more transitions in the lex file. Now, I do one rule for all states where the tag is not allowed (check lines flexml.pl:1382-1397). But where the hell can I find what each state wants to get further? Those damn data structures are not friendly... Another change direction I'd like to follow is the possible use of schema instead of DTD as input. Shouldn't be hard, and not intrusive either (only parsechildren needs to be changed). Just need some more time ;) Bye, Mt. On Thu, Oct 11, 2007 at 12:48:56PM -0400, William F. Dowling wrote: > Hi Martin, >=20 > This looks like something useful to have, but if I am understanding > correctly, it does not belong in flexml. The reason is that flexml > makes no interpretation of any tag or attribute name. But you are > proposing that > 1) the 'foreach' tag now has a specific meaning; > 2) the 'variable' and 'values' attribute of the 'foreach' tag has a > specific meaning. >=20 > These thing will be surprising to someone expecting flexml to be an XML > parser-generator, as we currently say. >=20 > Some questions: >=20 > What if my DTD does not have > <!ELEMENT foreach ...> >=20 > Or are you saying that *if* my DTD has > <!ELEMENT foreach (plop)*> > <!ATTLIST foreach > variable CDATA #REQUIRED > values CDATA #REQUIRED> >=20 > *then* flexml will interpret a document as you indicated? >=20 > Or, suppose my DTD has > <!ELEMENT foreach (plop)*> > <!ATTLIST foreach > variable CDATA #IMPLIED > values CDATA #IMPLIED> >=20 > what should flexml do? >=20 > Or, suppose my DTD has > <!ELEMENT foreach (plop)*> > <!ATTLIST foreach > variable NMTOKEN #REQUIRED > values CDATA #IMPLIED> >=20 > what should flexml do? >=20 > Even if you specify the requirement on the DTD quite tightly, the result > will be very surprising to somebody who just wants an XML parser. >=20 > I think your proposal would move flexml from being a parser to being an > interpretter or parser+interpretter, which would make it harder to > document (describe), debug, and understand. >=20 > Maybe some of the flexml codebase could be used to create an xml > interpretter (I actually like your idea in the specific case of > 'foerach', but other constructs could also be easily imagined). Then we > would might want to refactor out some common parts between the parser > and the interpreter. >=20 > Will >=20 >=20 > On Thu, 2007-10-11 at 17:11 +0200, Martin Quinson wrote: > > Hello, > >=20 > > I was thinking about implementing a foreach tag able to multiplicate > > the xml. > >=20 > > For example, having the following in the file: > > <foreach variable=3D"i" values=3D"1 2 3 4"> > > <plop key=3D"$i" /> > > </foreach> > > would be equivalent to having the following: > > <plop key=3D"1" /> > > <plop key=3D"2" /> > > <plop key=3D"3" /> > > <plop key=3D"4" /> > >=20 > > It's somehow close to xsl transformation, but it would be embeeded > > directly in the XML, not in a separate file. Also, the syntax would be > > a bit different. > >=20 > > I have ideas about how to implement the beast, I was just wondering > > whether having this in flexml (maybe enabled by a command-line option) > > was ok for you guys, or if it was too specific to my own needs to be > > placed in the main tree. > >=20 > > Bye, Mt. > >=20 > > -----------------------------------------------------------------------= -- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ FleXML-Users mailing li= st Fle...@li... https://lists.sourceforge.net/lists/l= istinfo/flexml-users > --=20 > William F Dowling > wil...@th... > www.scientific.thomson.com --=20 In the future, don't waste your time writing articles manually.=20 Use a generator such as http://pdos.csail.mit.edu/scigen/ to ensure they are funny, if not instructive. -- Bastard Reviewer From the Hell |