logo       

Re: [xmlc] 2.3beta getElementById() behavior: msg#00016

java.enhydra.xmlc

Subject: Re: [xmlc] 2.3beta getElementById() behavior

On Jan 24, 2007, at 6:37 AM, Jacob Kjome wrote:

Can you expand on what you mean by "attempting to look it up by its new id elsewhere"?


I'm importing a node from one page into another.

page 1:
-----
<page1>
  <node id="wherePage2ContentGoes"></node>
</page1>
-----

page 2:
-----
<page2>
  <node id="content">
    Stuff to be transferred to page1.
    <node id="needToMatch">this node</node>
  </node>
</page2>
-----

// import content from page 2
Node destNode = page1.getElementById("wherePage2ContentGoes");
Node srcNode = page2.getElementById("content");
destNode.appendChild(page1.importNode(srcNode, true));

...

// then later:
Node match = page1.getElementById("needToMatch");  // fails (match == null)

// but a full node traversal works:
XPathExpression query = XPathFactory.newInstance().newXPath().compile("//*[@id='needToMatch']");
match = ((NodeList) query.evaluate(page1, XPathConstants.NODESET)).item(0); // succeeds

>Will it be possible to update the cache when element.setId() is

>called?  If not, can I disable this caching?

>


I have to look into this, but don't have time tonight.  Can you try XMLC-2.2.13 and verify that what you are trying to do works there?


It seems to be broken in XMLC-2.2.13 too.  I was using XMLC-2.2.8 back when it was working.

Is there a better solution than using xpath?  It seems like importNode() should add all the new id's into its id-to-node map, no?

Erik

--
You receive this message as a subscriber of the xmlc@xxxxxxxxxxxxx mailing list.
To unsubscribe: mailto:xmlc-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise