XML / XSD在publicId和systemId之间需要空格 [英] XML/XSD White spaces are required between publicId and systemId

查看:249
本文介绍了XML / XSD在publicId和systemId之间需要空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中有一个很多XML文件的PHP项目。现在,我的所有XML文件验证失败,并显示以下错误消息:

  publicId和systemId $之间需要空格b $ b  

我已经搜索过,而publicId和systemId似乎与以DOCTYPE开头的XML文件相关。我没有另一个 SO发布表示将XSD添加到Eclipse中的XML目录,但这似乎没有什么不同。



一个示例XML如下:

 <?xml version =1.0encoding =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\CmsAddresstable =cms_users>

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

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

< named-native-query name =countresult-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 =idcolumn =id/>
< field-result name =citycolumn =city/>
< field-result name =countrycolumn =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 =idtype =integercolumn =id>
< generator strategy =AUTO/>
< / id>

< field name =countrycolumn =countrytype =stringlength =50/>
< field name =citycolumn =citytype =stringlength =50/>
< field name =zipcolumn =ziptype =stringlength =50/>

< one-to-one field =usertarget-entity =CmsUserinversed-by =address>
< join-column referenced-column-name =id/>
< / one-to-one>

< / entity>
< / doctrine-mapping>

我有点困惑,接下来要尝试。我可以禁用XML验证,但是我讨厌这样做来解决Eclipse中的错误。如果它有任何区别,我使用Eclipse 3.7与PDT。失败的XML文件都是库的一部分,所以我认为它必须是一个Eclipse配置详细信息,必须进行修改/纠正以解决问题,但我不知道什么。



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

解决方案

基本上,顺序应该是这样的 - 属性,然后跟随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>


I've got a PHP project in Eclipse with a lot of XML files. Right now, all my XML files are failing validation, with the following error message:

White spaces are required between publicId and systemId

I've searched around, and publicId and systemId seem to be related to XML files that start with DOCTYPE. Mine don't. Another SO posting indicated to add the XSD to the XML catalog in Eclipse, but that doesn't seem to make a difference.

One sample XML is the following:

<?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>

I'm a bit stumped at what to try next. I can disable XML validation, but I hate doing things like that to resolve errors in Eclipse. If it makes any difference, I'm using Eclipse 3.7 with PDT. The XML files that fail are all part of libraries so I presume it must be an Eclipse configuration detail that had to be modified/rectified to resolve the issue, but I have no idea what.

Any suggestions what I can try to have my XML files validate?

解决方案

Basically, the order should be like this - property and then followed by 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">

这篇关于XML / XSD在publicId和systemId之间需要空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆