 |
| XML General XML discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 27th, 2004, 04:34 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Tags as text in XML elements
Is it possible to include tags (name enclosed with the brackets <>) into an element so it would be considered as text, not a subelement?
Thanks!
Janis
|
|

August 27th, 2004, 05:12 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You can substitute < with < and > with >
|
|

August 28th, 2004, 02:34 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Or wrap it in a CDATA section.
Code:
<myElement><![CDATA[This is just <textual> content]]></myElement>
--
Joe (Co-author Beginning XML, 3rd edition)
|
|

August 28th, 2004, 03:01 AM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hmm interesting
can i include elements along in it...
< some <defname> abue bue </defname>text >,
the whitespaces in this context is it preserved ?
|
|

August 28th, 2004, 06:09 AM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you, Joe, it did the trick!
I suppose, Birger's suggestion would work too, but it just wouldn't be so elegant. :)
But what if I have a character ']' in my text too?
|
|

August 28th, 2004, 12:25 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Quote:
quote:Originally posted by janise
But what if I have a character ']' in my text too?
|
It's okay as long as you dont have ]]>.
--
Joe (Co-author Beginning XML, 3rd edition)
|
|

August 28th, 2004, 04:28 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
OK, thanks!
Well, now I have the next problem... I use an xsl to nicely display the xml data. And now I need that it takes my tags as real HTML tags, not text...
For example, I have this text for an element:
<img src="photo.jpg" heigth="100" width="100" alt="Photo">
So, now when I transfer this data using the style sheet, I would like the image not the code to be displayed.
Is this possible?
Thanks!
Janis
|
|

August 28th, 2004, 04:43 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Well as long as you try to display the output in a browser it should work, what are you doing at the moment?
--
Joe (Co-author Beginning XML, 3rd edition)
|
|

August 28th, 2004, 04:58 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I tried to view plain .xml in the browser and now I'm using an external .xsl to change the layout. And it shows me the img code and br tags instead of an image or a new line... (I mean, these tags I have in the xml elements. Tags in the xsl stylesheet are executed correctly.)
Janis
|
|

August 29th, 2004, 03:49 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Sorry but you'll have to elucidate, are youi embedding the xsl path in the xmlk with a processing-instruction, transforming via some script or some other way?
--
Joe (Co-author Beginning XML, 3rd edition)
|
|
 |