You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by tn...@ca.ibm.com on 2000/10/20 21:34:52 UTC

Re: Type:IllegalArgumentException, Message:String pool id was not legal

in  void DOMParser::endAttList of src/parers/DOMParsers, it has:

   :
   XMLAttDefList* defAttrs = &elemDecl.getAttDefList();
   XMLAttDef* attr = 0;
   :
   while (defAttrs->hasMoreElements())
   {
   attr = &defAttrs->nextElement();
   if (attr->getValue() != null)
   {
     if (fScanner->getDoNamespaces())
     {
        // Namespaces is turned on...
        unsigned int attrURIId = attr->getId();
        //>>>>>
        //>>>>> attr is defined as XMLAttDef, not XMLAtt
        //>>>>> there is no URIId stored in XMLAttDef
        //>>>>>
        XMLBuffer buf;
        DOMString namespaceURI = 0;
        if (!XMLString::compareString(attr->getFullName(), XMLNS))    //for
        xmlns=...
          attrURIId = fValidator->getXMLNSNamespaceId();
        if (attrURIId != fValidator->getGlobalNamespaceId()) { //TagName
        has a prefix
          fValidator->getURIText(attrURIId, buf);                    //get
          namespaceURI
          //>>>>>
          //>>>>> pool id of attrbute type treated as
          //>>>>> namespace URI pool id which leads to
          //>>>>> IllegalArgumentException from above getURIText call
          //>>>>>>
          namespaceURI = DOMString(buf.getRawBuffer());
        }
        insertAttr = elem->setAttributeNS(namespaceURI,
        attr->getFullName(), attr->getValue());
        insertAttr->setSpecified(false);
   :
   :

The XMLAttDef::getid() returns the pool id of this attribute type, not an
URI id.  Thus it should not be used to retrieve the namespaceURI which
leads to this IllegalArgumentException.

Regards,

Tinny Ng
XML Parsers Development
IBM Toronto Laboratory email: tng@ca.ibm.com



Re: Type:IllegalArgumentException, Message:String pool id was not legal

Posted by Andy Heninger <an...@jtcsv.com>.
And it looks like there's yet another problem in this little section
of code.  If a DTD has two ATTLISTs declared for the same
element type (this is legal), it looks like the stuff from the
second one will replace the attributes from the first.  And, for
efficiency, it might be worth deferring creation of the dummy
ElementImpl until we see an attribute with a default value,
thus avoiding creatinn one altogether if there are no defaulted attrs.

  -- Andy

----- Original Message -----
From: "Andy Heninger" <an...@jtcsv.com>


> I was just looking into this problem too.  It's a little worse, in
> that there is never any namesapce binding associated with attributes,
> or anything else, in the context of a DTD.  This whole section
> of code dealing with namespaces at this point in the DTD handler
> needs to be removed.
>
>
> Andy Heninger
> IBM XML Technology Group, Cupertino, CA
> heninger@us.ibm.com
>
> ----- Original Message -----
> From: <tn...@ca.ibm.com>
> Subject: Re: Type:IllegalArgumentException, Message:String pool id was
not
> legal
>
>
> > in  void DOMParser::endAttList of src/parers/DOMParsers, it has:
> >
> >    :
> >    XMLAttDefList* defAttrs = &elemDecl.getAttDefList();
> >    XMLAttDef* attr = 0;
> >    :
> >    while (defAttrs->hasMoreElements())
> >    {
> >    attr = &defAttrs->nextElement();
> >    if (attr->getValue() != null)
> >    {
> >      if (fScanner->getDoNamespaces())
> >      {
> >         // Namespaces is turned on...
> >         unsigned int attrURIId = attr->getId();
> >         //>>>>>
> >         //>>>>> attr is defined as XMLAttDef, not XMLAtt
> >         //>>>>> there is no URIId stored in XMLAttDef
> >         //>>>>>
> >         XMLBuffer buf;
> >         DOMString namespaceURI = 0;
> >         if (!XMLString::compareString(attr->getFullName(), XMLNS))
> //for
> >         xmlns=...
> >           attrURIId = fValidator->getXMLNSNamespaceId();
> >         if (attrURIId != fValidator->getGlobalNamespaceId()) {
//TagName
> >         has a prefix
> >           fValidator->getURIText(attrURIId, buf);
> //get
> >           namespaceURI
> >           //>>>>>
> >           //>>>>> pool id of attrbute type treated as
> >           //>>>>> namespace URI pool id which leads to
> >           //>>>>> IllegalArgumentException from above getURIText call
> >           //>>>>>>
> >           namespaceURI = DOMString(buf.getRawBuffer());
> >         }
> >         insertAttr = elem->setAttributeNS(namespaceURI,
> >         attr->getFullName(), attr->getValue());
> >         insertAttr->setSpecified(false);
> >    :
> >    :
> >
> > The XMLAttDef::getid() returns the pool id of this attribute type, not
> an
> > URI id.  Thus it should not be used to retrieve the namespaceURI which
> > leads to this IllegalArgumentException.
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>


Re: Type:IllegalArgumentException, Message:String pool id was not legal

Posted by Andy Heninger <an...@jtcsv.com>.
I was just looking into this problem too.  It's a little worse, in
that there is never any namesapce binding associated with attributes,
or anything else, in the context of a DTD.  This whole section
of code dealing with namespaces at this point in the DTD handler
needs to be removed.


Andy Heninger
IBM XML Technology Group, Cupertino, CA
heninger@us.ibm.com

----- Original Message -----
From: <tn...@ca.ibm.com>
Subject: Re: Type:IllegalArgumentException, Message:String pool id was not
legal


> in  void DOMParser::endAttList of src/parers/DOMParsers, it has:
>
>    :
>    XMLAttDefList* defAttrs = &elemDecl.getAttDefList();
>    XMLAttDef* attr = 0;
>    :
>    while (defAttrs->hasMoreElements())
>    {
>    attr = &defAttrs->nextElement();
>    if (attr->getValue() != null)
>    {
>      if (fScanner->getDoNamespaces())
>      {
>         // Namespaces is turned on...
>         unsigned int attrURIId = attr->getId();
>         //>>>>>
>         //>>>>> attr is defined as XMLAttDef, not XMLAtt
>         //>>>>> there is no URIId stored in XMLAttDef
>         //>>>>>
>         XMLBuffer buf;
>         DOMString namespaceURI = 0;
>         if (!XMLString::compareString(attr->getFullName(), XMLNS))
//for
>         xmlns=...
>           attrURIId = fValidator->getXMLNSNamespaceId();
>         if (attrURIId != fValidator->getGlobalNamespaceId()) { //TagName
>         has a prefix
>           fValidator->getURIText(attrURIId, buf);
//get
>           namespaceURI
>           //>>>>>
>           //>>>>> pool id of attrbute type treated as
>           //>>>>> namespace URI pool id which leads to
>           //>>>>> IllegalArgumentException from above getURIText call
>           //>>>>>>
>           namespaceURI = DOMString(buf.getRawBuffer());
>         }
>         insertAttr = elem->setAttributeNS(namespaceURI,
>         attr->getFullName(), attr->getValue());
>         insertAttr->setSpecified(false);
>    :
>    :
>
> The XMLAttDef::getid() returns the pool id of this attribute type, not
an
> URI id.  Thus it should not be used to retrieve the namespaceURI which
> leads to this IllegalArgumentException.
>