maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hervé BOUTEMY <herve.bout...@free.fr>
Subject Re: Maven Modello - Problem
Date Fri, 12 Feb 2010 21:03:21 GMT
Hi,

If you add modello's XML schema reference, you'll see that association tag 
can't have a name: see http://modello.codehaus.org/modello.html.

In your case, you'll need <association xml.itemsStyle="flat">.

Create a main class with 3 fields (valid, invalid and warning) each as a 1-
multiplicity association to a LicenseList class, having a licenses field 
declared as flat association.

If this isn't clear, please continue this discussion on 
user@modello.codehaus.org.

Regards,

Hervé

Le vendredi 12 février 2010, Karl Heinz Marbaise a écrit :
> Hi,
> 
> i've found the modello idea very interesting, cause i need to read an XML
> file....my first try was to use xstream...but i've seen Modelle and
> experimented a little bit it .....
> 
> But now i've a little problem...
> I have an XML File which i would like to model with modello:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <licenses>
> 	<valid>
> 		<license>
> 			<id>Apache Software License 2.0</id>
> 			<description>Apache Software License 2.0</description>
> 			<names>
> 				<name>Apache 2</name>
> 				<name>Apache Software License 2.0</name>
> 				<name>Apache Software License, Version 2.0</name>
> 				<name>The Apache Software License, Version 2.0</name>
> 			</names>
> 			<urls>
> 				<url>http://www.apache.org/licenses/LICENSE-2.0</url>
> 				<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
> 				<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
> 				<url>http://apache.org/licenses/LICENSE-2.0</url>
> 				<url>http://apache.org/licenses/LICENSE-2.0.html</url>
> 				<url>http://apache.org/licenses/LICENSE-2.0.txt</url>
> 			</urls>
> 		</license>
> 
> 		<license>
> 			<id>Common Public License Version 1.0</id>
> 			<description>Common Public License Version 1.0</description>
> 			<names>
> 				<name>Common Public License Version 1.0</name>
> 			</names>
> 			<urls>
> 				<url>http://www.opensource.org/licenses/cpl1.0.txt</url>
> 			</urls>
> 		</license>
> 
> 		<license>
> 			<id>The TMate Open Source License</id>
> 			<description>The TMate Open Source License</description>
> 			<names>
> 				<name>The TMate Open Source License</name>
> 			</names>
> 			<urls>
> 				<url>http://svnkit.com/license.html</url>
> 			</urls>
> 		</license>
> 		<license>
> 			<id>Test License for two Licenses</id>
> 			<description>Test License for two Licenses</description>
> 			<names>
> 				<name>Test License</name>
> 				<name>Test License, Version 1.0</name>
> 			</names>
> 			<urls>
> 				<url>http://www.testlicense.org/License-1.0.txt</url>
> 				<url>http://www.testlicense.org/License-2.0.txt</url>
> 			</urls>
> 		</license>
> 
> 	</valid>
> 
> 	<invalid>
> 		<license>
> 			<id>GNU General Public License (GPL)</id>
> 			<description>GNU General Public License (GPL)</description>
> 			<names>
> 				<name>GNU General Public License, version 2</name>
> 				<name>GNU General Public License, version 3</name>
> 			</names>
> 			<urls>
> 				<url>http://www.gnu.org/licenses/gpl-2.0.html</url>
> 				<url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
> 			</urls>
> 		</license>
> 	</invalid>
> 
> 	<warning>
> 		<license>
> 			<id>Apache Software License 1.1 (Historic)</id>
> 			<description>Apache Software License 1.1 (Historic)</description>
> 			<names>
> 				<name>Apache License, Version 1.1</name>
> 			</names>
> 			<urls>
> 				<url>http://www.apache.org/licenses/LICENSE-1.1</url>
> 			</urls>
> 		</license>
> 	</warning>
> </licenses>
> 
> a modello file which looks like this:
> <?xml version="1.0"?>
> <model
> xsd.namespace="http://maven.apache.org/plugins/maven-license-verifier/licen
> ses/1.0.0"
> 
> xsd.targetNamespace="http://maven.apache.org/plugins/maven-license-verifier
> /licenses/1.0.0">
> 
> 	<id>licenses</id>
> 	<name>Licenses</name>
> 	<defaults>
> 		<default>
> 			<key>package</key>
> 			<value>com.soebes.maven.plugins.mlv.model</value>
> 		</default>
> 	</defaults>
> 	<classes>
> 		<class rootElement="true" xml.tagName="licenses">
> 			<name>Licenses</name>
> 			<version>1.0.0</version>
> 			<description>
>         <![CDATA[
>         	The Licenses file defines the three categories which are
> 	        used to categorize the different licenses.
>     	    ]]>
> 			</description>
> 			<fields>
> 				<field>
> 					<name>valid</name>
> 					<version>1.0.0</version>
> 					<description>
> 					<![CDATA[
> 						The valid category defines licenses which are
> 						assumed to be ok.
> 					]]>
> 					</description>
> 					<association xml.itemsStyle="wrapped">
> 						<name>licenses</name>
> 						<type>License</type>
> 						<multiplicity>*</multiplicity>
> 					</association>
> 				</field>
> 				<field>
> 					<name>invalid</name>
> 					<version>1.0.0</version>
> 					<association xml.itemsStyle="wrapped">
> 						<name>license</name>
> 						<type>License</type>
> 						<xml.tagName>license</xml.tagName>
> 						<multiplicity>*</multiplicity>
> 					</association>
> 				</field>
> 				<field>
> 					<name>warning</name>
> 					<version>1.0.0</version>
> 					<association xml.itemsStyle="wrapped">
> 						<name>license</name>
> 						<type>License</type>
> 						<multiplicity>*</multiplicity>
> 					</association>
> 				</field>
> 			</fields>
> 		</class>
> 
> 		<class>
> 			<name>License</name>
> 			<version>1.0.0</version>
> 			<fields>
> 				<field>
> 					<required>true</required>
> 					<identifier>true</identifier>
> 					<name>id</name>
> 					<type>String</type>
> 				</field>
> 				<field>
> 					<name>description</name>
> 					<type>String</type>
> 				</field>
> 				<field>
> 					<name>names</name>
> 					<version>1.0.0</version>
> 					<association xml.itemsStyle="wrapped">
> 						<name>name</name>
> 						<type>String</type>
> 						<multiplicity>*</multiplicity>
> 					</association>
> 				</field>
> 				<field>
> 					<name>urls</name>
> 					<version>1.0.0</version>
> 					<association xml.itemsStyle="wrapped">
> 						<name>url</name>
> 						<type>String</type>
> 						<multiplicity>*</multiplicity>
> 					</association>
> 				</field>
> 			</fields>
> 		</class>
> 	</classes>
> </model>
> 
> and a resulting output XML file which i created based on the created code:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <licenses>
>   <valid>
>     <valid>
>       <id>ThisIsTheId</id>
>       <description>This is the description Text</description>
>       <names>
>         <name>Test Name 1</name>
>         <name>Test Name 2</name>
>         <name>Test Name 3</name>
>       </names>
>       <urls>
>         <url>URL 1</url>
>         <url>URL 2</url>
>       </urls>
>     </valid>
>     <valid>
>       <id>ThisIsTheId2</id>
>       <description>This is the description Text 2</description>
>       <names>
>         <name>Test Name 21</name>
>         <name>Test Name 22</name>
>         <name>Test Name 23</name>
>       </names>
>       <urls>
>         <url>URL 21</url>
>         <url>URL 22</url>
>       </urls>
>     </valid>
>   </valid>
> </licenses>
> 
> 
> So may be someone here can give me a little tip how to solve the problem
>  may be oversight something in the docs ...
> 
> Many thanks in advance..
> 
> Kind regards
> Karl Heinz Marbaise
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message