| XML validation & content assist w/o doctype or namespace [message #221308] |
Fri, 12 September 2008 13:19  |
Chris W Messages: 33 Registered: July 2009 |
Member |
|
|
We'd like to enable the default XML Editor's validation and content
assistance feature, but on an XML file that does not have doctype or
namespace.
We have XML documents w/ namespaces for which we associate XSD with their
namespaces via XML Catalog entries. This works great. But, we don't have
control over this particular XML document, so we're trying to figure out
the best way to provide validation and content assistance w/o a namespace.
Looking at how XML content assistance is performed, I see that
XMLAssociationProvider.getCMElementDeclaration(...) gets the XSD registry
for a given namespace and subsequent processing creates wrappers for each
assistance candidate. I'm thinking that I could add to this [empty]
result by creating an arbitrary XML Catalog registry containing the
supporting XSD and somehow explicitly retrieve the associated XSD and add
selection candidates to the ContentAssistRequest.
What's the best way to implement a solution? Suggestions? Appreciate
your help.
|
|
|
| Re: XML validation & content assist w/o doctype or namespace [message #221317 is a reply to message #221308] |
Fri, 12 September 2008 13:46   |
|
Originally posted by: dcarver.starstandard.org
You can create a custom Resolver class that if that particular XML file
is found, then have it load the appropriate XSD. This would always
load the XSD for that file, with out having to go into the catalog.
Dave
Chris W wrote:
> We'd like to enable the default XML Editor's validation and content
> assistance feature, but on an XML file that does not have doctype or
> namespace.
>
> We have XML documents w/ namespaces for which we associate XSD with
> their namespaces via XML Catalog entries. This works great. But, we
> don't have control over this particular XML document, so we're trying to
> figure out the best way to provide validation and content assistance w/o
> a namespace.
>
> Looking at how XML content assistance is performed, I see that
> XMLAssociationProvider.getCMElementDeclaration(...) gets the XSD
> registry for a given namespace and subsequent processing creates
> wrappers for each assistance candidate. I'm thinking that I could add
> to this [empty] result by creating an arbitrary XML Catalog registry
> containing the supporting XSD and somehow explicitly retrieve the
> associated XSD and add selection candidates to the ContentAssistRequest.
>
> What's the best way to implement a solution? Suggestions? Appreciate
> your help.
|
|
|
|
| Re: XML validation & content assist w/o doctype or namespace [message #221418 is a reply to message #221356] |
Mon, 15 September 2008 20:43  |
Chris W Messages: 33 Registered: July 2009 |
Member |
|
|
Thank you David and Lawrence.
Yep, with _ we're able to register an XSD for a given file extension.
However, since the XML file is namespace-less, the XSD is parsed as a
default, as note by the code below:
// we assume that this is an inferred CMDocument for a DTD style
'namespaceless' document
CMDocument cmDocument = getCMDocument("", "", "DTD");
Do you guys, anybody, know a way around this? Is there an extension point
to manipulate XMLAssociationProvider?
Thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.01599 seconds