xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregor Karlinger" <gregor.karlin...@iaik.at>
Subject DOM 3 normalizeDocument behaviour
Date Sun, 03 Nov 2002 13:10:52 GMT
Hi all,

I have tried to work with Xerces 2.2.0 DOM level 3 method 
CoreDocumentImpl.normalizeDocument(), but I came across
the following problem:

In order to find out the method's behaviour regarding ID
attributes, I created a DOM by parsing an XML instance in
non-validation mode. This is the instance document:

  <?xml version="1.0" encoding="UTF-8"?>
  <Envelope xmlns="urn:gregor:test">
    <Payload IDAttribute="iDValue"/>
  </Envelope>

Then I added the appropriate XML Schema attributes to the
DOM (xsi:schemaLocatation, ...) and invoked method
normalizeDocument on my DOM Document:

  doc.setNormalizationFeature("validate", true);
  doc.normalizeDocument();

The following is the XML Schema I used in xsi:schemaLocation:

  <?xml version="1.0" encoding="UTF-8"?>
  <xs:schema targetNamespace="urn:gregor:test" 
    xmlns:test="urn:gregor:test" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    elementFormDefault="qualified" 
    attributeFormDefault="unqualified">
    <xs:element name="Envelope">
      <xs:complexType>
        <xs:sequence>
          <xs:element ref="test:Payload"/>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    <xs:element name="Payload">
      <xs:complexType>
        <xs:attribute name="DefaultAttribute" 
          type="xs:string" use="optional" default="aValue"/>
        <xs:attribute name="IDAttribute" type="xs:ID"
          use="optional"/>
      </xs:complexType>
    </xs:element>
  </xs:schema>

Unexpectedly, invoking the method getElementById("iDValue")
on the normalized Document got a null instead of the "Payload"
element.

Is this normal behaviour, or have I made a mistake?

Liebe Gruesse/Regards, 
---------------------------------------------------------------
DI Gregor Karlinger
mailto:gregor.karlinger@iaik.at
http://www.iaik.at
Phone +43 316 873 5541
Institute for Applied Information Processing and Communications
Austria
---------------------------------------------------------------
 


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


Mime
View raw message