Kony Fabric 无法生成 XML 树
Kony Fabric Cannot generate XML tree
当我尝试从 kony-fabric
中的 xml
响应生成 XML 树时出现以下错误。
错误:无法生成 XML
树。无法解析后端响应,因为 XML
无效。第 3 行第 139 列的错误:属性构造错误
我的 xml
回复来自 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>
当 api 在 POSTMAN 客户端中给出有效的 xml
响应时。
POSTMAN 客户端有效 xml
响应是:
<?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>
我只是 运行 你的 XML 通过两个不同的 XML 验证器,它是无效的 XML:
我得到:
Errors in the XML document:
3: 139 Element type "categories" must be followed by either attribute specifications, ">" or "/>".
所以这不是 Kony Fabric 的问题,而是来自后端的响应。
此错误是由 categories
元素中的 canonicalUrl
属性引起的。此属性的值包含双引号,即 XML entity。您可以从下面屏幕截图中的颜色变化中看到 - 其中 cat00000
是黑色而不是绿色 - 它破坏了语法。
您必须使用单引号:
canonicalUrl="/v1/categories(id='cat00000')?apiKey=lAqRUSojMrpkxyefjjfha"
或者使用 XML 实体名称转义双引号:
canonicalUrl="/v1/categories(id="cat00000")?apiKey=lAqRUSojMrpkxyefjjfha"
那么这个属性就有效了。
但是,您将继续遇到 TV & Home Theater
或 Computers & Tablets
等值的问题,因为与符号 &
字符也是一个XML 实体。在所有这些情况下,您都必须将 &
替换为 "
.
希望对您有所帮助。
你好@Rishil 我已经检查了在线 xml
验证器中的两个响应,并且 Kony
生成的第一个响应有错误,但 postman
的第二个响应是有效的.因此 Kony fabric
.
中可能存在问题
我同意@Mig82 的说法"escape the double quotes using the XML entity name:"
canonicalUrl="/v1/categories(id="cat00000")?apiKey=lAqRUSojMrpkxyefjjfha"
postman
管理得很好。
希望对您有所帮助。
当我尝试从 kony-fabric
中的 xml
响应生成 XML 树时出现以下错误。
错误:无法生成 XML
树。无法解析后端响应,因为 XML
无效。第 3 行第 139 列的错误:属性构造错误
我的 xml
回复来自 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>
当 api 在 POSTMAN 客户端中给出有效的 xml
响应时。
POSTMAN 客户端有效 xml
响应是:
<?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>
我只是 运行 你的 XML 通过两个不同的 XML 验证器,它是无效的 XML:
我得到:
Errors in the XML document: 3: 139 Element type "categories" must be followed by either attribute specifications, ">" or "/>".
所以这不是 Kony Fabric 的问题,而是来自后端的响应。
此错误是由 categories
元素中的 canonicalUrl
属性引起的。此属性的值包含双引号,即 XML entity。您可以从下面屏幕截图中的颜色变化中看到 - 其中 cat00000
是黑色而不是绿色 - 它破坏了语法。
您必须使用单引号:
canonicalUrl="/v1/categories(id='cat00000')?apiKey=lAqRUSojMrpkxyefjjfha"
或者使用 XML 实体名称转义双引号:
canonicalUrl="/v1/categories(id="cat00000")?apiKey=lAqRUSojMrpkxyefjjfha"
那么这个属性就有效了。
但是,您将继续遇到 TV & Home Theater
或 Computers & Tablets
等值的问题,因为与符号 &
字符也是一个XML 实体。在所有这些情况下,您都必须将 &
替换为 "
.
希望对您有所帮助。
你好@Rishil 我已经检查了在线 xml
验证器中的两个响应,并且 Kony
生成的第一个响应有错误,但 postman
的第二个响应是有效的.因此 Kony fabric
.
我同意@Mig82 的说法"escape the double quotes using the XML entity name:"
canonicalUrl="/v1/categories(id="cat00000")?apiKey=lAqRUSojMrpkxyefjjfha"
postman
管理得很好。
希望对您有所帮助。