Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [xsd-dev] XMI or XSD

Le Anh,

I'm not really sure what you are asking because installing XSD does not
replace XMI serialization with "XSD serialization."   EMF serializes a
resource as XMI by default, no matter what is installed.

 If you look at a ResourceFactory that's generated for an Ecore model
imported from XML Schema, you'll see this something like this:

   public class CameraResourceFactoryImpl extends XMLResourceFactoryImpl
   {
      /**
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * @generated
       */
      protected XMLResource.XMLMap xmlMap = new XMLMapImpl();

      /**
       * Creates an instance of the resource factory.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * @generated
       */
      public CameraResourceFactoryImpl() {
            super();
      }

      /**
       * Creates an instance of the resource.
       * <!-- begin-user-doc -->
       * <!-- end-user-doc -->
       * @generated
       */
      public Resource createResource(URI uri) {
            XMLResource result = new CameraResourceImpl(uri);
            result.getDefaultSaveOptions().put(XMLResource.OPTION_XML_MAP,
   xmlMap);
            result.getDefaultLoadOptions().put(XMLResource.OPTION_XML_MAP,
   xmlMap);
            return result;
      }
   } //CameraResourceFactoryImpl

Is the presence of the XMLMap during load or save that causes EMF to
intepret the EAnnotations on the Ecore model that indicate how to serialize
according to the original XSD:

   <?xml version="1.0" encoding="ASCII"?>

   <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"; name="camera"
       nsURI="http://jbauer.boeblingen.de.ibm.com/Camera"; nsPrefix
   ="com.ibm.de.boeblingen.jbauer.camera">
     <eAnnotations source
   ="http:///org/eclipse/emf/mapping/xsd2ecore/XSD2Ecore";>
       <details key="representation" value="schema"/>
       <details key="targetNamespace" value
   ="http://jbauer.boeblingen.de.ibm.com/Camera"/>
     </eAnnotations>
     <eClassifiers xsi:type="ecore:EClass" name="Camera" eSuperTypes="
   #//CameraType">
       <eAnnotations source
   ="http:///org/eclipse/emf/mapping/xsd2ecore/XSD2Ecore";>
         <details key="representation" value="element"/>
         <details key="name" value="Camera"/>
         <details key="targetNamespace" value
   ="http://jbauer.boeblingen.de.ibm.com/Camera"/>
       </eAnnotations>
     </eClassifiers>



Ed Merks/Toronto/IBM@IBMCA
mailto: merks@xxxxxxxxxx
905-413-3265  (t/l 969)




                                                                                                                            
                      Le Anh Tuyet                                                                                          
                      <anh-tuyet.le@ima        To:       xsd-dev@xxxxxxxxxxx                                                
                      g.fr>                    cc:                                                                          
                      Sent by:                 Subject:  [xsd-dev] XMI or XSD                                               
                      xsd-dev-admin@ecl                                                                                     
                      ipse.org                                                                                              
                                                                                                                            
                                                                                                                            
                      12/19/2002 08:01                                                                                      
                      AM                                                                                                    
                      Please respond to                                                                                     
                      xsd-dev                                                                                               
                                                                                                                            
                                                                                                                            



Hi,

I have installed XML Schema Infoset Model in the Eclipse workbench.
Therefore, XMI serialization is replaced by XSD schema. How can I
configure for switching between XMI and XSD and to force EMF use either
a XMI or a XSD like I want?

Regards

_______________________________________________
xsd-dev mailing list
xsd-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/xsd-dev





Back to the top