export items as .xml

4 months 1 day ago #76185

Jay Haydon's Avatar Jay Haydon

Hey Peter,

Is there a possibility to export items as a .xml file instead of .rrbak?

As we are using some same items across different sites I would like to centralize them in one .xml file and then create one item for that file.
Also, when I do this manually (convert .json to .xml) result is lots of lines within <params>.

I would be very grateful for any suggestions how to make this process smoother :)


4 months 1 day ago #76187

Peter van Westen's Avatar Peter van Westen Admin

No, sorry. The export is and will stay in json format.

4 months 1 day ago #76188

Jay Haydon's Avatar Jay Haydon

Sorry, I didn't express myself very clearly.

We are planning to make use of the feature "Use an XML file" to centralise our ReReplacer rules across several Joomla sites, which are all hosted on the same server. We have quite a lot of rules with a variety of settings which we'll move over to the XML file and are looking for some quick/easy/automated method to convert these ReReplacer rules into the XML format required by ReReplacer.

We had various ideas on how to achieve this:
1 . Converting .rrbak files into XML in some way (since the data saved is the same)
2. Displaying the equivalent XML within ReReplacer in the Joomla backend, then copy/paste into the XML file
3. Similar to (2) ... but exporting directly as an XML file (not instead of .rrbak export)
4. Exporting from the ReReplacer mySQL table directly to XML with a custom script

The XML examples provided are helpful, but the process of creating new rules manually within the XML file is very slow-going and the risk of making errors significant.

Any help, suggestions or direction you could provide us with would be greatly appreciated. If this is a feature you might consider adding to ReReplacer in some form we would perhaps be able to partly fund this development. Alternatively we could perhaps develop this ourselves and made the final code available to you for possible later integration into the extension, if this is something you might be interested in.

An as an asides, three of our team ( ) will be in Rome over the weekend, and will certainly attend your talk. We're long time fans of your extensions and big fans of Regular Labs. If you have time, we'd be happy to buy you a beer/coffee and hear more about Regular Labs.

3 months 3 weeks ago #76224

Peter van Westen's Avatar Peter van Westen Admin

Like we just discussed in person at JWC17, I'll be looking in an 'Export as XML' option for items...

3 months 3 weeks ago #76339

Peter van Westen's Avatar Peter van Westen Admin

So the dev version can now export in .xml format. You can switch the default output format in the ReReplacer settings from .json to .xml.
Let me know if that is working ok.

The import function only accepts .json (or the old .rrbak) format.
I am looking into also allowing xml as an import format. But it is a little more complicated.

3 months 2 weeks ago #76424

Jay Haydon's Avatar Jay Haydon

Thanks for much for this ... we've been slammed since returning from the JWC, but should have time to test this and give you feedback by next week. Really excited to try it out :)

3 months 1 week ago #76554

Peter van Westen's Avatar Peter van Westen Admin

Have you had a chance to look at this?

2 months 2 days ago #77340

Jay Haydon's Avatar Jay Haydon

Hey there, finally we'll be looking at this this week - sorry for taking so long :huh:

Before we begin, one thing: the dev version you've provided is based on ReReplacer Free, however many of our existing rules make use of Pro features - would it be possible to make a dev/Pro version available to test so that we can be sure we'll be able to see/export e.g. "Replace with PHP" settings?


2 months 2 days ago #77341

Peter van Westen's Avatar Peter van Westen Admin

If you are logged in, you can also download the Pro version of ReReplacer dev.

2 months 1 day ago #77385

Jay Haydon's Avatar Jay Haydon

Hey man, finally we started to play with this feature and everything looks great except two things.

1. When we export the rule, within <items> there is again <items> instead of <item> tag.
2. This one is of stylistic nature :) <name> tag is aligned on the same row as <items> instead of in the next one.

If you got some time it would be great to help us with those...

Big thanks!

2 months 1 day ago #77386

Peter van Westen's Avatar Peter van Westen Admin

Please try the latest development version from:

2 months 1 day ago #77387

Jay Haydon's Avatar Jay Haydon

Fantastique!!! :)

2 months 53 minutes ago #77421

Jay Haydon's Avatar Jay Haydon

Good morning, here we go again :)

Here some feedback on the XML export feature:

1. In many cases the content entered into the 'replace' field is wrapped in CDATA tags, which e.g. breaks the 'Treat as PHP' feature, if this is activated. Manually removing CDATA in the XML file resolves this issue, however only if the PHP code doesn't contain any actual HTML tags ... in which case it just breaks it in a different way :-)

2. In case of a single 'broken' rule (e.g. <item>) in the XML file, none of the remaining rules is executed. Would it be possible that all valid rules are executed even when invalid rules are present?

3. When an individual rule is exported as XML, some of the settings of that rule are exported, whereas others seem to have no effect on the XML File generated, for example:
- Published status (always exported [0|1] but has no effect when the XML file is executed)
- Enable in feeds (only exported if set to NO)
- Enable in HTML tags (only exported if set to NO)

4. Within the actual rule that is set to load the external XML file most of the ReReplacer options are still visible/selectable within all three tabs (details, search areas and publishing assignments), e.g.
- Regular Expressions
- Use 'newline' modifier
- Case sensitive
- Thorough
- Strip Wrapping Paragraphs
- Treat as PHP
Do these settings have any effect on the execution of the XML file?
If not it would perhaps be less confusing to hide all of these options?

1 month 3 weeks ago #77430

Peter van Westen's Avatar Peter van Westen Admin

1) Should be fixed now:

2) If the xml contains errors, the whole file can't be read

3) The published setting should now take effect.
The other settings are only placed in the xml export if they are different than the default setting.

4) Any settings not specifically set in the xml will use whatever you have set in the main ReReplacer item.

1 month 3 weeks ago #77461

Jay Haydon's Avatar Jay Haydon

Hey there,
just to confirm that 1. and 3. are now ok.
+ tnx for feedback on others!