This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Was the screenshot in your first post the exact set of data you are working with?
If the XML wasn't that clean, then you may have to modify the RegEx to account for other characters.
For example, if any of your tags have a space in them:
When I recreated your screen shot:
But let's say that one of the tags was anything other than a single word. For example, if it had a two words with a space between them:
See how I modified the RegEx to account for the fact that there may or may not be a space? \s = space \s*=zero or multiple spaces
Same thing with the second word. The \w got an * also to show that it may or may not exist.
Also, and again depending on how clean the data is, @PeterGoldey's solution may work for you as well. The reason I didn't go there first is because I assumed you didn't have clean data. Depending on how you got to the XML/if any modifications happened to it already, the XML parse tool may not catch all of the tags or may need to be iterated through a few times.
Remember, there is always more than one way to get something done with Alteryx, so don't strictly focus on a single person's suggestion.
To add to the above, in a GIANT XML file that I parse each day, not every record has all tags (or even all nodes).
In that case, you need to parse a substantial set of the data, then transpose, then do a summarize to get all the unique tag names out of the "name" column (after transpose, the tags will be names and the data will be "value").
If there are nested multiple sub-nodes, then you actually have to as sub steps parse those and transpose them and repeat.
So 100% agree my suggestion is only good for the use case I mentioned...but if that is your use case it will be very simple.
There are so many cool ways you could do this. It wouldn't necessarily have to be through editing the xml, but that probably is the fastest way to get started.
I've attached a very basic example. "ContainerEnabled.yxmd" is just an example I used as a template. If you open that up in your favorite text editor you see that the node is identified as a container seven lines above the line that identifies it as enabled or disabled. So in the workflow that does the disabling ("DisableContainer.yxmd"), I just used a Multirow tool to identify the node and the property, then used a Replace function to disable it.
This is just a starting point. Depending on how complex you want to be, you could make this into a macro that will then run the workflow after complete.