SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: XML and RelaxNG

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML and RelaxNG

    Now PHP5 does provide XML validation facilities, but there is yet to be any proper error handling. Although there is a script or two on the net for providing some better means of handling the validation errors, they're still not good enough.

    So what I was thinking about is using an XSL file to transform the RelaxNG into PHP code and probably use rule based validation.

    But before i jump in I just want to know if anyone else has a solution to this issue? Or have I just been away from the net that long that PHP5 has some better error handling?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hrmph looks like i'll just have to go with it this time around.

    Just about to plan a site and will probably end up using this, its a medium sized site, but im not being paid so I think I can mess around with it a little. Hopefully it all turns out well.

  3. #3
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like a sizeable task. Did you check if any extensions provides something in that direction ?

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PECL only includes XMLReader, which can do RelaxNG validation, but only return a boolean of true or false.

    It is indeed a sizeable task because I would have to include all the relaxng specs... but going through the intro of JAXB, it seems they've done, whilst not the same goal, this idea for Java, where XML Schemas are mapped to Java objects.

  5. #5
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PECL only includes XMLReader, which can do RelaxNG validation, but only return a boolean of true or false.
    That's a pitty. If you know your C/C++, you may be able to put together your own extension. You wouldn't have to code the actual validation-engine yourself, if you can just find a working parser, that is in open source (I bet a few exists).

    Of course your initial idea is easier accessible, but I fear that such a mapping may not be trivial ? Keep in mind that I don't know too much about RelaxNG though.

  6. #6
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, especially since I have to cover the whole spec, but not to worry, should be interesting nonetheless.

  7. #7
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Go ahead then. The beauty of a XSL-based solution is that it could be used on other platforms as well. I could have used something like that for javascript a while back. Ended up using DTD in lack of better.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •