Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 22598 - Implement XSLT code completion
Implement XSLT code completion
Status: RESOLVED DUPLICATE of bug 20421
Product: xml
Classification: Unclassified
Component: Text-Edit
3.x
PC All
: P3 (vote)
: 3.x
Assigned To: _ pkuzel
issues@xml
:
Depends on:
Blocks: 21881 22657
  Show dependency treegraph
 
Reported: 2002-04-18 14:11 UTC by _ pkuzel
Modified: 2007-09-25 01:33 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ pkuzel 2002-04-18 14:11:33 UTC
Details to come ...
Comment 1 _ pkuzel 2002-04-18 14:31:53 UTC
asgeir@dimon.is wrote:
> 
> Hi.
> I was investigating the text-edit code to see how code completion
for XSLT
> might be implemented.  If I want to reuse XMLCompletion and
XMLCompletion
> query, there no way for me to add support for a new GrammarQuery. 
To add
> this support, the following has to be done:
> 
> 1.  Create a new interface: GrammarParser which should be defined
like:
> public interface GrammarParser {
>     GrammarQuery parse(InputSource in);
> }
> 
> DTDParser should implement this interface.  I could create a
> XSLTGrammarParser which implements this interface.  When the parse
method
> of XSLTGrammarParser is called, it will return a XSLTGrammarQuery if
the
> root element in the InputSource XML is <xsl:stylesheet>, otherwise
it will
> return null.

Look at current sources, there is also a need for grammar invalidation
means. It is not probably required by XSLT grammar provider but it is
must for DTD grammar provider. I was not able to generalize it so 
I deferred it (hardcoded the logic) until really needed.
 
Besides basic XSLT completion can be delivered by any XML Schema aware
grammar provider.

> ----
> 
> 2.  Add a static method to XMLCompletionQuery which allows any class
to add
> a GrammarParser:
> public static void addGrammarParser(GrammarParser parser) {
>      ..
> }
> 
> This method should add a GrammarParser to a static list of
GrammarParsers.

Mind dependencies! It is better to use org.openide.util.Lookup style
of
registrations i.e. let providers register themselves at their module
XML
layer and let XMLCompletionQuery lookup for them.
 
> ----
> 
> 3.  Change the XMLCompletion.GrammarCache.loadParser() method to
make it
> look through the list of registered GrammarParser objects.  For each
> GrammarParser object, the parse method is called.  If the method
returns
> non-null GrammarQuery, that particular query will be used.  If all
the
> registered GrammarParser object's parse methods return null, the
DTDParser
> is used (which means unchanged behavior).

Searching a list of registered grammars may be very expensive if
every grammar tries to parse. Well it may return lazy initialized
GrammarQuery (an implementation will finish parsing on the first
request).
 
> -----------
> 
> Do you accept those changes?  If so, I will implement them.

Yes, we need to get rid of hardcoded logic now. It blocks you.
Another interfaces draft:

/**
 * Factory registered in Lookup under Services/XML/text-completion.
 */
public abstract class GrammarManagerFactory {

  GrammarManager createGrammarManager(Document or InputSource ???);
  // identity of InputSource etc,

}

/**
 * Takes care of grammar creating and notifies if it is still
 * able to serve properly.
 */
public interface GrammarManager {

  GrammarQuery getGrammarQuery();

  // it must be able to decide, how???

  final String PROP_VALID;
 
  addPropertyChangeListener(...);
  removePropertyChangeListener();

  boolean isValid();
  
}

I hope you get some idea how to improve them.
 
> Where should I put the XSLTGrammarParser and XSLTGrammarQuery
classes?
> XSLT support is becomming a standard part of most XML editors.  I
would
> thus like to include them in the "xml-text-edit" module in the
package
> "org.netbeans.modules.xml.text.completion.xslt".  Do you agree?

I makes sense to me. Let others speak up (I heard that some people
need very lightweight XML editing support, it probably does not
cover XSLT).
Comment 2 Marek Grummich 2002-07-19 16:58:30 UTC
Target milestone was changed from not determined to TBD
Comment 3 _ pkuzel 2002-08-14 16:56:55 UTC
Feature positively influences user 
productivity.  
Comment 4 _ pkuzel 2002-08-14 16:57:04 UTC
Feature positively influences user 
productivity.  
Comment 5 _ pkuzel 2002-08-14 17:01:09 UTC
Duplicate  

*** This issue has been marked as a duplicate of 20421 ***


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo