-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save element name in extension element if it has any new lines #3946
Save element name in extension element if it has any new lines #3946
Conversation
Hi, I'm not sure this is a good idea. New lines in XML should be encoded as (line feed) or possibly 
 (line feed, carriage return) if you prefer. |
Thanks for the feedback @tstephen. We were looking into that option actually as well. We tried using When writing it the generated XML looks like:
However, when this is read the new lines are getting removed (by the If you have some better suggestion for this, we are more than happy to look into it |
How extraordinary! And annoying! Nonetheless I think this is a very visible obstacle to interchange, so I hope some solution can be found. I think the problem stems from an underspecification of XMLStreamWriter. The Java tutorial states:
Ideas I can think of:
None of these seem particularly attractive to be honest. I am not sure what the new behaviour is but it apears that the standard name may not be written if it contains new line? (line 173 of BaseBpmnXMLConverter.java)? |
I'm not sure that it is worth adding another dependency for the purpose of this.
I'm not sure when the initial XML parsing was added, but it's been in there for a really long time. The page you linked also says
which makes the Cursor API more attractive.
Indeed the standard name will not output the default attribute name if it contains a new line. However, it will output a custom extension element, which we then use to load it. Why do you think that it is a problem if the default attribute name is not written down? |
Because it means that interchange between tools will lose the name. This is a slippery slope. |
We are talking about an extreme edge case, right? This is when you do an explicit new line in the name. Let's take following scenarios into consideration:
Basically, the only thing that will not work is if you are using explicitly new lines in names using Flowable Java API and / or Flowable Design. Do you have some other scenario in mind? |
I was thinking about your first scenario.... So if I give a name containing |
So for the first scenario nothing changes. Depending on how an XML with an attribute name with The only thing that this affects is if you are using the Flowable BPMN XML Converter to convert from the Flowable BPMN Model Java API to XML. In any case, we are going to add a flag in the converter to use or not use the new extension element when exporting. This way nothing should change. Keep in mind that 3rd party XML -> Flowable is not affected by this change anyways. |
Thanks for bearing with me Filip, very glad to hear this. |
Yes I did @filiphr, though I've not had a chance to try it out, it looked good. Many thanks! |
If an element name has any newlines, save it in an extension element instead of in an attribute because new lines are changed into spaces when xml attribute is parsed