[ 
http://issues.apache.org/jira/browse/JAXME-58?page=comments#action_12315892 ] 

Jochen Wiedmann commented on JAXME-58:
--------------------------------------

Proposed way to resolve the issue;

Forgetting for a moment, that the actual bean classes need changes,
I'll suggest that we start with validating the IDREF's. We'll later
see, that this is actually most of the work, if we do it right.

If an object has embedded ID/IDREF's, then its generated SAX handler
needs two additional objects:

  - A Map for storing the ID's and and the elements, to which are
being mapped. An
    element is added to this Map, whenever the SAX handler detects an
ID. The Map
    keys are the ID's and the Map elements are the associated elements.
  - A List for storing the IDREF's. Whenever the SAX handler detects
an IDREF, then
    it adds an implementation of the interface

            interface IDREF {
                void validate(Map pIds) throws SAXException;
            }

    The idea is, that the SAX handler will invoke all the IDREF's
within endDocument().
    Obviously, if the IDREF implementation is a suitable inner class,
then it can not
    only validate the reference, but invoke a proper setter as well.

For that first step, you should be able to work within the class
DriverSGImpl and its subclasses only, so a deeper understanding of all
the JaxMe details shouldn't be required.


> IDREF handling does not follow JAXB spec (5.8.2)/reference implementation
> -------------------------------------------------------------------------
>
>          Key: JAXME-58
>          URL: http://issues.apache.org/jira/browse/JAXME-58
>      Project: JaxMe
>         Type: Bug
>   Components: JaxMe Core
>     Versions: current (nightly)
>     Reporter: Fredrik Vraalsen

>
> JaxMe's implementation of IDREF differs from the JAXB specification and the 
> RI, as JaxMe seems to only set/get the IDREF String itself, as opposed to the 
> RI which sets/gets the actual object being referenced.  From the JAXB spec 
> (section 5.8.2):
> "An element or attribute with a type of xs:IDREF refers to the element in the 
> instance document that has an attribute with a type of xs:ID or derived from 
> type xs:ID with the same value as the xs:IDREF value. Rather than expose the 
> Java programmer to this XML Schema concept, the default binding of an 
> xs:IDREF  component maps it to a Java property with a base type of 
> java.lang.Object. The caller of the property setter method must be sure that 
> its 
> parameter is identifiable. An object is considered identifiable if one of its 
> properties is derived from an attribute that is or derives from type xs:ID. 
> There is an expectation that all instances provided as values for properties? 
> representing an xs:IDREF should have the Java property representing the xs:ID 
> of the instances set before the content tree containing both the xs:ID and 
> xs:IDREF is (1) globally validated or (2) marshalled. If a property 
> representing an xs:IDREF is set with an object that does not have its xs:ID 
> set, the NotIdentifiableEvent is reported by (1) validation or (2) 
> marshalling."
> See the spec for an example.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to