[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Problem XML serialization

Hello,

I have defined a simple metamodel using Ecore and I have generated the plugins. When I create a model conforming to that metamodel, the serialized thext looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Library xmlns="http://sLibMM"; xmlns:_="" _:name="theLibrary">
  <Book ref="1" available="no">
    <title>myBook</title>
    <author>me</author>
  </Book>
  <Book ref="2" available="no">
    <title>yourBook</title>
    <author>you</author>
  </Book>
</Library>

And I would like it to be:

<?xml version="1.0" encoding="UTF-8"?>
<Library name="theLibrary">
  <Book ref="1" available="no">
    <title>myBook</title>
    <author>me</author>
  </Book>
  <Book ref="2" available="no">
    <title>yourBook</title>
    <author>you</author>
  </Book>
</Library>

That is, I don't want the xmlns attribute in my XML.
Any idea how can I do it?

I attach my Ecore metamodel.

Thanks in advance.

Ander
<?xml version="1.0" encoding="UTF-8"?>
<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="sLibMM"
    nsURI="http://sLibMM"; nsPrefix="">
  <eClassifiers xsi:type="ecore:EClass" name="Library">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString";>
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
        <details key="kind" value="attribute"/>
        <details key="namespace" value=""/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EReference" name="Book" upperBound="-1" eType="#//Book"
        containment="true"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="Book">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="ref" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString";>
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
        <details key="kind" value="attribute"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="available" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString";
        defaultValueLiteral="">
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
        <details key="kind" value="attribute"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString";>
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
        <details key="kind" value="element"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="author" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString";>
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
        <details key="kind" value="element"/>
      </eAnnotations>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="category" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString";>
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
        <details key="kind" value="element"/>
      </eAnnotations>
    </eStructuralFeatures>
  </eClassifiers>
</ecore:EPackage>
<?xml version="1.0" encoding="UTF-8"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"; xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"; xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.1/notation"; xmi:id="_R2y5ETrbEd6PJt7yRKGdHg" type="EcoreTools" measurementUnit="Pixel">
  <children xmi:type="notation:Node" xmi:id="_UKBf8DrbEd6PJt7yRKGdHg" type="1001">
    <children xmi:type="notation:Node" xmi:id="_UKKp4DrbEd6PJt7yRKGdHg" type="4001"/>
    <children xmi:type="notation:Node" xmi:id="_UKKp4TrbEd6PJt7yRKGdHg" type="5001">
      <children xmi:type="notation:Node" xmi:id="_WY7AcDrbEd6PJt7yRKGdHg" type="2001">
        <element xmi:type="ecore:EAttribute" href="slib.ecore#//Library/name"/>
        <layoutConstraint xmi:type="notation:Location" xmi:id="_WY7AcTrbEd6PJt7yRKGdHg"/>
      </children>
      <styles xmi:type="notation:DrawerStyle" xmi:id="_UKKp4jrbEd6PJt7yRKGdHg"/>
      <styles xmi:type="notation:SortingStyle" xmi:id="_UKKp4zrbEd6PJt7yRKGdHg"/>
      <styles xmi:type="notation:FilteringStyle" xmi:id="_UKKp5DrbEd6PJt7yRKGdHg"/>
    </children>
    <children xmi:type="notation:Node" xmi:id="_UKKp5TrbEd6PJt7yRKGdHg" type="5002">
      <styles xmi:type="notation:DrawerStyle" xmi:id="_UKKp5jrbEd6PJt7yRKGdHg"/>
      <styles xmi:type="notation:SortingStyle" xmi:id="_UKKp5zrbEd6PJt7yRKGdHg"/>
      <styles xmi:type="notation:FilteringStyle" xmi:id="_UKKp6DrbEd6PJt7yRKGdHg"/>
    </children>
    <styles xmi:type="notation:ShapeStyle" xmi:id="_UKBf8TrbEd6PJt7yRKGdHg" fontHeight="10" fillColor="13761016" lineColor="0"/>
    <element xmi:type="ecore:EClass" href="slib.ecore#//Library"/>
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_UKBf8jrbEd6PJt7yRKGdHg" x="80" y="205"/>
  </children>
  <children xmi:type="notation:Node" xmi:id="_ahuB0DrbEd6PJt7yRKGdHg" type="1001">
    <children xmi:type="notation:Node" xmi:id="_ahuB0zrbEd6PJt7yRKGdHg" type="4001"/>
    <children xmi:type="notation:Node" xmi:id="_ahuB1DrbEd6PJt7yRKGdHg" type="5001">
      <children xmi:type="notation:Node" xmi:id="_bfHeMDrbEd6PJt7yRKGdHg" type="2001">
        <element xmi:type="ecore:EAttribute" href="slib.ecore#//Book/ref"/>
        <layoutConstraint xmi:type="notation:Location" xmi:id="_bfHeMTrbEd6PJt7yRKGdHg"/>
      </children>
      <children xmi:type="notation:Node" xmi:id="_btHd8DrbEd6PJt7yRKGdHg" type="2001">
        <element xmi:type="ecore:EAttribute" href="slib.ecore#//Book/available"/>
        <layoutConstraint xmi:type="notation:Location" xmi:id="_btHd8TrbEd6PJt7yRKGdHg"/>
      </children>
      <children xmi:type="notation:Node" xmi:id="_b3aCYDrbEd6PJt7yRKGdHg" type="2001">
        <element xmi:type="ecore:EAttribute" href="slib.ecore#//Book/title"/>
        <layoutConstraint xmi:type="notation:Location" xmi:id="_b3aCYTrbEd6PJt7yRKGdHg"/>
      </children>
      <children xmi:type="notation:Node" xmi:id="_b7uhsDrbEd6PJt7yRKGdHg" type="2001">
        <element xmi:type="ecore:EAttribute" href="slib.ecore#//Book/author"/>
        <layoutConstraint xmi:type="notation:Location" xmi:id="_b7uhsTrbEd6PJt7yRKGdHg"/>
      </children>
      <children xmi:type="notation:Node" xmi:id="_b_ckEDrbEd6PJt7yRKGdHg" type="2001">
        <element xmi:type="ecore:EAttribute" href="slib.ecore#//Book/category"/>
        <layoutConstraint xmi:type="notation:Location" xmi:id="_b_ckETrbEd6PJt7yRKGdHg"/>
      </children>
      <styles xmi:type="notation:DrawerStyle" xmi:id="_ahuB1TrbEd6PJt7yRKGdHg"/>
      <styles xmi:type="notation:SortingStyle" xmi:id="_ahuB1jrbEd6PJt7yRKGdHg"/>
      <styles xmi:type="notation:FilteringStyle" xmi:id="_ahuB1zrbEd6PJt7yRKGdHg"/>
    </children>
    <children xmi:type="notation:Node" xmi:id="_ahuB2DrbEd6PJt7yRKGdHg" type="5002">
      <styles xmi:type="notation:DrawerStyle" xmi:id="_ahuB2TrbEd6PJt7yRKGdHg"/>
      <styles xmi:type="notation:SortingStyle" xmi:id="_ahuB2jrbEd6PJt7yRKGdHg"/>
      <styles xmi:type="notation:FilteringStyle" xmi:id="_ahuB2zrbEd6PJt7yRKGdHg"/>
    </children>
    <styles xmi:type="notation:ShapeStyle" xmi:id="_ahuB0TrbEd6PJt7yRKGdHg" fontHeight="10" fillColor="13761016" lineColor="0"/>
    <element xmi:type="ecore:EClass" href="slib.ecore#//Book"/>
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ahuB0jrbEd6PJt7yRKGdHg" x="360" y="189"/>
  </children>
  <styles xmi:type="notation:DiagramStyle" xmi:id="_R2y5EjrbEd6PJt7yRKGdHg"/>
  <element xmi:type="ecore:EPackage" href="slib.ecore#/"/>
  <edges xmi:type="notation:Edge" xmi:id="_Bl3y0DrcEd6PJt7yRKGdHg" type="3002" source="_UKBf8DrbEd6PJt7yRKGdHg" target="_ahuB0DrbEd6PJt7yRKGdHg">
    <children xmi:type="notation:Node" xmi:id="_Bl3y1DrcEd6PJt7yRKGdHg" type="4011">
      <layoutConstraint xmi:type="notation:Location" xmi:id="_Bl3y1TrcEd6PJt7yRKGdHg" x="-10" y="-10"/>
    </children>
    <children xmi:type="notation:Node" xmi:id="_Bl3y1jrcEd6PJt7yRKGdHg" type="4012">
      <layoutConstraint xmi:type="notation:Location" xmi:id="_Bl3y1zrcEd6PJt7yRKGdHg" x="10" y="10"/>
    </children>
    <styles xmi:type="notation:ConnectorStyle" xmi:id="_Bl3y0TrcEd6PJt7yRKGdHg" lineColor="0"/>
    <styles xmi:type="notation:FontStyle" xmi:id="_Bl3y0jrcEd6PJt7yRKGdHg" fontHeight="10"/>
    <element xmi:type="ecore:EReference" href="slib.ecore#//Library/Book"/>
    <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Bl3y0zrcEd6PJt7yRKGdHg" points="[58, 4, -294, -18]$[356, 22, 4, 0]"/>
    <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_BmA8wDrcEd6PJt7yRKGdHg" id="(0.9699248,0.5495495)"/>
  </edges>
</notation:Diagram>