You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Joachim Schreiber <yo...@yos.biz> on 2005/04/17 08:09:39 UTC

POM root Element: project or model?

The Docs on m2 web site for the POM shows <model> as the root element. 

In the m2 cvs is a mixture of <project> and <model> elements in the pom.xml
files.

What is the planned name for this element, project or model?

BTW Why not using a namespace declaration (and an online accessible schema
representation of the pom) in the pom.xml?


yo




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


RE: POM root Element: project or model?

Posted by Joachim Schreiber <yo...@yos.biz>.
> If you'd like, you can use the same code Maven does:
> maven-model-2.0-alpha-1.jar (you'll also need plexus-utils-1.0-alpha-
> 2.jar)
> 
> MavenXppReader reader = new MavenXpp3Reader();
> Model pom = reader.read( new FileReader( new File( "pom.xml" ) ) );
> (with suitable error handling on the FileReader, of course)
> 
> >From that, you have pom.getName(), pom.getBuild(),
> pom.getDependencies(), etc - basically the same as XMLBeans would give
> you.

Cool, I will do this ;-)
Thanks!

yo





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


Re: POM root Element: project or model?

Posted by Brett Porter <br...@apache.org>.
>In the moment I have created a schema for the new m2 POM and use it with XML
>Beans for parsing the POM. Before I give the XML to the parser I add a
>science fiction namespace and good ;-)
>  
>
If you'd like, you can use the same code Maven does:
maven-model-2.0-alpha-1.jar (you'll also need plexus-utils-1.0-alpha-2.jar)

MavenXppReader reader = new MavenXpp3Reader();
Model pom = reader.read( new FileReader( new File( "pom.xml" ) ) );
(with suitable error handling on the FileReader, of course)

>From that, you have pom.getName(), pom.getBuild(),
pom.getDependencies(), etc - basically the same as XMLBeans would give you.

Cheers,
Brett



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


RE: POM root Element: project or model?

Posted by Joachim Schreiber <yo...@yos.biz>.
> From: Brett Porter Sent: Sunday, April 17, 2005 8:14 AM
> To: Maven Developers List
> Subject: Re: POM root Element: project or model?
> 

[snip]

> It's planned to provide a generated schema - however, different
> namespaces will not tend to be used inside the POM - we've looked at the
> option and preferred to keep it simple, finding no need to add them at
> this point.
> 

Yes this is not really a problem for m2 ;-)

I was just playing around with the new m2 model. For me the POM is a
repository for Metadata about a project/artifact. I want to parse the
pom.xml files and transfer them to a XTM TopicMap. For XML parsing I very
often use XMLBeans... and XMLBeans needs a schema and xml instances with a
namespace.

In the moment I have created a schema for the new m2 POM and use it with XML
Beans for parsing the POM. Before I give the XML to the parser I add a
science fiction namespace and good ;-)

Yes I know this is just my personal kismet and I can live with it ;-) but
perhaps other schema and namespace aware parsers for examples in IDE's or
Tools may have the same problem.

Just an idea and a report from working with m2. Not a criticism!

yo




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


Re: POM root Element: project or model?

Posted by Brett Porter <br...@apache.org>.
Joachim Schreiber wrote:

>The Docs on m2 web site for the POM shows <model> as the root element. 
>
>In the m2 cvs is a mixture of <project> and <model> elements in the pom.xml
>files.
>  
>
It should be project... it is in the process of being changed. Actually,
either is valid, for now.

>What is the planned name for this element, project or model?
>
>BTW Why not using a namespace declaration (and an online accessible schema
>representation of the pom) in the pom.xml?
>  
>
It's planned to provide a generated schema - however, different
namespaces will not tend to be used inside the POM - we've looked at the
option and preferred to keep it simple, finding no need to add them at
this point.

- Brett


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