I keep getting an error in my installation because an xmlFileSet action is failing in a postInstallationActionList of a particular component. Can you tell me how to debug this or what is wrong with the following code?

XML file to edit (pmdfile.xml):

<?xml version="1.0" encoding="US-ASCII"?>
<PMD SchemaVersion="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\etc\somefile.xsd">

Using the following:

    <postInstallationActionList>
        <xmlFileSet>
            <attribute>xsi:noNamespaceSchemaLocation</attribute>
            <element>/PMD[@SchemaVersion="1.0"]</element>
            <file>${installdir}${platform_path_separator}pmdfile.xml</file>
            <value>${installdir}${platform_path_separator}etc${platform_path_separator}PMD.xsd</value>
        </xmlFileSet>
    </postInstallationActionList>

asked 02 May '12, 23:24

DevHopeful_2012's gravatar image

DevHopeful_2012
176131521
accept rate: 9%


The problem is that the action does not work well with namespaces. As a workaround, you can use the below code:

<substitute>
    <files>${installdir}${platform_path_separator}pmdfile.xml</files>
    <type>regexp</type>
    <substitutionList>
        <substitution>
            <pattern>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\s*xsi:noNamespaceSchemaLocation=</pattern>
            <value>xsi:noNamespaceSchemaLocation=</value>
        </substitution>
    </substitutionList>
</substitute>
    <xmlFileSet>
        <attribute>xsi:noNamespaceSchemaLocation</attribute>
        <element>/PMD[@SchemaVersion="1.0"]</element>
        <file>${installdir}${platform_path_separator}pmdfile.xml</file>
        <value>${installdir}${platform_path_separator}etc${platform_path_separator}PMD.xsd</value>
    </xmlFileSet>
<substitute>
    <files>${installdir}${platform_path_separator}pmdfile.xml</files>
    <type>regexp</type>
    <substitutionList>
        <substitution>
            <pattern>xsi:noNamespaceSchemaLocation=</pattern>
            <value>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=</value>
        </substitution>
    </substitutionList>
</substitute>
link

answered 06 May '12, 16:45

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Thanks! Good to know. I'll test this out. I am guessing that all I need is the substitute action and the rest of this is just some accidental copy and paste, correct?

(07 May '12, 00:03) DevHopeful_2012

Sorry, I meant to use the <substitute> actions to disable (remove) and re-enable the namespace so the <xmlFileSet> action work but as the setting you tried to set is so simple you can just use the substitute for that as you mention.

link

answered 11 May '12, 09:56

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×2

Asked: 02 May '12, 23:24

Seen: 2,206 times

Last updated: 11 May '12, 09:56