我需要将变量放入 XML 文件中
在 XML 文件中,有引用图像的节点,而且数量很多!我想做的是在文档顶部创建一个变量来指定驱动器和路径(C:\IMAGES),这样如果我想更改路径或驱动器或两者,那么我只需在一行。但是,我尝试了不同的格式,但无法让它在节点内工作。
这就是现在的样子:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CustSection xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FileVersion IncrementalVersion="3" MajorVersion="0" MinorVersion="1" UserVersion="0"/>
<Header>...
</Header>
<MenuMacro UID="ID_EPSOutput">
<Macro type="Any">
<Revision MajorVersion="16" MinorVersion="2" UserVersion="1"/>
<Name UID="XLS_1309" xlate="true">Create EPS output for IOC</Name>
<Command>-vbarun acadproject.main.Run_EPSOutput </Command>
<SmallImage Name="F:\COMMON\CAREM-B18\Images\EPS.bmp"/>
<LargeImage Name="F:\COMMON\CAREM-B18\Images\EPS.bmp"/>
</Macro>
</MenuMacro>
简化
我想用这样的东西 :
In the XML file, there are nodes that reference images and there are a lot of them! What I'm trying to do is create a variable at the top of the doc to specify drive and path (C:\IMAGES) so that if I want to change the path or drive or both, then I only have to do it in one line. However, I've tried different formats but can't get it to work inside the node.
This is what it looks like now:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CustSection xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FileVersion IncrementalVersion="3" MajorVersion="0" MinorVersion="1" UserVersion="0"/>
<Header>...
</Header>
<MenuMacro UID="ID_EPSOutput">
<Macro type="Any">
<Revision MajorVersion="16" MinorVersion="2" UserVersion="1"/>
<Name UID="XLS_1309" xlate="true">Create EPS output for IOC</Name>
<Command>-vbarun acadproject.main.Run_EPSOutput </Command>
<SmallImage Name="F:\COMMON\CAREM-B18\Images\EPS.bmp"/>
<LargeImage Name="F:\COMMON\CAREM-B18\Images\EPS.bmp"/>
</Macro>
</MenuMacro>
I want to simplify <SmallImage Name="F:\COMMON\CAREM-B18\Images\EPS.bmp"/>
with something like this:<SmallImage Name="{$path}EPS.bmp"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实体对此效果很好。您可以将
path
声明为 DTD 内的实体:然后在 XML 中将
path
实体引用为&path;
。应用于您的文档:
Entities work well for this. You can declare the
path
as an entity inside of a DTD:and then reference the
path
entity in the XML as&path;
.Applied to your document: