multiple schemas and intellisense

This should cover W3C XML Schema, Relax NG and DTD related problems.
mikemille
Posts: 5
Joined: Tue Jul 11, 2006 6:33 pm

multiple schemas and intellisense

Post by mikemille »

I'm wondering if it's possible to have the intellisense work with a document linked against multiple schemas. For example, I have the following schema defined:

Code: Select all


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
xmlns:hj="customizations/customizations.xsd"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb/bindingschema_1_0.xsd"
jaxb:extensionBindingPrefixes="hj"
jaxb:version="1.0">
...
</xs:schema>
[code]

Intellisense works great for the xs: namespace. When I add tags begining with <hj: or <jaxb:, I don't get any help from intellisense. I'm wondering if it's possible to get intellisense working for those tags as well. I'm fairly new to schemas, so forgive me if what I'm asking about doesn't make any sense.

Thanks,
Mike
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

I am not sure I understand what you need to do. If you edit an XML document and you want to see in the content completion window elements from multiple schemas that is already possible by declaring all the schemas in the xsi:schemaLocation attribute of the root element of the XML document, where xsi is a prefix for the "http://www.w3.org/2001/XMLSchema-instance" namespace. If that is not what you need do you want to be able to set an annotation schema with elements and attributes allowed inside xs:annotation/xs:xs:appinfo and xs:annotation/xs:documentation elements of an XML Schema schema ? That is do you want the content completion to offer elements from other XML Schema while editing the xs:annotation elements of an XML Schema schema ? Can you give an example ?

Regards,
Sorin
mikemille
Posts: 5
Joined: Tue Jul 11, 2006 6:33 pm

Post by mikemille »

I'm trying to use hyperjaxb2 to map my schema to existing database tables. Here's an example:

Code: Select all


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
xmlns:hj="http://hyperjaxb2.jvnet.org/customizations"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:extensionBindingPrefixes="hj"
jaxb:version="1.0">

<!-- the above schema declaration is what they recommend in the hyperjaxb2 documentation -->

<xs:annotation><xs:documentation>
This xml schema was created to map to existing Product tables.
</xs:documentation>
<xs:appinfo>
<jaxb:globalBindings generateIsSetMethod="true"/>
<jaxb:schemaBindings>
<jaxb:package name="com.starkbros.jursa.domain"/>
</jaxb:schemaBindings>
</xs:appinfo>
</xs:annotation>

<xs:complexType name="productType">
<xs:annotation>
<xs:appinfo>
<hj:class>
<hj:table name="timProduct"/>
<hj:discriminator type="integer">
<hj:column name="ProductTypeKey"/>
</hj:discriminator>
</hj:class>
</xs:appinfo>
</xs:annotation>
<xs:attribute name="productKey" use="required" type="xs:int">
<xs:annotation>
<xs:appinfo>
<hj:id>
<hj:column name="ProductKey"/>
<hj:generator generatorClass="identity"/>
<hj:type name="integer"/>
</hj:id>
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute ref="productDescription" use="optional"/>
</xs:complexType>

<xs:complexType name="greengoodType">
<xs:annotation>
<xs:documentation>
Greengood product.
</xs:documentation>
<xs:appinfo>
<hj:class discriminator-value="262"/>
</xs:appinfo>
</xs:annotation>
<xs:complexContent>
<xs:restriction base="productType">
<xs:attribute ref="productDescription" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>

<xs:attribute name="productDescription">
<xs:annotation><xs:documentation>
Product Description.
</xs:documentation></xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>

</xs:schema>
When I'm entering <jaxb: or <hj: tags, there is no command completion...which is probably how it's supposed to work.
you want to be able to set an annotation schema with elements and attributes allowed inside xs:annotation/xs:xs:appinfo
That's what I want. Then I wouldn't have to check the documentation all the time. :) Is it possible?

Thanks for your help.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

It is not possible in the current version (7.2) but a future version will allow the configuration of an annotation schema for an XML Schema, something like the schema which can be configured for the result document of an XSLT stylesheet which enables content completion based on that schema while editing an XSLT stylesheet.

Regards,
Sorin
mikemille
Posts: 5
Joined: Tue Jul 11, 2006 6:33 pm

Post by mikemille »

That would be great. Since we're talking about a future version, maybe your code gurus can make it so end users can specify more then one schema for the annotations. In my example, it would be nice to add both the jaxb and hyperjaxb xsd files so oxygen can present me with multiple options once I enter the xs:appinfo tag. If that's not pssible, just being able to specify the hyperjaxb xsd file will save me a ton of time.

Thanks,
Mike
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Thank you for the suggestion. We will update this forum entry when the feature is implemented.

Regards,
Sorin
hutchkintoot
Posts: 3
Joined: Mon Mar 04, 2013 11:58 am

Re: multiple schemas and intellisense

Post by hutchkintoot »

Is there any progress on this feature-request?

I'm also using the appinfo element of an xml-schema to store instances beloning to another schema. For the author, command completion and nested validation would be a killer feature.

I know that Intellj supports this based on namespaces and known schemas (detected or configured).

Regards,
Johan
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: multiple schemas and intellisense

Post by adrian »

Hi,

For content completion this has been implemented the way Sorin described (since v8.x I believe). A setting for an additional schema has been added in: Options > Preferences, Editor / Content Completion / XSD
Oxygen User Manual - Content Completion - XSD
You can set this option to Other and user your own schema.
Note however that this does not provide validation for the content from the appinfo element against that schema, only content completion is available.

We already have a request on our issue tracking tool for validating the content against the schema. I've submitted another vote for this and mentioned your comments.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply