[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Entities contain XML tags?
- From: Michael Kay <mike@saxonica.com>
- To: xml-dev@lists.xml.org
- Date: Sun, 05 Aug 2012 09:08:03 +0100
On 04/08/2012 07:42, Dan Shelton wrote:
> Can entities themselves contain XML tags? I'm trying to write my own
> XML parser (for fun) and try to understand when entity expansion
> should be done - before tag parsing, after tag parsing or do entities
> only apply to text data?
>
Unfortunately the logical layer of XML (the element hierarchy) and the
physical layer (the entity hierarchy) are deeply intertwined (read, not
properly layered). Entities can contain elements, but they can't contain
unmatched tags. So you can't simply expand the entity references to
create a concatenated character stream and then parse the character
stream: the parsing needs to be aware of entity boundaries.
With parameter entities it gets even worse, but it's so long since I did
anything serious with DTDs that I have thankfully forgotten the details.
Michael Kay
Saxonica
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]