Hi Fabrizio,
AFAICT, namespace awareness should solve our problem.
Try the following: set factory.setNamespaceAware(true) in
JaxpMsvBean.java, and insert a default and targetNamespace (the same as
in maven-project-3.xsd) in pom-strict-3.xsd (pom plugin): with this
setup you will correctly validate the current pom of the eclipse plugin
(which includes a xsi:schemaLocation declaration).
The problem is that now, msv seems to hang on poms without a namespace
declaration (after correctly identifying them as invalid). It actually
doesn't hang but the parsing gets very slow because it expects a
namespace declaration for every element, so in practice I always have to
kill the process. I've been trying to turn namespace awareness off after
the first violation (the <project> element), but I didn't succeed.
Maybe somebody on the list knows a bit more about that than I do...
-Lukas
Fabrizio Giustina wrote:
Hi Lukas
On 11/14/05, Lukas Theussl <[EMAIL PROTECTED]> wrote:
This can only be a temporary solution, I am still hoping that we will be
able to make validation work with full namespace awareness. If we
succeed, we'll have to undo this commit.
Sure, if we can make MSV validate files properly we will have to
remove this temporary hack... anyway, let make it work now, till we
find a better solution.
Also note that this has nothing to do with namespace awareness, also
if we can make namespaces working it will not solve the problem: the
only solution would be validating project.xml against 2 schemas at the
same time (maven xsd+schema xsd), but AFAIK msv doesn't support that
at all...
fabrizio
-Lukas
[EMAIL PROTECTED] wrote:
Author: fgiust
Date: Sun Nov 13 01:21:00 2005
New Revision: 332953
URL: http://svn.apache.org/viewcvs?rev=332953&view=rev
Log:
quick hack for removing wrong error messages for poms with an xsd declaration
Modified:
maven/maven-1/plugins/trunk/plugin/src/main/org/apache/maven/JaxpMsvBean.java
Modified:
maven/maven-1/plugins/trunk/plugin/src/main/org/apache/maven/JaxpMsvBean.java
URL:
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/plugin/src/main/org/apache/maven/JaxpMsvBean.java?rev=332953&r1=332952&r2=332953&view=diff
==============================================================================
---
maven/maven-1/plugins/trunk/plugin/src/main/org/apache/maven/JaxpMsvBean.java
(original)
+++
maven/maven-1/plugins/trunk/plugin/src/main/org/apache/maven/JaxpMsvBean.java
Sun Nov 13 01:21:00 2005
@@ -181,6 +181,14 @@
public void error(SAXParseException e) throws SAXException
{
+ if (e.getMessage() != null &&
e.getMessage().indexOf("xsi:schemaLocation") > -1)
+ {
+ // unexpected attribute "xsi:schemaLocation"
+ // ignore, this is due to a valid xsd declaration
+ // Jaxp ignores additionals namespaces declared in the xml
file (xmlns:xsi) and it can't validate
+ // using multiple schema at once
+ return;
+ }
errorMessage(e, MSV_ERROR);
setValid(false);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]