Bug 562197 - Invalid XML not diagnosed
Summary: Invalid XML not diagnosed
Status: NEW
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2020-04-16 03:36 EDT by Ed Willink CLA
Modified: 2024-03-28 00:07 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2020-04-16 03:36:30 EDT
Bug 562194 describes an incident whereby the intended

      version="3.10.2.qualifier"

line in feature.xml was suffixed by the residue of a GIT merge comment to give

      version="3.10.2.qualifier">>>>>>> 4e2d158 [releng] Bump build/features by 

This should give a warning in at least the feature.xml tab of the manifest editor. It doesn't.
Comment 1 Ed Merks CLA 2020-04-16 05:52:15 EDT
An important thing to note is that the XML is not actually invalid.

E.g., this example of your problem is actually well-formed XML that any SAXParser happily converts to a DOM:

<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="test.feature"
      label="Feature" 
      version="1.0.0.qualifier"
      >>>>
      provider-name="%providerName"
      plugin="org.eclipse.m2m.qvt.oml.editor.ui"
      image="eclipse_update_120.jpg">

   <description url="http://www.example.com/description">
      [Enter Feature Description here.]
   </description>

   <copyright url="http://www.example.com/copyright">
      [Enter Copyright Description here.]
   </copyright>

   <license url="http://www.example.com/license">
      [Enter License Description here.]
   </license>

</feature>

That DOM's root element has this text node:

[#text: >>>
      provider-name="%providerName"
      plugin="org.eclipse.m2m.qvt.oml.editor.ui"
      image="eclipse_update_120.jpg">

   ]

The processing of the DOM ignores text nodes:

org.eclipse.pde.internal.core.feature.Feature.parse(Node)

I'm not sure it's a good idea that superfluous non-whitespace text content should fail the parser.  Also, I don't see much in the way of infrastructure for recording such problems while the Document's root element is being processed and after that point, only the recorded/represented/extracted information is available for validation.
Comment 2 Ed Willink CLA 2020-04-16 06:49:38 EDT
Is it really valid?

I see the first > of >>>> as the interim closer of the <feature tag

Thereafter the next three >>> and subsequent text form a text node which terminates at <description. This is surely illegal because the text node cannot revert to allow more child elements of the closed <feature so there is an error - adding child element to parent element after text node.

For example in the Sample Reflective XML Ecoe Editor
...
   <description url="http://www.eclipse.org/mmt/qvto">
      [Enter Feature Description here.]
      <comment>
          My comment
      </comment>
      [Enter Feature Description here.]
   </description>
...
gives "Element 'comment' is not legal as a child of element 'description'."

which seems like the same relationship as <description to root except that we got back to root without properly closing the <feature tag.
Comment 3 Eclipse Genie CLA 2022-04-07 08:05:35 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Eclipse Genie CLA 2024-03-28 00:07:38 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.