[oXygen-user] Content completion & nested dependencies

John Madden
Fri Jan 8 08:12:03 CST 2010


Hi,

This is about inaccurate content completion lists in editing XML instances associated with certain Relax NG schemas.

I have some schemas that have this kind of structure:

	...
	<element name="item">
		<attribute name="name">
			<value>first</value>
		</attribute>
		<element name="response">
			<attribute name="value">
				<choice>
					<value>alpha</value>
					<value>beta</value>
				</choice>
			</attribute>
		</element>
	</element>
	<element name="item">
		<attribute name="name">
			<value>second</value>
		</attribute>
		<element name="response">
			<attribute name="value">
				<choice>
					<value>gamma</value>
					<value>delta</value>
			</attribute>
		</element>
	</element>
	...

resulting in instances that look like this:

	...
	<item name="first">
		<response value="alpha"/>
	</item>
	<item name="second">
		<response value="gamma"/>
	</item>
	...	

What I tend to find when editing the instance, the content completion lists are accurate for //item/@name, but generally **inaccurate** for //item/response/@value.
I can understand this -- the latter have a layer of dependency that the former do not.

On the other hand, when I validate such an instance, the error messages I get from Jing regarding //item/response/@value always accurately enumerate the valid options. For example, this (invalid) instance:

	...
1)	<item name="first">
2)		<response value="gamma"/>
3)	</item>
4)	<item name="second">
5)		<response value="alpha"/>
6)	</item>
	...

would get the following errors from Jing:

	(line 2) [Jing] value of attribute "value" is invalid; must be equal to "alpha" or "beta".
	(line 5) [Jing] value of attribute "value" is invalid; must be equal to "gamma" or "delta".
	
The content completion lists usually would just show the choices pertaining to item[@name="first"]/response/@name, even when attempting to complete the value entry for item[@name="second"]/response/@value.

So basically, Jing sees all the dependencies, but the content completion list algorithm does not.

So my question is: would it be possible to give the content completion engine some hints from Jing, in order to improve the accuracy in cases like this where there are such dependencies? Or is there some other strategy for improving content completion in these cases?

John


More information about the oXygen-user mailing list