File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
src/Symfony/Component/CssSelector Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -7,25 +7,23 @@ The component only goal is to convert CSS selectors to their XPath
7
7
equivalents:
8
8
9
9
``` php
10
- use Symfony\Component\CssSelector\CssSelector ;
10
+ use Symfony\Component\CssSelector\CssSelectorConverter ;
11
11
12
- print CssSelector::toXPath('div.item > h4 > a');
12
+ $converter = new CssSelectorConverter();
13
+ print $converter->toXPath('div.item > h4 > a');
13
14
```
14
15
15
16
HTML and XML are different
16
17
--------------------------
17
18
18
19
The ` CssSelector ` component comes with an ` HTML ` extension which is enabled by
19
20
default. If you need to use this component with ` XML ` documents, you have to
20
- disable this ` HTML ` extension. That's because, ` HTML ` tag & attribute names
21
- are always lower-cased, but case-sensitive in ` XML ` :
21
+ disable this ` HTML ` extension. That's because, ` HTML ` tag & attribute names are
22
+ always lower-cased, but case-sensitive in ` XML ` :
22
23
23
24
``` php
24
25
// disable `HTML` extension:
25
- CssSelector::disableHtmlExtension();
26
-
27
- // re-enable `HTML` extension:
28
- CssSelector::enableHtmlExtension();
26
+ $converter = new CssSelectorConverter(false);
29
27
```
30
28
31
29
When the ` HTML ` extension is enabled, tag names are lower-cased, attribute
You can’t perform that action at this time.
0 commit comments