|
| Re: use custom xsd with the StructuredTextEditor [message #209897 is a reply to message #209886] |
Fri, 07 March 2008 08:17   |
|
Originally posted by: merks.ca.ibm.com
Alexandre,
If I understand the posts I've read here, I think you'd register the
namespace of the schema in the XML catalog...
Alexandre Jaquet wrote:
> Hi,
>
> I need the content assist feature for some of my xsd, how can I tell
> the StructuredTextEditor to parse my xsd's files
>
> Thanks
>
> Alexandre
|
|
|
| Re: use custom xsd with the StructuredTextEditor [message #209904 is a reply to message #209897] |
Fri, 07 March 2008 08:44   |
|
Originally posted by: alexjaquet.gmail.com
Where / How can I get the xml catalog ?,
rigth now I've written an editor that extends the StructuredTextEditor
-I set the source viewer configuration to a custom one
-my source viewer configuration class extends
StructuredTextViewerConfigurationXML
-I've created a scanner for my editor
-I've created a completion processor
With the normal TextEditor you only needs to define what are the
completion propals
What I do I missed for the StructuredTextEditor
Thanks
Alexandre
Ed Merks a écrit :
> Alexandre,
>
> If I understand the posts I've read here, I think you'd register the
> namespace of the schema in the XML catalog...
>
>
> Alexandre Jaquet wrote:
>> Hi,
>>
>> I need the content assist feature for some of my xsd, how can I tell
>> the StructuredTextEditor to parse my xsd's files
>>
>> Thanks
>>
>> Alexandre
|
|
|
|
| Re: use custom xsd with the StructuredTextEditor [message #209934 is a reply to message #209912] |
Fri, 07 March 2008 10:05   |
|
Originally posted by: alexjaquet.gmail.com
The completion work only if I add the doctype declaration at the begin
of my file (my file represent a portion of code and cannot contain xml
declaration and a doctype)
Is it possible to hide these declaration and make the completion still
working.
To make it work I've to declare
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xgui:module PUBLIC "-TOTO-" "unknown.dtd">
Any idea ?
|
|
|
| Re: use custom xsd with the StructuredTextEditor [message #209942 is a reply to message #209897] |
Fri, 07 March 2008 10:28   |
|
Originally posted by: dcarver.starstandard.org
There are a couple of ways to do this, depending on how your XSD is setup.
If it is namespace aware, then as ED said, you can register it in the
XML Catalog by namespace, and have it load the appropriate XSD based on
the namespace in the xml. This will require you specifying at the
minimum a xmlns="" attribute with the appropriate namespace filled in,
in the XML instance.
The other option is to use the xsi:schemaLocation="" attribute to
specify where the schema can be found locally.
http://xerces.apache.org/xerces-j/schema.html
Dave
Ed Merks wrote:
> Alexandre,
>
> If I understand the posts I've read here, I think you'd register the
> namespace of the schema in the XML catalog...
>
>
> Alexandre Jaquet wrote:
>> Hi,
>>
>> I need the content assist feature for some of my xsd, how can I tell
>> the StructuredTextEditor to parse my xsd's files
>>
>> Thanks
>>
>> Alexandre
|
|
|
| Re: use custom xsd with the StructuredTextEditor [message #209950 is a reply to message #209934] |
Fri, 07 March 2008 10:31   |
|
Originally posted by: dcarver.starstandard.org
Alexandre:
Take a look a the following tutorial on the XML Catalog. You need to
make sure you specify it correctly. Again if you have an XSD that is
tied to a namespace, you can use the xmlns="" attribute to set the
default namespace, and the eclipse xml editor should pickup the grammar
from there by looking in the xml catalog.
http://www.eclipse.org/webtools/community/tutorials/XMLCatal og/XMLCatalogTutorial.html
Alexandre Jaquet wrote:
> The completion work only if I add the doctype declaration at the begin
> of my file (my file represent a portion of code and cannot contain xml
> declaration and a doctype)
>
> Is it possible to hide these declaration and make the completion still
> working.
>
> To make it work I've to declare
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE xgui:module PUBLIC "-TOTO-" "unknown.dtd">
>
> Any idea ?
|
|
|
|
|
| Re: use custom xsd with the StructuredTextEditor [message #210109 is a reply to message #209966] |
Mon, 10 March 2008 09:02   |
|
Originally posted by: alexjaquet.gmail.com
I'm not sure if that can run correctly but I'm trying to hide a portion
of the document content
My document contains the following code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xgui:module PUBLIC "-TOTO-" "unknown.dtd">
<xgui:module>
<xgui:hbox></xgui:hbox>
</xgui:module>
I want to hide the first two lines, I'm trying the following code
public void activateEditor() {
String str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE
xgui:module PUBLIC \"-TOTO-\" \"unknown.dtd\"";
boolean readOnly = true;
if (property != null) {
String v = property.getValue();
str = str.concat(v);
//str = v == null ? "" : v;
readOnly = false;
}
// Update the contents of the InputStreamEditorInput
InputStreamEditorInput input = (InputStreamEditorInput) getEditorInput();
InputStream is = new ByteArrayInputStream(str.getBytes());
input.setContents(is);
input.setReadOnly(readOnly);
getSourceViewer().getDocument().set(str);
String text = getSourceViewer().getDocument().get();
int length = getSourceViewer().getDocument().getLength();
getSourceViewer().setVisibleRegion(str.length(), length -1);
}
but my code is still visible :/ any idea why ?
(Do you think this solution will still enable the content assist)
Thanks
Alexandre
|
|
|
| Re: use custom xsd with the StructuredTextEditor [message #210132 is a reply to message #210109] |
Mon, 10 March 2008 12:57   |
|
Originally posted by: dcarver.starstandard.org
Well, there is one thing that stands out here to begin with. It looks
like you are trying to use namespaces with DTDs, which aren't supported.
http://www.rpbourret.com/xml/NamespacesFAQ.htm#dtd
The qualified support your are using in the DTD, is probably throwing
the processors for a loop as they may be thinking you are trying to do
namespaces. The qualifiers look like XML Namespace prefixes. So if
you can I would recommend migrating your DTD to a XML Schema.
A online service you can use to accomplish this is here:
http://www.hitsw.com/xml_utilites/
Dave
If you need namespace support you need to use XML Sck
Alexandre Jaquet wrote:
> I'm not sure if that can run correctly but I'm trying to hide a portion
> of the document content
>
> My document contains the following code
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE xgui:module PUBLIC "-TOTO-" "unknown.dtd">
> <xgui:module>
> <xgui:hbox></xgui:hbox>
> </xgui:module>
>
> I want to hide the first two lines, I'm trying the following code
>
> public void activateEditor() {
> String str = "<?xml version=\"1.0\"
> encoding=\"UTF-8\"?><!DOCTYPE xgui:module PUBLIC \"-TOTO-\"
> \"unknown.dtd\"";
>
> boolean readOnly = true;
> if (property != null) {
> String v = property.getValue();
> str = str.concat(v);
> //str = v == null ? "" : v;
> readOnly = false;
> }
>
> // Update the contents of the InputStreamEditorInput
> InputStreamEditorInput input = (InputStreamEditorInput)
> getEditorInput();
> InputStream is = new ByteArrayInputStream(str.getBytes());
> input.setContents(is);
> input.setReadOnly(readOnly);
> getSourceViewer().getDocument().set(str);
> String text = getSourceViewer().getDocument().get();
> int length = getSourceViewer().getDocument().getLength();
> getSourceViewer().setVisibleRegion(str.length(), length -1);
> }
>
> but my code is still visible :/ any idea why ?
>
> (Do you think this solution will still enable the content assist)
>
>
> Thanks
>
> Alexandre
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02150 seconds