users@jaxb.java.net

Associating JAXB unmarshalled object to the corresponding xml sou rce ?

From: Thierry Hanot <thanot_at_infovista.com>
Date: Mon, 16 Dec 2002 19:18:36 +0100

Hello all
Is there a way to associate the jaxb object loaded by unmarshalling, with
the declaration part of the related xml source used for building them ?

i.e :

A dummy and not complete xml file :

<actions>
    <print msg="dummy" />
    <read var="dummyVar" />
</actions>

it's associated schema
<xs:complexType name="actions">
    <xs:sequence>
       <xs:element name="print" type="printAction"/>
       <xs:element name="read" type="readAction"/>
  </xs:sequence>
</xs:complexType>
<xs:complexType name="printAction">
    <xs:attribute name="msg" type="xs:string" use="required"/>
</xs:complexType name="printAction">
<xs:complexType name="readAction">
    <xs:attribute name="var" type="xs:string" use="required"/>
</xs:complexType name="readAction">

jaxb will generate

class ActionType{
    List getPrintAndRead();
   }
class PrintType{
    String getMsg();
  }
class ReadType{
    String getVar();
}


I want to, on one PrintType instance, retreive the position of its
declaration in the xml file ?

Is it possible ? if yes how ?



Thanks .

Thierry Hanot .