Replies: 1 comment
-
Hi @softKarma, Thank you for your question. We have a special mode to convert attributes without prefixes. <?xml version="1.0" encoding="UTF-8"?>
<widget>
<debug>on</debug>
<window title="Sample Konfabulator Widget">
I just put some text here
<name>main_window</name>
<width>500</width>
<height>500</height>
</window>
<image name="sun1" src="Images/Sun.png">
<hOffset>
250<unit>mm</unit>
</hOffset>
<vOffset>250</vOffset>
<alignment>center</alignment>
</image>
</widget> may be converted to {
"widget": {
"debug": "on",
"window": {
"title": "Sample Konfabulator Widget",
"#text": "\n\t\tI just put some text here\n",
"name": "main_window",
"width": 500,
"height": 500
},
"image": {
"name": "sun1",
"src": "Images/Sun.png",
"hOffset": {
"#text": "\n\t\t\t\t250",
"unit": "mm"
},
"vOffset": 250,
"alignment": "center"
}
}
} The java code Object result = U.removeMinusesAndConvertNumbers((Map<String, Object>) Xml.fromXml(xmlString)); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My colleague just let me know about this library and it's great. I am now using it to mainly convert XML to JSON. While converting I observed that XML attributes in a tag are converted to JSON properties prefixed with "-" or "@" (if we provide the specific mode). I was wondering what is the reason to do so? Is there a way to just convert it into properties without a prefix?
Beta Was this translation helpful? Give feedback.
All reactions