Accessing attribute from DTD

Subject: Accessing attribute from DTD
From: David Megginson <ak117@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 May 1998 09:09:24 -0400
Amit Rekhi writes:

 > I can access the attribute value of a target element in XSL using 
 > 
 > target-element.getAttribute("attribute-name");
 > 
 > In such a case, the attribute value for the target-element is picked from
 > the XML file.
 > 
 > But what if the attribute value is specified in the DTD rather than the XML?
 > 
 > What API do I use to access the attribute value (of a target element)
 > specified in the DTD??

It should be exactly the same: for general XML processing, doing

 <!DOCTYPE foo [
   <!ATTLIST foo
     bar CDATA "xxx">
 ]>
 <foo/>

is exactly identical to

 <!DOCTYPE foo [
   <!ATTLIST foo
     bar CDATA #IMPLIED>
 ]>
 <foo bar="xxx"/>

There is currently a bug in the Java version of MSXML that prevents
these attributes from being reported correctly, but I know that the MS
developers are aware of the bug and I expect that it will be fixed
soon -- I don't work in Windows, so I don't know if the problem
affects Microsoft's XSL tool as well.

In the mean time, if you need to do any work involving a Java-based
XML parser, I suggest that you try one of the others, such as IBM's
XML for Java, DataChannel's DXP, Tim Bray's Lark, James Clark's XP, or
Microstar's AElfred.


All the best,


David

-- 
David Megginson                 ak117@xxxxxxxxxxxxxxxxxxx
Microstar Software Ltd.         dmeggins@xxxxxxxxxxxxx
      http://home.sprynet.com/sprynet/dmeggins/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread