Edit XML Node

barnuthin

New member
Can anyone post an example of using the “Custom Action” XML Write?

I’m needing to replace the entire contents of a specific node.

All of my attempts leave me with a completely blank document. My guess is I’m incorrectly entering the PathToNode
 
Last edited:
Okay, I’ve found that if I remove this one line from the very top of the XML document that I’m trying to manipulate - I am able successfully find and manipulate the nodes.
there must be something I need to add to my XPath “PathToNde” that is escaping me.
 
Last edited:
After some research, this is a common failing of XPath in general - not a problem with PaquetBuilder.

When the XML document contains a !DOCTYPE statement, XPath fails to read PathToNode. This seems to be the case in most scripting languages. Fortunately in my case, the DOCTYPE statement served no real purpose. In cases where the DOCTYPE statement is critical, there were more complicated solutions based on the scripting language you are working with.

I’ve resolved it with a bit of cheating. Running this batch file in the containing folder gets rid of the DOCTYPE Statement. - run a second time it reverts the document

In this case, the file I’m working with is “Layout.xml”
Code:
ren Layout.xml Layout.xml.old
findstr /v /b /c:"<!DOCTYPE xml>" Layout.xml.old > Layout.xml
I find it hard to understand that as “almighty” as XPath is suppose to be - they haven’t overcome this common failing. Especially when everything I read says that the DOCTYPE statement is an important part of a proper XML document.
 
Last edited:
Thank you for your investigation. Regarding samples for XML actions, we’ll introduce action templates in next release of Paquet Builder 3. This will allow users to import set of actions from a template library (that can be shared online).
 
Back
Top