- From: Joseph Kesselman <keshlam@us.ibm.com>
- Date: Thu, 5 Jul 2001 14:01:37 -0400
- To: WWW DOM <www-dom@w3.org>
>I have got to find a "Entity and EntityReference Objects for Dummies" >document somewhere. First question: How well do you understand XML entities in the first place? Our objects are driven by what the XML Recommendation says about how entities are used (http://www.w3.org/TR/REC-xml#sec-references) and defined (http://www.w3.org/TR/REC-xml#sec-entity-decl). Entity References are bound to the Entity definition which has the same name; that's built into the XML spec and is handled automagically by the DOM. Two complicating factors: 1) There isn't an API in DOM Level 1 or Level 2 for creating/changing/removing Entity (definition) nodes. That's because those versions of the DOM deliberately deferred most of DTD/Schema issues. We provided a place for parsers to hang the data, but how it gets there was deliberately left as implementation-specific pending DOM Level 3's "abstract schema" support. 2) As noted in the DOM spec, parsers are permitted to fully expand Entity References -- replacing them with their value, rather than presenting that value as children of an appropriate EntityReference node. If your parser is doing this, you'll never see EntityReference nodes in your document tree unless you create them explicitly. (There are arguments for and against this expansion, depending on whether your application does or doesn't want to know where the boundaries were... so the DOM deliberately left this open. Some parsers actually let you pick which mode you prefer by setting a flag before you parse.) Hope that gets you pointed in the right direction. ______________________________________ Joe Kesselman / IBM Research
Received on Thursday, 5 July 2001 14:02:13 UTC