[英]How to grab the value of an xml node - onix file
I'm trying to grab the value of Text in vb, only when TextTypeCode = "02" - if I should change tes to be 我试图在vb中获取Text的值,仅当TextTypeCode =“ 02”时-如果我应该将tes更改为
tes = (product.Elements(HandleTagName("OtherText"))).value
it grabs the entire information including TextTypeCode, TextFormat and Text PublicationDate but, when 它获取包括TextTypeCode,TextFormat和Text PublicationDate在内的全部信息,但是,当
tes = (product.Elements(HandleTagName("Text"))).value
it grabs nothing ! 它什么也没抓住!
For Each ThisOtherText In product.Elements(HandleTagName("OtherText"))
If ThisOtherText.Element(HandleTagName("TextTypeCode")) = "02" Then
Dim tes as string = (product.Elements(HandleTagName("Text"))).value
ThisBook.shortDescription = tes
Next
<Product>
<OtherText>
<TextTypeCode>02</TextTypeCode>
<TextFormat>05</TextFormat>
<Text>In a series of humorous incidents and hair-raising episodes </Text>
<TextPublicationDate>20140422</TextPublicationDate>
</OtherText>
</Product>
Also I declared shortDescription on the Database as LONGTEXT 我也在数据库上将shortDescription声明为LONGTEXT
名为Text的节点不是Product的直接子节点,要转到Text,您必须转到Product.OtherText.Text,从第一个查询中获得所有值的原因是Product.OtherText抓住了其所有子节点,包括Text节点
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.