I get below error when I tried to generate XML tree from xml
response in kony-fabric
.
error : Cannot generate XML
tree. Failed to parse Backend Response as XML
is invalid. error on line 3 at column 139: attributes construct error
my xml
response is from konyfabric
:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/v1/xsl/xml_pretty_printer.xsl" type="text/xsl"?>
<categories currentPage="1" from="1" to="1" totalPages="1" total="1" queryTime="0.023" totalTime="0.028" canonicalUrl="/v1/categories(id="cat00000")?apiKey=lAqRUSojMrpkxyefjjfha" partial="false">
<category>
<id>cat00000</id>
<name>Best Buy</name>
<active>true</active>
<url>https://www.bestbuy.com/?cmp=RMX-cat</url>
<path>
<category>
<id>cat00000</id>
<name>Best Buy</name>
</category>
</path>
<subCategories>
<category>
<id>abcat0900000</id>
<name>Appliances</name>
</category>
<category>
<id>abcat0100000</id>
<name>TV & Home Theater</name>
</category>
<category>
<id>abcat0500000</id>
<name>Computers & Tablets</name>
</category>
<category>
<id>abcat0400000</id>
<name>Cameras & Camcorders</name>
</category>
<category>
<id>abcat0800000</id>
<name>Cell Phones</name>
</category>
<category>
<id>abcat0200000</id>
<name>Audio</name>
</category>
<category>
<id>abcat0700000</id>
<name>Video Games</name>
</category>
<category>
<id>abcat0600000</id>
<name>Movies & Music</name>
</category>
<category>
<id>abcat0300000</id>
<name>Car Electronics & GPS</name>
</category>
<category>
<id>pcmcat332000050000</id>
<name>Wearable Technology</name>
</category>
<category>
<id>pcmcat242800050021</id>
<name>Health, Fitness & Beauty</name>
</category>
<category>
<id>pcmcat312300050015</id>
<name>Home, Garage & Office</name>
</category>
<category>
<id>pcmcat254000050002</id>
<name>Smart Home</name>
</category>
<category>
<id>pcmcat252700050006</id>
<name>Drones, Toys & Collectibles</name>
</category>
<category>
<id>pcmcat142300050026</id>
<name>Best Buy Outlet</name>
</category>
<category>
<id>abcat0207000</id>
<name>Musical Instruments</name>
</category>
<category>
<id>cat09000</id>
<name>Gift Cards</name>
</category>
<category>
<id>abcat0010000</id>
<name>Gift Ideas</name>
</category>
<category>
<id>pcmcat128500050004</id>
<name>Name Brands</name>
</category>
<category>
<id>pcmcat1529524080138</id>
<name>Magnolia</name>
</category>
<category>
<id>pcmcat164600050001</id>
<name>Featured Offers</name>
</category>
<category>
<id>pcmcat1528819595254</id>
<name>Services</name>
</category>
<category>
<id>pcmcat230900050001</id>
<name>Best Buy Business</name>
</category>
<category>
<id>pcmcat356600050000</id>
<name>Best Buy Education</name>
</category>
<category>
<id>pcmcat144600050035</id>
<name>Electronics</name>
</category>
<category>
<id>pcmcat87800050001</id>
<name>Customer Service</name>
</category>
<category>
<id>pcmcat748302046864</id>
<name>Tech Help & Inspiration</name>
</category>
<category>
<id>sc_digital_platform</id>
<name>Digital Platform</name>
</category>
<category>
<id>pcmcat225600050002</id>
<name>Black Friday</name>
</category>
<category>
<id>pcmcat370900050002</id>
<name>Franchises</name>
</category>
<category>
<id>pcmcat140900050011</id>
<name>Top-Rated Products</name>
</category>
<category>
<id>pcmcat748302045953</id>
<name>AF TestingTemplates</name>
</category>
<category>
<id>pcmcat311300050017</id>
<name>Video Games, Movies & Music</name>
</category>
<category>
<id>pcmcat44800050004</id>
<name>Reward Zone</name>
</category>
<category>
<id>pcmcat140700050010</id>
<name>Special Sale</name>
</category>
<category>
<id>pcmcat128800050004</id>
<name>Reviews & Ratings</name>
</category>
<category>
<id>pcmcat149500050013</id>
<name>Best Buy Racing</name>
</category>
<category>
<id>pcmcat156400050050</id>
<name>Partsearch</name>
</category>
<category>
<id>pcmcat253600050018</id>
<name>e Gift Cards</name>
</category>
<category>
<id>pcmcat133200050003</id>
<name>Best Buy News</name>
</category>
</subCategories>
</category>
</categories>
When same api give valid xml
response in POSTMAN client.
POSTMAN client valid xml
response is:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/v1/xsl/xml_pretty_printer.xsl" type="text/xsl"?>
<categories currentPage="1" from="1" to="1" totalPages="1" total="1" queryTime="0.062" totalTime="0.068" canonicalUrl="/v1/categories(id="cat00000")?apiKey=lAqRUSojMrpkxyefjjfha" partial="false">
<category>
<id>cat00000</id>
<name>Best Buy</name>
<active>true</active>
<url>https://www.bestbuy.com/?cmp=RMX-cat</url>
<path>
<category>
<id>cat00000</id>
<name>Best Buy</name>
</category>
</path>
<subCategories>
<category>
<id>abcat0900000</id>
<name>Appliances</name>
</category>
<category>
<id>abcat0100000</id>
<name>TV & Home Theater</name>
</category>
<category>
<id>abcat0500000</id>
<name>Computers & Tablets</name>
</category>
<category>
<id>abcat0400000</id>
<name>Cameras & Camcorders</name>
</category>
<category>
<id>abcat0800000</id>
<name>Cell Phones</name>
</category>
<category>
<id>abcat0200000</id>
<name>Audio</name>
</category>
<category>
<id>abcat0700000</id>
<name>Video Games</name>
</category>
<category>
<id>abcat0600000</id>
<name>Movies & Music</name>
</category>
<category>
<id>abcat0300000</id>
<name>Car Electronics & GPS</name>
</category>
<category>
<id>pcmcat332000050000</id>
<name>Wearable Technology</name>
</category>
<category>
<id>pcmcat242800050021</id>
<name>Health, Fitness & Beauty</name>
</category>
<category>
<id>pcmcat312300050015</id>
<name>Home, Garage & Office</name>
</category>
<category>
<id>pcmcat254000050002</id>
<name>Smart Home</name>
</category>
<category>
<id>pcmcat252700050006</id>
<name>Drones, Toys & Collectibles</name>
</category>
<category>
<id>pcmcat142300050026</id>
<name>Best Buy Outlet</name>
</category>
<category>
<id>abcat0207000</id>
<name>Musical Instruments</name>
</category>
<category>
<id>cat09000</id>
<name>Gift Cards</name>
</category>
<category>
<id>abcat0010000</id>
<name>Gift Ideas</name>
</category>
<category>
<id>pcmcat128500050004</id>
<name>Name Brands</name>
</category>
<category>
<id>pcmcat1529524080138</id>
<name>Magnolia</name>
</category>
<category>
<id>pcmcat164600050001</id>
<name>Featured Offers</name>
</category>
<category>
<id>pcmcat1528819595254</id>
<name>Services</name>
</category>
<category>
<id>pcmcat230900050001</id>
<name>Best Buy Business</name>
</category>
<category>
<id>pcmcat356600050000</id>
<name>Best Buy Education</name>
</category>
<category>
<id>pcmcat144600050035</id>
<name>Electronics</name>
</category>
<category>
<id>pcmcat87800050001</id>
<name>Customer Service</name>
</category>
<category>
<id>pcmcat748302046864</id>
<name>Tech Help & Inspiration</name>
</category>
<category>
<id>sc_digital_platform</id>
<name>Digital Platform</name>
</category>
<category>
<id>pcmcat225600050002</id>
<name>Black Friday</name>
</category>
<category>
<id>pcmcat370900050002</id>
<name>Franchises</name>
</category>
<category>
<id>pcmcat140900050011</id>
<name>Top-Rated Products</name>
</category>
<category>
<id>pcmcat748302045953</id>
<name>AF TestingTemplates</name>
</category>
<category>
<id>pcmcat311300050017</id>
<name>Video Games, Movies & Music</name>
</category>
<category>
<id>pcmcat44800050004</id>
<name>Reward Zone</name>
</category>
<category>
<id>pcmcat140700050010</id>
<name>Special Sale</name>
</category>
<category>
<id>pcmcat128800050004</id>
<name>Reviews & Ratings</name>
</category>
<category>
<id>pcmcat149500050013</id>
<name>Best Buy Racing</name>
</category>
<category>
<id>pcmcat156400050050</id>
<name>Partsearch</name>
</category>
<category>
<id>pcmcat253600050018</id>
<name>e Gift Cards</name>
</category>
<category>
<id>pcmcat133200050003</id>
<name>Best Buy News</name>
</category>
</subCategories>
</category>
</categories>
hi @Rishil I have checked both Response in online xml
validator and there is an error with your first response which generated by Kony
but the second response by postman
is valid. So there may be an issue in Kony fabric
.
I am agree with @Mig82's statements "escape the double quotes using the XML entity name:"
canonicalUrl="/v1/categories(id="cat00000")?apiKey=lAqRUSojMrpkxyefjjfha"
which is well managed by postman
.
I hope this will helpful to you.