[GCC-XML]ID attribute

Brad King brad.king at kitware.com
Wed Mar 17 10:03:56 EST 2004


Jason Stanek wrote:

> Greetings again,
> 
> After conferring with various colleagues, I have come to this 
> conclusion.  Many XML parsers assume that if an id attribute is 
> specified, it should be searchable with the getElementById.  Some do not 
> (Java DOM for instance).
> 
> My good friend Yogy Namara was kind enough to devote his time explaining 
> a bit about XML to me.  It seems that to specify an attribute as 
> searchable by getElementById, the ID attribute-type must be specified in 
> the DTD.  I could not find a DTD in the XML document generated by 
> GCC-XML, but when I added one - all of my problems went away.
> 
> Currently, the beginning of the generated XML document looks like this:
> <?xml version="1.0"?>
> <GCC_XML>
> 
> If I change it to the following, I can use getElementById to search for 
> any Element by its id attribute:
> <?xml version="1.0"?>
> <!DOCTYPE GCC_XML [
>   <!ATTLIST Namespace id ID #REQUIRED>
>   <!ATTLIST Variable id ID #REQUIRED>
>   <!ATTLIST Field id ID #REQUIRED>
>   <!ATTLIST Method id ID #REQUIRED>
>   <!ATTLIST ReferenceType id ID #REQUIRED>
>   <!ATTLIST Class id ID #REQUIRED>
>   <!ATTLIST Struct id ID #REQUIRED>
>   <!ATTLIST FundamentalType id ID #REQUIRED>
>   <!ATTLIST PointerType id ID #REQUIRED>
>   <!ATTLIST ArrayType id ID #REQUIRED>
>   <!ATTLIST Typedef id ID #REQUIRED>
>   <!ATTLIST CvQualifiedType id ID #REQUIRED>
>   <!ATTLIST Constructor id ID #REQUIRED>
>   <!ATTLIST Destructor id ID #REQUIRED>
>   <!ATTLIST OperatorFunction id ID #REQUIRED>
>   <!ATTLIST OperatorMethod id ID #REQUIRED>
>   <!ATTLIST Enumeration id ID #REQUIRED>
>   <!ATTLIST Union id ID #REQUIRED>
>   <!ATTLIST File id ID #REQUIRED>
> ]>
> <GCC_XML>
> 
> I dont know if these are all of the types of elements.  If there are 
> others with a searchable id, they should be added.  How difficult would 
> it be to make these changes to the source?  Is this something that could 
> warrant a re-release?  It sure would help me out a lot.

This question is asked often enough that I've just created a FAQ entry 
for it:

http://www.gccxml.org/HTML/FAQ.html

This kind of functionality is on the list to be implemented before a 1.0 
release, but 0.6 will not be re-released with this change. 
Unfortunately there is no schedule set for this work to be done because 
the project is not directly funded.

-Brad




More information about the gccxml mailing list