Jump to content

Creating XML language on top of php


blasto333

Recommended Posts

I am currently an information technology student at RIT (Rochester Institute Of technology). I am involved in a very interesting project known as Molly.

 

Molly is an xml abstraction layer on top of php. Basically it has a set of "maml" xml tags that generate php to preform common tasks. These "maml" tags are embedded in existing XHTML documents.

 

Here is a quick example of a tag:(This would be in an XHTML document)

 

<maml:select query="SELECT * FROM test">

    <maml:record>

        Person Name: <maml:field name="person_id" />

    </maml:record>

</maml:select>

 

We are currently using the SAX for parsing the xml document.

 

We are considering an architecture change.

 

Here are the problems we have with SAX:

* The document must be perfect XHTML or it will have parsing errors

* Very hard to program using it

* Has a hard time with entities such as   when between tags.

 

 

I am not sure how many XML abstraction layer's have been built using PHP, but are there any other methods for competing this task?

 

Any suggestions would be helpful.

Link to comment
Share on other sites

Well there is DOM available too, but I am not sure why SAX won't work for you.  I also found making a SAX parser difficult until I came across this.

 

http://homework.nwsnet.de/products/69

 

It's very clear and I think you could probably just lift the ideas from it and implement them yourself if you wanted to.  The only thing which may cause an error is the namespaces on the tags, but aside from that the query would be passed as attribute data, and the "Person Name" would be character data.

 

I believe that XML ans DOM are the two options available period, so you'd need to find a way to accomodate one.  I don't much about using DOM, but I believe it's more complicated to implement and stores the entire document structure in memory.  Implementing your own parser is a possibility too, but I think that will most likely turn into a large project.  Also it's worth checking out PEAR or even PECL for solutions; those would most likely be of the highest quality.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.