I have a problem:
I have an XML file which contains:
<colortable>
<color id="1" type="transparent"/>
<color id="2"/>
<color id="3" values="1.0"/>
<color id="4" type="rgb" values="0.0,0.0,0.0"/>
<color id="5" type="rgb" values="1.0,1.0,1.0"/>
</colortable>
<imagetable>
<imagedata id="1" source="E:\xml2pdf_universal_physical_layer\tmp\dbres22C79BB2A484491458226919210\r.437248.1395746975.csfolha1v2SemMensagem_Tim.jpg">
</imagedata>
<imagedata id="2" source="E:\xml2pdf_universal_physical_layer\tmp\dbres22C79BB2A484491458226919210\r.42189.1400584131.csfolha2v2fiscal_Tim.jpg">
</imagedata>
<imagedata id="3" source="E:\xml2pdf_universal_physical_layer\tmp\dbres22C79BB2A484491458226919210\r.488328.1422006304.DT1_Image6_T.jpg">
</imagedata>
<imagedata id="4" source="E:\xml2pdf_universal_physical_layer\tmp\dbres22C79BB2A484491458226919210\r.1262464.1427173896.csfolha3v2fiscal_Tim.jpg">
</imagedata>
<imagedata id="5" source="E:\xml2pdf_universal_physical_layer\tmp\dbres22C79BB2A484491458226919210\r.54571.1400584131.csfolha0v2fiscal_Tim.jpg">
</imagedata>
</imagetable>
I want change the path from the one above to C:\images\
I'm trying to use this Powershell code:
while ($line = [Console]::In.ReadLine())
{
switch -wildcard ($line)
{
'<imagedata*' {$line -replace '[A-Z]{1}:.+[r][.]([0-9]+[.]){2}', 'c:\images\'}
default {$line}
}
}
I want this to, for every string starting with <imagedata, find the path (matching a regexp) and replace it with a new path.
This isn't working. How can I fix it?
c:\images\. The most disturbing thing in the script is[Console]::In.ReadLine())which I really can't understand why you're using.