|
|
 |
| XML General XML discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XML section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |
|

August 27th, 2004, 05:34 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Location: , , Latvia.
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, 06:12 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You can substitute < with < and > with >
|

August 28th, 2004, 03:34 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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, 04:01 AM
|
|
Registered User
|
|
Join Date: Aug 2004
Location: subang jaya, selangor, Malaysia.
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, 07:09 AM
|
|
Authorized User
|
|
Join Date: Mar 2004
Location: , , Latvia.
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, 01:25 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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, 05:28 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Location: , , Latvia.
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, 05:43 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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, 05:58 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Location: , , Latvia.
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, 04:49 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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)
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |