Add an attribute to an xml file

Hello,

It's possible to add an attribute to an xml-file with Finalbuilder? My xml-file looks like this:

 

.c9Y6TC { color:#0000ff; }.c194KG { color:#602020; }.cLUY2 { color:#ea8f0f; }.c18YC0 { color:#d00020; }.c5M9S0 { color:#000090; } <?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity name="test" version="1.0.0.2" publicKeyToken="304b26cdaf23d288" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
  <description asmv2:publisher="test" asmv2:product="test" asmv2:supportUrl="http://www.test.ch/" xmlns="urn:schemas-microsoft-com:asm.v1" />
  <deployment install="true">
    <subscription>
      <update>
        <beforeApplicationStartup />
      </update>
    </subscription>
    <deploymentProvider codebase="http://zeittw222/system7/Ch.ZeitAg.System7.Client.Smart.application" />
....

I want to add the mapFileExtensions="true" attribute to the deployment node, that it looks like this:

 <deployment install="true" mapFileExtensions="true">


How can I do that with a Finalbuilder Action?

Thanks for a fast answer...

Greets,

Peter

Hi Peter,

You can do this with FinalBuilder’s Edit XML File action, but you’ll first need to set up the action to use the namespaces in the XML File. This is due to a limitation in MSXML.

When you add the Edit XML action, go to the “MSXML Parser” tab, check the box marked “Automatically use namespace prefixes declared in the document root node”. In the field underneath the checkbox, type in a prefix to use for the default namespace (something like ‘df’)

Then, go back to the Edit XML tab and choose the relevant source file.

The XPath will be : /asmv1:assembly/df:deployment

The Attribute will be : mapFileExtensions

The value : true

… that should get the result you need.

If you’re having trouble getting it up and running, please zip up the XML file and attach it to the forum thread, and I will put together an example FinalBuilder project for it.

Regards,

angus

Wow thanks! It works...

peter