Re: xml extraction and conversion with BBEDIT

256 views
Skip to first unread message

Dennis Whiteman

unread,
Aug 24, 2012, 4:16:00 PM8/24/12
to bbe...@googlegroups.com
I've actually worked quite a bit with converting WordPress files, but have done post type conversions using SQL:

UPDATE wp_posts SET post_type = 'product' WHERE post_type = 'post'

Similarly, you can copy just the posts to another table using SQL.

I also wrote a plugin a few years ago that took an XML file containing book records and converted them into WordPress posts (and later books as a custom post type) using XSLT. WordPress has a reasonably good XML parser builtin so it's not that complicated to use PHP to handle the conversion.

Patrick Woolsey

unread,
Aug 24, 2012, 5:17:33 PM8/24/12
to bbe...@googlegroups.com
At 09:23 -0700 08/24/2012, nohler wrote:
>I've got an xml file that was exported from WordPress. I want to find the
>Post item types and copy them to another file. I also want to change the
>posts to products.
>
>I think I'm looking for a multi-line block of text that starts with <item>
>and contains <wp:status>publish</wp:status> and contains
><wp:post_type>post</wp:post_type> and ends with </item>
[...]
>
>If there is a way to find this with a grep expression, what would I write?


Though that will depend on exactly what you want to do with the found text,
here's a building block you can use:

<http://groups.google.com/group/bbedit/msg/a52259af27de5d95>

to match the sections of text in between the specified tags.


Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. <http://www.barebones.com>
P.O. Box 1048, Bedford, MA 01730-1048

Reply all
Reply to author
Forward
0 new messages