0

我需要从'textpath'中提取'String'值。我尝试将以下代码分配给字符串“innertext”。然后使用代码“xmlutil.create”:

innertext="<?xml:namespace prefix = rvml ns......"
set xml1=xmlutil.create
xml1.loadxml(innertext)

但这显示了一个不完整的 XML 错误。如何提取 SR....... 分配给标签 rvml:textpath 中的“字符串”?

用于绘制 Web 元素的 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>
4

1 回答 1

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
于 2013-11-04T08:08:40.020 回答