CFEngine 3.5.2 - edit_xml namespaces and proposal for first() or [x]-access

9 views
Skip to first unread message

Sebastian Möbius

unread,
Dec 6, 2013, 5:42:59 AM12/6/13
to help-c...@googlegroups.com
Hello together,

I am currently checking out the edit_xml feature.
I struggled with two things though. Maybe my findings could be helpful to someone.

First: Namespaces

If one has a document like:
<?xml version="1.0" encoding="UTF-8"?>
<foo xmlns="http://www.example.com/namespace">
  <bar>Test</bar>
</foo>

I tried
/*[local-name()="foo"]/*[local-name()="bar"]
with success :) but it can become a quite large string if you want to access deeply nested elements

Normally one would define namespace prefixes to cope with this.
This apparently is not possible in CF at the moment - a new property where we could define such namespaces could be very helpful.

Second: Positioned access
Another annoying thing is, that access of elements is not possible with position parameters.
I understand that there is the possiblity of convergence issues but if I only want to use setText or setAttribute it is hard to think of an example where we get into to convergence problems.

I would therefore suggest to think about an additional edit_xml-bundle property which let us enable positioned access, e.g allowPositionAccess => "true"
Nevertheless the limitation should be mentioned in the documentation - at least I cannot see it there - i read it in the bugtracking system

What do you think?


Reply all
Reply to author
Forward
0 new messages