Solution: Manipulating eZXML Document Contents

This is a Stub article. Help the eZ Publish community by expanding it!

Problem - Example #1

I need to modify the contents of the eZXML document stored in the ezorder.data_text_1 (variable/field).

I need to append three sibling items to the last in the 'shop_account' structure.

The document

The eZXML document contains the following example structure.

<shop_account>
  <first-name>Null</first-name>
  <mi></mi>
  <last-name>Man</last-name>
  <address1>7x Campus</address1>
  <address2>Suite 250</address2>
  <city>Anchorage</city>
  <zip>99507</zip>
  <state>AK</state>
  <phone>907-555-1212</phone>
  <email>null@example.com</email>
  <shipping>1</shipping>
  <shippingtype>0</shippingtype>
</shop_account>

I could not find a way to modify an existing document simply this using any existing eZ code or API. I was pointed by a friend to use 'domxml' as an alternative to provide the features should need to modify an existing document without having to write code to regenerate it myself (which I did not really want to do, or think I should have too).

The code

The following is an example of the code used in this example solution

/* umm ... */

The summary

There are a number of solutions to this problem. This is simply one example for the next person trying to use, manipulate information stored (trapped) in ezxml / xml inside the eZ publish database content.