History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-18099
Type: Bug Bug
Status: Resolved Resolved
Resolution: Won't Fix
Assignee: Maxim Mossienko
Reporter: Serge Baranov
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

XML validation failing for Mule 2.0 config files

Created: 15 May 08 21:38   Updated: 28 May 08 23:35
Component/s: XML editing

Build: 7,757
Severity: Medium


 Description  « Hide
Support feedback:

I recently started migrating from Mule 1.4.x to Mule 2.0.1, and I've
noticed that IntelliJ is having problems with the new-style config
files. Mule 1.4.x used DTD-based validation, whereas Mule 2.x uses XML
schema-based validation.

I'm specifically running into a problem with Mule configs that define
and use a CXF namespace. Consider the following example:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:soap="http://www.mulesource.org/schema/mule/soap/2.0"
       xmlns:cxf="http://www.mulesource.org/schema/mule/cxf/2.0"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.mulesource.org/schema/mule/core/2.0
http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
       http://www.mulesource.org/schema/mule/soap/2.0
http://www.mulesource.org/schema/mule/soap/2.0/mule-soap.xsd
       http://www.mulesource.org/schema/mule/cxf/2.0
http://www.mulesource.org/schema/mule/cxf/2.0/mule-cxf.xsd">

    <description>
        This config builds a JAX-WS service with CXF.
        
        We use a "serviceClass" which is a JAX-WS interface we've
defined. It allows us

        To invoke the EchoUMO hit the following URL -
 
http://localhost:65081/services/EchoUMO?method=echo&amp;param=Is there
an echo?
        (remember to replace the '&amp;' with an ampersand)

        To view the WSDL for the EchoUMO service go to -
            http://localhost:65081/services/EchoUMO?wsdl
    </description>

    <model name="echoSample">
        <service name="EchoUMO">
            <inbound>
                <cxf:inbound-endpoint
address="http://localhost:65082/services/EchoUMO"
 
serviceClass="org.mule.example.echo.Echo"/>
            </inbound>
            <echo-component/>
        </service>
    </model>
</mule>

If I ask IntelliJ to fetch external resources to resolve the XSD
references, this works fine for all of them except mule-cxf.xsd –
attempting to have IntelliJ fetch this resource results in the following
error:

Error while fetching
http://www.springframework.org/schema/beans/spring-beans.xsd

...followed by a FileNotFoundException

Surfing to http://www.springframework.org/schema/beans shows that there
is no "spring-beans.xsd", but there is a "spring-beans-2.0.xsd", just as
it is declared in the above XML example. I manually downloaded the
mule-cxf.xsd file and opened it in a text editor, and can see no
explicit reference to "spring-beans.xsd", so at first glance I am
confused as to how this resolution is happening.

If I then go into IntelliJ Settings -> Resources and manually add the
URI and point its location to the manually downloaded XSD, IntelliJ will
then complain that the tag <cxf:inbound-endpoint> is not allowed in that
position. This would seem to be an error, since this is one of the
examples that ships in the archive with the Mule 2.0.1 distribution, and
the above quoted XML config file is pulled directly from that example.

This is causing me no end of headaches, because I rely on IntelliJ to
let me know if my XML is well-formed or not before I go through the
trouble of deploying to a Mule instance and try running it.



 All   Comments   Work Log   Change History      Sort Order:
Andrew Perepelytsya - 15 May 08 23:22
Guys,

Here's some more info from Daniel Feist:

Here my attempt at trying to describe the issue more concisely, maybe this would be more useful to InteliJ guys..

The XML editor auto-complete functionality show elements from other namespace which are valid in the current context via the use of XML schema abstract elements and substitution groups.

HTH,
Andrew


Thibaut - 16 May 08 01:18
thing is http://www.mulesource.org/schema/mule/cxf/2.0/mule-cxf.xsd includes the following
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans"/>

which is probably the cause of your problem, guess this should be raised against the mule team


Andrew Perepelytsya - 16 May 08 20:43
I'm not sure if it's a new issue or related, but the real problem is as follows. Consider the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
      xmlns:management="http://www.mulesource.org/schema/mule/management/2.0"
      xmlns:spring="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
        http://www.mulesource.org/schema/mule/management/2.0 http://www.mulesource.org/schema/mule/management/2.0/mule-management.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <!--
        When typed in full, xml auto-completion for attributes kicks in.
    -->
    <management:jmx-server

    <!--
        However, auto-completion for element names *doesn't* work.
    -->
    <!--<management:-->

</mule>

Check the comments for 2 scenarios. This is a demo with substitution groups in XML schemas, which are valid schemas btw. E.g. other commercial xml-dedicated editors like Oxygen XML work perfectly with them and provide auto-completion.


Maxim Mossienko - 26 May 08 23:13
http://www.mulesource.org/schema/mule/cxf/2.0/mule-cxf.xsd has import that does not allow IDEA to fetch the resource

<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans"/>


Taras Tielkes - 27 May 08 12:36
Andrew, Spring requires the schemaLocation to point to an "virtual schema location" that can be resolved by Spring (using META-INF/spring.schemas).

IDEA simply has the same requirement.


Maxim Mossienko - 27 May 08 14:27
I have solved the problem with highlighting / completion with substitutes