XML Schema annotation

This should cover W3C XML Schema, Relax NG and DTD related problems.
scottbdr
Posts: 50
Joined: Tue Jul 21, 2009 1:48 am

XML Schema annotation

Post by scottbdr »

Hi - wondering if you have advise on the following... basically I'd like to be able to author specific elements/attributes within the <xs:annotation> elements in a schema. For example, I might want to require within the xs:annotation/xs:documentation element several elements like 'description', 'label' and other metadata. Same with the <xs:appInfo>. These elements/attributes would be in the pop-up suggestions along with the other xs:schema elements when authoring the XML (in text mode). The ultimate goal of this is transformation for more detailed online documentation (perhaps even an extension of your existing schema documentation XSLT).

I'm assume that setting up a custom Document Type Association is what's required here, but I'm a bit unsure about how to go about it - the XML Schema is a bit more complex than most I suspect. Any suggestions on how to leverage Oxygen's framework in this way would be greatly appreciated.

Thanks, Scott
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: XML Schema annotation

Post by Radu »

Hi Scott,
There is a preferences page where you can point Oxygen to an XML Schema which should be used to propose content completion entries inside xs:appInfo elements when editing other XML Schemas:
https://www.oxygenxml.com/doc/versions/ ... n-xsd.html
We do not have a similar feature for xs:documentation.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
scottbdr
Posts: 50
Joined: Tue Jul 21, 2009 1:48 am

Re: XML Schema annotation

Post by scottbdr »

That gets the job done well enough! Thank you!
Scott
scottbdr
Posts: 50
Joined: Tue Jul 21, 2009 1:48 am

Re: XML Schema annotation

Post by scottbdr »

Well... I must be doing something wrong. My schema looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" >
    <xs:element name="test" type="xs:string" />
</xs:schema>
And I have the preference set to "Other" pointing to this schema. I don't see the element "test" in the context popup. I've tried it as both global and project based preference, with and without a target namespace. What am I doing wrong? I'm using v24.1.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: XML Schema annotation

Post by Radu »

Hi,

I tested and this seems to be working for me:
Screen Shot 2022-11-10 at 14.54.34.png
Screen Shot 2022-11-10 at 14.54.34.png (119.9 KiB) Viewed 1701 times
Screen Shot 2022-11-10 at 14.55.45.png
Screen Shot 2022-11-10 at 14.55.45.png (77.56 KiB) Viewed 1701 times
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
scottbdr
Posts: 50
Joined: Tue Jul 21, 2009 1:48 am

Re: XML Schema annotation

Post by scottbdr »

Well, indeed it does... couldn't seem to make it work yesterday, today I restarted my computer and Oxygen and it works. Thank you!
Terry65
Posts: 1
Joined: Thu Nov 17, 2022 6:35 am
Contact:

Re: XML Schema annotation

Post by Terry65 »

Hello,

Thank you for your advice. I was also wondering if we could point oxygen to an XML schema. I got my answer from this link.
scottbdr
Posts: 50
Joined: Tue Jul 21, 2009 1:48 am

Re: XML Schema annotation

Post by scottbdr »

Just a few notes from my experience with this - while it does get the elements in the schema added to the contextual menu, there is no real validation per the annotation schema you point at. I suppose I thought that might be possible but thinking about it its not surprising it doesn't. Given the volume of documentation and the size of my schema, I'm starting to think in terms of just having another document I define and linking to it using the @source attribute on the xs:documentation and xs:appinfo. This provides a bit more flexibility in my case - for smaller schemas it's probably easier just to keep it all in the schema and to use this feature which all said is still quite useful.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: XML Schema annotation

Post by Radu »

Hi,
Yes, this features helps only with content completion, we do not have something similar for validation.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply