XML / XSD的空格都需要publicId和的systenId之间(XML/XSD White

2019-09-01 01:45发布

我有在Eclipse PHP项目有很多的XML文件。 现在,我的所有的XML文件都验证失败,并出现以下错误信息:

White spaces are required between publicId and systemId

我,四处搜寻,publicId和的systenId似乎涉及到与DOCTYPE开始的XML文件。 矿井没有。 另一个因此发布会指示给XSD添加到Eclipse中的XML目录,但是这似乎并没有发挥作用。

一个示例XML如下:

<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                          http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <entity name="Doctrine\Tests\Models\CMS\CmsAddress" table="cms_users">

        <named-native-queries>
            <named-native-query name="find-all" result-set-mapping="mapping-find-all">
                <query>SELECT id, country, city FROM cms_addresses</query>
            </named-native-query>

            <named-native-query name="find-by-id" result-class="CmsAddress">
                <query>SELECT * FROM cms_addresses WHERE id = ?</query>
            </named-native-query>

            <named-native-query name="count" result-set-mapping="mapping-count">
                <query>SELECT COUNT(*) AS count FROM cms_addresses</query>
            </named-native-query>
        </named-native-queries>

        <sql-result-set-mappings>
            <sql-result-set-mapping name="mapping-find-all">
                <entity-result entity-class="CmsAddress">
                    <field-result name="id" column="id"/>
                    <field-result name="city" column="city"/>
                    <field-result name="country" column="country"/>
                </entity-result>
            </sql-result-set-mapping>

            <sql-result-set-mapping name="mapping-without-fields">
                <entity-result entity-class="CmsAddress"/>
            </sql-result-set-mapping>

            <sql-result-set-mapping name="mapping-count">
                <column-result name="count"/>
            </sql-result-set-mapping>
        </sql-result-set-mappings>

        <id name="id" type="integer" column="id">
            <generator strategy="AUTO"/>
        </id>

        <field name="country" column="country" type="string" length="50"/>
        <field name="city" column="city" type="string" length="50"/>
        <field name="zip" column="zip" type="string" length="50"/>

        <one-to-one field="user" target-entity="CmsUser" inversed-by="address">
            <join-column referenced-column-name="id" />
        </one-to-one>

    </entity>
</doctrine-mapping>

我在什么尝试下一个有点难倒。 我可以禁用XML验证,但我不喜欢做这样的事情,在Eclipse中解决错误。 如果这有什么差别,我使用Eclipse 3.7与PDT。 失败的XML文件库的一部分,所以我推测它必须是一个Eclipse配置的细节,必须修改/整流解决这个问题,但我不知道是什么。

任何建议我可以尝试有我的XML文件验证?

Answer 1:

基本上,顺序应该是这样的 - 属性,然后接着property.xsd

xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/security
       http://www.springframework.org/schema/security/spring-security-3.2.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc 
       http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">


Answer 2:

保持一个空格“”在XSI每个URL后财产的schemaLocation除了最后一个。

的xsi:的schemaLocation =“http://doctrine-project.org/schemas/orm/doctrine-mapping**<1空格> ** http://www.doctrine-project.org/schemas/orm/doctrine-mapping的.xsd “>



文章来源: XML/XSD White spaces are required between publicId and systemId