Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.straub-nv.de!newsout01.versatel.de!news.versatel.de!not-for-mail From: Michael Jung Newsgroups: comp.lang.java.programmer Subject: Re: xml:id Date: Mon, 19 Dec 2011 10:27:48 +0100 Lines: 43 Message-ID: <87ehw0ap2i.fsf@golem.phantasia.org> References: <87wr9t1uxp.fsf@golem.phantasia.org> <33c64ae6-d7f1-466b-8534-35f777eb3c7c@h4g2000yqk.googlegroups.com> NNTP-Posting-Host: i59f763f3.versanet.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news01.versatel.de 1324286870 1840 89.247.99.243 (19 Dec 2011 09:27:50 GMT) X-Complaints-To: abuse@versatel.de NNTP-Posting-Date: Mon, 19 Dec 2011 09:27:50 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:+SHDgzbym4hJT+CRfONMAonR6Hg= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10864 Lee Fesperman writes: > On Dec 18, 12:33 pm, Michael Jung wrote: >> I have a problem with transfering xml:ids from one document to another, >> sample code is attached. Somehow the id attribute gets lost. Am I doing >> something wrong, missing something, or is this a bug in the XML libs (I >> use the ones supplied with the standard JDK)? Maybe this is a "feature"? >> It is rather annoying if this doesn't work, since it forces me to to >> travers the tree and do id handling myself. >> >> The code produces the same output under OpenJDK, Sun's JDK 1.6 and 1.5: >> : [elem: null] >> : [elem: null] >> : null >> >> === SimleTest.java === [...] >> === test.xml === [..] >> === test.xsd === >> >> [...] > Try removing 'elementFormDefault="qualified"' from your schema (xsd). > Some schema processors may require qualification in your xml (for > 'elem'), even though qualification is not possible in your case ... > because you have no (target)Namespace. I have (a) removed the elementForDefault, (b) set it to unqualified, and (c) even added namespaces: and No difference in output. I also don't think that this has to do with the validation process, since that has passed successfully. The ID property is known for both parsed files. It is simply forgotten during adopt(ion) of a node. (Though both documents even adhere to the same schema!) Michael