3

Delphi 2010 の XML データバインディング ウィザードを使用して、Citrix Web インターフェイスからPNAgent.dtdファイルを解析しました。これが結果のユニットです。

次に、次の XML を読み込もうとします。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE PNAgent_Configuration SYSTEM "PNAgent.dtd"[]>
<PNAgent_Configuration xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
    <FolderDisplay>
        <StartMenuDisplay>
            <Enabled>true</Enabled>
            <RootFolder root="programs">
            </RootFolder>
        </StartMenuDisplay>
        <DesktopDisplay>
            <Enabled>false</Enabled>
            <Icon>
                <Name>
                </Name>
            </Icon>
        </DesktopDisplay>
        <SystemTrayMenuDisplay>
            <Enabled>true</Enabled>
        </SystemTrayMenuDisplay>
    </FolderDisplay>
    <DesktopIntegration>
        <StartMenu>add</StartMenu>
        <Desktop>add</Desktop>
    </DesktopIntegration>
    <ConfigurationFile>
        <Location modifiable="true" forcedefault="false" replaceServerLocation="true" RedirectNow="false">http://2003xa/Citrix/PNAgent/config.xml</Location>
        <Refresh>
            <OnApplicationStart>false</OnApplicationStart>
            <OnResourceRequest>false</OnResourceRequest>
            <Poll>
                <Enabled>false</Enabled>
                <Period>8</Period>
            </Poll>
        </Refresh>
    </ConfigurationFile>
    <Request>
        <Enumeration>
            <Location replaceServerLocation="true" modifiable="true" forcedefault="false" RedirectNow="false">http://2003xa/Citrix/PNAgent/enum.aspx</Location>
            <Smartcard_Location replaceServerLocation="true">https://2003xa/Citrix/PNAgent/smartcard_enum.aspx</Smartcard_Location>
            <Integrated_Location replaceServerLocation="true">http://2003xa/Citrix/PNAgent/integrated_enum.aspx</Integrated_Location>
            <Refresh>
                <OnApplicationStart modifiable="false" forcedefault="true">true</OnApplicationStart>
                <OnResourceRequest modifiable="false" forcedefault="true">false</OnResourceRequest>
                <Poll modifiable="false" forcedefault="true">
                    <Enabled>true</Enabled>
                    <Period>6</Period>
                </Poll>
            </Refresh>
        </Enumeration>
        <Resource>
            <Location replaceServerLocation="true" modifiable="true" forcedefault="false" RedirectNow="false">http://2003xa/Citrix/PNAgent/launch.aspx</Location>
            <Smartcard_Location replaceServerLocation="true">https://2003xa/Citrix/PNAgent/smartcard_launch.aspx</Smartcard_Location>
            <Integrated_Location replaceServerLocation="true">http://2003xa/Citrix/PNAgent/integrated_launch.aspx</Integrated_Location>
        </Resource>
        <Reconnect>
            <Location replaceServerLocation="true" modifiable="true" forcedefault="false" RedirectNow="false">http://2003xa/Citrix/PNAgent/reconnect.aspx</Location>
            <Smartcard_Location replaceServerLocation="true">https://2003xa/Citrix/PNAgent/smartcard_reconnect.aspx</Smartcard_Location>
            <Integrated_Location replaceServerLocation="true">http://2003xa/Citrix/PNAgent/integrated_reconnect.aspx</Integrated_Location>
        </Reconnect>
        <Change_Password>
            <Location replaceServerLocation="true" modifiable="true" forcedefault="false" RedirectNow="false">http://2003xa/Citrix/PNAgent/change_password.aspx</Location>
        </Change_Password>
        <MachineControl>
            <Location replaceServerLocation="true">http://2003xa/Citrix/PNAgent/desktopControl.aspx</Location>
            <Smartcard_Location replaceServerLocation="true">https://2003xa/Citrix/PNAgent/smartcard_desktopControl.aspx</Smartcard_Location>
            <Integrated_Location replaceServerLocation="true">http://2003xa/Citrix/PNAgent/integrated_desktopControl.aspx</Integrated_Location>
        </MachineControl>
    </Request>
    <Failover>
    </Failover>
    <Logon>
        <LogonMethod>prompt</LogonMethod>
        <EnableSmartcardPromptAutoLogon>false</EnableSmartcardPromptAutoLogon>
        <EnableSavePassword>false</EnableSavePassword>
        <EnableKerberos>false</EnableKerberos>
        <SupportNDS>false</SupportNDS>
        <NDS_Settings>
            <DefaultTree>
            </DefaultTree>
        </NDS_Settings>
        <CaptureSmartCardPin>false</CaptureSmartCardPin>
    </Logon>
    <ChangePassword>
        <Allow>Never</Allow>
        <Method>Direct-Only</Method>
    </ChangePassword>
    <UserInterface>
        <ServerSettings>true</ServerSettings>
        <FolderDisplaySettings>true</FolderDisplaySettings>
        <RefreshSettings>false</RefreshSettings>
        <ReconnectSettings>true</ReconnectSettings>
    </UserInterface>
    <ReconnectOptions>
        <ReconnectFromLogon>
            <Disconnected>true</Disconnected>
            <Active>true</Active>
        </ReconnectFromLogon>
        <ReconnectFromButton>
            <Disconnected>true</Disconnected>
            <Active>true</Active>
        </ReconnectFromButton>
    </ReconnectOptions>
    <FileCleanup>
        <Logoff>false</Logoff>
        <Exit>false</Exit>
        <RefreshApp directoryDepth="0">true</RefreshApp>
    </FileCleanup>
    <ICA_Options>
        <DisplaySize>
            <Options>
                <Mode>seamless</Mode>
                <Mode>fullscreen</Mode>
                <Dimension>
                    <Width>640</Width>
                    <Height>480</Height>
                </Dimension>
                <Dimension>
                    <Width>800</Width>
                    <Height>600</Height>
                </Dimension>
                <Dimension>
                    <Width>1024</Width>
                    <Height>768</Height>
                </Dimension>
                <Dimension>
                    <Width>1280</Width>
                    <Height>1024</Height>
                </Dimension>
                <Dimension>
                    <Width>1600</Width>
                    <Height>1200</Height>
                </Dimension>
            </Options>
        </DisplaySize>
        <ColorDepth>
            <Options>4</Options>
            <Options>8</Options>
        </ColorDepth>
        <Audio>
            <Options>high</Options>
            <Options>medium</Options>
            <Options>low</Options>
            <Options>off</Options>
        </Audio>
        <TransparentKeyPassthrough>
            <Options>local</Options>
            <Options>remote</Options>
            <Options>fullscreenonly</Options>
        </TransparentKeyPassthrough>
        <SpecialFolderRedirection modifiable="false">
            <Enabled>false</Enabled>
        </SpecialFolderRedirection>
    </ICA_Options>
    <AppAccess>
        <AppAccessMethod>Remote</AppAccessMethod>
    </AppAccess>
</PNAgent_Configuration>

PNAgent.Request.Enumeration.Location.ReplaceServerLocation が「http://2003xa/Citrix/PNAgent/enum.aspx」ではなく空の文字列になるのはなぜですか?

procedure TForm1.Button3Click(Sender: TObject);
var
  XML: IXMLDocument;
  PNAgent: IXMLPNAgent_ConfigurationType;
begin
  XML := TXMlDocument.Create(nil);
  XML.LoadFromFile('config.xml');
  PNAgent := NewPNAgent_Configuration;
  PNAgent.Text := XML.XML.Text;
  Memo1.Lines.Add(Format('Server Location: %s', [PNAgent.Request.Enumeration.Location.ReplaceServerLocation]));

PNAgent.Request.XML の値を確認すると、次のように表示されます (値が欠落しているようです)。

'<Request><Enumeration><Location replaceServerLocation=""/></Enumeration></Request>'
4

1 に答える 1

2

LoadXMLDocument のほかに、生成されたユニットに LoadPNAgent_Configuration があることに気付いたときに、TLama の Answer をテストしたかったのです。私がそれを試してみると、それは完全に機能します!

procedure TForm1.Button3Click(Sender: TObject);
var
  XML: IXMLDocument;
  PNAgent: IXMLPNAgent_ConfigurationType;
begin
  PNAgent := LoadPNAgent_Configuration('config.xml');
  Memo1.Lines.Add(Format('Server Location: %s', [PNAgent.Request.Enumeration.Location.NodeValue]));
end;

実装は次のとおりです。

function LoadPNAgent_Configuration(const FileName: string): IXMLPNAgent_ConfigurationType;
begin
  Result := LoadXMLDocument(FileName).GetDocBinding('PNAgent_Configuration', TXMLPNAgent_ConfigurationType, TargetNamespace) as IXMLPNAgent_ConfigurationType;
end;
于 2012-05-18T14:11:46.890 に答える