Validating XD files

This should cover W3C XML Schema, Relax NG and DTD related problems.
4everJang
Posts: 22
Joined: Mon Oct 14, 2013 2:12 pm

Validating XD files

Post by 4everJang »

I am working on a large XML schema that is using the xd namespace - bound to http://www.w3.org/2001/XMLSchema. Why the xs namespace is not used is unknown to me but there is no way I can change that. I am trying to make oXygen validate the file as if it were an xsd file but I fail to set the Doc type association for this.

I thought the scenario would be picked up via the local root name "schema" and the namespace identifier, but even though the file ihas both of these items identical to the XSD file with the xs namespace, the validation scenario is not catching. What am I forgetting here ?

This is what my xd files look like (first couple of lines):

<?xml version="1.0" encoding="utf-8"?>
<xd:schema xmlns:xd="http://www.w3.org/2001/XMLSchema">
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: Validating XD files

Post by adrian »

Hello,

The namespace prefix is not relevant, just the namespace that it is bound to. The namespace seems to be the correct one for XML Schema.

What is the filename extension for these files (.xml, .xsd, other)?
If it's already .xsd, it should already work in Oxygen XML Editor or Developer.

If it's a different filename extension (other than .xml or .xsd ) and you want Oxygen to treat it as any other XML Schema, you will have to associate it with the XSD editor, Options > Preferences , File Types, press New, type your extension (without dot) and from the Editor combo select XSD Editor.

If it has the .xml file extension, you can either:
- make it use the appropriate validation scenario, Document > Validate > Configure validation scenario, pick "Validate XML Schema with Xerces", but you won't have the XML Schema editing helpers (e.g. Design mode) available only in the XSD Editor.
or
- add the file(s) to the Oxygen project, right click on the file in the Project view and from the contextual menu pick Open With > Internal editor... and pick XML Schema from the list. For the current session Oxygen will remember that it's a schema even if you just double click it, but if you restart, you'll have to through Open with again.

PS: Not really significant, but you should know that visually, in Text mode, Oxygen is configured by default to render differently (with green, considered documentation) the elements and attributes that have the xd namespace prefix. You can adjust this in Options > Preferences > Editor / Syntax Highlight / Elements/Attributes by Prefix. Select xd from the list and you can change the color on the right side.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
4everJang
Posts: 22
Joined: Mon Oct 14, 2013 2:12 pm

Re: Validating XD files

Post by 4everJang »

Hi Adrian,

Thanks for the hint about the filename extension being mapped to a different editor. The validation no longer throws errors now. I am not concerned with the coloring of the xd:* elements. But there is one thing that does not seem to work yet: I am not yet getting the Elements catalog or the context menu populated with valid candidates while editing the file. Is there a different setting for that? Do I need to restart oXygen after making the file type preference change?

Thanks

Jang
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: Validating XD files

Post by adrian »

Hi,

After making the file type association, you should reopen the file and check if it is indeed open in the XSD Editor (purple icon in editor tab). Only the XSD Editor has the Design mode, so if there is no Design mode (just Text/Grid/Author), restart Oxygen.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
4everJang
Posts: 22
Joined: Mon Oct 14, 2013 2:12 pm

Re: Validating XD files

Post by 4everJang »

Thanks. It works now - after restart.
Post Reply