in reply to Re: the axml parser v3.4
in thread the axml parser v3.4

Re : Grandfather; thanks I will look into those suggestions in my next verion!

Re : glory hack; thanks for the constructive part of the critiscm, however imho posting ameture code makes a person look like they are willing to learn something new, saying someone looks a like a dork for being a begginer makes a person look like a snob... whilst I'm sure your perl coding could make mark j dominus look like a noob, manners are universal Sir.

Re : Jenda, i found that using the ( ) and other such chars caused my regex's to fail, and after many frustrating hours trying to figure out why that is, i decided on the solution you see here.

I wasn't intending this post to be some sort of statement of programming prowess, I needed some info on capturing data from a given url and the resulting conversation on the chatter box prompted me to share this code. I'm fully aware its both ameture and in need of a lot of work, and thanks to some of the more mature responses here I have some directions in which to take it.

The code aside, I still think the aim of aXML is valid and worthy of being understood. The ability to nest xml tags which correspond to plugins gives a freedom of expression which makes my development work so much easier.

Sticky forms are a snip with axml, if for instance the user makes a mistake and you have to show the same form back to them with the values filled in you can simply nest a <qd> tag in the input tag :

<input type="text" name="username"><qd>username</qd></input>

Its possible to build tags on the fly;
action.pl?gettype=html

<<qd>gettype</qd>>
</<qd>gettype</qd>>
would resolve to the tag <html> and its close </html>

alsorts of behaviours become possible, im only just scratching the surface of what this parser can do yet, ok its weird its a bit left of feild, but it has its novelties and good points... it would be a shame to simply overlook the fine points because my perl coding is not perfect.

Many thanks.

Replies are listed 'Best First'.
Re^3: the axml parser v3.4
by jdporter (Paladin) on Apr 13, 2007 at 16:04 UTC

    I strongly recommend that you separate out the parser into its own, reusable module, if you expect other people to pick it up. The fact that it's entwined monolithically with other junk (like a hand-rolled CGI handler) is going to be a major stumbling block for many people who might otherwise be interested in it.

    If you need help modularizing your code, there's some tutorials on the topic here at PerlMonks; and of course you can always ask in the CB or post a SOPW.

    A word spoken in Mind will reach its own level, in the objective world, by its own weight
Re^3: the axml parser v3.4
by Jenda (Abbot) on Apr 13, 2007 at 15:03 UTC

    If you allow the later example then it's no longer XML. Therefore there is no need for this to look like XML. Especially since it's supposed to be used within HTML. You'd rather use some other syntax ... something that stands out more and that doesn't get confused with the HTML. Or use one of the many existing templating modules.

    Of course if you looked at them and none of them fits your needs, go ahead and build your own. It seems to me like it will be a good learning experience, but nothing more.

    Regarding the () and friends ... you have to escape those in regexps as they have a special meaning. You'd better try to fix the problems with the regexps than to try to circumvent them like this. Post an example of text you are trying to match and fail and the regexp and maybe we can help.

Re^3: the axml parser v3.4
by Anonymous Monk on Apr 12, 2007 at 17:31 UTC
    I like to use # in place of /..... it doesn't look too bad, and works just fine. m# # or s# # # macdaddy.