我有一个带有简单SELECT语句的SQL查询,FOR XML AUTO,ELEMENTS。
这是SQL Management Studio中的示例文本结果:
> XML_F52E2B61-18A1-11d1-B105-00805F49916B
> -------------------------------------------------------------------------------- <row><CompanyID>0</CompanyID><Company>0
> </Company><GlCode>00-1010</GlCode><GlYear>2009</GlYear><BeginYearBalance>0.00</BeginYearBalance><ClosingBalPer1>50251640.00</ClosingBalPer1><ClosingBalPer2>45141985.00</ClosingBalPer2><ClosingBalPer3>43603485.00</C
> lPer7><ClosingBalPer8>0.00</ClosingBalPer8><ClosingBalPer9>0.00</ClosingBalPer9><ClosingBalPer10>0.00</ClosingBalPer10><ClosingBalPer11>0.00</ClosingBalPer11><ClosingBalPer12>0.00</ClosingBalPer12><ClosingBalPer13>0.00</ClosingBalPer13><ClosingBalPer14>0.0
> BalPer1><ClosingBalPer2>20000.00</ClosingBalPer2><ClosingBalPer3>0.00</ClosingBalPer3><ClosingBalPer4>0.00</ClosingBalPer4><ClosingBalPer5>0.00</ClosingBalPer5><ClosingBalPer6>0.00</ClosingBalPer6><ClosingBalPer7>0.00</ClosingBalPer7><ClosingBalPer8>0.00</
> alPer14>
它为每条记录创建了<row>
元素的熟悉结构,每列都有一个元素。
但是,这是我在Flowgear中运行节点时返回的内容:
<Result>
<Table>
<XML_F52E2B61-18A1-11d1-B105-00805F49916B><row><CompanyID>0</CompanyID><Company>0 </Company><GlCode>00-1010</GlCode><GlYear>2009</GlYear><BeginYearBalance>0.00</BeginYearBalance><ClosingBalPer1>50251640.00</ClosingBalPer1><ClosingBalPer2>45141985.00</ClosingBalPer2><ClosingBalPer3>43603485.00</ClosingBalPer3><ClosingBalPer4>37602854.06</ClosingBalPer4><ClosingBalPer5>30477670.97</ClosingBalPer5><ClosingBalPer6>27131030.91</ClosingBalPer6><ClosingBalPer7>26489572.00</ClosingBalPer7><ClosingBalPer8>24508174.38</ClosingBalPer8><ClosingBalPer9>25107606.36</ClosingBalPer9><ClosingBalPer10>24838327.11</ClosingBalPer10><ClosingBalPer11>28456828.16</ClosingBalPer11><ClosingBalPer12>3205488.90</ClosingBalPer12><ClosingBalPer13>3205488.90</ClosingBalPer13><ClosingBalPer14>3205488.90</ClosingBalPer14><ClosingBalPer15>0.00</ClosingBalPer15></row><row><CompanyID>0</CompanyID><Company>0 </Company><GlCode>00-1010</GlCode><GlYear>2010</GlYear><BeginYearBalance>3205488.90</BeginYearBalance><ClosingBalPer1>69904850.41</ClosingBalPer1><ClosingBalPer2>70035845.09</ClosingBalPer2><ClosingBalPer3>69751854.18</ClosingBalPer3><ClosingBalPer4>76699659.70</ClosingBalPer4><ClosingBalPer5>64868593.99</ClosingBalPer5><ClosingBalPer6>63343067.84</ClosingBalPer6><ClosingBalPer7>67160186.41</ClosingBalPer7><ClosingBalPer8>66030723.36</ClosingBalPer8><ClosingBalPer9>67336905.21</ClosingBalPer9><ClosingBalPer10>67363017.56</ClosingBalPer10><ClosingBalPer11>67275039.96</ClosingBalPer11><ClosingBalPer12>64310025.92</ClosingBalPer12><ClosingBalPer13>64310025.92</ClosingBalPer13><ClosingBalPer14>64310025.92</ClosingBalPer14><ClosingBalPer15>0.00</ClosingBalPer15></row><row><CompanyID>0</CompanyID><Company>0 </Company><GlCode>00-1010</GlCode><GlYear>2011</GlYear><BeginYearBalance>64310025.92</BeginYearBalance><ClosingBalPer1>63333898.71</ClosingBalPer1><ClosingBalPer2>63334486.71</ClosingBalPer2><ClosingBalPer3>0.00</ClosingBalPer3><ClosingBalPer4>0.00</ClosingBalPer4><ClosingBalPer5>0.00</ClosingBalPer5><ClosingBalPer6>0.00</ClosingBalPer6><ClosingBalPer7>0.00</ClosingBa</XML_F52E2B61-18A1-11d1-B105-00805F49916B>
</Table>
<Table>
<XML_F52E2B61-18A1-11d1-B105-00805F49916B>lPer7><ClosingBalPer8>0.00</ClosingBalPer8><ClosingBalPer9>0.00</ClosingBalPer9><ClosingBalPer10>0.00</ClosingBalPer10><ClosingBalPer11>0.00</ClosingBalPer11><ClosingBalPer12>0.00</ClosingBalPer12><ClosingBalPer13>0.00</ClosingBalPer13><ClosingBalPer14>0.00</ClosingBalPer14><ClosingBalPer15>0.00</ClosingBalPer15></row><row><CompanyID>0</CompanyID><Company>0 </Company><GlCode>00-1020</GlCode><GlYear>2009</GlYear><BeginYearBalance>0.00</BeginYearBalance><ClosingBalPer1>20000.00</ClosingBalPer1><ClosingBalPer2>20000.00</ClosingBalPer2><ClosingBalPer3>20000.00</ClosingBalPer3><ClosingBalPer4>20000.00</ClosingBalPer4><ClosingBalPer5>20000.00</ClosingBalPer5><ClosingBalPer6>20000.00</ClosingBalPer6><ClosingBalPer7>20000.00</ClosingBalPer7><ClosingBalPer8>20000.00</ClosingBalPer8><ClosingBalPer9>20000.00</ClosingBalPer9><ClosingBalPer10>20000.00</ClosingBalPer10><ClosingBalPer11>20000.00</ClosingBalPer11><ClosingBalPer12>20000.00</ClosingBalPer12><ClosingBalPer13>20000.00</ClosingBalPer13><ClosingBalPer14>20000.00</ClosingBalPer14><ClosingBalPer15>0.00</ClosingBalPer15></row><row><CompanyID>0</CompanyID><Company>0 </Company><GlCode>00-1020</GlCode><GlYear>2010</GlYear><BeginYearBalance>20000.00</BeginYearBalance><ClosingBalPer1>20000.00</ClosingBalPer1><ClosingBalPer2>20000.00</ClosingBalPer2><ClosingBalPer3>20000.00</ClosingBalPer3><ClosingBalPer4>20000.00</ClosingBalPer4><ClosingBalPer5>20000.00</ClosingBalPer5><ClosingBalPer6>20000.00</ClosingBalPer6><ClosingBalPer7>20000.00</ClosingBalPer7><ClosingBalPer8>20000.00</ClosingBalPer8><ClosingBalPer9>20000.00</ClosingBalPer9><ClosingBalPer10>20000.00</ClosingBalPer10><ClosingBalPer11>20000.00</ClosingBalPer11><ClosingBalPer12>20000.00</ClosingBalPer12><ClosingBalPer13>20000.00</ClosingBalPer13><ClosingBalPer14>20000.00</ClosingBalPer14><ClosingBalPer15>0.00</ClosingBalPer15></row><row><CompanyID>0</CompanyID><Company>0 </Company><GlCode>00-1020</GlCode><GlYear>2011</GlYear><BeginYearBalance>20000.00</BeginYearBalance><ClosingBalPer1>20000.00</Closing</XML_F52E2B61-18A1-11d1-B105-00805F49916B>
</Table>
<Table>
<XML_F52E2B61-18A1-11d1-B105-00805F49916B>BalPer1><ClosingBalPer2>20000.00</ClosingBalPer2><ClosingBalPer3>0.00</ClosingBalPer3><ClosingBalPer4>0.00</ClosingBalPer4><ClosingBalPer5>0.00</ClosingBalPer5><ClosingBalPer6>0.00</ClosingBalPer6><ClosingBalPer7>0.00</ClosingBalPer7><ClosingBalPer8>0.00</ClosingBalPer8><ClosingBalPer9>0.00</ClosingBalPer9><ClosingBalPer10>0.00</ClosingBalPer10><ClosingBalPer11>0.00</ClosingBalPer11><ClosingBalPer12>0.00</ClosingBalPer12><ClosingBalPer13>0.00</ClosingBalPer13><ClosingBalPer14>0.00</ClosingBalPer14><ClosingBalPer15>0.00</ClosingBalPer15></row><row><CompanyID>0</CompanyID><Company>0 </Company><GlCode>00-1030</GlCode><GlYear>2009</GlYear><BeginYearBalance>0.00</BeginYearBalance><ClosingBalPer1>15000.00</ClosingBalPer1><ClosingBalPer2>30000.00</ClosingBalPer2><ClosingBalPer3>30000.00</ClosingBalPer3><ClosingBalPer4>30000.00</ClosingBalPer4><ClosingBalPer5>30000.00</ClosingBalPer5><ClosingBalPer6>30000.00</ClosingBalPer6><ClosingBalPer7>30000.00</ClosingBalPer7><ClosingBalPer8>30000.00</ClosingBalPer8><ClosingBalPer9>30000.00</ClosingBalPer9><ClosingBalPer10>30000.00</ClosingBalPer10><ClosingBalPer11>30000.00</ClosingBalPer11><ClosingBalPer12>30000.00</ClosingBalPer12><ClosingBalPer13>30000.00</ClosingBalPer13><ClosingBalPer14>30000.00</ClosingBalPer14><ClosingBalPer15>0.00</ClosingBalPer15></row><row><CompanyID>0</CompanyID><Company>0 </Company><GlCode>00-1030</GlCode><GlYear>2010</GlYear><BeginYearBalance>30000.00</BeginYearBalance><ClosingBalPer1>30000.00</ClosingBalPer1><ClosingBalPer2>30000.00</ClosingBalPer2><ClosingBalPer3>30000.00</ClosingBalPer3><ClosingBalPer4>30000.00</ClosingBalPer4><ClosingBalPer5>30000.00</ClosingBalPer5><ClosingBalPer6>30000.00</ClosingBalPer6><ClosingBalPer7>30000.00</ClosingBalPer7><ClosingBalPer8>30000.00</ClosingBalPer8><ClosingBalPer9>30000.00</ClosingBalPer9><ClosingBalPer10>30000.00</ClosingBalPer10><ClosingBalPer11>30000.00</ClosingBalPer11><ClosingBalPer12>30000.00</ClosingBalPer12><ClosingBalPer13>30000.00</ClosingBalPer13><ClosingBalPer14>30000.00</ClosingB</XML_F52E2B61-18A1-11d1-B105-00805F49916B>
</Table>
Node正在进一步将结果拆分为似乎是固定长度的<Table>
元素。其中第二个表节点包含第一个表元素的文本余额。
这导致了非常不同的XML,我不知道如何在下一个Flowgear节点(我的XSLT转换)中处理这个看似非结构化的XML
请帮助......为什么会发生这种情况?如何让它停止?
答案 0 :(得分:1)
当您使用XML查询时,需要勾选Node上的XmlQuery属性。
SQL为XML查询返回一个非常不同的响应,并且需要告诉Flowgear相应地解析它。