Bug 135485 - There should be a way to specify a schema through the UI.
Summary: There should be a way to specify a schema through the UI.
Status: NEW
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 1.0.1   Edit
Hardware: All All
: P4 enhancement (vote)
Target Milestone: Future   Edit
Assignee: wst.xml CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2006-04-07 04:17 EDT by Bob Kanefsky CLA
Modified: 2013-07-18 14:17 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Kanefsky CLA 2006-04-07 04:17:33 EDT
Some XML validation tools provide a way to explicitly specify the schema (XSD) that goes with a particular instance (XML) document, even if none is specified or the specified one is wrong.  That can be useful in certain situations, including:

1.  The file belongs to someone else and you want to make minimal changes to it (suppose for example I consider historical plan files from MER in Rover Markup Language to be read-only and want to experiment with schema changes and ensure they are backward compatable), and the schema path in the file is
  (a) missing, or
  (b) an absolute or relative pathname that exists in the intended environment but is difficult to set up in your development environment.
  (c) outdated (e.g. it may contain a version number and I'm experimenting with a new one)

2.  The schema path is correctly specified but is not honored by WTP for some reason (such as Bug 133093).
Comment 1 David Williams CLA 2006-05-13 21:37:41 EDT
When I first began this work (years ago) I wsa opposed to this sort of thing, because I thought it was "bad practice" to use one schema in the file, but another to validate and use for content assist ... but, its frequently requested, so we will consider as an enhancement for our next release. 

We actually do something similar now, for JSPF file, where's it more required. 

I'm assigning to Amy, for now, since this will "fit in" with the content properties page. 

Comment 2 Bob Kanefsky CLA 2006-06-19 12:12:44 EDT
(In reply to comment #1)

Thanks for your decision to add this feature.  In support of it, here's a typical example that just came up on the Phoenix Mars scout mission project:

As a favor for one of the instrument teams, I wanted to validate an XML instance their tool had output.  Unfortunately, none of us had the latest version of the schema with us (RML-2_3.xsd) and I couldn't find it on our intranet site.  But I did have the previous version (RML-2_2.xsd).

So in 1.5RC4 (and earlier), which is designed not to let me override what the file says, it would seem I have three choices:
   - I can give up on validating it at all until the right version can be obtained, which would be a shame since even a non-definitive answer can be a useful clue at this early stage of development.
   - I can edit the instance file they sent me so that it says RML-2_2.xsd, instead of validating exactly what they sent me.  This could be risky if the file is manually maintained (this one happens to be generated by a program), because if I send them back a version with syntax errors fixed, I might accidentally leave it pointed at the old version of the schema.
   - I can rename the schema file to RML-2_3.xsd, thus lying about its content, which could be very confusing to anyone else who sees it, or even to me in a few months.

That's why it will be nice to have an override option.

Another case that has come up in the past is when I'm helping someone troubleshoot a file in which XML Spy has added an absolute pathname to the schema on the original computer.  I didn't want to force the custodian of the document to reorganize his files, so if I can't override the location, I have to edit it and remember to change it back.  And a third case is when there's a bug that prevents the schema being found -- e.g. Bug 133093 rendered version 1.0 unusable to me for validation since I don't feel like convincing the project to change the schemas to define a namespace.

So I look forward to this feature being added.
Comment 3 Amy Wu CLA 2006-06-19 13:11:16 EDT
The cases where you mention you cannot change the xml file and a schema is already specified in it, but you want to use another schema, I wonder if you could actually use the XML Catalog.  You could add an XML Catalog entry in your workspace to say that when schemaX is specified, use schemaY instead.  Granted, this will apply to all files in your workspace though.

Craig, does that sound about right?

For cases where no schema is specified though, that would require some sort of XML Content Properties page.
Comment 4 Amy Wu CLA 2008-02-04 12:58:12 EST
mass reassignment of my bugs to xml-inbox
Comment 5 Craig Salter CLA 2008-02-04 14:39:01 EST
FYI, there is a way via the 'Edit Namespaces...' dialog that can be invoked from the root element on the outline view.  Of course it's terribly hard to find and it's not intuitive that 'Editing Namespaces...' would allow a schema to be assigned.  I use it just to avoid all the filthy 'xsi:schemaLocation' stuff (and the notorious whitespace separated namespace/location pairs).

We need something more prominent and nicely generalized for Schema and DTD (and any other grammar language folks may use).  Showing a warning message when a user selects a schema or DTD that doesn't match the document's content would be useful too.  Perhaps the 'Edit Namespaces...' dialog could be a second page (applicable to XML Schema only) to this generalized dialog?

Just some thoughts.