You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Jean-Guillaume LALANNE <je...@coming.fr> on 2001/03/05 15:15:56 UTC

Re: Bug in handling attributes, when importing nodes

Hi,

I have get the same kind of bug with the importNode method and the
xerces1.3.0 release.
It looks like someone has recently fixed this bug.
I have downloaded the source code for this xerces release.
If the bug fix is not too complex ...isn't it possible to get it.
I'am currently setting a dynamic validation for my application and it works
fine with xerces1.3.0.
But I am now confronted to a new problem with this importNode&attribute bug
...
It was working fine with previous xerces versions ... but this last ones
didn't handle my validation
correctly...!!!
So the only way for me is to fix locally the bug ...
If you could provide me some tips to fix the bug in xerces1.3.0, it would be
very helpful for me.
Many Thanks in advance for your help.

Best Regards
Jean-Guillaume LALANNE



----- Original Message -----
From: <ne...@ca.ibm.com>
To: "Karl Scheibelhofer" <Ka...@iaik.at>
Cc: <xe...@xml.apache.org>
Sent: Friday, March 02, 2001 5:10 PM
Subject: RE: Bug in handling attributes, when importing nodes


>
>
> Hi Karl,
>
> Interesting!  The problem is this:  your main schema wants to find an
> element (that it knows about) from some other namespace to use as the
> content for <signedContent>.  But you've given <signedContent> content
> drawn from an unrelated schema--that your main schema doesn't know
anything
> about.  So Xerces complains.
>
> If you add an <import schemaLocation="personal.xsd"/> to your
> eDocument.xsd, your problems will go away, since now eDocument.xsd knows
> about the elements of personal.xsd and can tell that they come from a
> different namespace.
>
> I do agree that the error is wrong, however.  Note that the "+" on the end
> of the error is completely spurious:  <any> elements not explicitly
> declared otherwise have maxOccurs set to 1.
>
> Hope that helps,
> Neil
>
> Neil Graham
> XML Parser Development
> IBM Toronto Lab
> Phone:  416-448-3519, T/L 778-3519
> E-mail:  neilg@ca.ibm.com
>
>
>
> "Karl Scheibelhofer" <Ka...@iaik.at> on 03/02/2001 10:05:13
AM
>
> Please respond to "Karl Scheibelhofer" <Ka...@iaik.at>
>
> To:   <xe...@xml.apache.org>, Neil Graham/Toronto/IBM@IBMCA
> cc:
> Subject:  RE: Bug in handling attributes, when importing nodes
>
>
> hi Neil,
>
> it seems not to be completely fixed. the file
> "personal-schema.xmlsignature.xml" should validate, but the current xerces
> from CVS (i checked out the latest version two hours ago) reports an
error:
>
> Parser ERROR: The content of element type "aida:signedContent" must match
> "(##any:uri=)+".
> Public ID: null
> System ID: null
> Line Number: 54
> Column Number: 25
>
> even the error message is incorrect. i think that "aida:signedContent"
must
> match "(##other:uri=http://www.iaik.at/aida)+".
> see the attached file(s).
>
> i hope this helps to fix the problem,
>
>   Karl Scheibelhofer
>
> --
>
> Karl Scheibelhofer, <ma...@iaik.at>
> Institute for Applied Information Processing and Communications (IAIK)
> at Technical University of Graz, Austria, http://www.iaik.at
> Phone: (+43) (316) 873-5540
>
>
> > -----Original Message-----
> > From: neilg@ca.ibm.com [mailto:neilg@ca.ibm.com]
> > Sent: Thursday, March 01, 2001 4:32 PM
> > To: xerces-j-user@xml.apache.org
> > Subject: RE: Bug in handling attributes, when importing nodes
> >
> >
> >
> >
> > Hi Karl,
> >
> > I sort of broke Xerces's <any> support last week, but I think I fixed it
> > again on Tuesday.  So try a cvs update, rebuild and let me know if you
> > still have problems.
> >
> > Cheers,
> > Neil
> >
> > Neil Graham
> > XML Parser Development
> > IBM Toronto Lab
> > Phone:  416-448-3519, T/L 778-3519
> > E-mail:  neilg@ca.ibm.com
> >
> >
> >
> > "Karl Scheibelhofer" <Ka...@iaik.at> on 02/28/2001
> > 04:26:46 AM
> >
> > Please respond to xerces-j-user@xml.apache.org
> >
> > To:   <xe...@xml.apache.org>
> > cc:
> > Subject:  RE: Bug in handling attributes, when importing nodes
> >
> >
> > hi Neil,
> >
> > i checked out the latest code from CVS yesterday. this fixed this first
> > bug.
> > but now, there is a new one. the latest code seems to have problems with
> > the
> > any-element and the namespace attribute.
> > when i try to parse the document
> > ExaminationCertificationData_unsigned_0001.xmlsignature.xml (see
> > attachment), i get the error
> > The content of element type "aida:signedContent" must match
> > "(eDocument|##other:uri=http://www.iaik.at/aida+)".
> > in my opinion, i matches (it also validates using the release 1.3.0 and
> > XMLSpy 3.5).
> >
> > i hope, someone can help, regards
> >
> >   Karl
> >
> > PS: i had to set "protected boolean errorChecking = false;" in
> > DocumentImpl,
> > otherwise importing nodes fails, when the parser tries to import the
> > namespace attributes of the node.
> >
> >
> > > -----Original Message-----
> > > From: neilg@ca.ibm.com [mailto:neilg@ca.ibm.com]
> > > Sent: Tuesday, February 27, 2001 7:37 PM
> > > To: xerces-j-user@xml.apache.org
> > > Subject: Re: Bug in handling attributes, when importing nodes
> > >
> > >
> > >
> > >
> > > Hi Karl,
> > >
> > > This sounds like a bug that keeps getting reported once or twice a
week
> > > which was fixed shortly after 1.3.0 was released.  Could you try
> > > extracting
> > > and building the latest code from CVS and test that to see if it
solves
> > > your problem?
> > >
> > > Thanks,
> > > Neil
> > >
> > > Neil Graham
> > > XML Parser Development
> > > IBM Toronto Lab
> > > Phone:  416-448-3519, T/L 778-3519
> > > E-mail:  neilg@ca.ibm.com
> > >
> > >
> > >
> > > "Karl Scheibelhofer" <Ka...@iaik.at> on 02/27/2001
> > > 02:56:38 AM
> > >
> > > Please respond to xerces-j-user@xml.apache.org
> > >
> > > To:   "Xerces-j User" <xe...@xml.apache.org>
> > > cc:
> > > Subject:  Bug in handling attributes, when importing nodes
> > >
> > >
> > > the new Xerces 1.3.0 seems to introduce a new bug with handling
> > > attributes,
> > > when importing elements from other documents. if i (deep) import
> > > an element
> > > with attributes, xerces 1.3.0 messes up the attributes of the newly
> > > imported
> > > node. with the version 1.2.1, it worked.
> > > i use sun jdk 1.3.0.
> > > i attached files that show the problem.
> > > ExaminationCertificationData_unsigned_0001.xml is the original
document
> > > which i want to insert into a new signed one. if i do this using
> > >
> > >     Node importedContent = domDocument_.importNode(originalNode,
true);
> > >     // add signedContent node
> > >     destinationParentElement_.appendChild(importedContent);
> > >
> > > xerces does not correctly handle the attributes. you can see this in
> the
> > > resulting document ExaminationCertificationData_0001.xmlsignature.xml.
> > the
> > > attributes of aida:eDocument/aida:signedContent/certificationData are
> > > messed.
> > > however, all this worked with xerces 1.2.1 (unfortunately with the old
> > > schemas).
> > >
> > > i hope, you can response quite soon.
> > >
> > >   Karl Scheibelhofer
> > >
> > > --
> > >
> > > Karl Scheibelhofer, <ma...@iaik.at>
> > > Institute for Applied Information Processing and Communications (IAIK)
> > > at Technical University of Graz, Austria, http://www.iaik.at
> > > Phone: (+43) (316) 873-5540
> > > (See attached file: bug.zip)
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> > >
> > >
> > (See attached file: bug2.zip)
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> >
> >
> (See attached file: bug3.zip)
>
>


----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Bug in handling attributes, when importing nodes

Posted by Arnaud Le Hors <le...@us.ibm.com>.
Jean-Guillaume LALANNE wrote:
> 
> Hi,
> 
> I have get the same kind of bug with the importNode method and the
> xerces1.3.0 release.
> It looks like someone has recently fixed this bug.
> I have downloaded the source code for this xerces release.
> If the bug fix is not too complex ...isn't it possible to get it.
> I'am currently setting a dynamic validation for my application and it works
> fine with xerces1.3.0.
> But I am now confronted to a new problem with this importNode&attribute bug
> ...
> It was working fine with previous xerces versions ... but this last ones
> didn't handle my validation
> correctly...!!!
> So the only way for me is to fix locally the bug ...
> If you could provide me some tips to fix the bug in xerces1.3.0, it would be
> very helpful for me.
> Many Thanks in advance for your help.
> 

The specific fix to the importNode bug is attached. Alternatively you
can grab the relevant version of the file at:
http://xml.apache.org/websrc/cvsweb.cgi/~checkout~/xml-xerces/java/src/org/apache/xerces/dom/DocumentImpl.java?rev=1.49&content-type=text/plain
-- 
Arnaud  Le Hors - IBM Cupertino, XML Strategy Group

Re: Bug in handling attributes, when importing nodes

Posted by Arnaud Le Hors <le...@us.ibm.com>.
Jean-Guillaume LALANNE wrote:
> 
> Hi,
> 
> I have get the same kind of bug with the importNode method and the
> xerces1.3.0 release.
> It looks like someone has recently fixed this bug.
> I have downloaded the source code for this xerces release.
> If the bug fix is not too complex ...isn't it possible to get it.
> I'am currently setting a dynamic validation for my application and it works
> fine with xerces1.3.0.
> But I am now confronted to a new problem with this importNode&attribute bug
> ...
> It was working fine with previous xerces versions ... but this last ones
> didn't handle my validation
> correctly...!!!
> So the only way for me is to fix locally the bug ...
> If you could provide me some tips to fix the bug in xerces1.3.0, it would be
> very helpful for me.
> Many Thanks in advance for your help.
> 

The specific fix to the importNode bug is attached. Alternatively you
can grab the relevant version of the file at:
http://xml.apache.org/websrc/cvsweb.cgi/~checkout~/xml-xerces/java/src/org/apache/xerces/dom/DocumentImpl.java?rev=1.49&content-type=text/plain
-- 
Arnaud  Le Hors - IBM Cupertino, XML Strategy Group