Omit showing XML elements in content assist, which are not a

<oXygen/> general issues.
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Omit showing XML elements in content assist, which are not a

Post by SSC » Tue Apr 30, 2013 11:22 am

Hello,

We have a DTD, which defines a certain order of the child elements of a XML element, but all the childelements are optional.
The problem we just faced is that the content assist and the elements view also offers those XML elements, which would cause a validation error, because of a wrong order.

Example:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//PI-MOD//DTD PI-Mod V1.2.2//EN" "pi-mod.dtd">
<task><heading>Sample Task Module</heading>
<task_body>
<actiondescription>
<paragraph/>
</actiondescription>
<action>
<step/>
</action>
</task_body></task>
If the cursor is behind the <action> element the content assist still offers to insert an <actiondescription> element and when an <actiondescription> element is inserted after the <action> element a validation error is shown:

Code: Select all


The content of element type "task_body" is incomplete, it must match "(((actiondescription|safetyadvice)*,action,or-action*,result?,troubleshooting*,note*)+,actionsequenceend?,outlook?)".
In my opinion the content assist and the elements view should not even offer to insert an <actiondescription> element after the <action> element, when it will cause a validation error.

Is this a missing feature or did I configure something wrong?

Best regards,

Simon
Simon Scholz
vogella GmbH
http://www.vogella.com

Radu
Posts: 6582
Joined: Fri Jul 09, 2004 5:18 pm

Re: Omit showing XML elements in content assist, which are n

Post by Radu » Tue Apr 30, 2013 12:19 pm

Hi Simon,

Could you send us (support@oxygenxml.com) a sample XML + the PI-MOD DTDs?
It would make testing on our side easier.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Radu
Posts: 6582
Joined: Fri Jul 09, 2004 5:18 pm

Re: Omit showing XML elements in content assist, which are n

Post by Radu » Tue Apr 30, 2013 3:14 pm

Hi Simon,

Thanks for the samples.

The content model in the DTD of the task_body element is something like:

Code: Select all

<!ENTITY % cm.task_body "
(((actiondescription | safetyadvice)*, action, or-action*, result?, troubleshooting*, note*)+, actionsequenceend?, outlook?)
">
The + sign there indicates that the task_body can have one or more sequences of (actiondescription, action, ... note) tags.

So for example this XML is valid:

Code: Select all

<task>
<heading>Sample Task Module</heading>
<task_body>
<actiondescription>
<paragraph/>
</actiondescription>
<action>
<step/>
</action>
<!--And here we can repeat again the sequence (the + sign in the content model)-->
<actiondescription>
<footnote></footnote>
</actiondescription>
<action>
<step></step>
</action>
</task_body>
</task>
So the editor is correct in proposing the entries because the DTD is very relaxed, the validation error you obtain says that the content of "actiondescription" is incomplete and needs to be filled further.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply