我正在尝试访问Visio发送到SVG文档中的一些自定义数据。我用过jquery。不幸的是,即使使用svgdom扩展,我也无法访问“形状11-15以获取rect的更改颜色并获得标题”PDP-E.10。
<g v:mID="0" v:index="1" v:groupContext="foregroundPage">
<v:userDefs>
<v:ud v:nameU="msvThemeOrder" v:val="VT0(0):26"/>
</v:userDefs>
<title>Page 1</title>
<v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394"
v:shadowOffsetY="-8.50394"/>
<g id="group2-1" transform="translate(758.179,18) rotate(90)" v:mID="2" v:groupContext="group">
<title>Entrée-sortie</title>
<g id="group3-2" v:mID="3" v:groupContext="group">
<title>Feuille.3</title>
<g id="group4-3" v:mID="4" v:groupContext="group">
<title>Double_Arrow_Left_x2F_Right</title>
<g id="shape5-4" v:mID="5" v:groupContext="shape" transform="translate(0,-14.0532)">
<title>Feuille.5</title>
<path d="M6.17 582.78 L33.62 582.78 C34.59 582.78 35.38 581.98 35.38 581 C35.38 580.01 34.59 579.22 33.62
579.22 L6.17 579.22 L15.32 569.93 C16.01 569.23 16.01 568.11 15.32 567.42 C14.63 566.72 13.52
566.72 12.83 567.42 L0.68 579.74 C0.01 580.42 0 581.57 0.68 582.26 L12.83 594.58 C13.52 595.28
14.64 595.27 15.32 594.58 C16.01 593.89 16.01 592.76 15.32 592.07 L6.17 582.78 Z" class="st1"/>
</g>
<g id="shape6-6" v:mID="6" v:groupContext="shape" transform="translate(21.3076,0)">
<title>Feuille.6</title>
<path d="M34.7 579.74 L22.55 567.42 C21.86 566.72 20.75 566.72 20.06 567.42 C19.37 568.11 19.37 569.24 20.06
569.93 L29.22 579.22 L1.76 579.22 C0.79 579.22 0 580.02 0 581 C0 581.98 0.79 582.78 1.76 582.78
L29.22 582.78 L20.06 592.07 C19.37 592.76 19.37 593.89 20.06 594.58 C20.75 595.28 21.86 595.28
22.55 594.58 L34.7 582.26 C35.38 581.57 35.39 580.43 34.7 579.74 Z" class="st1"/>
</g>
</g>
</g>
</g>
<g id="group7-8" transform="translate(67.3228,-517.323)" v:mID="7" v:groupContext="group">
<title>PDP-E.22</title>
<g id="shape8-9" v:mID="8" v:groupContext="shape">
<title>Feuille.8</title>
<rect x="0" y="549.235" width="77.9528" height="46.0409" class="st2"/>
</g>
<g id="shape9-11" v:mID="9" v:groupContext="shape" transform="translate(42.2539,0)">
<title>Feuille.9</title>
<desc>342</desc>
<v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/>
<v:textRect cx="17.8494" cy="584.733" width="35.7" height="21.0846"/>
<rect x="0" y="574.191" width="35.6988" height="21.0846" class="st3"/>
<text x="8.73" y="588.33" class="st4" v:langID="1036"><v:paragraph v:horizAlign="1"/><v:tabList/>342</text> </g>
</g>
<g id="group10-14" transform="translate(67.3228,-418.11)" v:mID="10" v:groupContext="group">
<title>PDP-E.10</title>
<g id="shape11-15" v:mID="11" v:groupContext="shape">
<title>Feuille.11</title>
<rect x="0" y="549.235" width="77.9528" height="46.0409" class="st2"/>
</g>
我使用jquery来获取元素Rect。
$('ud')
.filter(function (index) {
return $(this).attr("v:val") == "VT0(0):26";
console.log($(ud).attr("v:val"));
})
.parent()
.parent()
.parent()
.parent()
.each(function (i, item) { Alert('found something'); })
.animate({ svgFill: 'red' }, 2000)
.animate({ svgFill: 'white' }, 2000);