zaus / forms-3rdparty-xpost

Converts external submission from [Forms: 3rdparty Integration](http://wordpress.org/plugins/forms-3rdparty-integration/) plugin to XML post; optionally can add custom headers (to allow SOAP submissions).
4 stars 2 forks source link

root xml element <post> can't be ignored #14

Closed sasa-yovanovicc closed 7 years ago

sasa-yovanovicc commented 8 years ago

I dont need root elements

But if i leave Root element(s) empty I got XML with "post" root element.

How to exclude root element in settings?

zaus commented 8 years ago

Ah I see what you mean - while xml should have one root element, there can be other stuff around it other than the prolog, like comments and instructions: https://en.m.wikipedia.org/wiki/Root_element

That aside, the "easy" way is to write a hook to str_replace (or substr) it from the submission. Or you can use the "mask" setting to fully customize the fields transformation, but you'll have to manually make all of xml for each field. But you might actually just be able to put an "empty" prolog statement in the root, depending on what your endpoint wants to see.

zaus commented 8 years ago

To clarify the last part, if there is xml in the 'root' setting (with a sprintf placeholder for the content) it won't wrap the content. So you could even set a comment instead:

<!-- ignore --> %s

(nevermind, got confused between mask and xml handling)