Cannot find the declaration of element 'datasource'.

459 views
Skip to first unread message

Marc

unread,
Jan 5, 2021, 11:23:24 AM1/5/21
to transfer-dev
Hello all,

I have a Coldfusion site using Transfer. when requesting the domain a blan screen is returned. The page only contains basis html. When I cfdump the arguments of the onError handler I get an error:

The XML Provided in 'D:\home\marcbakker.com\subdomains\frameworks\config_taksu\datasource.xml' is not valid against its XML Schema:[Error] :1:67: cvc-elt.1: Cannot find the declaration of element 'datasource'.

Looks like the datasource.xml file can be found but  the datasource's key declaration cannot be found. Apparently Transfer requires this all of a sudden because I did not change this file (datasource.cml) after creation... and of course... it did work before.

Below the contents of te relevant files.

datasource.xml
<?xml version="1.0" encoding="UTF-8"?>
<datasource>
    <name>CMS</name>
    <username>www</username>
    <password>xxx</password>
</datasource>

Transfer\resources\xsd\datasource.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="datasource">
    <xsd:complexType>
        <xsd:sequence minOccurs="1" maxOccurs="1">
            <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1">
            </xsd:element>
            <xsd:element name="username"
                type="xsd:string" minOccurs="1" maxOccurs="1">
            </xsd:element>
            <xsd:element name="password"
                type="xsd:string" minOccurs="1" maxOccurs="1">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

</xsd:schema>

I changed datasource.xml by adding the schema to the datasource key:

<datasource

but that did not work, got the same error about declaration of key datasource not found. I hesitate to fiddle with the datasource.xsd file.

What should I do here?

Transfer version 1.1 Release Candidate 2
Lucee 5.3.7.47

Marc

unread,
Jan 5, 2021, 11:36:49 AM1/5/21
to transfer-dev
If I add a schemalocation to datasource key (as described here) I get the error:

The XML Provided in 'D:\home\marcbakker.com\subdomains\frameworks\config_taksu\datasource.xml' is not valid against its XML Schema:[Error] :5:14: cvc-complex-type.2.3: Element 'datasource' cannot have character [children], because the type's content type is element-only.

What is wrong here?

Marc

unread,
Jan 5, 2021, 11:49:50 AM1/5/21
to transfer-dev
Yesss validating against the datasource.xsd does work:

Leaving the datasource.xsd as is (content and location) and performing validation on the datasource.xml

from (before validation)

<?xml version="1.0" encoding="UTF-8"?>
<datasource>
    <name>CMS</name>
    <username>www</username>
    <password>xxx</password>
</datasource>


to (with validation)

<?xml version="1.0" encoding="UTF-8"?>
<datasource 
    xsi:noNamespaceSchemaLocation="">
    <name>CMS</name>
    <username>www</username>
    <password>xxx</password>
</datasource>

In my previous post where I stated validation did not work I had a typo in datasource.xml  -
xsi:noNamespaceSchemaLocation="">>
 
Thanks all!

Marc

unread,
Jan 5, 2021, 12:08:50 PM1/5/21
to transfer-dev
... that should be

to (with validation)

<?xml version="1.0" encoding="UTF-8"?>
<datasource 
    xsi:noNamespaceSchemaLocation="frameworks/Transfer/resources/xsd/datasource.xsd">  <---  added omitted value of datasource.xsd file --->
    <name>CMS</name>
    <username>www</username>
    <password>xxx</password>
</datasource>

Reply all
Reply to author
Forward
0 new messages