Bug 246427 - [content model] New XML Wizard generates EMPTY root element with start and end tag
Summary: [content model] New XML Wizard generates EMPTY root element with start and en...
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.0.1   Edit
Hardware: All All
: P5 trivial (vote)
Target Milestone: 3.2.2   Edit
Assignee: Rakesh CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: bugday, helpwanted
Depends on:
Blocks:
 
Reported: 2008-09-05 16:12 EDT by Nitin Dahyabhai CLA
Modified: 2010-08-23 17:17 EDT (History)
4 users (show)

See Also:
nsand.dev: review+


Attachments
Example DTD with empty root element (61 bytes, patch)
2010-03-16 08:41 EDT, Ian Tewksbury CLA
no flags Details | Diff
Patch (1.00 KB, patch)
2010-06-25 02:57 EDT, Rakesh CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nitin Dahyabhai CLA 2008-09-05 16:12:05 EDT
In 3.0.1, the wizard always generates the root element with a start/end tag pair separated by a line delimiter.  When the root element is defined as having EMPTY content, given that this makes little sense, the wizard will generate an invalid document.
Comment 1 Ian Tewksbury CLA 2010-03-09 13:58:01 EST
This is still reproducible in WTP 3.2
Comment 2 Valentin Baciu CLA 2010-03-16 01:06:44 EDT
What specific schema or DTD did you use?
Comment 3 Ian Tewksbury CLA 2010-03-16 08:41:55 EDT
Created attachment 162154 [details]
Example DTD with empty root element

This is the example DTD I used.
Comment 4 Valentin Baciu CLA 2010-03-16 09:52:48 EDT
Yeah, there's some logic in org.eclipse.wst.xml.core.internal.contentmodel.util.DOMWriter.XMLVisitor.visitElement(Element) which says to always print a new line if the element is the root element, regardless of whether or not it has element content.
Comment 5 Rakesh CLA 2010-06-25 02:57:48 EDT
Created attachment 172711 [details]
Patch

changed if statement.
Comment 6 Nick Sandonato CLA 2010-06-28 17:41:21 EDT
Looks good to me. Thanks, Rakesh.
Comment 7 Nick Sandonato CLA 2010-08-23 17:17:11 EDT
Code committed.