Opened 10 years ago
Closed 10 years ago
#10478 closed defect (fixed)
Error when installing preset (chunk containing only list_entry items)
Reported by: | malcolmh | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 14.09 |
Component: | Core | Version: | |
Keywords: | preset chunk xml validation | Cc: |
Description (last modified by )
Attachments (1)
Change History (10)
follow-up: 3 comment:1 by , 10 years ago
comment:2 by , 10 years ago
Description: | modified (diff) |
---|---|
Keywords: | chunk xml validation added |
Summary: | Error when installing preset → Error when installing preset (chunk containing only list_entry items) |
comment:3 by , 10 years ago
Replying to bastiK:
list_entry
is normally inside acombo
element, so it is a little unusual to put a couple oflist_entry
s in a chunk and not the entirecombo
. We could allow this, but then the schema file would no longer be able to catch all the syntax errors in the preset xml.
used in combo and multiselection
- on one hand, it is useful but will clutter the presets file even more
- on the other hand a complete syntax check saves quite some time
As copy & paste works on all systems, I am in favour of the syntax check and excluding single "value" attribute definitions from chunk
.
comment:4 by , 10 years ago
The reason that I need chunks with only "list_entry" items is that I have many different keys that share a common set of values, so I want to define these once and reference them in combos and multiselects with different keys. The "chunk" facility appears on the face of it to be a generalised macro definition entity, so it should only be the expanded source that is checked for validity in the preset context, i.e. don't check the chunks themselves, but check that all the invocations of the chunks result in valid preset structures.
comment:5 by , 10 years ago
Milestone: | → 14.09 |
---|
comment:7 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
The latest revision still causes the error at install time. Try installing https://raw.githubusercontent.com/OpenSeaMap/josm/master/INT-1-preset.xml as a test case.
by , 10 years ago
Attachment: | 10478_error.png added |
---|
comment:8 by , 10 years ago
Description: | modified (diff) |
---|
comment:9 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
It's because you have a reference
in the chunk
. I tried to allow this, but it's almost impossible to express that in XSD without adding new types, etc, and I don't want to change the structure. See this comment in XSD:
<sequence> <!-- Cannot use tns:list_elements here because reference is present both in optional_elements and list_elements so it violates cos-nonambig: Unique Particle Attribution : <group ref="tns:list_elements" minOccurs="1" maxOccurs="unbounded" />--> <element name="list_entry" type="tns:list_entry" minOccurs="1" maxOccurs="unbounded" /> </sequence>
You can change your file as follows. Instead of defining:
<chunk id="lightcolours"> <list_entry value="white" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/white.svg" icon_size="16"/> <list_entry value="red" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/red.svg" icon_size="16"/> <list_entry value="green" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/green.svg" icon_size="16"/> <list_entry value="yellow" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/yellow.svg" icon_size="16"/> <list_entry value="blue" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/blue.svg" icon_size="16"/> <list_entry value="amber" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/amber.svg" icon_size="16"/> <list_entry value="violet" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/violet.svg" icon_size="16"/> <list_entry value="orange" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/orange.svg" icon_size="16"/> <list_entry value="magenta" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/magenta.svg" icon_size="16"/> </chunk> <chunk id="colours"> <reference ref="lightcolours"/> <list_entry value="black" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/black.svg" icon_size="16"/> <list_entry value="grey" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/grey.svg" icon_size="16"/> <list_entry value="brown" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/brown.svg" icon_size="16"/> <list_entry value="pink" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/pink.svg" icon_size="16"/> </chunk> <multiselect key="seamark:landmark:colour" text="Colours"> <reference ref="colours"/> </multiselect>
This syntax will be accepted by the XSD:
<chunk id="lightcolours"> <list_entry value="white" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/white.svg" icon_size="16"/> <list_entry value="red" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/red.svg" icon_size="16"/> <list_entry value="green" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/green.svg" icon_size="16"/> <list_entry value="yellow" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/yellow.svg" icon_size="16"/> <list_entry value="blue" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/blue.svg" icon_size="16"/> <list_entry value="amber" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/amber.svg" icon_size="16"/> <list_entry value="violet" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/violet.svg" icon_size="16"/> <list_entry value="orange" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/orange.svg" icon_size="16"/> <list_entry value="magenta" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/magenta.svg" icon_size="16"/> </chunk> <chunk id="colours"> <list_entry value="black" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/black.svg" icon_size="16"/> <list_entry value="grey" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/grey.svg" icon_size="16"/> <list_entry value="brown" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/brown.svg" icon_size="16"/> <list_entry value="pink" icon="https://raw.githubusercontent.com/OpenSeaMap/josm/master/icons/svg/Q/Q3/pink.svg" icon_size="16"/> </chunk> <multiselect key="seamark:landmark:colour" text="Colours"> <reference ref="lightcolours"/> <reference ref="colours"/> </multiselect>
list_entry
is normally inside acombo
element, so it is a little unusual to put a couple oflist_entry
s in a chunk and not the entirecombo
. We could allow this, but then the schema file would no longer be able to catch all the syntax errors in the preset xml.