读取包含搜索词的xml标签。 [英] Read xml tags containing search term.
问题描述
我有xml文件,我想把它读作以下规则
- 检查xml文件中的字符串。
- 读取最近的标签名称
< queryItem> ...............< / queryItem>
那
将stringn包含在第1点。 - 返回名称标签的名称值
< name
在queryItem标记内。
locale =" zh"> **此名称**< / name> < li style ="margin:0px;填充:0像素;边框:0像素;自动换行:break-word">读取名称最近的标签
< querySubject> ...............< / querySubject>
将字符串括起来点1.并将其名称值返回为第3点。
我已经通过阅读行(vbscript)尝试了很多 行
并从行获取queryItem和querySubject标签。但由于返回的行包含许多其他queryItems和querySubjects所以我的readline无法获取我到包含字符串的确切标签。
= contents.readline
任何建议实现这个逻辑?
< blockquote>
你好,
你可以使用Linq to XML API实现所有逻辑。
没有你的XML就不可能为您提供满足您需求的代码示例。
I have xml file and I want to read it as following rule
- Check for a string in xml file.
- Read the nearest tag with name
<queryItem>...............</queryItem>
that encloses the stringn in point 1. - Return the name value of name tag
<name locale="en">**This Name**</name>
within queryItem tag. - Read the nearest tag with name
<querySubject>...............</querySubject>
that encloses the string in point 1. and return its name value as point 3.
I have already tried a lot by reading line(vbscript) Line
= contents.readline
and getting queryItem and querySubject tags from line. But as the Line returned contains many other queryItems and querySubjects so My readline fails to get me to the exact tags containing string.
Any suggestion to implement this logic?
Hi there,
You can implement all your logic by using Linq to XML API.
Without having your XML it is impossible to provide you a sample of the code for your needs.
这篇关于读取包含搜索词的xml标签。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!