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

Enhacement: Add a new option to not show the "_text" option at all #19

Closed
noveens opened this issue Jun 14, 2017 · 3 comments
Closed

Enhacement: Add a new option to not show the "_text" option at all #19

noveens opened this issue Jun 14, 2017 · 3 comments

Comments

@noveens
Copy link

noveens commented Jun 14, 2017

We can introduce an option to directly show the corresponding XML value instead of showing it under _text.

Eg.
XML:

<key1>value1</key1>
<key2>value2</key2>

COMPACT JS-OBJECT:

{
    key1: {_text: "value1"},
    key2: {_text: "value2"}
}

With the new option:

{
    key1: "value1",
    key2: "value2"
}

For my own usage, I used this recursive workaround for the same, hence thought for the enhancement : https://github.com/noveens/js-owncloud-client/pull/19/files#diff-b9b823e719730e39048dffbb512e743cR777

Thanks.

@nashwaan
Copy link
Owner

@noveens What would be the result if the xml is:

<key1>
    value1
    <key2>value2</key2>
</key1>

This kind of structure is common in html.

@nashwaan
Copy link
Owner

Similarly, what would be the output if the xml is:

<key1 attr1="yes">
    value1
</key1>

I wanted to support your syntax when I first designed this library but I could not come up with a clear answer for these situations. I welcome any suggestion on these.

@noveens
Copy link
Author

noveens commented Jul 1, 2017

@nashwaan ,

Agreed, there is no workaround that I can see for these situations.

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

No branches or pull requests

2 participants