com.ebm_ws.infra.xmlmapping.interfaces
Interface IXmlObject


public interface IXmlObject

This is the base interface to use the implicit XML mapping.

A class implementing this interface will be able through simple naming rules, to:

  1. Instantiate automatically from an XML file,
  2. Generate automatically its model schema (XSD).

Here are the naming rules:

Here is an example:

 // --- Class mapped to an XML element named 'MyNode'
 public class MyNode implements IXmlObject
 {
     // --- field mapped to the root object
     private MyRoot _xmlroot;
     // --- field mapped to the parent object
     private MyParent _xmlparent;
     
     // --- field mapped to mandatory string attribute with name 'ID'
     private String _xmlattr_req_ID;
     // --- field mapped to optional int attribute with name 'Length'
     private String _xmlattr_opt_Length;
     // --- field mapped to optional boolean attribute with name 'Bool'
     private String _xmlattr_opt_Bool;
     
     // --- field mapped to a mandatory child element in the child node with name 'Obj1'
     private MyInterface1 _xmlnode_req_Obj1;
     // --- field mapped to one or more children elements in the child node with name 'ArrayObj2'
     private MyInterface2[] _xmlnode_1_unb_ArrayObj2;
     // --- field mapped to one or two children elements right under the node
     private MyClass3[] _xmlcollect_1_2_ArrayObj3;
     
     public MyNode(XmlObject iParent, Element iNode, IInstanciationErrors iErrors)
     {
         super(iParent, iNode, iErrors);
     }
     [...]
 }
 
Such a class may be instantiated with the following XML:
 <MyRoot [...]>
   [...]
   <MyParent [...]>
     [...]
     <MyNode ID="node1" Length="12">
       <Obj1>
           <MyClass1 (implements MyInterface1) [...]>
               [...]
           </MyClass1>
       </Obj1>
       <ArrayObj2>
           <MyClass2a (implements MyInterface2) [...]>
               [...]
           </MyClass2a>
           <MyClass2b (implements MyInterface2) [...]>
               [...]
           </MyClass2b>
           <MyClass2a [...]>
               [...]
           </MyClass2b>
       </ArrayObj2>
       <MyClass3 [...]>
           [...]
       </MyClass3>
       <MyClass3 [...]>
           [...]
       </MyClass3>
     </MyNode>
     [...]
   </MyParent [...]>
   [...]
 </MyRoot [...]>
 

See Also:
XmlInstantiator, XsdGenerator

Method Summary
 void checkThisNode(java.lang.Object iValidSupport, IValidityLogger iErrors)
          This method is meant to check the validity of this object.
 

Method Detail

checkThisNode

void checkThisNode(java.lang.Object iValidSupport,
                   IValidityLogger iErrors)
This method is meant to check the validity of this object.
That is checking required resources exist, the model is coherent, ...

Parameters:
iValidSupport - Object that gives support for checking validity
iErrors - Object that allows logging validation errors.


Copyright © 2008 eBMWebsourcing. All Rights Reserved.