我尝试在vb中获取文本的值,只有当TextTypeCode = "02“时-如果我应该将tes更改为
tes = (product.Elements(HandleTagName("OtherText"))).value它捕获包括TextTypeCode、TextFormat和Text PublicationDate在内的全部信息,但是,当
tes = (product.Elements(HandleTagName("Text"))).value它什么也没抓到!
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>另外,我在数据库中将shortDescription声明为LONGTEXT
发布于 2014-10-03 04:48:35
名为Text的节点不是Product的直接子节点,要获取Text,您必须转到Product.OtherText.Text,您从第一个查询中获得所有值的原因是Product.OtherText获取了它的所有子节点,包括Text节点
https://stackoverflow.com/questions/23431810
复制相似问题