facebook

XML validation

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #250361 Reply

    Hi !

    I have a very annoying problem. My project contains the following XML file:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
        /*
        * Copyright 2004-2005 The Apache Software Foundation or its licensors,
        *                     as applicable.
        *
        * Licensed under the Apache License, Version 2.0 (the "License");
        * you may not use this file except in compliance with the License.
        * You may obtain a copy of the License at
        *
        *      http://www.apache.org/licenses/LICENSE-2.0
        *
        * Unless required by applicable law or agreed to in writing, software
        * distributed under the License is distributed on an "AS IS" BASIS,
        * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        * See the License for the specific language governing permissions and
        * limitations under the License.
        */
    -->
    <!DOCTYPE nodeTypes [
        <!ELEMENT nodeTypes (nodeType)*>
            <!ELEMENT nodeType ( (supertypes?), (propertyDefinition*), (childNodeDefinition*))>
    
            <!ATTLIST nodeType
                name CDATA #REQUIRED
                isMixin (true|false) #REQUIRED
                 hasOrderableChildNodes (true|false) #REQUIRED
                primaryItemName CDATA #REQUIRED
            >
            <!ELEMENT supertypes (supertype+)>
            <!ELEMENT supertype (#PCDATA)>
    
            <!ELEMENT propertyDefinition (valueConstraints?|defaultValues?)>
            <!ATTLIST propertyDefinition
                name CDATA #REQUIRED
                requiredType (String|Date|Path|Name|Reference|Binary|Double|Long|Boolean|undefined) #REQUIRED
                autoCreated (true|false) #REQUIRED
                mandatory (true|false) #REQUIRED
                onParentVersion (COPY|VERSION|INITIALIZE|COMPUTE|IGNORE|ABORT) #REQUIRED
                protected (true|false) #REQUIRED
                multiple  (true|false) #REQUIRED
            >
            <!ELEMENT valueConstraints (valueConstraint+)>
            <!ELEMENT valueConstraint (#PCDATA)>
            <!ELEMENT defaultValues (defaultValue+)>
            <!ELEMENT defaultValue (#PCDATA)>
    
            <!ELEMENT childNodeDefinition (requiredPrimaryTypes)>
            <!ATTLIST childNodeDefinition
                name CDATA #REQUIRED
                defaultPrimaryType  CDATA #REQUIRED
                autoCreated (true|false) #REQUIRED
                mandatory (true|false) #REQUIRED
                onParentVersion (COPY|VERSION|INITIALIZE|COMPUTE|IGNORE|ABORT) #REQUIRED
                protected (true|false) #REQUIRED
                sameNameSiblings (true|false) #REQUIRED
            >
            <!ELEMENT requiredPrimaryTypes (requiredPrimaryType+)>
            <!ELEMENT requiredPrimaryType (#PCDATA)>
    ]>
        
    <nodeTypes
        xmlns:rep="internal"
        xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
        xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
        xmlns:mgnl="http://www.magnolia.info/jcr/mgnl"
        xmlns:cmed="http://www.c4media.com/jcr/cmed"
        xmlns:jcr="http://www.jcp.org/jcr/1.0">
            
        <nodeType name="cmed:classifiable" isMixin="true" hasOrderableChildNodes="true" primaryItemName="">
            <supertypes>
                <supertype>nt:hierarchyNode</supertype>
            </supertypes>
            <propertyDefinition name="cmed:category0" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true" />
    
            <propertyDefinition name="cmed:category1" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true" />
    
            <propertyDefinition name="cmed:category2" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
            <!--     <defaultValues>
                    <defaultValue></defaultValue>
                </defaultValues> -->
            </propertyDefinition>
            <propertyDefinition name="cmed:category3" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true" />
            <propertyDefinition name="cmed:category4" requiredType="Long" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true" />
        </nodeType>
        
        <nodeType name="cmed:translatable" isMixin="true" hasOrderableChildNodes="true" primaryItemName="">
            <supertypes>
                <supertype>nt:hierarchyNode</supertype>
            </supertypes>
            <propertyDefinition name="translationLanguages" requiredType="String" autoCreated="true" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
                <defaultValues>
                    <defaultValue></defaultValue>
                </defaultValues>
            </propertyDefinition>
        </nodeType>
    
        <nodeType name="cmed:resource" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
            <supertypes>
                <supertype>nt:unstructured</supertype>
            </supertypes>
            <propertyDefinition name="cmed:resourceName" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false" />
            <propertyDefinition name="cmed:encoding" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
            <propertyDefinition name="cmed:mimeType" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
            <propertyDefinition name="cmed:resourceAlias" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
            <propertyDefinition name="cmed:link" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false" />
        </nodeType>
    
        <nodeType name="cmed:resourcelinkable" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
            <supertypes>
                <supertype>nt:unstructured</supertype>
            </supertypes>
            <childNodeDefinition name="*" defaultPrimaryType="" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
                <requiredPrimaryTypes>
                    <requiredPrimaryType>cmed:resource</requiredPrimaryType>
                </requiredPrimaryTypes>
            </childNodeDefinition>
        </nodeType>
    </nodeTypes>

    This results in a set of reported errors:

    Attribute “xmlns:cmed” must be declared for element type “nodeTypes”. How can I make MyEclipse understand/validate this XML file?

    I’ve been searching the forums for a similar problem but couldn’t find anything. Also, I cannot set these files as Derived, because this will lead to CVS/SVN problems (SVN is no longer seeing this file as belonging to it).

    Please help point me to the right direction. I know it must be a way, but I feel like I am missing it.

    ./alex

    .w( the_mindstorm )p.

    #250384

    Riyad Kalla
    Member

    Alex,
    I was able to reproduce this with your file in MyEclipse, NetBeans and IntelliJ. It looks like the file does infact have an error.

    Now that being said, assuming you still just want “MyEclipse to shut up about it”, unfortunately the derived trick is the only thing I can offer you right now. However, because of this, I am pushing hard to get a new mode of validation exclusion included in MyEclipse, I’m sorry for the delay.

    #250411

    Thanks Riyad, but I am wondering if the reported error is exactly the one about the xmlns usage? If so I will wait for the new feature, but if not I will however have to fix it ;-).

    ./alex

    .w( the_mindstorm )p.

    #250419

    Riyad Kalla
    Member

    Yes it’s the same error from each.

    #250533

    I have found the quickest workaround for the problem 🙂

    
        <!ATTLIST nodeTypes
            xmlns:rep CDATA #IMPLIED
            xmlns:nt CDATA #IMPLIED
            xmlns:mix CDATA #IMPLIED
            xmlns:jcr CDATA #IMPLIED
            xmlns:mgnl CDATA #IMPLIED
            xmlns:cmed CDATA #IMPLIED
        >
    

    ./alex

    .w( the_mindstorm )p.

    #250534

    Riyad Kalla
    Member

    Very cool, thank you for following up for others.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: XML validation

You must be logged in to post in the forum log in