Tuesday, September 4, 2012

XML export basics

Hello ... and thank you for being willing to offer your time and expertise to help me!

My ultimate goal is to take the data from one of my models and export it as an xml file (that I can then import into Adobe InDesign).

I've read the article "XML" under "Core Libraries," but cannot seem to get started.

Every time I try to use one of the examples, I get the error: "Error: Class 'Xml' not found." I assume there is something very basic I'm not seeing. I was just placing code into my index function, e.g.:

public function index($id = null) {
// JUST TRYING TO TEST BASIC XML FUNCTIONALITY
$xmlArray = array('root' => array('child' => 'value'));
$xmlObject = Xml::fromArray($xmlArray, array('format' => 'tags')); // You can use Xml::build() too
$xmlString = $xmlObject->asXML();
die(debug($xmlString));
}

Can you tell me what I'm doing wrong, missing? ... perhaps a reminder of the basic xml setup (do I need a helper setup?) and a small sample code that will produce some basic xml output so I know I'm on the right track.

I will really appreciate your help -- thank you!

Kevin

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

No comments: