[英]How to Read XML Multi Tag in VB.Net
My Xml
File is look like 我的Xml
文件看起来像
<MainTitle>
<Text>BRICK kfhy;</Text>
<Select>0</Select>
<ContentObject>
<TextContent> True </TextContent>
<ImageContent> False </ImageContent>
</ContentObject>
<FONTS>
<Name>4;Anglican;1;AndyMacarthurSH;5;Tsunami 9.0</Name>
<Size> 48 </Size>
<Color> Color.Red </Color>
<Multiple> True </Multiple>
</FONTS>
</MainTitle>
My Code: 我的代码:
Dim _xdoc As New XDocument()
_xdoc = XDocument.Load(_rdFl$)
Dim GetValues = (From T In _xdoc...<MainTitle> _
Select Text = T.<Text>.Value,
TextContent = T.<TextContent>.Value,
FontName = T.<FontName.Value,
Color = T.<Color.Value)
Here I can read Text values but could not read Font,Contentobject values, I can understand that loop return the MAINTITLE sub nodes but how to get ContentObject
with Fonts
values here. 在这里,我可以读取Text值,但不能读取Font,Contentobject值,我可以理解该循环返回MAINTITLE子节点,但是如何在此处获取带有Fonts
值的ContentObject
。
Dim GetValues = (From T In _xdoc...<MainTitle> _
Select Text = T.<Text>.Value,
TextContent = T...<ContentObject>.<TextContent>.Value,
FontName = T...<FONTS>.<FontName.Value,
Color = T...<FONTS>.<Color.Value)
this code is worked fine, i can read values with in the multi tag xml 此代码工作正常,我可以在多标签xml中读取值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.