--- In [email protected], "Erwan TROEL" <[EMAIL PROTECTED]> wrote:
> is it  possible to access and change entities in dtd

The W3C DOM Level 2 Core models entity nodes as nodes of type 6 and
the XML document should have a property named doctype which should
have a property named entities which is a NamedNodeMap so in theory a
compliant implementation should give access to
  document.doctype.entities.item(index)
respectively
  document.doctype.entities.getNamedItem('entityname')
but Mozilla for instance does not implement the enities collection so far.

With Adobe SVG viewer 3.0 run in IE 6 the following example however
shows the two entities declared:

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
         "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"; [
<!ENTITY GOD "Kibo">
<!ENTITY DEVIL "Xibo">
]>
<svg xmlns="http://www.w3.org/2000/svg";
     xml:lang="en"
     onload="checkEntities(document);">
<script type="text/javascript"><![CDATA[
function checkEntities (xmlDocument) {
  var text = 'Checking for entities:\r\n';
  var docTypeDeclaration = xmlDocument.doctype;
  if (docTypeDeclaration != null) {
    text += 'document.doctype: ' + docTypeDeclaration + '\r\n';
    if (docTypeDeclaration.entities != null) {
      text += 'Found ' + docTypeDeclaration.entities.length + '\r\n';
      for (var i = 0; i < docTypeDeclaration.entities.length; i++) {
        var entityDeclaration = docTypeDeclaration.entities.item(i);
        text += 'Entity ' + (i + 1) + ': nodeType: ' +
entityDeclaration.nodeType + '; '
          + 'nodeName: ' + entityDeclaration.nodeName + '\r\n';
      }
    }
    else {
      text += 'No entities found.\r\n';
    }
  }
  alert(text);
}
]]>
</script>
<text x="50" y="50">&GOD; and &DEVIL;</text>
</svg>

But I don't think the DOM allows changing those entities declared in
the DTD, the DTD is meant to be read only.





-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to