SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2009
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    looking for light weight tool/API/script(in PHP) to validate whether a html code snip

    I am looking for light weight tool/API/script(in PHP) to validate whether a html code sippet is 'tidy'.By 'tidy' I simply mean whether the html snippet has properly closed tags and is valid html.

    the tools that are usually ailable are generally for validating a url html. I wnat to be able to validate only a small html snippet . e.g

    HTML Code:
    <a href="xyz.com" Click Here </a>
    the above is invalid as the
    HTML Code:
    <a>
    tag does not close properly
    where as

    HTML Code:
    <span> my name is xyz</span>
    is valid .

    What would be the best way to validate html snippets? Thanks in advance for your help.

  2. #2
    SitePoint Zealot GOPalmer's Avatar
    Join Date
    Jan 2009
    Location
    Wiltshire, UK
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might want to take a look at http://php.net/manual/en/book.tidy.php

    Best Regards, George

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can find a source code of the official validator.w3.org validator at http://validator.w3.org/source/ It is not written in PHP, but might give you some ideas.


Tags for this Thread

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
  •