Skip to content

Commit 59e8411

Browse files
committed
Merge pull request #2866 from WouterJ/book_fix_xml
Fixed XML examples
2 parents e203c40 + 23dd638 commit 59e8411

16 files changed

+594
-321
lines changed

book/controller.rst

+21-7
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,16 @@ to the controller:
156156
.. code-block:: xml
157157
158158
<!-- app/config/routing.xml -->
159-
<route id="hello" path="/hello/{name}">
160-
<default key="_controller">AcmeHelloBundle:Hello:index</default>
161-
</route>
159+
<?xml version="1.0" encoding="UTF-8" ?>
160+
<routes xmlns="http://symfony.com/schema/routing"
161+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
162+
xsi:schemaLocation="http://symfony.com/schema/routing
163+
http://symfony.com/schema/routing/routing-1.0.xsd">
164+
165+
<route id="hello" path="/hello/{name}">
166+
<default key="_controller">AcmeHelloBundle:Hello:index</default>
167+
</route>
168+
</routes>
162169
163170
.. code-block:: php
164171
@@ -235,10 +242,17 @@ example:
235242
.. code-block:: xml
236243
237244
<!-- app/config/routing.xml -->
238-
<route id="hello" path="/hello/{first_name}/{last_name}">
239-
<default key="_controller">AcmeHelloBundle:Hello:index</default>
240-
<default key="color">green</default>
241-
</route>
245+
<?xml version="1.0" encoding="UTF-8" ?>
246+
<routes xmlns="http://symfony.com/schema/routing"
247+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
248+
xsi:schemaLocation="http://symfony.com/schema/routing
249+
http://symfony.com/schema/routing/routing-1.0.xsd">
250+
251+
<route id="hello" path="/hello/{first_name}/{last_name}">
252+
<default key="_controller">AcmeHelloBundle:Hello:index</default>
253+
<default key="color">green</default>
254+
</route>
255+
</routes>
242256
243257
.. code-block:: php
244258

book/doctrine.rst

+45-22
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,24 @@ information. By convention, this information is usually configured in an
8080
.. code-block:: xml
8181
8282
<!-- app/config/config.xml -->
83-
<doctrine:config>
84-
<doctrine:dbal
85-
driver="%database_driver%"
86-
host="%database_host%"
87-
dbname="%database_name%"
88-
user="%database_user%"
89-
password="%database_password%"
90-
>
91-
</doctrine:config>
83+
<?xml version="1.0" encoding="UTF-8" ?>
84+
<container xmlns="http://symfony.com/schema/dic/services"
85+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
86+
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
87+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
88+
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
89+
90+
<doctrine:config>
91+
<doctrine:dbal
92+
driver="%database_driver%"
93+
host="%database_host%"
94+
dbname="%database_name%"
95+
user="%database_user%"
96+
password="%database_password%"
97+
>
98+
</doctrine:config>
99+
100+
</container>
92101
93102
.. code-block:: php
94103
@@ -161,13 +170,22 @@ for you:
161170
.. code-block:: xml
162171
163172
<!-- app/config/config.xml -->
164-
<doctrine:config
165-
driver="pdo_sqlite"
166-
path="%kernel.root_dir%/sqlite.db"
167-
charset="UTF-8"
168-
>
169-
<!-- ... -->
170-
</doctrine:config>
173+
<?xml version="1.0" encoding="UTF-8" ?>
174+
<container xmlns="http://symfony.com/schema/dic/services"
175+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
176+
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
177+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
178+
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
179+
180+
<doctrine:config
181+
driver="pdo_sqlite"
182+
path="%kernel.root_dir%/sqlite.db"
183+
charset="UTF-8"
184+
>
185+
<!-- ... -->
186+
</doctrine:config>
187+
188+
</container>
171189
172190
.. code-block:: php
173191
@@ -299,6 +317,7 @@ in a number of different formats including YAML, XML or directly inside the
299317
.. code-block:: xml
300318
301319
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
320+
<?xml version="1.0" encoding="UTF-8" ?>
302321
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
303322
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
304323
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
@@ -833,9 +852,11 @@ To do this, add the name of the repository class to your mapping definition.
833852
.. code-block:: xml
834853
835854
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
836-
837-
<!-- ... -->
838-
<doctrine-mapping>
855+
<?xml version="1.0" encoding="UTF-8" ?>
856+
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
857+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
858+
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
859+
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
839860
840861
<entity name="Acme\StoreBundle\Entity\Product"
841862
repository-class="Acme\StoreBundle\Entity\ProductRepository">
@@ -1332,9 +1353,11 @@ the current date, only when the entity is first persisted (i.e. inserted):
13321353
.. code-block:: xml
13331354
13341355
<!-- src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.xml -->
1335-
1336-
<!-- ... -->
1337-
<doctrine-mapping>
1356+
<?xml version="1.0" encoding="UTF-8" ?>
1357+
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
1358+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1359+
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
1360+
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
13381361
13391362
<entity name="Acme\StoreBundle\Entity\Product">
13401363
<!-- ... -->

book/forms.rst

+45-19
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,11 @@ object.
319319
320320
<!-- Acme/TaskBundle/Resources/config/validation.xml -->
321321
<?xml version="1.0" charset="UTF-8"?>
322-
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
322+
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
323+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
324+
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
325+
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
326+
323327
<class name="Acme\TaskBundle\Entity\Task">
324328
<property name="task">
325329
<constraint name="NotBlank" />
@@ -912,10 +916,16 @@ easy to use in your application.
912916
.. code-block:: xml
913917
914918
<!-- src/Acme/TaskBundle/Resources/config/services.xml -->
915-
<service id="acme_demo.form.type.task"
916-
class="Acme\TaskBundle\Form\Type\TaskType">
917-
<tag name="form.type" alias="task" />
918-
</service>
919+
<?xml version="1.0" encoding="UTF-8" ?>
920+
<container xmlns="http://symfony.com/schema/dic/services"
921+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
922+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd>
923+
924+
<service id="acme_demo.form.type.task"
925+
class="Acme\TaskBundle\Form\Type\TaskType">
926+
<tag name="form.type" alias="task" />
927+
</service>
928+
</container>
919929
920930
.. code-block:: php
921931
@@ -1375,12 +1385,20 @@ file:
13751385
.. code-block:: xml
13761386
13771387
<!-- app/config/config.xml -->
1378-
<twig:config ...>
1379-
<twig:form>
1380-
<resource>AcmeTaskBundle:Form:fields.html.twig</resource>
1381-
</twig:form>
1382-
<!-- ... -->
1383-
</twig:config>
1388+
<?xml version="1.0" encoding="UTF-8" ?>
1389+
<container xmlns="http://symfony.com/schema/dic/services"
1390+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1391+
xmlns:twig="http://symfony.com/schema/dic/twig"
1392+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
1393+
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
1394+
1395+
<twig:config>
1396+
<twig:form>
1397+
<twig:resource>AcmeTaskBundle:Form:fields.html.twig</twig:resource>
1398+
</twig:form>
1399+
<!-- ... -->
1400+
</twig:config>
1401+
</container>
13841402
13851403
.. code-block:: php
13861404
@@ -1453,14 +1471,22 @@ file:
14531471
.. code-block:: xml
14541472
14551473
<!-- app/config/config.xml -->
1456-
<framework:config ...>
1457-
<framework:templating>
1458-
<framework:form>
1459-
<resource>AcmeTaskBundle:Form</resource>
1460-
</framework:form>
1461-
</framework:templating>
1462-
<!-- ... -->
1463-
</framework:config>
1474+
<?xml version="1.0" encoding="UTF-8" ?>
1475+
<container xmlns="http://symfony.com/schema/dic/services"
1476+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1477+
xmlns:framework="http://symfony.com/schema/dic/symfony"
1478+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
1479+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
1480+
1481+
<framework:config ...>
1482+
<framework:templating>
1483+
<framework:form>
1484+
<framework:resource>AcmeTaskBundle:Form</framework:resource>
1485+
</framework:form>
1486+
</framework:templating>
1487+
<!-- ... -->
1488+
</framework:config>
1489+
</container>
14641490
14651491
.. code-block:: php
14661492

book/http_cache.rst

+24-7
Original file line numberDiff line numberDiff line change
@@ -845,10 +845,19 @@ First, to use ESI, be sure to enable it in your application configuration:
845845
.. code-block:: xml
846846
847847
<!-- app/config/config.xml -->
848-
<framework:config ...>
849-
<!-- ... -->
850-
<framework:esi enabled="true" />
851-
</framework:config>
848+
<?xml version="1.0" encoding="UTF-8" ?>
849+
<container xmlns="http://symfony.com/schema/dic/symfony"
850+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
851+
xmlns:framework="http://symfony.com/schema/dic/symfony"
852+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
853+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
854+
855+
<framework:config ...>
856+
<!-- ... -->
857+
<framework:esi enabled="true" />
858+
</framework:config>
859+
860+
</container>
852861
853862
.. code-block:: php
854863
@@ -957,9 +966,17 @@ listener that must be enabled in your configuration:
957966
.. code-block:: xml
958967
959968
<!-- app/config/config.xml -->
960-
<framework:config>
961-
<framework:fragments path="/_fragment" />
962-
</framework:config>
969+
<?xml version="1.0" encoding="UTF-8" ?>
970+
<container xmlns="http://symfony.com/schema/dic/services"
971+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
972+
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
973+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
974+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
975+
976+
<framework:config>
977+
<framework:fragments path="/_fragment" />
978+
</framework:config>
979+
</container>
963980
964981
.. code-block:: php
965982

book/http_fundamentals.rst

+10-3
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,16 @@ by adding an entry for ``/contact`` to your routing configuration file:
429429
430430
.. code-block:: xml
431431
432-
<route id="contact" path="/contact">
433-
<default key="_controller">AcmeDemoBundle:Main:contact</default>
434-
</route>
432+
<?xml version="1.0" encoding="UTF-8" ?>
433+
<routes xmlns="http://symfony.com/schema/routing"
434+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
435+
xsi:schemaLocation="http://symfony.com/schema/routing
436+
http://symfony.com/schema/routing/routing-1.0.xsd">
437+
438+
<route id="contact" path="/contact">
439+
<default key="_controller">AcmeDemoBundle:Main:contact</default>
440+
</route>
441+
</routes>
435442
436443
.. code-block:: php
437444

book/internals.rst

+32-18
Original file line numberDiff line numberDiff line change
@@ -566,20 +566,27 @@ the configuration for the development environment:
566566
567567
.. code-block:: xml
568568
569-
<!-- xmlns:webprofiler="http://symfony.com/schema/dic/webprofiler" -->
570-
<!-- xsi:schemaLocation="http://symfony.com/schema/dic/webprofiler http://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd"> -->
571-
572-
<!-- load the profiler -->
573-
<framework:config>
574-
<framework:profiler only-exceptions="false" />
575-
</framework:config>
576-
577-
<!-- enable the web profiler -->
578-
<webprofiler:config
579-
toolbar="true"
580-
intercept-redirects="true"
581-
verbose="true"
582-
/>
569+
<?xml version="1.0" encoding="UTF-8" ?>
570+
<container xmlns="http://symfony.com/schema/dic/services"
571+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
572+
xmlns:webprofiler="http://symfony.com/schema/dic/webprofiler"
573+
xmlns:framework="http://symfony.com/schema/dic/symfony"
574+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
575+
http://symfony.com/schema/dic/webprofiler http://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd
576+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
577+
578+
<!-- load the profiler -->
579+
<framework:config>
580+
<framework:profiler only-exceptions="false" />
581+
</framework:config>
582+
583+
<!-- enable the web profiler -->
584+
<webprofiler:config
585+
toolbar="true"
586+
intercept-redirects="true"
587+
verbose="true"
588+
/>
589+
</container>
583590
584591
.. code-block:: php
585592
@@ -614,10 +621,17 @@ If you enable the web profiler, you also need to mount the profiler routes:
614621
615622
.. code-block:: xml
616623
617-
<import
618-
resource="@WebProfilerBundle/Resources/config/routing/profiler.xml"
619-
prefix="/_profiler"
620-
/>
624+
<?xml version="1.0" encoding="UTF-8" ?>
625+
<routes xmlns="http://symfony.com/schema/routing"
626+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
627+
xsi:schemaLocation="http://symfony.com/schema/routing
628+
http://symfony.com/schema/routing/routing-1.0.xsd">
629+
630+
<import
631+
resource="@WebProfilerBundle/Resources/config/routing/profiler.xml"
632+
prefix="/_profiler"
633+
/>
634+
</routes>
621635
622636
.. code-block:: php
623637

0 commit comments

Comments
 (0)