« Return to Thread: simple xml editor

Re: simple xml editor

by Robi-8 :: Rate this Message:

Reply to Author | View in Thread

I added the Enterprise pack but the ide still cannot find the
following classes:

import org.netbeans.modules.xml.core.XMLDataObjectLook;
import org.netbeans.modules.xml.core.cookies.DataObjectCookieManager;
import org.netbeans.modules.xml.core.sync.DataObjectSyncSupport;
import org.netbeans.modules.xml.core.sync.Synchronizator;
import org.netbeans.modules.xml.core.text.TextEditorSupport;
import org.netbeans.spi.xml.cookies.CheckXMLSupport;
import org.netbeans.spi.xml.cookies.DataObjectAdapters;
import org.netbeans.spi.xml.cookies.ValidateXMLSupport;

Where are the above classes?

Best regards.
Roberto


Roberto Nunnari wrote:

> Vivek Jain wrote:
>> Hi Roberto,
>
> Hi Vivek,
>
>
>>
>> I hope you are creating a new file type for an xml document which ends
>> with +xml. MIME types like  |text/???+xml| are used in the IDE to
>
> I used text/x-sposi+xml
> Is that correct?
>
>
>> represent an XML document. Creating a filetype like this, IDE will
>> treat your files as an XML document. Netbeans Editor will provide all
>> functionality like code highlighting, indent, code folding, code
>> completion and any other to your xml document.
>
> Yes.. That works just fine.
>
>
>>
>> To get the schema based code completion for your xml files, you have
>> to install enterprise pack. Once you install NB enterprise pack, run your
>
> I haven't checked code completion, yet.
>
>
>> module project, and create new file (that is your xml document). In
>> your xml document, provide the value for schemaLocation attribute
>> which will be the relative or absolute location of your schema file.
>> Just doing this will give you the schema support for your xml files.
>
> The xml is correct, as I can validate it using other tools..
> But.. here's how my xml file starts:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <sp:Sposi xsi:schemaLocation="http://www.nunnisoft.ch/schemas/sposi 
> http://www.nunnisoft.ch/schemas/sposi01.xsd"
> xmlns:sp="http://www.nunnisoft.ch/schemas/sposi"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> ...
>
>
>>
>> Please note that Currently schema-based code completion for xml files
>> works only if we provide value for 'schemaLocation' attribute and the
>> value should be relative or absolute path of xsd file on the
>> filesystem. Schema based Code Completion is not available through XML
>> catalog. I have filed an issue
>> <http://www.netbeans.org/issues/show_bug.cgi?id=91333> (fix in
>> progress) on Netbeans XML component to provide Schema based Code
>> Completion through XML catalog.
>>
>> To get validate, checkXml, Transformable support, you have to add the
>> following code to your DataObject. Refer this link for the same
>> http://wiki.netbeans.org/wiki/view/DevFaqNewXMLFileType
>>
>>             CookieSet cookies = getCookieSet();
>>             cookieManager = new DataObjectCookieManager(this, cookies);
>>             cookies.add((Node.Cookie) DataEditorSupport.create(this,
>>     getPrimaryEntry(), cookies));
>>                        InputSource is =
>> DataObjectAdapters.inputSource(this);
>>             Source source = DataObjectAdapters.source(this);
>>                        cookies.add(new CheckXMLSupport(is));
>>             cookies.add(new ValidateXMLSupport(is));
>>             cookies.add(new TransformableSupport(source));
>>
>> To get the Navigator support for your xml files Add following code in
>> your layer.xml file (with your xml MIME type)
>>
>>         <folder name="Navigator">
>>             <folder name="Panels">
>>                 <folder name="text">
>>                     <folder name="MIME_TYPE">
>>                         <file
>>    
>> name="org-netbeans-modules-xml-text-navigator-XMLNavigatorPanel.instance"/>
>>
>>                     </folder>
>>                 </folder>
>>             </folder>
>>         </folder>
>>
>
> Ok. Thanks a lot to all who answered my question.
> I'll try that as soon as possible and let you know the result.
>
> Best regards.
> Roberto
>
>
>> Thanks & Regards,
>> Vivek
>> ------------------------------------
>> http://www.netbeans.org/
>> http://www.sun.com/
>> ------------------------------------
>>
>> Roberto Nunnari wrote:
>>> Hello.
>>>
>>> I'd like to develop a simple xml editor based on netbeans platform
>>> for a particular xml schema, something like the ide has for the
>>> web.xml file. Just the explorer, the navigator, the editor and the
>>> output window.
>>>
>>> I have to say that even though I've been using netbeans since early
>>> 2001 for java development, I'm a beginner with module development.
>>>
>>> I just started working on the module with netbeans ide 5.0 (but
>>> tomorrow I'll upgrade to 5.5) and using the wizard, have already made
>>> a new file type for my xml namespace.
>>>
>>> Launching the new application, I see that my xml files are
>>> recognized, as the icon I set for this file type is shown.
>>>
>>> The first problem is that the new fileType seams to not have
>>> inherited all the functionalities used for xml files.
>>>
>>> 1) the well formed and validate buttons in the editor are disabled.
>>> 2) the navigator doesn't show anything
>>>
>>> But the editor still uses highlighting and colors..
>>>
>>> Of course, when editing an xml file that doesn't use an xml schema
>>> the well formed and validate buttons are again enabled and the
>>> navigator again shows its content.
>>>
>>> How can I add all features present for plain xml files to my file type?
>>>
>>> I also would appreciate any hints and directions you could give me on
>>> how to implement the editor (wizards, apis, files to edit, etc..)
>>>
>>> Best regards.
>>>
>>> --
>>> Roberto

 « Return to Thread: simple xml editor