Is it possible in php with the default xml classes to parse an xml file in such a way that only elements from one namespace are considered to be xml? I want to parse xml files in which some elements contain html code, and preferably I don't want to encapsulate every element with cdata tags, or escape all special characters. Since html has a syntax quite similar to xml, most parsers won't be able to parse this correctly.
Example:
<ns:root>
<ns:date>
06-12-2011
</ns:date>
<ns:content>
<html>
<head>
<title>Sometitle</title>
</head>
<body>
--a lot of stuff here
</body>
</html>
</ns:content>
</ns:root>
In this example I want all the html content inside to be the content of that element, and it shouldn't be parsed itself. Is this possible with the default parsers like simplexml etc, or should I write my own parser?
Edit: Let me explain my situation a little bit better: I want to create a little personal php framework in which code is separated from the HTML (similar to MVC, but not quite the same). However, many HTML code will be the same in multiple pages, but not everything, and some data from e.g. a database should be inserted in some pages, nothing different from normal websites. So I came up with the idea to use separate html component files, which can be parsed by an html script. This would look something like this:
main.fw:
<html>
<head>
<title>
<fw:placeholder name="title" />
</title>
</head>
<body>
<div id="menubar">
<ul>
<li>page1</li>
<li>page2</li>
</ul>
</div>
<div id="content>
<fw:placeholder name="maincontent" />
</div>
</body>
</html>
page1.fw
<fw:component file="main.fw">
<fw:content name="title">
page1
</fw:content>
<fw:content name="maincontent" />
some content with html
</fw:content>
</fw:component>
Result after parsing: page1
- page1
- page2
This question is mainly about that second type of file, in which html is nested inside xml elements.