xs:alternative Content Completion

This should cover W3C XML Schema, Relax NG and DTD related problems.
pmenso57
Posts: 2
Joined: Sat May 01, 2021 8:21 am

xs:alternative Content Completion

Post by pmenso57 »

Years ago, the editor supplied content completion based on the type selected via an xs:alternative. It stopped doing so when I upgraded from 15/16 to 21/23.

E.g. given this schema:

Code: Select all

<?xml version="1.1" encoding="UTF-8"?>
<xs:schema
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
	xmlns="urn:test" targetNamespace="urn:test" elementFormDefault="qualified"
	vc:minVersion="1.1">
	<xs:complexType name="base">
		<xs:attribute name="condition" type="xs:boolean" use="required"/>
	</xs:complexType>
	<xs:complexType name="derived-1">
		<xs:complexContent>
			<xs:extension base="base">
				<xs:attribute name="left"/>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="derived-2">
		<xs:complexContent>
			<xs:extension base="base">
				<xs:attribute name="right"/>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:element name="element" type="base">
		<xs:alternative test="data(@condition) = ('true', 1)" type="derived-1"/>
		<xs:alternative test="data(@condition) = ('false', 0)" type="derived-2"/>
	</xs:element>
</xs:schema>
The editor will not give content completion assistance for the attributes "left" or "right" depending on "condition."

Code: Select all

<?xml version="1.1" encoding="UTF-8"?>
<element
	xmlns="urn:test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="urn:test test.xsd"
	condition="true"/>
Similarly, if the derived types in the schema have child elements (etc.), no content completion assistance comes up for them either.

This is causing a bloat of xsi:type attributes in the instance documents. What happened?
tavy
Posts: 365
Joined: Thu Jul 01, 2004 12:29 pm

Re: xs:alternative Content Completion

Post by tavy »

Hello,

Thanks for your feedback.
Unfortunately I cannot reproduce the problems. The content completion works fine for me, it provides the "left" or "right" attributes depending on "condition". I tested with oXygen XML Editor 23.1, build 2021030206.
Maybe you have set an option that affects the content completion support. I recommend you to reset to default the options from Options->Preferences->XML / XML Parser / XML Schema option page. The try to run the validation again on the XML document and then start the content completion.
If this does not work, maybe you can try to reset all your options. You can first save the options using the Options->Export Global Options action, then reset them using Options->Reset Global Options action.

If still does not work, please tell me what version of Oxygen do you use exactly, and send me the exported options on support@oxygenxml.com, to try to reproduce the problem.

Best Regards,
Octatian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
pmenso57
Posts: 2
Joined: Sat May 01, 2021 8:21 am

Re: xs:alternative Content Completion

Post by pmenso57 »

I reset the XML Schema settings and then immediately changed it back to use 1.1, Saxon EE, and allow multiple schema imports, and now it works. The difference from what I had before is only in the Xerces validation features section--which it supposedly isn't using. Maybe the content completion is using Xerces anyway?

Thanks for the help.
tavy
Posts: 365
Joined: Thu Jul 01, 2004 12:29 pm

Re: xs:alternative Content Completion

Post by tavy »

Hello,

Yes, only the XML Schema validation engine can be changed to Saxon, the content completion is always using Xerces.

Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply