2013-12-10 26 views
2

路由文件中的routing.yml我的ressource其他路由CONFIGS有:的ressource在XML

leaphly_cart: 
type: rest 
resource: '@AppXXXBundle/Resources/config/rest.xml' 
prefix: /api/v1/ 

而且rest.xml文件:

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

    <routes xmlns="http://symfony.com/schema/routing" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> 

     <import id="carts" type="rest" resource="leaphly_cart.cart.limited.controller" name-prefix="api_1_" /> 
     <import id="cartItems" type="rest" resource="leaphly_cart.cart_item.limited.controller" name-prefix="api_1_" parent="carts" /> 
     <import id="carts_full" type="rest" resource="leaphly_cart.cart.full.controller" name-prefix="api_1_full_" prefix="/full" /> 
     <import id="cartItems_full" type="rest" resource="leaphly_cart.cart_item.full.controller" name-prefix="api_1_full_" parent="carts_full" prefix="/full" /> 
     <import id="cartTransitions" type="rest" resource="Leaphly\CartBundle\Controller\CartTransitionsController" name-prefix="api_1_" parent="carts" /> 

    </routes> 

但是,这并不工作...并显示错误:

InvalidArgumentException: [ERROR 1845] Element '{http://symfony.com/schema/routing}routes': No matching global declaration available for the validation root. (in /var/www/app.com/web/ - line 5, column 0) 

这是怎么回事?

+0

你错过了''还是仅仅是复制/粘贴错误? –

+0

我想念最后提到。我已经更新了相同的代码。 – Sid

+0

请修正问题中的缩进以反映实际代码中的缩进。您的'routing.yml'中的行不会以当前的形式工作。 – nifr

回答

3

XML验证因为有symfony的标准路由XSD不包括/允许(即name-prefix属性)本属性失败。

添加FOSRestBundle/Resources/config/schema/routing/rest_routing-1.0.xsd将XML文件和验证也不会失败。

+0

感谢您的回答.. – Sid

相关问题