cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MicheleLaPietra
Level 2

Installshield 2008 Xml

I created the following xml structure in xml changes view




Product1


Product2




when I try to test it, I can retrieve the following xml file.




Product2




Where am I wronging?
thanks a lot
Labels (1)
0 Kudos
(3) Replies
DebbieL
Level 17

The XML File Changes view isn't meant to have a node for every node in an XML file. The XML File Changes view should show only the settings that differ from the base XML file. The recommended implementation is to add the base XML file to a component in your project through the Files and Folders view. Then in the XML File Changes view, import only the nodes that you want to change at run time.

The following help topics have more information:

Creating an XML File Reference

Using XPath Expressions to Find XML Data in an XML File

I hope that helps.

Debbie Landers
Macrovision Corporation
0 Kudos
MicheleLaPietra
Level 2

Ok, I agree with you.
If I need to modify all the nodes, Shall I insert in XML File Changes all the XML structure?
I think so..
so these are the steps i follow:
1) I import my XML file
2) I choose all nodes (in fact, program lets me to do it!)
3) Importing operation successfully done
4) In XML file Changes View I can see only the last field.

Why?
Thanks in advance
0 Kudos
DebbieL
Level 17

I’m not exactly sure, but it sounds like the import wizard may be running basic XPath queries. That is, I suspect that it is searching for a Products node that has a Product subelement. Since one is not found in the XML view, it creates one with the Product1 content. Then it runs another XPath query, searching for a Products node that has a Product subelement. It finds that existing node, so it updates the content from Product1 to Product2. The same sort of behavior happens at run time on the target machine. Since your XML file requires more complex XPath queries, you’ll need to set them up in the XML File Changes view manually.

If your XML file were written differently, it might be easier to create the XPath queries. For example, currently, it looks like the only differentiating parts between the different Product nodes in your XML is the content. If you use element attributes to differentiate between nodes, you’d be able to use the same kind of XPath expressions that are shown in the help library. So instead of generating the XML that you have, your XML might look something like this:


some text
some different text



I don't think that one method is necessarily "more correct" or better. In my opinion, it seems a little easier to manipulate XML through XPath queries when the XML is written like that. I’m not sure if you have any control over that, though.

In your particular XML example, if you set up the XML file to look like my sample screen shot, the resulting XML file is displayed at run time as you expect it to be displayed. (Note: In my example, the content for the first Name node is set to Product1, and the content for the second node is set to Product2.)

Will something like that work? Without knowing more about how you will be using the XML file, I’m not entirely sure that these XPath queries will work. For example, (a) if your installation is installing a suite of various optional products, (b) the XML file will contain the list of products in the suite that are actually installed, and (c) you don’t have other installations that will update the same XML file with additional product names, this method might work for you. However, if you have other installations that will keep updating this XML file with additional names, every time that the XML file changes are executed, the installation will be overwriting the existing data, since my sample XPath queries use a position predicate. So, during the first installation, Product1 may be included in the first Product node, and Product2 may be included in the second Product node. For the next installation, Product3 may overwrite the Product1 name, since my sample uses the position()=1 XPath expression. Similarily, Product4 would overwrite the Product2 name.

Does that make sense?

Can you explain a little more about how you will be using the XML file?
0 Kudos