Re: Regexp for xhtml compliant matching
| From: | Klaus Guenther | Date: | Wed, 03 Dec 2003 23:52:50 +0000 |
| Subject: | Re: Regexp for xhtml compliant matching | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-24110@lists.php.net to get a copy of this message | ||
Paul M Jones <pmjones@ciaweb.net> wrote:
> Hi, Klaus,
>
> Did you get a useful answer on this?
To both questions :-) See below:
> >> Unless this source is inaccurate, it appears that <html> is not a
> >> valid
> >> child of the <body> tag.
> >>
> >> http://www.zvon.org/xxl/xhtmlReference/Output/
> >
> > Hmm! could have sworn I came across it somewhere! I know that embedded
> > documents are allowed in the latest xhtml version(s?). I'll have to
> > see what
> > the exact syntax for it is. Maybe I'm jumping the gun and trying to
> > implement something that isn't implemented yet...
OK, I've dredged up a reason :-) Don't know if it's good enough:
http://www.w3.org/TR/XHTMLplusMathMLplusSVG/#howto-xhtml
This page discribes how to embed svg and other xml document types within
xhtml. As you can see in the examples, it is possible to embed svg within
xhtml, and then embed xhtml within the svg:
"An SVG fragment inside an XHTML document can contain another XHTML or MathML
fragments, and that XHTML fragment can again contain another MathML or SVG
fragments. There's no restriction on nesting levels."
But as far as I can see, there's no requirement that the embedded xhtml be
fully self-contained (i.e., no head, body tags; all content is treated as
being within the body tag). However, I still suppose it's not impossible to
imagine that someone somewhere will have the bright idea to nest body tags in
there...
The main purpose is to ensure that there's no possibility that someone will
break it. I'm worried enough about common "bad" html coders who might forget
to close the body tag... :-)
> > But still, my question for regexing nested tags still is open...
> > because I'd
> > like to be able to parse anyway... as I said, I've not done too much
> > with
> > regular expressions.
Michael's regex works like a charm :-) Thanks a bunch!
Klaus