Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » XPAND and XSD adapter(namespace problem)
XPAND and XSD adapter [message #498084] Sat, 14 November 2009 11:31 Go to next message
Marco  is currently offline Marco Friend
Messages: 216
Registered: August 2009
Senior Member
Hi,

To isolate a problem with namespace I created a minimalistic project, and now even without namespace. And it seems that suddenly nothing works anymore.

The template editor shows errors for all types and elements that they are not resolvable. But the Reader can read the xml and the Generator processes the first 2 elements (root and entity) but then fails with TheName of entity.
INFO: Loading XSDSchema from 'ns1.xsd'
Nov 14, 2009 12:09:04 PM org.eclipse.xtend.typesystem.xsd.builder.OawXSDEcoreBuilder initEPackage
INFO: Creating EPackage 'ns1' from XSDSchema 'file:/.../ns1.xsd' (null)
Nov 14, 2009 12:09:05 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: XMLReader: Loading XML file entity.xml
Nov 14, 2009 12:09:05 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: DirectoryCleaner: cleaning directory 'src-gen/mypackage'
Nov 14, 2009 12:09:05 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: Generator: generating 'templates::main::Root FOR model' => src-gen
Nov 14, 2009 12:09:05 PM org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflo wComponent invokeInternal
SEVERE: Error in Component of type org.eclipse.xpand2.Generator:
EvaluationException : Couldn't find type or property 'TheName'
templates::main.xpt[162,7] on line 11 'TheName'
templates::main.xpt[75,28] on line 6 'EXPAND entity FOREACH entity'
[23,38] on line 1 'EXPAND templates::main::Root FOR model'

For easy reproducing I have uploaded the project to http://drop.io/9t38ntm

Most probably I am blind again. This project is so simple and still I can't see what is wrong.

br,
Marco
Re: XPAND and XSD adapter [message #498091 is a reply to message #498084] Sat, 14 November 2009 12:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14722
Registered: July 2009
Senior Member
hi, the problem is quite simple to solve:

modify the template like this

«DEFINE entity FOR EntityType»
	«theName.value»
«ENDDEFINE»


by the way. it helps you if you put your metamodel into a source folder and enable the xsd metamodels in the xtend/xpand section of your projects preferences. then you'll get e.g. code completion in your templates


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: XPAND and XSD adapter [message #498093 is a reply to message #498091] Sat, 14 November 2009 12:15 Go to previous messageGo to next message
Marco  is currently offline Marco Friend
Messages: 216
Registered: August 2009
Senior Member
Thank you Christian.

Now I have re-introduced the namespace in the XSD and get the following error which is the same as in my real project:
SEVERE: Error in Component  of type org.eclipse.xpand2.Generator: 
	EvaluationException : No Definition 'templates::main::Root for type::AnyType' found!
	[23,38] on line 1 'EXPAND templates::main::Root FOR model'


ns1.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.example.org/test" xmlns:ns1="http://www.example.org/test">
  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="ns1:Entity"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Entity">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="ns1:TheName"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="TheName">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:NCName">
          <xs:attribute name="Type" use="required" type="xs:NCName"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
</xs:schema>


br
Marco
Re: XPAND and XSD adapter [message #498095 is a reply to message #498093] Sat, 14 November 2009 12:45 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14722
Registered: July 2009
Senior Member
as you can find in the documentation and maybe already tried <option key="DEFAULT_NAMESPACE" val="http://www.example.org/test" /> does the trick

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:XSD adapter and imports
Next Topic:Doubt in Xpand template
Goto Forum:
  


Current Time: Wed Oct 09 04:49:59 GMT 2024

Powered by FUDForum. Page generated in 0.04637 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top