Modify

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 Don-vip)

I have a preset that produces an error message when I try to install it:


It does not seem to like the fact that I have chunks that contain only list_entry items. However, if I click on "Yes" to accept the install, the preset then works fine, with the chunk invocations working as expected.

Attachments (1)

10478_error.png (48.9 KB ) - added by Don-vip 10 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by bastiK, 10 years ago

list_entry is normally inside a combo element, so it is a little unusual to put a couple of list_entrys in a chunk and not the entire combo. We could allow this, but then the schema file would no longer be able to catch all the syntax errors in the preset xml.

comment:2 by Don-vip, 10 years ago

Description: modified (diff)
Keywords: chunk xml validation added
Summary: Error when installing presetError when installing preset (chunk containing only list_entry items)

in reply to:  1 comment:3 by skyper, 10 years ago

Replying to bastiK:

list_entry is normally inside a combo element, so it is a little unusual to put a couple of list_entrys in a chunk and not the entire combo. 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.

Last edited 10 years ago by skyper (previous) (diff)

comment:4 by malcolmh, 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.

Last edited 10 years ago by malcolmh (previous) (diff)

comment:5 by Don-vip, 10 years ago

Milestone: 14.09

comment:6 by Don-vip, 10 years ago

Resolution: fixed
Status: newclosed

In 7503/josm:

fix #10478 - update preset XSD to allow list_entry in chunk (JOSM already supports it)

comment:7 by malcolmh, 10 years ago

Resolution: fixed
Status: closedreopened

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 Don-vip, 10 years ago

Attachment: 10478_error.png added

comment:8 by Don-vip, 10 years ago

Description: modified (diff)

comment:9 by Don-vip, 10 years ago

Resolution: fixed
Status: reopenedclosed

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>

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.