更多XML查询问题 [英] More XML query questions

查看:71
本文介绍了更多XML查询问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释为什么这不起作用?如果我取出第一个{sql:column(" daf.XmlFieldName")}"和替换是一些硬编码字符串。我需要这个是动态的,基于XmlFieldName字段值


谢谢!!

Brian

Can someone explain why this won''t work? It works if I take out the first "{sql:column("daf.XmlFieldName")}" and replace is with some hard coded string. I need this to be dynamic based on that XmlFieldName field value

Thanks!!
Brian

展开 | 选择 | Wrap | 行号

推荐答案

有人对我的问题有任何建议吗?


谢谢!

Brian

Does anyone have any suggestions for my question below???

Thanks!
Brian


有人可以解释为什么这会赢了干嘛?如果我取出第一个{sql:column(" daf.XmlFieldName")}"和替换是一些硬编码字符串。我需要这个是动态的,基于XmlFieldName字段值


谢谢!!

Brian

Can someone explain why this won''t work? It works if I take out the first "{sql:column("daf.XmlFieldName")}" and replace is with some hard coded string. I need this to be dynamic based on that XmlFieldName field value

Thanks!!
Brian

展开 | 选择 | Wrap | 行号


我给了你可能的工作,它将返回以下XML,但你似乎没有兴趣。


[PHP]< ROOT>

<默认名称=" Pepsi" value =" Free">

<默认名称="可乐" vlue =" Zero"

< / ROOT> [/ PHP]


不幸的是我相信你想要实现的东西会使XML形成不好,因为它无法构建静态Schema,其中每个属性都是事先定义的这是不可能的原因。
I gave you possible work around which would return following XML but you didn''t seem to be interested.

[PHP]<ROOT>
<Default name="Pepsi" value="Free">
<Default name="Coke" vlue="Zero">
</ROOT> [/PHP]

Unfortunately I believe what ever you are trying to achieve will make XML not well formed because it will not be able to built static Schema where each attribute defined in advance and this is a reason it is not possible.


我很感兴趣。不幸的是,我必须验证XSD,它看起来像下面。我们有一个奇怪的情况,我们生成XSD的那一部分,以便我们的客户不能在那里放置不映射到我们的数据库中的字段的属性。属性是动态生成的,因此下面的attrs列表可以根据它们是否在我们的应用程序中添加了地址字段而改变。因此,尽我所能,我不能做你的建议。


我现在正在生成一个具有动态生成的行并使用PIVOT表的表的路径?我从来没有做过这样的事情,但我认为它可行吗?


我真的很感谢你的帮助。这个例子是否使事情更清楚或者给你更多的想法?


谢谢!


< xs:element name =" Addresses" >

< xs:complexType>

< xs:sequence maxOccurs =" unbounded">

< xs:element name =" Address">

< xs:complexType>

< xs:attribute name =" AddressType"类型= QUOT; XS:串QUOT;使用= QUOT;需" />

< xs:attribute name =" City"类型= QUOT; XS:串QUOT; />

< xs:attribute name =" Country"类型= QUOT; XS:串QUOT; />

< xs:attribute name =" CountryCode"类型= QUOT; XS:串QUOT; />

< xs:attribute name =" State"类型= QUOT; XS:串QUOT; />

< xs:attribute name =" StreetAddress1"类型= QUOT; XS:串QUOT; />

< xs:attribute name =" StreetAddress2"类型= QUOT; XS:串QUOT; />

< xs:attribute name =" StreetAddress3"类型= QUOT; XS:串QUOT; />

< xs:attribute name =" ZipCode"类型= QUOT; XS:串QUOT; />

< / xs:complexType>

< / xs:element>

< / xs:sequence>

< / xs:complexType>

< / xs:element>



I am very interested. Unfortunately, I have to validate against an XSD and it looks something like below. We have a weird case where we generate that part of the XSD so that our customers cannot put attributes in there that don''t map to fields in our DB. The attributes are dynamically generated, so this list of attrs below can change based on if they have added address fields in our application. Therefore, as much as I would like to, I can''t do your suggestion.

I am going down the path now of generating a table that has the dynamically generated rows and using a PIVOT table?? I have never done anything like that, but I think it could work?

I REALLY appreciate your help. Does this example make things clearer or give you any more ideas?

Thanks!

<xs:element name="Addresses">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Address">
<xs:complexType>
<xs:attribute name="AddressType" type="xs:string" use="required" />
<xs:attribute name="City" type="xs:string" />
<xs:attribute name="Country" type="xs:string" />
<xs:attribute name="CountryCode" type="xs:string" />
<xs:attribute name="State" type="xs:string" />
<xs:attribute name="StreetAddress1" type="xs:string" />
<xs:attribute name="StreetAddress2" type="xs:string" />
<xs:attribute name="StreetAddress3" type="xs:string" />
<xs:attribute name="ZipCode" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>





我给了你可能的工作,它将返回XML,但你似乎没有兴趣。


[PHP]< ROOT>

<默认名称=" Pepsi" value =" Free">

<默认名称="可乐" vlue =" Zero"

< / ROOT> [/ PHP]


不幸的是我相信你想要实现的东西会使XML形成不好,因为它无法构建静态Schema,其中每个属性都是事先定义的这是不可能的原因。
I gave you possible work around which would return following XML but you didn''t seem to be interested.

[PHP]<ROOT>
<Default name="Pepsi" value="Free">
<Default name="Coke" vlue="Zero">
</ROOT> [/PHP]

Unfortunately I believe what ever you are trying to achieve will make XML not well formed because it will not be able to built static Schema where each attribute defined in advance and this is a reason it is not possible.


这篇关于更多XML查询问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆