Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322704

Summary: xmi:id is not encoded for XML validity
Product: [Modeling] EMF Reporter: Ed Willink <ed>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.6.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Ed Willink CLA 2010-08-14 07:29:07 EDT
If an EObject has an ID with a <, the < is output unchanged to XMI. e.g.

        <ownedParameter xsi:type="pivot:TypeTemplateParameter"
            xmi:id="oclM1::Bag<T>::T"
            parameteredElement="#oclM1::Bag<T>::T">

which of course gives an error when the XML is reloaded.
Comment 1 Ed Merks CLA 2010-08-14 11:43:43 EDT
We won't go through the additional expense of encoding ID values (scan every character of every ID that's ever serialized). I'm pretty sure that XMI requires they be well formed identifiers the same as xsd:ID so even escaping them wouldn't produce valid XMI; one would need an encoding scheme using % or something like that.  In any case, at least with EMF, it's up to you to ensure IDs are NCNames when you assign them.  Or at the very least, don't include whitespace, ":", or "#", or any other characters like <, ', ", or & with special XML meaning.  Definitely values like what you're showing that are arbitrary expressions.