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 30095 - DTD completion offers elements not appropriate in current part of parent
Summary: DTD completion offers elements not appropriate in current part of parent
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: issues@xml
URL:
Keywords: SIMPLEFIX
: 19775 (view as bug list)
Depends on:
Blocks: 20762
  Show dependency tree
 
Reported: 2003-01-14 20:32 UTC by Jesse Glick
Modified: 2007-09-25 01:31 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Another sample. (959 bytes, text/plain)
2003-06-23 18:12 UTC, Martin Schovanek
Details
Project branch patch (2.85 KB, patch)
2003-06-24 12:36 UTC, _ pkuzel
Details | Diff
release35 patch (prepared for beta AU deployment) (3.42 KB, patch)
2003-06-24 13:18 UTC, _ pkuzel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2003-01-14 20:32:38 UTC
Consider this XML document:

---%<---
<!DOCTYPE x [
<!ELEMENT x (a*, b*)>
<!ELEMENT a EMPTY>
<!ELEMENT b EMPTY>
]>
<x>
    <a/>
    <b/>
    <!-- here -->
</x>
---%<---

Open such a file in NB. Put the cursor at the
comment (I tried in dev jan 13) and type '<' then
Ctrl-Space. You are offered both <a> and <b> as
completions; yet only <b> is actually valid.

FWIW, Emacs' PSGML mode gets it right: before <b/>
you are offered either, but after you are only
offered another <b>. For some DTDs with a lot of
elements in a single parent, all in a particular
order (apichanges.xml comes to mind) it is very
important for usability of code completion that it
only offer elements valid at the current point.
Comment 1 _ pkuzel 2003-02-06 16:31:02 UTC
I have heavy problems with equality and lifetime of on-fly created DOM
Nodes. Anyway I also have working prototype.
Comment 2 _ pkuzel 2003-02-07 10:30:44 UTC
Integrated:

<--  ContentModel.java new revision: 1.2
<--  DTDGrammar.java new revision: 1.10
<--  DTDParser.java new revision: 1.4
<--  SyntaxElement.java new revision: 1.6
<--  SyntaxNode.java new revision: 1.4
<--  Tag.java new revision: 1.10
Comment 3 _ pkuzel 2003-02-07 11:45:37 UTC
*** Issue 19775 has been marked as a duplicate of this issue. ***
Comment 4 _ pkuzel 2003-02-07 11:47:25 UTC
*** Issue 19775 has been marked as a duplicate of this issue. ***
Comment 5 _ pkuzel 2003-02-21 11:15:38 UTC
Rolling back. I must improve the ContentModel class reliability.
Comment 6 _ pkuzel 2003-02-24 14:31:45 UTC
Reintegrated. Added netbeans.xml.completion system property that can
take following values: fast, default or accurate. Fast maps to
original behaviour, default to behaviour with this fix/enhancement and
accurate is reserved for #20762 implementation.
Comment 7 Martin Schovanek 2003-02-26 15:13:59 UTC
Default content model doesn't offer all appropriate elements.
e.g. in the xhtml <table> element doesn't offer:
<tr>, ...
Comment 8 _ pkuzel 2003-02-27 09:13:13 UTC
Sucesfully tested with XHTML tables. 6 new tests added. Comparing to
infinite input/output possibilities...
Comment 9 Martin Schovanek 2003-03-14 13:06:22 UTC
I tried on Build 200303132350 with Jesse's sample and completion
doesn't work at all.
Comment 10 Jesse Glick 2003-03-14 20:05:53 UTC
Yes, I've been having serious problems with completion lately too (dev
mar 11 I think) but forgot to file it. Working on a <MIME-resolver>, I
think I had a <file> with three <ext>s in it followed by a <resolver>,
and when positioning the cursor after the first <ext>, I could not get
any element completion. Or something like that.
Comment 11 _ pkuzel 2003-03-17 13:23:16 UTC
Silent code completion is another issue #32042.
Comment 12 Asgeir Asgeirsson 2003-05-07 15:37:35 UTC
I'm using NB 3.5-RC1.  The implementation which was 
intended to solve this issue seems to be very buggy and 
causes the XML code completion to be usless in many cases.

Try for example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
	<!ELEMENT root (sub1,sub2?,sub3?,sub4?)>
	<!ELEMENT sub1 (#PCDATA)>
	<!ELEMENT sub2 (#PCDATA)>
	<!ELEMENT sub3 (#PCDATA)>
	<!ELEMENT sub4 (#PCDATA)>
]>

<root>
	<sub1>test</sub1>
	<sub3>test3</sub3>
	 <!-- press ctrl-space here -->
</root>

sub3 and sub4 should be allowed here but nothing is 
allowed.  I use the XML editor a lot to write docbook 
documents, but I can't use v3.5 because of this bug.  I 
thus prefer that this fix will be rollbacked until later 
versions, if it isn't too late for v3.5 final.
Comment 13 _ pkuzel 2003-05-07 16:04:39 UTC
I'm affraid that for NB 3.5 it's too late.

Meanwhile there is a system property:

  runide -J-Dnetbeans.xml.completion=fast

fast is another name for the old implementation (that offers more
possibilities).
Comment 14 _ pkuzel 2003-06-19 09:45:11 UTC
*** Issue 34453 has been marked as a duplicate of this issue. ***
Comment 15 _ pkuzel 2003-06-19 09:46:26 UTC
34453 excerpt:

This may be more XML-module related thing.
When either creating or mounting web module
filesystem then there is code-completion support
in its deployment descriptor (web.xml). However
this works only at begining of that file:

<!-- xml declaration and dtd prolog is here -->
<web-app>
    <!-- here is the place where code-completion
works -->
    <session-config>        
        <session-timeout>
            30
        </session-timeout>
    </session-config>

    <!-- here it does not work -->        
</web-app>
Comment 16 Martin Schovanek 2003-06-23 18:12:56 UTC
Created attachment 10774 [details]
Another sample.
Comment 17 _ pkuzel 2003-06-24 12:36:16 UTC
Created attachment 10781 [details]
Project branch patch
Comment 18 _ pkuzel 2003-06-24 12:41:32 UTC
Fixed in prj40_prototype branch.

This patch is worth to deliver to users ASAP, it affects all XML
documents following many common DTDs.

It's safe to backport to release35 (and release the patch via NB-AU).
It's covered by unit tests.
Comment 19 _ pkuzel 2003-06-24 13:18:47 UTC
Created attachment 10785 [details]
release35 patch (prepared for beta AU deployment)
Comment 20 Jesse Glick 2003-06-24 17:14:58 UTC
This looks like a SIMPLEFIX to me, do you agree? Only a couple of
lines of code changed.
Comment 21 _ pkuzel 2003-06-25 10:14:03 UTC
Yes indeed. I just have not been aware of the SIMPLEFIX kw.
Comment 22 _ pkuzel 2003-06-27 15:50:14 UTC
I have asked aumasters to deploy updated nbm to beta AU.
Comment 23 Martin Schovanek 2003-10-10 07:30:29 UTC
VERIFIED 
Comment 24 Antonin Nebuzelsky 2003-11-04 15:30:34 UTC
Fixed also in Nevada Patch 1 and in Arrow.