Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Content Assist for StructuredTextEditor
Content Assist for StructuredTextEditor [message #207260] Sun, 20 January 2008 04:13 Go to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

Hi,

I am using StructuredTextEditor as text editor for xml in my application.
The xml document i am editing have the schema. Does the StructuredTextEditor
provide content assist by default or do i need to configure or should i need
to write code to provide content assits while the user type in. The schema
is in my local disk and in my xml i am specifing the location some thing
like below

<MyXml xmlns="http://www.myschema.com"
xsi:schemaLocation="http://www.myschema.com C:\myschemas\myschedefine.xsd">

when i run my application by default the StructuredText editor provide only
the xml tag validation only i.e if I type" < " till i end the tag it shows
the error. that is good . but what i need to do is if the user types in
element the other attribute which are applicable for that element need to be
show as code complete.

Thanks,
Suresh Subramanian
Re: Content Assist for StructuredTextEditor [message #207262 is a reply to message #207260] Sun, 20 January 2008 11:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Suresh,

It's never a good idea to use a file system path as if it were a URI
since they aren't the same thing, just misleadingly similar. It's
likely that C: will be considered the protocol and a \ is not a segment
separator for a URI the way / is. You might have better success using a
well formed URI, e.g., "file:/C:/myshcemas/myschedefine.xsd"


Suresh Subramanian wrote:
> Hi,
>
> I am using StructuredTextEditor as text editor for xml in my application.
> The xml document i am editing have the schema. Does the StructuredTextEditor
> provide content assist by default or do i need to configure or should i need
> to write code to provide content assits while the user type in. The schema
> is in my local disk and in my xml i am specifing the location some thing
> like below
>
> <MyXml xmlns="http://www.myschema.com"
> xsi:schemaLocation="http://www.myschema.com C:\myschemas\myschedefine.xsd">
>
> when i run my application by default the StructuredText editor provide only
> the xml tag validation only i.e if I type" < " till i end the tag it shows
> the error. that is good . but what i need to do is if the user types in
> element the other attribute which are applicable for that element need to be
> show as code complete.
>
> Thanks,
> Suresh Subramanian
>
>
>
Re: Content Assist for StructuredTextEditor [message #207264 is a reply to message #207262] Mon, 21 January 2008 03:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

Thanks Ed,

I tried that that also not working. ContentAssist is available only for the
element user entered. This is what i did
------------------------------------------------------
My xmlfile as follows
<?xml version= "1.0" encoding="ASCII"?>
<myXml xmlns="http://www.mysite.com/myurl "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mysite.com/myurl myurl.xsd" attr1="value1"
attr2="value2" >
....
</myXml>
--------------------------------------------------------
I added URIResolverExtention extension for my pluglin as follows
<extension

point="org.eclipse.wst.common.uriresolver.resolverExtensions ">

<resolverExtension

stage="postnormalization"

class="com.cisco.designtool.helper.Ei2dURIResolverExtension ">

</resolverExtension>

</extension>

which is called when i open up my xml file using the structuredTextEditor
and i am returning the correct file string for that. for the above xml, when
"http://www.mysite.com/myurl myurl.xsd" url is resolved i am returning
"http://www.mysite.com/myurl file:/c:/myurl.xsd"
ie. the myurl.xsd is in my local disk and its path is C:/myurl.xsd

but still the contentAssist is not working when the cursor is in a node it
shows the following tooltip like content
Element:<elementName>
ContentModel:()*

If i add child element of the <elementName> then it shows the name of the
child element insied ContentModel(). but what i want is completetion
proposal which is not showing right now. I not sure whether i should write
the contentAssist my self. since i am giving the schema for my document i
though StructuredTextEditor would understand the schema and give the the
completion proposal with no additional coding by me. Am i right?

Thanks,
Suresh Subramanian

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fmvcpe$7p7$1@build.eclipse.org...
> Suresh,
>
> It's never a good idea to use a file system path as if it were a URI since
> they aren't the same thing, just misleadingly similar. It's likely that
> C: will be considered the protocol and a \ is not a segment separator for
> a URI the way / is. You might have better success using a well formed
> URI, e.g., "file:/C:/myshcemas/myschedefine.xsd"
>
>
> Suresh Subramanian wrote:
>> Hi,
>>
>> I am using StructuredTextEditor as text editor for xml in my application.
>> The xml document i am editing have the schema. Does the
>> StructuredTextEditor provide content assist by default or do i need to
>> configure or should i need to write code to provide content assits while
>> the user type in. The schema is in my local disk and in my xml i am
>> specifing the location some thing like below
>>
>> <MyXml xmlns="http://www.myschema.com"
>> xsi:schemaLocation="http://www.myschema.com
>> C:\myschemas\myschedefine.xsd">
>>
>> when i run my application by default the StructuredText editor provide
>> only the xml tag validation only i.e if I type" < " till i end the tag it
>> shows the error. that is good . but what i need to do is if the user
>> types in element the other attribute which are applicable for that
>> element need to be show as code complete.
>>
>> Thanks,
>> Suresh Subramanian
>>
>>
Re: Content Assist for StructuredTextEditor [message #207265 is a reply to message #207262] Mon, 21 January 2008 09:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

My xmlfile as follows
<?xml version= "1.0" encoding="ASCII"?>
<myXml xmlns="http://www.mysite.com/myurl "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mysite.com/myurl fiel:/c:/myurl.xsd"
attr1="value1" attr2="value2" >
....
</myXml>

When i loaded this file in the WebTools XML Editor the source view shows
content Assist every thing is good...But when i load that in my
structuredTextEditor the content assist is not happening. One more thing i
notice is in my structuredTextEditor
xsi:schemaLocation="http://www.mysite.com/myurl fiel:/c:/myurl.xsd" is not
appearing. My guess is that my SturcturedTextEditor is not able understand
the xsi:schemaLocation. how could i solve this issue.

Thanks,
Suresh Subramanian
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fmvcpe$7p7$1@build.eclipse.org...
> Suresh,
>
> It's never a good idea to use a file system path as if it were a URI since
> they aren't the same thing, just misleadingly similar. It's likely that
> C: will be considered the protocol and a \ is not a segment separator for
> a URI the way / is. You might have better success using a well formed
> URI, e.g., "file:/C:/myshcemas/myschedefine.xsd"
>
>
> Suresh Subramanian wrote:
>> Hi,
>>
>> I am using StructuredTextEditor as text editor for xml in my application.
>> The xml document i am editing have the schema. Does the
>> StructuredTextEditor provide content assist by default or do i need to
>> configure or should i need to write code to provide content assits while
>> the user type in. The schema is in my local disk and in my xml i am
>> specifing the location some thing like below
>>
>> <MyXml xmlns="http://www.myschema.com"
>> xsi:schemaLocation="http://www.myschema.com
>> C:\myschemas\myschedefine.xsd">
>>
>> when i run my application by default the StructuredText editor provide
>> only the xml tag validation only i.e if I type" < " till i end the tag it
>> shows the error. that is good . but what i need to do is if the user
>> types in element the other attribute which are applicable for that
>> element need to be show as code complete.
>>
>> Thanks,
>> Suresh Subramanian
>>
>>
Re: Content Assist for StructuredTextEditor [message #207267 is a reply to message #207265] Mon, 21 January 2008 12:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------030309090107050609050507
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Suresh,

Is the "fiel" typo in your real example as well, or is it a newsgroup
only typo? Note that in your other example of using just "myurl.xsd"
directly, such a thing should be interpreted as relative to the
referencing document, i.e., it would imply the XSD is in the same folks
as the .xml document itself. Unfortunately I know nothing about what
drives document assist so someone else will need to comment on that. It
might even be sufficient to register the schema's namespace in WTP's XML
catalog so that there's no need for a physical location in the instance
document itself (which tends to be a bad idea since it makes the
document not portable).


Suresh Subramanian wrote:
> My xmlfile as follows
> <?xml version= "1.0" encoding="ASCII"?>
> <myXml xmlns="http://www.mysite.com/myurl "
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.mysite.com/myurl fiel:/c:/myurl.xsd"
> attr1="value1" attr2="value2" >
> ...
> </myXml>
>
> When i loaded this file in the WebTools XML Editor the source view shows
> content Assist every thing is good...But when i load that in my
> structuredTextEditor the content assist is not happening. One more thing i
> notice is in my structuredTextEditor
> xsi:schemaLocation="http://www.mysite.com/myurl fiel:/c:/myurl.xsd" is not
> appearing. My guess is that my SturcturedTextEditor is not able understand
> the xsi:schemaLocation. how could i solve this issue.
>
> Thanks,
> Suresh Subramanian
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:fmvcpe$7p7$1@build.eclipse.org...
>
>> Suresh,
>>
>> It's never a good idea to use a file system path as if it were a URI since
>> they aren't the same thing, just misleadingly similar. It's likely that
>> C: will be considered the protocol and a \ is not a segment separator for
>> a URI the way / is. You might have better success using a well formed
>> URI, e.g., "file:/C:/myshcemas/myschedefine.xsd"
>>
>>
>> Suresh Subramanian wrote:
>>
>>> Hi,
>>>
>>> I am using StructuredTextEditor as text editor for xml in my application.
>>> The xml document i am editing have the schema. Does the
>>> StructuredTextEditor provide content assist by default or do i need to
>>> configure or should i need to write code to provide content assits while
>>> the user type in. The schema is in my local disk and in my xml i am
>>> specifing the location some thing like below
>>>
>>> <MyXml xmlns="http://www.myschema.com"
>>> xsi:schemaLocation="http://www.myschema.com
>>> C:\myschemas\myschedefine.xsd">
>>>
>>> when i run my application by default the StructuredText editor provide
>>> only the xml tag validation only i.e if I type" < " till i end the tag it
>>> shows the error. that is good . but what i need to do is if the user
>>> types in element the other attribute which are applicable for that
>>> element need to be show as code complete.
>>>
>>> Thanks,
>>> Suresh Subramanian
>>>
>>>
>>>
>
>
>


--------------030309090107050609050507
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Suresh,<br>
<br>
Is the "fiel" typo in your real example as well, or is it a newsgroup
only typo?&nbsp; Note that in your other example of using just "myurl.xsd"
directly, such a thing should be interpreted as relative to the
referencing document, i.e., it would imply the XSD is in the same folks
as the .xml document itself.&nbsp; Unfortunately I know nothing about what
drives document assist so someone else will need to comment on that.&nbsp;
It might even be sufficient to register the schema's namespace in WTP's
XML catalog so that there's no need for a physical location in the
instance document itself (which tends to be a bad idea since it makes
the document not portable).<br>
<br>
<br>
Suresh Subramanian wrote:
<blockquote cite="mid:fn1oc5$fs9$1@build.eclipse.org" type="cite">
<pre wrap="">My xmlfile as follows
&lt;?xml version= "1.0" encoding="ASCII"?&gt;
&lt;myXml xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.mysite.com/myurl">"http://www.mysite.com/myurl "</a>
xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xsi:schemaLocation=<a class="moz-txt-link-rfc2396E" href="http://www.mysite.com/myurlfiel:/c:/myurl.xsd">"http://www.mysite.com/myurl fiel:/c:/myurl.xsd"</a>
attr1="value1" attr2="value2" &gt;
....
&lt;/myXml&gt;

When i loaded this file in the WebTools XML Editor the source view shows
content Assist every thing is good...But when i load that in my
structuredTextEditor the content assist is not happening. One more thing i
notice is in my structuredTextEditor
xsi:schemaLocation=<a class="moz-txt-link-rfc2396E" href="http://www.mysite.com/myurlfiel:/c:/myurl.xsd">"http://www.mysite.com/myurl fiel:/c:/myurl.xsd"</a> is not
appearing. My guess is that my SturcturedTextEditor is not able understand
the xsi:schemaLocation. how could i solve this issue.

Thanks,
Suresh Subramanian
"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:fmvcpe$7p7$1@build.eclipse.org">news:fmvcpe$7p7$1@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Suresh,

It's never a good idea to use a file system path as if it were a URI since
they aren't the same thing, just misleadingly similar. It's likely that
C: will be considered the protocol and a \ is not a segment separator for
a URI the way / is. You might have better success using a well formed
URI, e.g., <a class="moz-txt-link-rfc2396E" href="file:/C:/myshcemas/myschedefine.xsd">"file:/C:/myshcemas/myschedefine.xsd "</a>


Suresh Subramanian wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,

I am using StructuredTextEditor as text editor for xml in my application.
The xml document i am editing have the schema. Does the
StructuredTextEditor provide content assist by default or do i need to
configure or should i need to write code to provide content assits while
the user type in. The schema is in my local disk and in my xml i am
specifing the location some thing like below

&lt;MyXml xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.myschema.com">"http://www.myschema.com"</a>
xsi:schemaLocation=<a class="moz-txt-link-rfc2396E" href="http://www.myschema.comC:\myschemas\myschedefine.xsd">"http://www.myschema.com
C:\myschemas\myschedefine.xsd"</a>&gt;

when i run my application by default the StructuredText editor provide
only the xml tag validation only i.e if I type" &lt; " till i end the tag it
shows the error. that is good . but what i need to do is if the user
types in element the other attribute which are applicable for that
element need to be show as code complete.

Thanks,
Suresh Subramanian


</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</body>
</html>

--------------030309090107050609050507--
Re: Content Assist for StructuredTextEditor [message #207271 is a reply to message #207267] Mon, 21 January 2008 15:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

This is a multi-part message in MIME format.

------=_NextPart_000_009F_01C85C03.2A04E400
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

The typo is in newsgroup only.I know what you are refering about the =
schema. i should give a sudo name when the document scanned i need to =
provide a resolver to give the correct file URL. my resolver in the =
previous example is not correct. I read the document for uri resolver =
once again and it tells me that i need to implement URIResolver. my =
resolver is not correct. what i did was if it works for that one sample =
i can try to solve the URL issue next. my code is giving Classcast =
exception .simple code which return null is not working for me. is there =
a working sample i can look inot i looked into =
CacheURIResolverExtenstion but it was not clear to me.if my resolver =
only resolve my url is it fine. my extension point is=20

<extension

point=3D"org.eclipse.wst.common.uriresolver.resolverExtensions ">

<resolverExtension

class=3D"myPackage.MyURIResolver"

priority=3D"low"

stage=3D"postnormalization">

</resolverExtension>

</extension>



and it simple to returns null.

import =
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolver;


public class MyURIResolver implements URIResolver {


/* (non-Javadoc)

* @see =
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolver#resol=
ve(java.lang.String, java.lang.String, java.lang.String)

*/

public String resolve(String arg0, String arg1, String arg2) {

// TODO Auto-generated method stub

System.out.println("resolve");

System.out.println("baseLocation :" + arg0 + " publicId :" + arg1 + " =
systemId :" + arg2 );

return null;

}


/* (non-Javadoc)

* @see =
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolver#resol=
vePhysicalLocation(java.lang.String, java.lang.String, java.lang.String)

*/

public String resolvePhysicalLocation(String arg0, String arg1, String =
arg2) {

System.out.println("resolvePhysicalLocation");

System.out.println("baseLocation :" + arg0 + " publicId :" + arg1 + " =
systemId :" + arg2 );

// TODO Auto-generated method stub

return null;

}


}

this throw following exception.

java.lang.ClassCastException: mypackage..MyURIResolver

at =
org.eclipse.wst.common.uriresolver.internal.URIResolverExten sionDescripto=
r.getResolver(URIResolverExtensionDescriptor.java:82)

at =
org.eclipse.wst.common.uriresolver.internal.URIResolverExten sionRegistry.=
getMatchingURIResolvers(URIResolverExtensionRegistry.java:15 3)

at =
org.eclipse.wst.common.uriresolver.internal.ExtensibleURIRes olver.resolve=
(ExtensibleURIResolver.java:82)

at =
org.eclipse.wst.xml.core.internal.modelquery.XMLCatalogIdRes olver.resolve=
(XMLCatalogIdResolver.java:83)

at =
org.eclipse.wst.xml.core.internal.modelquery.XMLModelQueryAs sociationProv=
ider.resolveGrammarURI(XMLModelQueryAssociationProvider.java :58)

at =
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.XMLAssociat=
ionProvider.resolveGrammarURI(XMLAssociationProvider.java:16 0)

at =
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentM=
anagerImpl.lookupOrCreateResolvedURI(CMDocumentManagerImpl.j ava:115)

at =
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentM=
anagerImpl.addCMDocumentReference(CMDocumentManagerImpl.java :197)

at =
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentL=
oader.handleGrammar(CMDocumentLoader.java:105)

at =
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentL=
oader$CMDocumentLoadingNamespaceTable.addElement(CMDocumentL oader.java:18=
0)

at =
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentL=
oader.loadCMDocuments(CMDocumentLoader.java:74)

at =
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.InferredGra=
mmarBuildingCMDocumentLoader.loadCMDocuments(InferredGrammar BuildingCMDoc=
umentLoader.java:56)

at =
org.eclipse.wst.xml.ui.internal.DOMObserver.invokeCMDocument Load(DOMObser=
ver.java:182)

at =
org.eclipse.wst.xml.ui.internal.DOMObserver$TimerJob.run(DOM Observer.java=
:142)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


what i was trying is whenenver "http://www.mysite.com/myurl myurl.xsd" =
is called i need to return http://www.mysite.com/myurl =
fiel:/c:/myurl.xsd. is this what supposed to do?


I am sure my xml document is right but i am not sure why the code =
completion is not working when the same document is working fine in the =
xml editor.

Thanks,
Suresh Subramananian
news:fn24d9$e6g$1@build.eclipse.org...

Suresh,

Is the "fiel" typo in your real example as well, or is it a newsgroup =
only typo? Note that in your other example of using just "myurl.xsd" =
directly, such a thing should be interpreted as relative to the =
referencing document, i.e., it would imply the XSD is in the same folks =
as the .xml document itself. Unfortunately I know nothing about what =
drives document assist so someone else will need to comment on that. It =
might even be sufficient to register the schema's namespace in WTP's XML =
catalog so that there's no need for a physical location in the instance =
document itself (which tends to be a bad idea since it makes the =
document not portable).


Suresh Subramanian wrote:=20
My xmlfile as follows
<?xml version=3D "1.0" encoding=3D"ASCII"?>
<myXml xmlns=3D"http://www.mysite.com/myurl "
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=3D"http://www.mysite.com/myurl fiel:/c:/myurl.xsd"=20
attr1=3D"value1" attr2=3D"value2" >
....
</myXml>

When i loaded this file in the WebTools XML Editor the source view shows =

content Assist every thing is good...But when i load that in my=20
structuredTextEditor the content assist is not happening. One more thing =
i=20
notice is in my structuredTextEditor=20
xsi:schemaLocation=3D"http://www.mysite.com/myurl fiel:/c:/myurl.xsd" is =
not=20
appearing. My guess is that my SturcturedTextEditor is not able =
understand=20
the xsi:schemaLocation. how could i solve this issue.

Thanks,
Suresh Subramanian
"Ed Merks" <merks@ca.ibm.com> wrote in message=20
news:fmvcpe$7p7$1@build.eclipse.org...
Suresh,

It's never a good idea to use a file system path as if it were a URI =
since=20
they aren't the same thing, just misleadingly similar. It's likely that =

C: will be considered the protocol and a \ is not a segment separator =
for=20
a URI the way / is. You might have better success using a well formed=20
URI, e.g., "file:/C:/myshcemas/myschedefine.xsd"


Suresh Subramanian wrote:
Hi,

I am using StructuredTextEditor as text editor for xml in my =
application.=20
The xml document i am editing have the schema. Does the=20
StructuredTextEditor provide content assist by default or do i need to=20
configure or should i need to write code to provide content assits while =

the user type in. The schema is in my local disk and in my xml i am=20
specifing the location some thing like below

<MyXml xmlns=3D"http://www.myschema.com"
xsi:schemaLocation=3D"http://www.myschema.com=20
C:\myschemas\myschedefine.xsd">

when i run my application by default the StructuredText editor provide=20
only the xml tag validation only i.e if I type" < " till i end the tag =
it=20
shows the error. that is good . but what i need to do is if the user=20
types in element the other attribute which are applicable for that=20
element need to be show as code complete.

Thanks,
Suresh Subramanian


=20

=20

------=_NextPart_000_009F_01C85C03.2A04E400
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.3243" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>The typo is in newsgroup only.I know =
what you are=20
refering about the schema. i should give a sudo name when the document =
scanned i=20
need to provide a resolver to give the correct file URL. my resolver in =
the=20
previous example is not correct. I read the document for uri resolver =
once again=20
and it tells me that i need to implement URIResolver. my resolver is not =

correct. what i did was if it works for that one sample i can try to =
solve the=20
URL issue next. my code is giving Classcast exception .simple code which =
return=20
null is not working for me. is there a working sample i can look inot i =
looked=20
into CacheURIResolverExtenstion but it was not clear to me.if my =
resolver only=20
resolve my url is it fine. my extension point is </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#800000 size=3D2>
<P align=3Dleft>&lt;extension</P>
<P=20
align=3Dleft>point=3D"org.eclipse.wst.common.uriresolver.resolverExtensio=
ns"&gt;</P>
<P align=3Dleft>&lt;resolverExtension</P>
<P align=3Dleft>class=3D"myPackage.MyURIResolver"</P>
<P align=3Dleft>priority=3D"low"</P>
<P align=3Dleft>stage=3D"postnormalization"&gt;</P>
<P align=3Dleft>&lt;/resolverExtension&gt;</P>
<P>&lt;/extension&gt;</P>
<P>&nbsp;</P>
<P><FONT face=3DArial color=3D#000000>and it simple to returns=20
null.</FONT></P><B><FONT color=3D#7f0055 size=3D2>
<P align=3Dleft>import</B></FONT><FONT size=3D2><FONT color=3D#000000>=20
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolver; </FON=
T></P>
<P align=3Dleft><FONT color=3D#000000></FONT></P></FONT><B><FONT =
color=3D#7f0055=20
size=3D2>
<P align=3Dleft>public</B></FONT><FONT color=3D#000000 size=3D2> =
</FONT><B><FONT=20
color=3D#7f0055 size=3D2>class</B></FONT><FONT color=3D#000000 size=3D2> =
MyURIResolver=20
</FONT><B><FONT color=3D#7f0055 size=3D2>implements</B></FONT><FONT =
size=3D2><FONT=20
color=3D#000000> URIResolver {</FONT></P>
<P align=3Dleft><FONT color=3D#000000></FONT></P>
<P align=3Dleft></FONT><FONT color=3D#3f7f5f size=3D2>/* =
(non-Javadoc)</P>
<P align=3Dleft>* @see=20
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolver#resol=
ve(java.lang.String,=20
java.lang.String, java.lang.String)</P>
<P align=3Dleft>*/</P></FONT><FONT size=3D2>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>public</B></FONT><FONT=20
size=3D2> String resolve(String arg0, String arg1, String arg2) {</P>
<P align=3Dleft></FONT><FONT color=3D#3f7f5f size=3D2>// </FONT><B><FONT =
color=3D#7f9fbf=20
size=3D2>TODO</B></FONT><FONT color=3D#3f7f5f size=3D2> Auto-generated =
method=20
stub</P></FONT><FONT size=3D2>
<P align=3Dleft>System.</FONT><I><FONT color=3D#0000c0 =
size=3D2>out</I></FONT><FONT=20
size=3D2>.println(</FONT><FONT color=3D#2a00ff =
size=3D2>"resolve"</FONT><FONT=20
size=3D2>);</P>
<P align=3Dleft>System.</FONT><I><FONT color=3D#0000c0 =
size=3D2>out</I></FONT><FONT=20
size=3D2>.println(</FONT><FONT color=3D#2a00ff size=3D2>"baseLocation =
:"</FONT><FONT=20
size=3D2> + arg0 + </FONT><FONT color=3D#2a00ff size=3D2>" publicId =
:"</FONT><FONT=20
size=3D2> + arg1 + </FONT><FONT color=3D#2a00ff size=3D2>" systemId =
:"</FONT><FONT=20
size=3D2> + arg2 );</P>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>return</B></FONT><FONT=20
size=3D2> </FONT><B><FONT color=3D#7f0055 size=3D2>null</B></FONT><FONT =
size=3D2>;</P>
<P align=3Dleft>}</P>
<P align=3Dleft></P>
<P align=3Dleft></FONT><FONT color=3D#3f7f5f size=3D2>/* =
(non-Javadoc)</P>
<P align=3Dleft>* @see=20
org.eclipse.wst.common.uriresolver.internal.provisional.URIR esolver#resol=
vePhysicalLocation(java.lang.String,=20
java.lang.String, java.lang.String)</P>
<P align=3Dleft>*/</P></FONT><FONT size=3D2>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>public</B></FONT><FONT=20
size=3D2> String resolvePhysicalLocation(String arg0, String arg1, =
String arg2)=20
{</P>
<P align=3Dleft>System.</FONT><I><FONT color=3D#0000c0 =
size=3D2>out</I></FONT><FONT=20
size=3D2>.println(</FONT><FONT color=3D#2a00ff=20
size=3D2>"resolvePhysicalLocation"</FONT><FONT size=3D2>);</P>
<P align=3Dleft>System.</FONT><I><FONT color=3D#0000c0 =
size=3D2>out</I></FONT><FONT=20
size=3D2>.println(</FONT><FONT color=3D#2a00ff size=3D2>"baseLocation =
:"</FONT><FONT=20
size=3D2> + arg0 + </FONT><FONT color=3D#2a00ff size=3D2>" publicId =
:"</FONT><FONT=20
size=3D2> + arg1 + </FONT><FONT color=3D#2a00ff size=3D2>" systemId =
:"</FONT><FONT=20
size=3D2> + arg2 );</P>
<P align=3Dleft></FONT><FONT color=3D#3f7f5f size=3D2>// </FONT><B><FONT =
color=3D#7f9fbf=20
size=3D2>TODO</B></FONT><FONT color=3D#3f7f5f size=3D2> Auto-generated =
method=20
stub</P></FONT><FONT size=3D2>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>return</B></FONT><FONT=20
size=3D2> </FONT><B><FONT color=3D#7f0055 size=3D2>null</B></FONT><FONT =
size=3D2>;</P>
<P align=3Dleft>}</P>
<P align=3Dleft></P>
<P align=3Dleft>}</P></FONT>
<P><FONT face=3DArial color=3D#000000>this throw following=20
exception.</FONT></FONT></P></DIV>
<DIV><U><FONT color=3D#000080 size=3D2>
<P align=3Dleft>java.lang.ClassCastException</U></FONT><FONT =
color=3D#ff0000=20
size=3D2>: mypackage..MyURIResolver</P>
<P align=3Dleft>at=20
org.eclipse.wst.common.uriresolver.internal.URIResolverExten sionDescripto=
r.getResolver(</FONT><U><FONT=20
color=3D#000080 =
size=3D2>URIResolverExtensionDescriptor.java:82</U></FONT ><FONT=20
color=3D#ff0000 size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.common.uriresolver.internal.URIResolverExten sionRegistry.=
getMatchingURIResolvers(</FONT><U><FONT=20
color=3D#000080 =
size=3D2>URIResolverExtensionRegistry.java:153</U></FONT> <FONT=20
color=3D#ff0000 size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.common.uriresolver.internal.ExtensibleURIRes olver.resolve=
(</FONT><U><FONT=20
color=3D#000080 size=3D2>ExtensibleURIResolver.java:82</U></FONT><FONT =
color=3D#ff0000=20
size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.modelquery.XMLCatalogIdRes olver.resolve=
(</FONT><U><FONT=20
color=3D#000080 size=3D2>XMLCatalogIdResolver.java:83</U></FONT><FONT =
color=3D#ff0000=20
size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.modelquery.XMLModelQueryAs sociationProv=
ider.resolveGrammarURI(</FONT><U><FONT=20
color=3D#000080 =
size=3D2>XMLModelQueryAssociationProvider.java:58</U></FONT ><FONT=20
color=3D#ff0000 size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.XMLAssociat=
ionProvider.resolveGrammarURI(</FONT><U><FONT=20
color=3D#000080 size=3D2>XMLAssociationProvider.java:160</U></FONT><FONT =

color=3D#ff0000 size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentM=
anagerImpl.lookupOrCreateResolvedURI(</FONT><U><FONT=20
color=3D#000080 size=3D2>CMDocumentManagerImpl.java:115</U></FONT><FONT=20
color=3D#ff0000 size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentM=
anagerImpl.addCMDocumentReference(</FONT><U><FONT=20
color=3D#000080 size=3D2>CMDocumentManagerImpl.java:197</U></FONT><FONT=20
color=3D#ff0000 size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentL=
oader.handleGrammar(</FONT><U><FONT=20
color=3D#000080 size=3D2>CMDocumentLoader.java:105</U></FONT><FONT =
color=3D#ff0000=20
size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentL=
oader$CMDocumentLoadingNamespaceTable.addElement(</FONT><U ><FONT=20
color=3D#000080 size=3D2>CMDocumentLoader.java:180</U></FONT><FONT =
color=3D#ff0000=20
size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.CMDocumentL=
oader.loadCMDocuments(</FONT><U><FONT=20
color=3D#000080 size=3D2>CMDocumentLoader.java:74</U></FONT><FONT =
color=3D#ff0000=20
size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimp l.InferredGra=
mmarBuildingCMDocumentLoader.loadCMDocuments(</FONT><U><FONT=20
color=3D#000080=20
size=3D2>InferredGrammarBuildingCMDocumentLoader.java:56</U ></FONT><FONT =

color=3D#ff0000 size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.ui.internal.DOMObserver.invokeCMDocument Load( </FONT><=
U><FONT=20
color=3D#000080 size=3D2>DOMObserver.java:182</U></FONT><FONT =
color=3D#ff0000=20
size=3D2>)</P>
<P align=3Dleft>at=20
org.eclipse.wst.xml.ui.internal.DOMObserver$TimerJob.run(</FONT ><U><FONT =

color=3D#000080 size=3D2>DOMObserver.java:142</U></FONT><FONT =
color=3D#ff0000=20
size=3D2>)</P>
<P>at org.eclipse.core.internal.jobs.Worker.run(</FONT><U><FONT =
color=3D#000080=20
size=3D2>Worker.java:55</U></FONT><FONT color=3D#ff0000 =
size=3D2>)</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>what i was trying is whenenver "<A=20
class=3Dmoz-txt-link-rfc2396E=20
href=3D"http://www.mysite.com/myurlfiel:/c:/myurl.xsd"><FONT=20
size=3D3>http://www.mysite.com/myurl myurl.xsd"</FONT></A><FONT =
size=3D3><FONT=20
size=3D2>&nbsp; is called i need to return <A =
class=3Dmoz-txt-link-rfc2396E=20
href=3D"http://www.mysite.com/myurl fiel:/c:/myurl.xsd"><FONT=20
size=3D3>http://www.mysite.com/myurl fiel:/c:/myurl.xsd</FONT></A>. is =
this what=20
supposed to do?</FONT></FONT><FONT size=3D3><BR><BR></FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am sure my xml document is right but =
i am not=20
sure why the code completion is not working when the same document is =
working=20
fine in the xml editor.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Suresh Subramananian</FONT></DIV>
<DIV><B><FONT color=3D#7f0055 size=3D2>
<P align=3Dleft></B></FONT><A=20
href=3D"news:fn24d9$e6g$1@build.eclipse.org">news:fn24d9$e6g$1@build.ecli=
pse.org</A>...</P></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">Suresh,<BR><BR>Is=20
the "fiel" typo in your real example as well, or is it a newsgroup =
only=20
typo?&nbsp; Note that in your other example of using just "myurl.xsd"=20
directly, such a thing should be interpreted as relative to the =
referencing=20
document, i.e., it would imply the XSD is in the same folks as the =
..xml=20
document itself.&nbsp; Unfortunately I know nothing about what drives =
document=20
assist so someone else will need to comment on that.&nbsp; It might =
even be=20
sufficient to register the schema's namespace in WTP's XML catalog so =
that=20
there's no need for a physical location in the instance document =
itself (which=20
tends to be a bad idea since it makes the document not=20
portable).<BR><BR><BR>Suresh Subramanian wrote:=20
<BLOCKQUOTE cite=3Dmid:fn1oc5$fs9$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">My xmlfile as follows
&lt;?xml version=3D "1.0" encoding=3D"ASCII"?&gt;
&lt;myXml xmlns=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"http://www.mysite.com/myurl">"http://www.mysite.com/myurl "</A>
xmlns:xsi=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/200=
1/XMLSchema-instance"</A>
xsi:schemaLocation=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"http://www.mysite.com/myurlfiel:/c:/myurl.xsd">"http://www.mysite=
..com/myurl fiel:/c:/myurl.xsd"</A>=20
attr1=3D"value1" attr2=3D"value2" &gt;
....
&lt;/myXml&gt;

When i loaded this file in the WebTools XML Editor the source view shows =

content Assist every thing is good...But when i load that in my=20
structuredTextEditor the content assist is not happening. One more thing =
i=20
notice is in my structuredTextEditor=20
xsi:schemaLocation=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"http://www.mysite.com/myurlfiel:/c:/myurl.xsd">"http://www.mysite=
..com/myurl fiel:/c:/myurl.xsd"</A> is not=20
appearing. My guess is that my SturcturedTextEditor is not able =
understand=20
the xsi:schemaLocation. how could i solve this issue.

Thanks,
Suresh Subramanian
"Ed Merks" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</A> wrote in =
message=20
<A class=3Dmoz-txt-link-freetext =
href=3D"news:fmvcpe$7p7$1@build.eclipse.org">news:fmvcpe$7p7$1@build.ecli=
pse.org</A>...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Suresh,

It's never a good idea to use a file system path as if it were a URI =
since=20
they aren't the same thing, just misleadingly similar. It's likely that =

C: will be considered the protocol and a \ is not a segment separator =
for=20
a URI the way / is. You might have better success using a well formed=20
URI, e.g., <A class=3Dmoz-txt-link-rfc2396E =
href=3D"file:/C:/myshcemas/myschedefine.xsd">"file:/C:/myshcemas/myschede=
fine.xsd"</A>


Suresh Subramanian wrote:
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Hi,

I am using StructuredTextEditor as text editor for xml in my =
application.=20
The xml document i am editing have the schema. Does the=20
StructuredTextEditor provide content assist by default or do i need to=20
configure or should i need to write code to provide content assits while =

the user type in. The schema is in my local disk and in my xml i am=20
specifing the location some thing like below

&lt;MyXml xmlns=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"http://www.myschema.com">"http://www.myschema.com"</A>
xsi:schemaLocation=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"http://www.myschema.comC:\myschemas\myschedefine.xsd">"http://www=
..myschema.com=20
C:\myschemas\myschedefine.xsd"</A>&gt;

when i run my application by default the StructuredText editor provide=20
only the xml tag validation only i.e if I type" &lt; " till i end the =
tag it=20
shows the error. that is good . but what i need to do is if the user=20
types in element the other attribute which are applicable for that=20
element need to be show as code complete.

Thanks,
Suresh Subramanian


</PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap=3D""><!---->

</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_009F_01C85C03.2A04E400--
Re: Content Assist for StructuredTextEditor [message #207273 is a reply to message #207271] Mon, 21 January 2008 16:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

Suresh Subramanian wrote:
>
> what i was trying is whenenver "http://www.mysite.com/myurl myurl.xsd"
> is called i need to return http://www.mysite.com/myurl
> fiel:/c:/myurl.xsd. is this what supposed to do?
>
> I am sure my xml document is right but i am not sure why the code
> completion is not working when the same document is working fine in the
> xml editor.

Why not leverage the XML Catalog, so that when the XML file is loaded,
it will get the correct file from the XML Catalog for the grammar. That
way you don't need to mess with the xsi:schemaLocation at all.

Dave
Re: Content Assist for StructuredTextEditor [message #207274 is a reply to message #207273] Mon, 21 January 2008 17:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

David,

I agree. Using schemaLocations in instance documents are usually a bad
idea, especially when they point at something local to one machine's
installation...


David Carver wrote:
> Suresh Subramanian wrote:
>>
>> what i was trying is whenenver "http://www.mysite.com/myurl
>> myurl.xsd" is called i need to return http://www.mysite.com/myurl
>> fiel:/c:/myurl.xsd. is this what supposed to do?
>>
>> I am sure my xml document is right but i am not sure why the code
>> completion is not working when the same document is working fine in
>> the xml editor.
>
> Why not leverage the XML Catalog, so that when the XML file is loaded,
> it will get the correct file from the XML Catalog for the grammar.
> That way you don't need to mess with the xsi:schemaLocation at all.
>
> Dave
Re: Content Assist for StructuredTextEditor [message #207275 is a reply to message #207273] Mon, 21 January 2008 18:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

Thanks david for your suggestion and i tried that too.

Following is the User Specific Entries item for my schemaLocation
Location: C:\myurl.xsd
URI: file:///C:/myurl.xsd
Key Type: Schema Location
Key: http://www.mysite.com/myurl myurl.xsd

and my xml file is

<?xml version= "1.0" encoding="ASCII"?>
<myXml xmlns="http://www.mysite.com/myurl "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mysite.com/myurl myurl.xsd"
attr1="value1" attr2="value2" >
....
</myXml>

now it is not even working in the XMLEditor.

Suresh Subramanian
"David Carver" <dcarver@starstandard.org> wrote in message
news:fn2isv$mfu$1@build.eclipse.org...
> Suresh Subramanian wrote:
>> what i was trying is whenenver "http://www.mysite.com/myurl myurl.xsd"
>> is called i need to return http://www.mysite.com/myurl
>> fiel:/c:/myurl.xsd. is this what supposed to do?
>>
>> I am sure my xml document is right but i am not sure why the code
>> completion is not working when the same document is working fine in the
>> xml editor.
>
> Why not leverage the XML Catalog, so that when the XML file is loaded, it
> will get the correct file from the XML Catalog for the grammar. That way
> you don't need to mess with the xsi:schemaLocation at all.
>
> Dave
Re: Content Assist for StructuredTextEditor [message #207276 is a reply to message #207275] Mon, 21 January 2008 19:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

After adding the XML Catalog entry in eclipse IDE and the open up my xml
file it is working fine with the XML Editor. if i run my plugin as it as an
eclipse RCP application, XML Editor doesn't show the content Assist. I
added the dependencies org.eclipse.wst.xml.core, org.eclipse.wst.xml.ui,
org.eclipse.wst.sse.core, org.eclipse.wst.sse.ui, org.eclipse.wst.common,ui
as dependencies for my plugin.I think some thing is missing while i am
running as RCP application. but i am not sure about it.

Thanks,
Suresh Subramanian

"Suresh Subramanian" <sursubra@cisco.com> wrote in message
news:fn2o38$7kf$1@build.eclipse.org...
> Thanks david for your suggestion and i tried that too.
>
> Following is the User Specific Entries item for my schemaLocation
> Location: C:\myurl.xsd
> URI: file:///C:/myurl.xsd
> Key Type: Schema Location
> Key: http://www.mysite.com/myurl myurl.xsd
>
> and my xml file is
>
> <?xml version= "1.0" encoding="ASCII"?>
> <myXml xmlns="http://www.mysite.com/myurl "
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.mysite.com/myurl myurl.xsd"
> attr1="value1" attr2="value2" >
> ...
> </myXml>
>
> now it is not even working in the XMLEditor.
>
> Suresh Subramanian
> "David Carver" <dcarver@starstandard.org> wrote in message
> news:fn2isv$mfu$1@build.eclipse.org...
>> Suresh Subramanian wrote:
>>> what i was trying is whenenver "http://www.mysite.com/myurl myurl.xsd"
>>> is called i need to return http://www.mysite.com/myurl
>>> fiel:/c:/myurl.xsd. is this what supposed to do?
>>>
>>> I am sure my xml document is right but i am not sure why the code
>>> completion is not working when the same document is working fine in the
>>> xml editor.
>>
>> Why not leverage the XML Catalog, so that when the XML file is loaded, it
>> will get the correct file from the XML Catalog for the grammar. That way
>> you don't need to mess with the xsi:schemaLocation at all.
>>
>> Dave
>
>
Re: Content Assist for StructuredTextEditor [message #207281 is a reply to message #207276] Tue, 22 January 2008 13:30 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Suresh Subramanian wrote:
> After adding the XML Catalog entry in eclipse IDE and the open up my xml
> file it is working fine with the XML Editor. if i run my plugin as it as an
> eclipse RCP application, XML Editor doesn't show the content Assist. I
> added the dependencies org.eclipse.wst.xml.core, org.eclipse.wst.xml.ui,
> org.eclipse.wst.sse.core, org.eclipse.wst.sse.ui, org.eclipse.wst.common,ui
> as dependencies for my plugin.I think some thing is missing while i am
> running as RCP application. but i am not sure about it.

Are these the only plug-ins from WTP loaded as part of your
application? You'll need the org.eclipse.wst.xsd.core plug-in (and
its dependencies) to edit against an XML Schema file as it
contributes that support and information to the XML Editor.

---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Content Assist for StructuredTextEditor [message #207282 is a reply to message #207275] Tue, 22 January 2008 14:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

Suresh Subramanian wrote:
> Thanks david for your suggestion and i tried that too.
>
> Following is the User Specific Entries item for my schemaLocation
> Location: C:\myurl.xsd
> URI: file:///C:/myurl.xsd
> Key Type: Schema Location
> Key: http://www.mysite.com/myurl myurl.xsd
>

Use Namespace and only specify the namespace in your XML file. If you
assign it by namespace, it will look at the namespace and then load the
appropriate entry.
Re: Content Assist for StructuredTextEditor [message #207283 is a reply to message #207281] Tue, 22 January 2008 15:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

Thanks for the suggestion Nitin, Yes those are the only plugins loaded as
part of my application . I added the org.eclipse.wst.xsd.core plugin and the
required plugins for org.eclipse.wst.xsd.core in my application
dependencies. In the run Dialog , for my application in the plug-ins table
if i deselect and select my plug-in then select "add required plugins" there
was no difference before adding org.eclipse.wst.xsd.core and after adding
org.eclipse.wst.xsd.core and its dependencies.

Stiil the same "Content assists not available at the current location". i
remember seeing a bug fix related this messgae in the thread. My eclipse
installation build id eclipse.buildId=I20070625-1500 and it is for
rcp/plugin developers bundle. i also have emf 2.3 with that.

Suresh Subramanian
"Nitin Dahyabhai" <nitind@us.ibm.com> wrote in message
news:fn4rab$2e7$1@build.eclipse.org...
> Suresh Subramanian wrote:
>> After adding the XML Catalog entry in eclipse IDE and the open up my xml
>> file it is working fine with the XML Editor. if i run my plugin as it as
>> an eclipse RCP application, XML Editor doesn't show the content Assist.
>> I added the dependencies org.eclipse.wst.xml.core,
>> org.eclipse.wst.xml.ui, org.eclipse.wst.sse.core, org.eclipse.wst.sse.ui,
>> org.eclipse.wst.common,ui as dependencies for my plugin.I think some
>> thing is missing while i am running as RCP application. but i am not sure
>> about it.
>
> Are these the only plug-ins from WTP loaded as part of your application?
> You'll need the org.eclipse.wst.xsd.core plug-in (and its dependencies) to
> edit against an XML Schema file as it contributes that support and
> information to the XML Editor.
>
> ---
> Nitin Dahyabhai
> Eclipse WTP Source Editing
> IBM Rational
Re: Content Assist for StructuredTextEditor [message #207287 is a reply to message #207273] Tue, 22 January 2008 21:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

I did little more debugging and i am able see all the xml classes are loaded
when my file with xml content is loaded in my application. Is there a way to
find whether the schema file is loaded or not. I am not able to figure out
how the same was loaded in my eclipse IDE environment and not in my
application environment..Some cludes for debugging will be helpful.

Suresh Subramanian
"David Carver" <dcarver@starstandard.org> wrote in message
news:fn2isv$mfu$1@build.eclipse.org...
> Suresh Subramanian wrote:
>> what i was trying is whenenver "http://www.mysite.com/myurl myurl.xsd"
>> is called i need to return http://www.mysite.com/myurl
>> fiel:/c:/myurl.xsd. is this what supposed to do?
>>
>> I am sure my xml document is right but i am not sure why the code
>> completion is not working when the same document is working fine in the
>> xml editor.
>
> Why not leverage the XML Catalog, so that when the XML file is loaded, it
> will get the correct file from the XML Catalog for the grammar. That way
> you don't need to mess with the xsi:schemaLocation at all.
>
> Dave
Re: Content Assist for StructuredTextEditor [message #207399 is a reply to message #207287] Wed, 23 January 2008 22:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wuamy.ca.ibm.com

Suresh Subramanian wrote:

> Is there a way to
> find whether the schema file is loaded or not. I am not able to figure out
> how the same was loaded in my eclipse IDE environment and not in my
> application environment

In Preferences->Web and XML->XML Files, there is a "Warn when no grammar
is specified" preference that you can check. That way, when you validate
your xml file (You can rightclick the file in the project explorer and
"Validate") you will get a warning if no schema is found.

You should also also uncheck "Use inferred grammar in absence of
DTD/Schema" located in the "Source" preference page under "XML Files"
That way you'll know you're not using an inferred grammar based on the
current contents of the xml file.
Re: Content Assist for StructuredTextEditor [message #207408 is a reply to message #207399] Thu, 24 January 2008 07:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sursubra.cisco.com

Thanks for all your helping. I tried what you said but still i am not able
to get the content assist. Probably following snippet may give better idea
about my issue.


I have an editor which extends FormEditor in that one of the page is source
editor which is a StructuredTextEditor in which i will edit the xml content.

public class MyMultiPageEditor extends MultipageEditorPart {
StructuredTextEditor textEditor = null;

protected void createPages() {
try {
textEditor = new StructuredTextEditor();
int myPageIndex = addPage(textEditor, getEditorInput());
setPageText(myPageIndex, "myXML");
setActivePage(myPageIndex);
}catch(Exception ex) {}
}

protected IEditorSite createSite(IEditorPart page) {
IEditorSite site = null;
if (page == textEditor) {
site = new MultiPageEditorSite(this, page) {
public String getId() {
// Sets this ID so nested editor is
configured for XML source
return ContentTypeIdForXML.ContentTypeID_XML
+ ".source"; //$NON-NLS-1$;
}
};
} else {
site = super.createSite(page);
}
return site;
}

public Object getAdapter(Class key) {
if (textEditor != null)
return textEditor.getAdapter(key);
return super.getAdapter(key);
}

}

following is my plugin.xml entry

<extension
point="org.eclipse.ui.editors">
<editor
name="MyXML Editor"
class="MyPacakge.MyMultiPageEditor"
id="mypackage.mymultipageeditor">
</editor>
</extension>

<extension point="org.eclipse.core.runtime.contentTypes">
<content-type
file-extensions="myext"
priority="normal"
name="My Content Type"
id="mysource"
base-type="org.eclipse.core.runtime.xml"
default-charset="UTF-8"/>
</extension>

<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
class="MyExtViewerConfiguration"
target="org.eclipse.core.runtime.xml.mysource" />
</extension>

import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;

public class MyExtViewerConfiguration extends
StructuredTextViewerConfigurationXML {



}

I expect the above code to work same as source page in the xml editor and
content assist to work for the structured editor page. But it is not
working.

My xml file have the schema file incluide for that i added xml catalgo for
the schema URI which define exact location of the schema file.

I added following wst plugins as dependancies for my application

org.eclipse.wst.xml.core,

org.eclipse.wst.xsd.core,

org.eclipse.wst.xml.ui,

org.eclipse.xsd,

org.eclipse.wst.sse.core,

org.eclipse.wst.sse.ui,

org.eclipse.wst.common.ui

Suresh Subramanian

"Amy Wu" <wuamy@ca.ibm.com> wrote in message
news:897260dc750e9292d183987e705508d5$1@www.eclipse.org...
> Suresh Subramanian wrote:
>
>> Is there a way to
>> find whether the schema file is loaded or not. I am not able to figure
>> out
>> how the same was loaded in my eclipse IDE environment and not in my
>> application environment
>
> In Preferences->Web and XML->XML Files, there is a "Warn when no grammar
> is specified" preference that you can check. That way, when you validate
> your xml file (You can rightclick the file in the project explorer and
> "Validate") you will get a warning if no schema is found.
>
> You should also also uncheck "Use inferred grammar in absence of
> DTD/Schema" located in the "Source" preference page under "XML Files"
> That way you'll know you're not using an inferred grammar based on the
> current contents of the xml file.
>
Re: Content Assist for StructuredTextEditor [message #207416 is a reply to message #207408] Thu, 24 January 2008 13:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

Suresh Subramanian wrote:
> Thanks for all your helping. I tried what you said but still i am not able
> to get the content assist. Probably following snippet may give better idea
> about my issue.
>
>
> I have an editor which extends FormEditor in that one of the page is source
> editor which is a StructuredTextEditor in which i will edit the xml content.

If your source is going to XML, why not use the
SourcePageActionContributor or the XMLEditorActionContributor as your
base class and then use the various extension functions to add your
specific functionality to these.

The above are the Source editing classes that make up the built in XML
Editor.

Dave
Re: Content Assist for StructuredTextEditor [message #207423 is a reply to message #207416] Thu, 24 January 2008 13:15 Go to previous message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

David Carver wrote:
> Suresh Subramanian wrote:
>> Thanks for all your helping. I tried what you said but still i am not
>> able to get the content assist. Probably following snippet may give
>> better idea about my issue.
>>
>>
>> I have an editor which extends FormEditor in that one of the page is
>> source editor which is a StructuredTextEditor in which i will edit the
>> xml content.
>
> If your source is going to XML, why not use the
> SourcePageActionContributor or the XMLEditorActionContributor as your
> base class and then use the various extension functions to add your
> specific functionality to these.
>
> The above are the Source editing classes that make up the built in XML
> Editor.
>
Never mind, I didn't look far enough in the code. Ignore the above.
Previous Topic:Using J2EE 'server' as a pre-deployment test environment
Next Topic:WST XML editor doesn't use IMARKER.CHAR_START/END?
Goto Forum:
  


Current Time: Tue Apr 23 17:50:42 GMT 2024

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

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

Back to the top