我需要从'textpath'中提取'String'值。我尝试将以下代码分配给字符串'innertext'。然后使用代码'xmlutil.create':
innertext="<?xml:namespace prefix = rvml ns......"
set xml1=xmlutil.create
xml1.loadxml(innertext)
但是这显示了XML不完整的错误。 如何在标签rvml:textpath?
中提取SR .......赋值给'string'用于绘制网络元素的VML代码采用以下格式,单行:
<?xml:namespace prefix = rvml ns = "urn:schemas-microsoft-com:vml" />
<rvml:textpath style="FONT: 10px Arial, sans-serif; v-text-align: left" class=rvml on = "t" string = "SR......."></rvml:textpath>
<rvml:path class=rvml textpathok = "t"></rvml:path>
<rvml:skew class=rvml on = "t" matrix = ".*" origin = "0,0" offset = "0,0"></rvml:skew>
<rvml:fill></rvml:fill… class=rvml></rvml:stroke>
答案 0 :(得分:0)
如果无法识别xml处理,请尝试正则表达式,搜索所需文本并使用捕获组获取所需值
Option explicit
Dim re, test
Set re = New RegExp
With re
.Pattern = "<rvml:textpath[^>]+ string\s*=\s*""(SR[^""]+)"
.IgnoreCase = true
End With
test = "<rvml:textpath style=""FONT: 10px Arial, sans-serif; v-text-align: left"" class=rvml on = ""t"" string = ""SR.......""></rvml:textpath> "
Dim matches, m
Set matches = re.Execute(test)
For Each m in matches
WScript.Echo m.Submatches(0)
Next