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

add a new option for simpleAttributes #195

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

1mike12
Copy link

@1mike12 1mike12 commented Nov 23, 2022

where attributes are directly added as keys to the element object instead of being placed into a separate _attributes object

this makes it much easier to work with xml that don't have text inbetween the tags and instead keeps all its info in single <element />.

It's really annoying to work with the _attributes object constantly if your XML shape is anything like the following:

<parent attr1="one" attr2="two">
   <child k1="1" k2="2" ... kn="n" />
   <child k1="1" k2="2" ... kn="n" />
   ...
</parent>

before

{
  parent: {
  __attributes: {attr1: "one", attr2: "two"},
  child: [{__attributes: {k1: "1", k2:"2", kn: "n"} }]
  }
 }

after

{
  parent: {
  attr1: "one", 
  attr2: "two"
  child: [{k1: "1", k2:"2", kn: "n"}]
  }
 }

… added as keys to the element object instead of being placed into a separate `_attributes` object
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

Successfully merging this pull request may close these issues.

1 participant