Editing XML => SetAttribute Not recognized

Antworten
jester
Beiträge: 9
Registriert: 01 Sep 2010, 20:02

Editing XML => SetAttribute Not recognized

Beitrag von jester »

Hi folks!

I'm still kinda new to Opsi and trying to get a grasp on the winst scripting language. I've been reading the docs, searching the forums and trying over and over but can't seem to work this out. I want to edit a XML file (for installing Office) on a Opsi4 installation from my setup32.ins script but i keep getting 'Not recognized' errors or it just won't do what i intend. I have the following XML file:

Code: Alles auswählen

<Configuration Product="Enterprise">
</Configuration>
I want to change the 'Product' attribute's value and add a few new child elements like 'Display' and 'PIDKEY' with some attributes so it ends up like:

Code: Alles auswählen

<Configuration Product="ProPlus">
    <Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes">
    <PIDKEY Value="xxxxx-xxxxx-xxxxx-xxxxx">
</Configuration>
Last iteration of this part of my script (that does not work):

Code: Alles auswählen

[XMLPatch_config.xml]
OpenNodeSet
  - error_when_no_node_existing false
  - warning_when_no_node_existing true
  - error_when_nodecount_greater_1 false
  - warning_when_nodecount_greater_1 true
  - create_when_node_not_existing true
  - attributes_strict false

  documentroot
	all_childelements_with:
		elementname: "Display"
		attribute "Level" value="none"
		attribute "CompletionNotice" value="no"
		attribute "SuppressModal" value="yes"
		attribute "AcceptEula" value="yes"
	all_childelements_with:
		elementname: "PIDKEY"
		attribute: "Value"  value="$LicenseKey$"
end
SetAttribute "Product"  value="$OfficeProdId$"
The winstdoc manual is a bit short on the XML commands and i can't get my head around the proper syntax and the SetAttribute command keeps throwing a "Not recognized" error.


Is there someone who can give me a hand on this?!
Thanx!
Benutzeravatar
wolfbardo
uib-Team
Beiträge: 1354
Registriert: 01 Jul 2008, 12:10

Re: Editing XML => SetAttribute Not recognized

Beitrag von wolfbardo »

Have a look at

http://www.opsi.org/opsi_wiki/Off2007

regards,
Bardo Wolf


OPSICONF 2024
https://opsi.org/en/opsiconf/

Basisworkshop Mainz :

17. - 20. 06. 2024


opsi support - uib gmbh
For productive opsi installations we recommend maintainance + support contracts which are the base of opsi development.

http://www.uib.de
jester
Beiträge: 9
Registriert: 01 Sep 2010, 20:02

Re: Editing XML => SetAttribute Not recognized

Beitrag von jester »

Hi Wolfbardo,

I found that script and used it as guidance but it only handles child elements. Using a construction like that won't change the value of 'Product'-attribute of the main 'Configuration' tag. I've tried that with a construct like below, but that won't work:

Code: Alles auswählen

[XMLPatch_config.xml]
OpenNodeSet
  - error_when_no_node_existing false
  - warning_when_no_node_existing true
  - error_when_nodecount_greater_1 false
  - warning_when_nodecount_greater_1 true
  - create_when_node_not_existing true
  - attributes_strict false

  documentroot
   all_childelements_with:
      elementname: "Configuration"
      attribute "Product"  value="$OfficeProdId$"
end
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3319
Registriert: 04 Jun 2008, 14:27

Re: Editing XML => SetAttribute Not recognized

Beitrag von d.oertel »

Hi,

you will find some examples at:

http://download.uib.de/opsi4.0/testing/ ... 4.0-3.opsi

regards

d.oertel
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.
http://www.uib.de
http://www.opsi.org
jester
Beiträge: 9
Registriert: 01 Sep 2010, 20:02

Re: Editing XML => SetAttribute Not recognized

Beitrag von jester »

Hi D. Oertel,

Thanks for the reference. I still could not find a solution to my problem in those examples through the use of XMLPatch in these files, but worked around it with the use of PatchTextFile.


Regards.
Antworten