Hello && XmlWriter problem

View: New views
1 Messages — Rating Filter:   Alert me  

Hello && XmlWriter problem

by Dan Ballance :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

First off, I just want to say how impressed I am with the Zend
Framework so far. I have been cutting my teeth on cakePHP for a while
now and feel the need to move to something more powerful and this
framework looks the business! :-)

I hope this is the correct list to ask for some help. I am trying to
run some example code I found that sets up a zend backend supplying
xml data to a flex front end (
http://devzone.zend.com/node/view/id/2019 ). I think it was written
for an older version of Zend, so it has not worked straight
out-of-the-box, but I have been working my way through it and fixing
things as I go.

The problem I currently have is that my flex app is rejecting the xml,
saying that an element is not enclosed. I have check the xml does
validate and am suspecting that it may be the way I am passing the
html of the feed. I am trying to wrap the html in CDATA tags. Here is
the code:

    protected function buildDom($data)
    {
        foreach($data as $key => $value) {
            if (!is_string($key)) {
                $key = $this->currentElement;
            }

            if(is_array($value)) {
                $this->currentElement = $key;
                $this->doc->startElement($key);
                $this->buildDom($value);
                $this->doc->endElement();
                continue;
            }

            $this->doc->writeElement($key, '<![CDATA['."$value" .
']]>'); // MY HACK LOL
        } // foreach($data as $key => $value)


    }

I have commented the line I have hacked above. The problem I suspect I
have is that the

<![CDATA[

tag gets converted to  html entities when i view source in firefox, ie

<![CDATA[

Might this be a problem for an xml parser and if so how can i fix?

Any help greatly appreciated, been trawling the net for a couple of
days now and no joy.

dan :-)
LightInTheBox - Buy quality products at wholesale price