blob: 11d64a6405e55f528b50625c0c9695c9371ded14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# xmlValidator tool
This tool can be used to check if the `.xml` files you have written are
following the `.xsd` schemas provided by the PFW. By doing so, you are *ensured*
that your configuration is *fully compatible* with the `parameter-framework`.
It scans all directories and subdirectories for `.xml` files and checks them
with `.xsd` from a *schemas* directory you specified for the script.
## Usage
To run xmlValidator, just start it from the commandline with:
python xmlValidator.py <xmlRootDirectory> <xsdDirectory>
where:
* `<xmlRootDirectory>` is a path to a directory containing:
- `.xml` files
- subdirectories containing `.xml` files
* `<xsdDirectory>` is a path to a directory containing:
- `.xsd` files (also called *schemas*)
## Example of usage
### File structure
In the example, we have the following files:
├── ParameterFrameworkConfiguration.xml
├── Schemas
│ ├── ComponentLibrary.xsd
│ ├── ComponentTypeSet.xsd
│ ├── ConfigurableDomains.xsd
│ ├── FileIncluder.xsd
│ ├── ParameterFrameworkConfiguration.xsd
│ ├── ParameterSettings.xsd
│ ├── Parameter.xsd
│ ├── Subsystem.xsd
│ └── SystemClass.xsd
├── Settings
│ └── FS
│ └── Genres.xml
└── Structure
└── FS
├── MusicLibraries.xml
└── my_music.xml
### Command
We are in the directory which contains the structure detailed previously.
To check the validity, we just run:
../../tools/xmlValidator/xmlValidator.py . Schemas
### Results
And we will get the following output on the commandline:
[*] Validate xml files in /home/lab/MusicLibrary/ with /home/lab/MusicLibrary/Schemas
Attempt to validate ParameterFrameworkConfiguration.xml with ParameterFrameworkConfiguration.xsd
ParameterFrameworkConfiguration.xml is valid
Attempt to validate my_music.xml with Subsystem.xsd
my_music.xml is valid
Attempt to validate MusicLibraries.xml with SystemClass.xsd
MusicLibraries.xml is valid
Attempt to validate Genres.xml with ConfigurableDomains.xsd
Genres.xml is valid
## Install requirements
In order to use this tool, you must have the following packages (these
are the names on a debian-based distribution):
* `python` (2.7 or later)
* `python-lxml`
* `libpython2.7` or later
|