This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 91617 - Please make xml-core, editor-structure API packages public
Summary: Please make xml-core, editor-structure API packages public
Status: NEW
Alias: None
Product: xml
Classification: Unclassified
Component: API (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker with 3 votes (vote)
Assignee: issues@xml
Depends on:
Reported: 2006-12-28 15:18 UTC by vivekjain
Modified: 2007-09-25 01:29 UTC (History)
4 users (show)

See Also:
Exception Reporter:

Java files attached shows Class Usage Scenario (3.53 KB, application/octet-stream)
2007-01-10 13:26 UTC, vivekjain

Note You need to log in before you can comment on or make changes to this bug.
Description vivekjain 2006-12-28 15:18:19 UTC
I am writing a module to provide the completion for XML files, based on xpath.
For calculating xpath, I have to do this:

DocumentModel model = DocumentModel.getDocumentModel(document);
DocumentElement docel = model.getLeafElementForOffset(offset);
tmpDocel = docel;
while (!tmpDocel.getName().equalsIgnoreCase("root")) {
	xpath =  tmpDocel.getName() + "/" + xpath  ;
    tmpDocel = tmpDocel.getParentElement();

Above code snippet will calculate the xpath based on caret position, but this
requires an impl dependency on editor-structure & xml-text modules.

My xml files have there own mime-type (text/x-abc+xml), but I want to use
Netbeans XML editor for these files to use the existing NB functionality for
editing, validation, xml check etc and again this requires an impl dependency on

The xml-core, editor-structure & xml-text module currently don't expose any
packages as public. This is causing problems for my modules because they need to
declare dependency on the implementation version of the module and this will
break regularly as the implementation version increases.

Please make the following API packages public

1) org.netbeans.modules.editor.structure
2) org.netbeans.modules.xml.core
3) org.netbeans.modules.xml.text

These API's are now widely used throughout NB, and it would make sense to expose
them as a public API.

Is there any workaround or any equivalent way to calculate xpath and also get
xml editor support without having any impl dependency?

Thanks & Regards,
Comment 1 Marek Fukala 2007-01-10 09:32:17 UTC
>Please make the following API packages public:
>1) org.netbeans.modules.editor.structure
Why this package? Or you mean the API packages from this module? The
org.netbeans.modules.editor.structure.api is the only thing you need and it is a
friend API now, so please add yourself as a friend module. Or do you have a
reason why friend-api is not enought?

>2) org.netbeans.modules.xml.core
Probably the same problem as in #1 - why do you need this package to be public?
I am not sure if you think exactly this package or some sub-packages. Please
elaborate exact packages and if possibile also classes you need to use and how.
So far, following packages are public:

>3) org.netbeans.modules.xml.text
Again, there is noting useful in this package, the
org.netbeans.modules.xml.text.api is friend API - do the same as in #2. If you
need another packages from this module let me know which ones and how and why
you need to use them.


BTW, there is similar request from Samaresh - #87244 - friend declaration for
xdm and schema/completion. 
Comment 2 vivekjain 2007-01-10 13:23:11 UTC
Hi Marek,
Thanks for your note. Actually I am developing the third party module, which is
not a <org.netbeans....> module. Though the above mentioned apis are friend
apis, I cannot add my module as a friend of those apis (as that would mean
modifying the XML modules in question to declare my module as a friend). 

Hence the need for making those apis public. 

I am using following classes in my code to do xml operations:




I have also attached the java files where I am using these classes. Please let
me know if there is any alternate way of doing the same.

Thanks & Regards,
Comment 3 vivekjain 2007-01-10 13:26:17 UTC
Created attachment 37220 [details]
Java files attached shows Class Usage Scenario
Comment 4 Marek Fukala 2007-01-12 13:55:39 UTC

1) As for the third party modules being friends I do not see any big issue with
this and I approve you to add yourself to the friends list. 

2) org.netbeans.modules.editor.structure.api.* is friend, so use it.

3) org.netbeans.modules.xml.text.navigator.NavigatorContent
   Why do you need your own implementation of NavigatorPanel
(SPSNavigatorPanel). If you use the default XML navigator just put its instance
under your mimetype in the xml layer. Or is there anything else what it does?
Did you consider this option?

4) XMLSyntaxSupport - I do not see any usage into the attached classes

5) What do you use the org.netbeans.modules.xml.core.sync.* support for? Its
original purpose was to synchronize between file-document-editable tree. Since
we do not have the XML tree editor for quite long time (still in CVS) and
file-document sync. is done in different way I planned to remove this support
completely. Can you describe the usecases? 

6) I also noticed you use XMLCompletionItem, which IMHO shouldn't be public.

7) org.netbeans.modules.xml.core.XMLDataObjectLook;

I am not sure about these. Can you point me out to a description what your
project does? (Just to have an idea about what we talk...) Or better send me the
relevant (complete) sources. Having more complex info I belive I can help you

Thanks for understanding.
Comment 5 Marek Fukala 2007-02-16 14:47:48 UTC
Reassigning to default owner of selected subcomponent. New owners are gladly
Comment 6 Marek Fukala 2007-02-16 14:49:41 UTC
Reassigning to default owner of selected subcomponent. New owners are gladly