New extension proposal for xdom

[email protected] (Darren Hill)
Newsgroups php.pecl.dev
Message-ID <1265096544.21547.65.camel@wyrm>
Hello!

My name is Darren Hill, and I have developed a new extension called
"xdom". It provides PHP5 objects representing all XHTML 1.0 elements in
a DOM-like object hierarchy.

With this extension, an entire web page can be built programmatically in
the same fashion as manipulating the DOM in JavaScript, and the output
is guaranteed to be pristine. All tags are properly terminated, all
attributes are properly spelled and nesting errors (e.g. - tables) are
impossible. Attribute values are error-proof, too. For example, a form
method can not be any value other than "get" or "post", and text node
contents are automatically converted to prevent insertion attacks (think
htmlspecialchars() ). This can be very useful in larger web development
teams to force markup consistency, and save a lot of time and hassle in
development and debugging. The objects are also very customizable: you
can add your own attributes to the pre-defined ones (which will break
your w3c compliance, but might be handy for a neat JS trick). Also, all
elements are based on an XDomNode parent class, from which you can
derive your own custom tags. Oh, and this puts all that markup from your
PHP scripts behind the interpreter in pre-compiled code, so they can run
faster, too.

I have fully developed and tested the code, and have demonstrated it to
several other web developers who were very excited to use it. The
extension still needs built-in tests and documentation, which I plan to
add soon, but it is fully functional and a breeze to use. I am
completely prepared to provide long-term support for xdom, including
updates as new versions of (X)HTML emerge, and I would like to add it to
the SVN repository.

The code is stored at http://www.digitalcascade.net/xdom_src.tar.gz

Here is the full list of exposed objects:
XDomDoc
XDomNode
XDomHead
XDomTitle
XDomMeta
XDomBody
XDomDiv
XDomSpan
XDomH1
XDomH2
XDomH3
XDomH4
XDomH5
XDomH6
XDomAddress
XDomTextNode
XDomP
XDomBr
XDomPre
XDomEm
XDomStrong
XDomCite
XDomDfn
XDomCode
XDomSamp
XDomKbd
XDomVar
XDomAbbr
XDomAcronym
XDomBlockquote
XDomQ
XDomSub
XDomSup
XDomIns
XDomDel
XDomUl
XDomOl
XDomLi
XDomDl
XDomDt
XDomDd
XDomTable
XDomRowCollection
XDomTableSection
XDomCaption
XDomThead
XDomTfoot
XDomTbody
XDomColgroup
XDomCol
XDomTr
XDomTh
XDomTd
XDomA
XDomLink
XDomBase
XDomImg
XDomObject
XDomParam
XDomMap
XDomArea
XDomStyle
XDomHr
XDomFrameset
XDomFrame
XDomNoframes
XDomIframe
XDomForm
XDomInput
XDomText
XDomPassword
XDomCheckbox
XDomRadio
XDomSubmit
XDomReset
XDomPushBtn
XDomFile
XDomHidden
XDomImage
XDomButton
XDomSelect
XDomOptgroup
XDomOption
XDomTextarea
XDomLabel
XDomFieldset
XDomLegend
XDomScript
XDomNoscript

That probably looks like a HUGE list, but all the real work gets done in
XDomNode - all of the derived classes are tiny.

Any feedback is appreciated, and SVN account approval would be great.

Thanks,
-Darren
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.