Skip to content
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

Wrong formating of mixed content elements #200

Closed
tomassvoboda opened this issue Jun 22, 2018 · 6 comments
Closed

Wrong formating of mixed content elements #200

tomassvoboda opened this issue Jun 22, 2018 · 6 comments

Comments

@tomassvoboda
Copy link

Description

White space is added to the content of mixed content element.
Formatting <mixedContentNode>text<innerNode>innerNodeText</innerNode></mixedContentNode> puts white space before the opening of the inner element.

Formatter Implementation

Using the default xmlTools.xmlFormatterImplementation setting value (v2).

XML Tools Version

2.3.1

VS Code Version

1.24.1

Operating System

Windows 10

@DotJoshJohnson
Copy link
Owner

I know this is technically valid XML, but I don't see it very often, so bear with me. What would the desired formatting be in this case?

Option A

<mixedContentNode>text
    <innerNode>innerNodeText</innerNode>
</mixedContentNode>

Option B

<mixedContentNode>
    text
    <innerNode>innerNodeText</innerNode>
</mixedContentNode>

@tomassvoboda
Copy link
Author

tomassvoboda commented Jun 30, 2018

I think using mixed content is a really bad practice and I don't think I have a good solution, but the only correct think to do in my opinion is to just not touch anything inside the <mixedContentNode>. That is obviously dumb think for a formatter to do, but I still have to see it as favourable to modifying the data of the XML by formatting it. Just like formatting simple <node>text</node> into

<node>
    text
</node>

would be modifying the data of the XML. I guess, I can see the formatting continuing inside the inner node like this:

<mixed>beginning text<inner>
    <a>data</a>
    <b>another data</b>
</inner>end text</mixed>

Other than that, I think Option A is better than Option B if only because it breaks the data a little less.

@stale
Copy link

stale bot commented Aug 1, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Aug 1, 2018
@tomassvoboda
Copy link
Author

Please don't close this if it is not resolved.

@escobarOD
Copy link

WELL IM GLAD IS NOT O.D DOINGS

@escobarOD
Copy link

escobarOD commented Sep 21, 2018 via email

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

No branches or pull requests

3 participants