Page 1 of 1
XML Schema annotation
Posted: Wed Nov 09, 2022 12:16 am
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
Re: XML Schema annotation
Posted: Wed Nov 09, 2022 9:39 am
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
Re: XML Schema annotation
Posted: Wed Nov 09, 2022 7:47 pm
by scottbdr
That gets the job done well enough! Thank you!
Scott
Re: XML Schema annotation
Posted: Wed Nov 09, 2022 8:34 pm
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.
Re: XML Schema annotation
Posted: Thu Nov 10, 2022 3:55 pm
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.55.45.png
Re: XML Schema annotation
Posted: Thu Nov 10, 2022 7:48 pm
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!
Re: XML Schema annotation
Posted: Thu Nov 17, 2022 9:41 am
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.
Re: XML Schema annotation
Posted: Thu Nov 17, 2022 7:57 pm
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.
Re: XML Schema annotation
Posted: Fri Nov 18, 2022 7:43 am
by Radu
Hi,
Yes, this features helps only with content completion, we do not have something similar for validation.
Regards,
Radu