Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10864

Re: xml:id

From Michael Jung <miju@golem.phantasia.org>
Newsgroups comp.lang.java.programmer
Subject Re: xml:id
Date 2011-12-19 10:27 +0100
Message-ID <87ehw0ap2i.fsf@golem.phantasia.org> (permalink)
References <87wr9t1uxp.fsf@golem.phantasia.org> <33c64ae6-d7f1-466b-8534-35f777eb3c7c@h4g2000yqk.googlegroups.com>

Show all headers | View raw


Lee Fesperman <firstsql@gmail.com> writes:
> On Dec 18, 12:33 pm, Michael Jung <m...@golem.phantasia.org> 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 ===
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
[...]

> 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:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://z" elementFormDefault="qualified">

and

<test xmlns="http://z" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://z ./test.xsd">

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

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

xml:id Michael Jung <miju@golem.phantasia.org> - 2011-12-18 21:33 +0100
  Re: xml:id Lee Fesperman <firstsql@gmail.com> - 2011-12-19 00:24 -0800
    Re: xml:id Michael Jung <miju@golem.phantasia.org> - 2011-12-19 10:27 +0100
      Re: xml:id Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-12-19 11:25 -0400
        Re: xml:id Michael Jung <miju@golem.phantasia.org> - 2011-12-19 19:06 +0100
          Re: xml:id Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-12-19 17:26 -0400
            Re: xml:id Michael Jung <miju@golem.phantasia.org> - 2011-12-20 22:54 +0100

csiph-web