Configuring XML output attributes - attributeValueProcessor?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- tooling
Research direction
Start with the XMLBuilder configuration and the attributeValueProcessor option mentioned in the issue, then compare the current behavior with the provided JSON and expected XML. Done means determining or documenting the configuration needed to emit type and id as attributes and to match the expected structure.
Written by the indexing model from the issue text.
Description
- Are you running the latest version?
- Have you included sample input, output, error, and expected output?
- Have you checked if you are using correct configuration?
- Did you try online tool?
Description
Not sure if this should be a feature request, or I am just not understanding the docs - How to I ensure that when I am using the XMLBuilder that XML attributes are correct? I have very strict requirements on the XML format, since it will need to be human writable. I know I will need to provide some additional config into the builder, as there is no way it can know that I want 'id' to be an attribute - I was looking at 'attributeValueProcessor' but there is no documentation how to use it, or I couldnt see it.
Input
Here is an example of the JSON
Code
{
"question": {
"ask": "Which of the following statements are true?",
"choice": [
{
"#text": "This one",
"id": "A"
},
{
"#text": "Probably this one",
"id": "B"
},
{
"#text": "Not this one",
"id": "C"
}
],
"answer": "A",
"response": [
{
"#text": "Sorry that is not right.",
"type": "incorrect"
},
{
"#text": "Well done!",
"type": "correct"
}
],
"type": "MC"
}
}
Output
<question>
<ask>
Which of the following statements are true?
</ask>
<choice>
This one.
<id>
A
</id>
</choice>
<choice>
Probably this one
<id>
B
</id>
</choice>
<choice>
Not this one.
<id>
C
</id>
</choice>
<answer>
A
</answer>
<response>
Sorry that is not right.
<type>
incorrect
</type>
</response>
<response>
Well done!
<type>
correct
</type>
</response>
<type>
MC
</type>
</question>
expected data
<question type="MC">
<ask>Which of the following statements are true?</ask>
<choice id="A">This one.</choice>
<choice id="B">Probably this one</choice>
<choice id="C">Not this one.</choice>
<answer>A</answer>
<response type="incorrect">Sorry that is not right.</response>
<response type="correct">Well done!</response>
</question>
Would you like to work on this issue?
- Yes
- No
Bookmark this repository for further updates.
- Dominant language
- JavaScript
- Stars
- 22
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NaturalIntelligence/fast-xml-builder
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
-
`preserveOrder: true` with `format: true` formats mixed content wrongly and adds whitespace to content that ends with `>`Possibly taken @neumaennl claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
`XMLBuilder` object should be exported as a named export, not just the typePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NaturalIntelligence/fast-xml-builder#25 · 1 comment ·
-
sanitizeName not applied to names inside stopNodes (quote injection / tag break-out bypass)Possibly taken @hicay claimed this 5 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
NaturalIntelligence/fast-xml-builder#34 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 54/100
All issues in NaturalIntelligence/fast-xml-builder
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
Extended search drops any query term that contains a line breakPossibly taken @goranai claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
area:mcp
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day