You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by John Fallows <jo...@gmail.com> on 2005/06/11 03:06:34 UTC

[m2] pom schema validation

What are the current design goals for the M2 pom xsd?

The existing schema definition for Maven 1.x

http://maven.apache.org/xsd/maven-project-3.0.0.xsd

has no namespace and uses sequence for child elements.

Will Maven2 instance documents be required to specify a namespace in production?

  <project xmlns="http://maven.apache.org/xsd/maven-project-4.0.0.xsd" >
  ...
  </project>

This is useful for design time integration, rather than relying on
just the filename.

Is there a ordering requirement within pom.xml in practice?

If not, it would seem appropriate to use <all> rather than <sequence>
to define the child elements at each nested level within the document.
 This gives greater flexibility during editing, without sacrificing
correctness.

Kind Regards,
John Fallows.

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


Re: [m2] pom schema validation

Posted by Brett Porter <br...@apache.org>.
John Fallows wrote:

>If processContents was set to "skip", the <war.bundle> would validate,
>but that seems very lenient.
>  
>
It seems the only valid setting as we have to retain backwards compat so 
can't change the format. Thanks!

- Brett


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


Re: [m2] pom schema validation

Posted by John Fallows <jo...@gmail.com>.
Brett,

> Take a peek at:
> http://maven.apache.org/maven-v3_0_0.xsd (Maven 1.1, can be used for
> 1.0.2 as well)
> http://maven.apache.org/maven-v4_0_0.xsd (Maven 2.0)

Looks good. :-)

> And if you can tell me why properties in the first don't validate
> <properties /> properly for the <war.bundle/> case, that'd be great :)

Although you have specified that <properties/> can receive any XML
elements, the "processContents" attribute is set to "lax".  This means
that contained elements will be validated if the validating XML parser
has schema information for the namespace of elements inside the "any"
section.

In your example,
  <properties><war.bundle>...</war.bundle></properties>
does not validate, because:

a) war.bundle is not defined in Maven POM 4.0 namespace schema, and
b) processContents is set to "lax" so that validation should be
attempted for recognized namespaces that have schema information

If processContents was set to "skip", the <war.bundle> would validate,
but that seems very lenient.

If "war" was defined as a namespace prefix, then:
  <properties><war:bundle>...</war:bundle></properties>
would validate just fine. (Note. war-colon-bundle, not war-period-bundle).

If you changed the style of property declaration to:
  <properties><property name="war.bundle">...</property></properties>
that would also validate.

Hope this helps,
John Fallows.

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


Re: [m2] pom schema validation

Posted by Brett Porter <br...@apache.org>.
John,

Take a peek at:
http://maven.apache.org/maven-v3_0_0.xsd (Maven 1.1, can be used for 
1.0.2 as well)
http://maven.apache.org/maven-v4_0_0.xsd (Maven 2.0)

And if you can tell me why properties in the first don't validate 
<properties /> properly for the <war.bundle/> case, that'd be great :)

Cheers,
Brett

John Fallows wrote:

>What are the current design goals for the M2 pom xsd?
>
>The existing schema definition for Maven 1.x
>
>http://maven.apache.org/xsd/maven-project-3.0.0.xsd
>
>has no namespace and uses sequence for child elements.
>
>Will Maven2 instance documents be required to specify a namespace in production?
>
>  <project xmlns="http://maven.apache.org/xsd/maven-project-4.0.0.xsd" >
>  ...
>  </project>
>
>This is useful for design time integration, rather than relying on
>just the filename.
>
>Is there a ordering requirement within pom.xml in practice?
>
>If not, it would seem appropriate to use <all> rather than <sequence>
>to define the child elements at each nested level within the document.
> This gives greater flexibility during editing, without sacrificing
>correctness.
>
>Kind Regards,
>John Fallows.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>For additional commands, e-mail: dev-help@maven.apache.org
>
>
>  
>


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