> -----Original Message-----
> From: Jason E. Stewart [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 05, 2001 20:49 PM
> To: [EMAIL PROTECTED]
> Subject: Re: creating element with ID in a document
>
>
> "Evert Haasdijk" <[EMAIL PROTECTED]> writes:
>
>
> > 2. modify the xerces sources and add a 'setAttributeWithID'
> function. That's
> > what I did when I encoutered the same problem (in xerces 1.4). If
> > you want me to, I can send you the modifications I made, although I
> > did make them to v1.4, so I'm not sure they'll work with 1.5.
>
> Sounds like a useful feature. If you submit it to the list as a patch
> agains the 1.4 code, then made the Toronto team will accept them into
> 1.5.
>
> Tinny?
>
> jas.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Well, I did post a message about this when I first made the mod, but I
didn't get any reaction then. But here's the diff, anyway.


cvs diff -r 1.1 DocumentImpl.cpp DocumentImpl.hpp DOM_Document.cpp
DOM_Document.hpp (in directory D:\USR\OmegaPlus\xerces-c-src1_4_0\src\dom)
Index: DocumentImpl.cpp
===================================================================
RCS file:
/group/cvs/kiq/OmegaPlus/xerces-c-src1_4_0/src/dom/DocumentImpl.cpp,v
retrieving revision 1.1
retrieving revision 1.3
diff -r1.1 -r1.3
58c58,69
<  * $Id: DocumentImpl.cpp,v 1.1 2001/04/05 09:01:11 evert Exp $
---
>  * $Id: DocumentImpl.cpp,v 1.3 2001/04/27 10:05:53 evert Exp $
>  */
>
> /* ====================================================================
>  * MODIFIED!!!
>  * ====================================================================
>  *
>  * EH: Modified importNode() to update fNodeIdMap when importing an ID
>  * attribute.
>  *
>  * EH: added DocumentImpl::createIDAttribute() to be able to create ID
>  * attributes that work without having to re-parse.
233,234d243
<
<
238a248,254
> // EH: added DocumentImpl::createIDAttribute()
> AttrImpl *DocumentImpl::createIDAttribute(const DOMString &nam)
> {
>     if (errorChecking && !isXMLName(nam)) {
>         throw
DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null);
>     }
>     AttrImpl* attr = new AttrImpl(this,nam);
239a256,273
>     if (attr)
>     {
>       //
>       // tell the attr that it's an ID
>       //
>       attr->isIdAttr(true);
>
>       //
>       // make sure that we have a NodeIDMap; it will be updated by
>       // AttrImpl::setValue(), so don't call fNodeIDMap->add(newattr)
>       //
>       if (fNodeIDMap == 0)
>                     fNodeIDMap = new NodeIDMap(500);
>     }
>
>     return attr;
> };
> // EH: end of DocumentImpl::createIDAttribute()
560a595,610
>
>             // EH: start importing ID
>             // Attributes of type ID.  If this is one, add it to the
hashtable of IDs
>             //   that is constructed for use by GetElementByID().
>             //
>             AttrImpl *newattr = (AttrImpl *) newnode;
>             if (attr->isIdAttr())
>             {
>                 newattr->isIdAttr(true);
>
>                 if (fNodeIDMap == 0)
>                     fNodeIDMap = new NodeIDMap(500);
>                 fNodeIDMap->add(newattr);
>             }
>             // EH: end importing ID
>
Index: DocumentImpl.hpp
===================================================================
RCS file:
/group/cvs/kiq/OmegaPlus/xerces-c-src1_4_0/src/dom/DocumentImpl.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
59a60,68
> /* ====================================================================
>  * MODIFIED!!!
>  * ====================================================================
>  *
>  * EH: added DocumentImpl::createIDAttribute() to be able to create ID
>  * attributes that work without having to re-parse.
>  */
>
>
61c70
<  * $Id: DocumentImpl.hpp,v 1.1 2001/04/05 09:01:11 evert Exp $
---
>  * $Id: DocumentImpl.hpp,v 1.2 2001/04/27 10:05:53 evert Exp $
182a192,193
>     // EH: added createIDAttribute()
>     virtual AttrImpl            *createIDAttribute(const DOMString &name);
Index: DOM_Document.cpp
===================================================================
RCS file:
/group/cvs/kiq/OmegaPlus/xerces-c-src1_4_0/src/dom/DOM_Document.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
58c58
<  * $Id: DOM_Document.cpp,v 1.1 2001/04/05 09:01:11 evert Exp $
---
>  * $Id: DOM_Document.cpp,v 1.2 2001/04/27 10:05:53 evert Exp $
60a61,67
> /* ====================================================================
>  * MODIFIED!!!
>  * ====================================================================
>  *
>  * EH: added DOM_Document::createIDAttribute() to be able to create ID
>  * attributes that work without having to re-parse.
>  */
187a195,200
>
> // EH: added DocumentImpl::createIDAttribute()
> DOM_Attr               DOM_Document::createIDAttribute(const DOMString
&name) {
>         return DOM_Attr(((DocumentImpl *)fImpl)->createIDAttribute(name));
> };
> // EH: end DocumentImpl::createIDAttribute()
Index: DOM_Document.hpp
===================================================================
RCS file:
/group/cvs/kiq/OmegaPlus/xerces-c-src1_4_0/src/dom/DOM_Document.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
58c58
<  * $Id: DOM_Document.hpp,v 1.1 2001/04/05 09:01:11 evert Exp $
---
>  * $Id: DOM_Document.hpp,v 1.2 2001/04/27 10:05:53 evert Exp $
60a61,68
> /* ====================================================================
>  * MODIFIED!!!
>  * ====================================================================
>  *
>  * EH: added createIDAttribute() to be able to create ID
>  * attributes that work without having to re-parse.
>  */
>
316a325,330
>
>     /** Same as createAttribute(), but the new attribute is an ID.
>      *
>      * <b> NON-STANDARD DOM Extension </b> by EH
>      */
>     DOM_Attr     createIDAttribute(const DOMString &name);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to