Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-05-2016, 07:48 AM
DRKev DRKev is online now
Registered User
 
Join Date: 07-05-2016
Posts: 1
Using Write XML action to create an element if not found?

I'm trying to use the WriteXML action to create an element if it does not exist, without much luck.

The option under the XPath tab to "Create element/attribute if it doesn't exist" is checked.

I'm trying to write a simple log file to record information for specific versions:-
Code:
<VersionLog>
    <Version versionNumber="0.1.0.0>
        <Info someValue="blah"/>
    </Version>
</VersionLog>
If I set the XPath query to (and existing entry):
/VersionLog/Version[[@versionNumber='0.1.0.0']]
I then set the attribute to update to 'versionNumber' and try to assign the value '0.1.0.0'

I am told "File already up-to-date". This therefore indicates that the XPath is at least valid and that a matching entry already exists.

If I try to add a new entry for version 2.0.0.0, and change the XPath and new value accordingly, the step produces an error:
XPath expression not found.

This is not intuitive as it implies there is no XPath expression, which of course there is. There is no matching element, but I requested that a new item be created.

Have I missed something?
The documentation is rather sparse for XML with only a few very simple examples.
Does the WriteXML action support this simple request?
Reply With Quote
  #2  
Old 07-05-2016, 08:17 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
That works in my tests. See the attached project and log file.
Attached Files
File Type: zip xml.zip (1.4 KB, 2343 views)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 06:16 PM.


Copyright © 1999-2023 Kinook Software, Inc.