[Xerte] Re: address CDATA?
Julian Tenney
Julian.Tenney at nottingham.ac.uk
Mon Aug 15 12:20:53 BST 2011
Not sure. From the xml directly it's via firstChild (it see the CDATA as a child node), but xmlToObject obviously drops the object itself into the array.
But this isn't the problem: if it were reporting 'object' then you'd see 'object' on the screen, not undefined.
Why can't you re-cast it?
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 15 August 2011 12:03
To: Xerte list
Subject: [Xerte] Re: address CDATA?
:-) Yes I know I can recast it.
But how do I get directly to the string within the CDATA tags?
debug( interfaceData.pages[0].page[0].intro_text[0]) // shows "blah" in the debug window
debug(typeof interfaceData.pages[0].page[0].intro_text[0]) // reports "object"
sometextid.setText(interfaceData.pages[0].page[0].intro_text[0]);
Says undefined on screen (because it's reporting as an object?)
From: Julian.Tenney at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk
Date: Mon, 15 Aug 2011 11:32:50 +0100
Subject: [Xerte] Re: address CDATA?
String(your[0].expression[0].here);
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 12 August 2011 15:50
To: Xerte list
Subject: [Xerte] address CDATA?
Senior moment.
What's the syntax for addressing the CDATA content so it comes out as typeof = string?
<content>
<pages>
<page id="1">
<intro_text>
- <![CDATA[blah]]>
</intro_text>
interfaceData = ifc.templateData.content[0];
debug(typeof interfaceData.pages[0].page[0].intro_text[0]);
//gives me "object"
How do I get at the string directly?
I know I could put it in a variable and re-type it, but I want to set text directly:
sometextid.setText(interfaceData.pages[0].page[0].intro_text[0]);
//displays undefined - because it's an object
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
_______________________________________________ Xerte mailing list Xerte at lists.nottingham.ac.uk http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110815/c23e50d3/attachment.html>
More information about the Xerte
mailing list