You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Claire Suttle <cl...@geoviz.com> on 2003/10/28 03:00:59 UTC

importNode() problem

Hello,

I'm having a problem with the importNode() function...I'm calling it with the "deep" option set, and but I'm finding ?that for some of the nested children, the attribute values aren't being copied over. 

so, printing the node out before importing I get:
<View><MetaLink>http://www.geoviz.com</MetaLink><ResourceIDs><ResourceID id="1"/><ResourceID id="7"/></ResourceIDs><EyePoints/></View>

but printing the node out after importing, I get:

<View><MetaLink>http://www.geoviz.com</MetaLink><ResourceIDs><ResourceID id=""/><ResourceID id=""/></ResourceIDs><EyePoints/></View>

So that the whole node structure copies over..but the attribute values of the ResourceID elements are not being copied over.

Now, I actually create this node structure from a String in the first place, and
I've found out some more information from a previous poster:

Jeff Greif jgreif@alumni.princeton.edu wrote:
>But some implementations have a quirk (bug!) in importNode such that it will
>produce a bad document when the imported node was built by a different
>parser from that of the importing document.  I think I ran into this in a
>situation where the importing document was built by xerces PSVI DOM (I can't
>remember which version, probably 2.1.0) and the imported node was built by
>the Crimson parser. 

So perhaps the problem is in the way I'm creating my document. Does Xalan have a method where I can parse a String and turn it into a Node, Document or DocumentFragment? Whats the best way to go about doing this?

Currently I'm using:
createDocumentBuilder().parse(new InputSource(new StringReader(string)));

to parse the string and create a new document. Is there a better way to do this that will cause Xalan to import the Node structure with no problems?

Thanks for any help you may be able to give,

Claire


  ----- Original Message
   ----- 
  From: Claire Suttle 
  To: xalan-j-users@xml.apache.org 
  Sent: Wednesday, October 22, 2003 9:28 PM
  Subject: Re: importNode() problem


  yes I'm passing true...the function is traversing the tree, but for some reason it's just missing the attributes in the <ResourceID> nodes, and I have no idea why.

  Claire
    ----- Original Message ----- 
    From: Singh, Anoop 
    To: Claire Suttle 
    Sent: Wednesday, October 22, 2003 5:13 PM
    Subject: RE: importNode() problem


    Are you passing the 2nd argument as true ?

    importNode(somenode,true);
      -----Original Message-----
      From: Claire Suttle [mailto:claire@geoviz.com] 
      Sent: Wednesday, October 22, 2003 5:12 PM
      To: xalan-j-users@xml.apache.org
      Subject: importNode() problem


      Hi,

      I'm having a problem with the importNode() function...I'm calling it with the "deep" option set, but I'm finding that for some of the nested children, the attribute values aren't being copied over. 

      so, printing the node out before importing I get:
      <View><MetaLink>http://www.geoviz.com</MetaLink><ResourceIDs><ResourceID id="1"/><ResourceID id="7"/></ResourceIDs><EyePoints/></View>

      but printing the node out after importing, I get:

      <View><MetaLink>http://www.geoviz.com</MetaLink><ResourceIDs><ResourceID id=""/><ResourceID id=""/></ResourceIDs><EyePoints/></View>

      Does anyone have any ideas why this could be?

      Thanks,

      Claire