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

XML Serializer is creating new line instead of empty node #426

Closed
chokdee opened this Issue Jul 3, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@chokdee

chokdee commented Jul 3, 2018

If I create modify an xml file like
<http:element path="//myxpath" value=""/>
the serializer is creating a new line.

I have tried to fix this and the following patch is working for me

/xml/XpathMessageConstructionInterceptor.java	
 
             if (node.getNodeType() == Node.ELEMENT_NODE) {
-                if (node.getFirstChild() == null) {
-                    node.appendChild(doc.createTextNode(valueExpression));
-                } else {
-                    node.getFirstChild().setNodeValue(valueExpression);
-                }
+                node.setTextContent(valueExpression);
             } else {
                 node.setNodeValue(valueExpression);
             }

@svettwer

This comment has been minimized.

Show comment
Hide comment
@svettwer

svettwer Jul 4, 2018

Member

Hi!

Thx for the fix. It would be great if you could provide a PR for the issue.

BR,
Sven

Member

svettwer commented Jul 4, 2018

Hi!

Thx for the fix. It would be great if you could provide a PR for the issue.

BR,
Sven

@chokdee

This comment has been minimized.

Show comment
Hide comment
@chokdee

chokdee commented Jul 7, 2018

Done

@christophd christophd added this to the v2.7.7 milestone Jul 10, 2018

@svettwer svettwer added TO REVIEW and removed READY labels Jul 20, 2018

svettwer added a commit that referenced this issue Sep 7, 2018

(#426) Added test for previously untested code branch, ensuring that …
…the contract is not broken by the change of this issue

svettwer added a commit that referenced this issue Sep 7, 2018

svettwer added a commit that referenced this issue Sep 7, 2018

(#426) Added test for previously untested code branch, ensuring that …
…the contract is not broken by the change of this issue

(cherry picked from commit 5208d00)

svettwer added a commit that referenced this issue Sep 7, 2018

(#426) Added some final modifier
(cherry picked from commit 0bb8ad9)
@svettwer

This comment has been minimized.

Show comment
Hide comment
@svettwer

svettwer Sep 7, 2018

Member

Hi!

Thx for your contribution.
The changes have been merged into master.

BR,
Sven

Member

svettwer commented Sep 7, 2018

Hi!

Thx for your contribution.
The changes have been merged into master.

BR,
Sven

@svettwer svettwer closed this Sep 7, 2018

@svettwer svettwer removed the TO REVIEW label Sep 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment