Parse XML from External API
Options
![Neil Harrington](https://us.v-cdn.net/6037124/user_avatars/3737967.jpg)
Neil Harrington
Member ✭
Anyway to easily parse XML coming from an External API. I can't access the elements in it easily, so I want to convert it into an array that I can then return to Bubble.
So far - I've had limited success with regex expressions; and am thinking of just looping thru the string with substring & indexes.
So far - I've had limited success with regex expressions; and am thinking of just looping thru the string with substring & indexes.
Comments
-
have you tried out the xml_decode filter yet? This might help get the data into a format that is easier to manipulate
-
There's an xml_decode filter? Sheesh. I didn't find that; will look tomorrow morning. Likely way better than my approach.
-
Couldn't wait. Tried the xml_decode filter -- it only pulled the first element rather than an array of them.
This is the xml:
The xml_decode only got the 1st vehicle, and the 1st item of that vehicle.
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
Returned Result:
{
VINquery: {
@attributes: {
Version: 1.0.0},
value: {
VIN: {
@attributes: {
Number: 2T1BURHE3HC952686,
Status: SUCCESS},
value: {
Vehicle: {
@attributes: {
Model_Year: 2017,
Make: Toyota,
Model: Corolla,
Trim_Level: L CVT},
value: {
Item: {
@attributes: {
Key: Model_Year,
Value: 2017,
Unit: },
value: }}}}}}}} -
the xml_decode filter has been fixed to work on the entire array of the response
-
Excellent - I've implemented that instead of my wacko string manipulation. Much appreciated.
-
@Neil Harrington , would you mind showing how / where you added the xml_decoder filter? Thx!
-
What should the input be for XML? Is it text or JSON? I'm continuously running into parsing errors. I'd prefer it to be a url, but that didn't seem to work either. Thanks in advanced!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback