MicroBlue 发表于 2011-10-22 17:52:18

AutoIt 怎么无法修改XML文件?

大家好, 我用AutoIt修改一个xml文件可以修改成功,但是修改另外一个xml文件却不行。 两个autoit的语句都一样,只是xml文档不一样。 请大家看一下原因, 谢谢!!!

这个是AutoIt文档!

#include <_XMLDomWrapper.au3>

Global Const $sFile = @ScriptDir & "\test.xml"

If _XMLFileOpen($sFile) = 1 Then

_XMLDeleteNode("unattend")

EndIf


这个是 我想修改但是无法修改的xml文件<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
                <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <UserData>
                                <AcceptEula>true</AcceptEula>
                        </UserData>
                        <ImageInstall>
                                <OSImage>
                                        <InstallFrom>
                                                <MetaData wcm:action="add">
                                                        <Key>/IMAGE/NAME</Key>
                                                        <Value>Windows 7 ULTIMATE</Value>
                                                </MetaData>
                                        </InstallFrom>
                                        <WillShowUI>OnError</WillShowUI>
                                </OSImage>
                        </ImageInstall>
                </component>
                <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <InputLocale>en-us</InputLocale>
                        <SystemLocale>en-us</SystemLocale>
                        <UILanguage>en-us</UILanguage>
                        <UserLocale>en-us</UserLocale>
                </component>
        </settings>
        <settings pass="specialize">
                <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <ComputerName>W7</ComputerName>
                        <ShowWindowsLive>false</ShowWindowsLive>
                </component>
                <component name="Microsoft-Windows-SystemRestore-Main" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <DisableSR>1</DisableSR>
                </component>
                <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <BlockPopups>yes</BlockPopups>
                        <FilterLevel>High</FilterLevel>
                        <PlaySound>false</PlaySound>
                        <ShowInformationBar>false</ShowInformationBar>
                        <DisableAccelerators>true</DisableAccelerators>
                        <DisableDevTools>true</DisableDevTools>
                        <DisableFirstRunWizard>true</DisableFirstRunWizard>
                        <DisableOOBAccelerators>true</DisableOOBAccelerators>
                        <Home_Page>http://google.com</Home_Page>
                </component>
                <component name="Microsoft-Windows-ErrorReportingCore" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <DisableWER>1</DisableWER>
                </component>
        </settings>
        <settings pass="oobeSystem">
                <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <InputLocale>en-us</InputLocale>
                        <SystemLocale>en-us</SystemLocale>
                        <UILanguage>en-us</UILanguage>
                        <UserLocale>en-in</UserLocale>
                </component>
                <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <OOBE>
                                <HideEULAPage>true</HideEULAPage>
                                <ProtectYourPC>3</ProtectYourPC>
                                <NetworkLocation>Home</NetworkLocation>
                        </OOBE>
                        <UserAccounts>
                                <LocalAccounts>
                                        <LocalAccount wcm:action="add">
                                                <Name>radeon</Name>
                                                <Group>Administrators</Group>
                                        </LocalAccount>
                                </LocalAccounts>
                        </UserAccounts>
                        <TimeZone>India Standard Time</TimeZone>
                </component>
        </settings>
        <cpi:offlineImage cpi:source="wim:/sources/install.wim#Windows 7 ULTIMATE" xmlns:cpi="urn:schemas-microsoft-com:cpi"/>
</unattend>
这个是 _XMLDomWrapper.au3   UDF

hzxymkb 发表于 2011-10-22 21:47:45

搜索论坛,早段时间才看到有人提到这个XML的!

xms77 发表于 2011-10-22 22:17:46

我提到过读取xml文件中的某个值,但是未果,现在还是用文本打开,然后用正则提取。

hzxymkb 发表于 2011-10-23 07:26:14

不明白楼主的意思,也许看看这里对你有帮助!
http://www.autoitx.com/search.php?searchid=3&orderby=lastpost&ascdesc=desc&searchsubmit=yes

woodywg 发表于 2011-10-23 21:42:33

学习, 正需要

MicroBlue 发表于 2011-10-28 09:06:34

回复 4# hzxymkb


    谢谢!

MicroBlue 发表于 2011-10-28 09:07:03

这个链接 帮我解决了问题,大家可以看一下
http://www.autoitx.com/search.ph ... mp;searchsubmit=yes
页: [1]
查看完整版本: AutoIt 怎么无法修改XML文件?