Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » XML validation & content assist w/o doctype or namespace
XML validation & content assist w/o doctype or namespace [message #221308] Fri, 12 September 2008 17:19 Go to next message
Chris W is currently offline Chris WFriend
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 17:46 Go to previous messageGo to next message
Eclipse UserFriend
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 #221356 is a reply to message #221317] Sun, 14 September 2008 17:24 Go to previous messageGo to next message
Lawrence Mandel is currently offline Lawrence MandelFriend
Messages: 486
Registered: July 2009
Senior Member
If you have access to the WTP book, ch. 15 [1] deals with custom resource
resolution including the XML catalog and URI resolution framework.

[1]http://eclipsewtp.org/chapter15.html

Lawrence Mandel
-
Co-author Eclipse Web Tools Platform: Developing Java Web Applications
http://www.eclipsewtp.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] Tue, 16 September 2008 00:43 Go to previous message
Chris W is currently offline Chris WFriend
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.
Previous Topic:Applets
Next Topic:Question on updating Eclipse
Goto Forum:
  


Current Time: Thu Mar 28 20:39:27 GMT 2024

Powered by FUDForum. Page generated in 0.05022 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top