Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
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
 
Old August 27th, 2004, 04:34 PM
Authorized User
 
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old August 27th, 2004, 05:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can substitute < with &lt; and > with &gt;
 
Old August 28th, 2004, 02:34 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Or wrap it in a CDATA section.

Code:
<myElement><![CDATA[This is just <textual> content]]></myElement>
--

Joe (Co-author Beginning XML, 3rd edition)
 
Old August 28th, 2004, 03:01 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmm interesting

can i include elements along in it...

&lt some <defname> abue bue </defname>text &gt,

the whitespaces in this context is it preserved ?

 
Old August 28th, 2004, 06:09 AM
Authorized User
 
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?

 
Old August 28th, 2004, 12:25 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
 
Old August 28th, 2004, 04:28 PM
Authorized User
 
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old August 28th, 2004, 04:43 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
 
Old August 28th, 2004, 04:58 PM
Authorized User
 
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old August 29th, 2004, 03:49 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find text within range of two tags dipsut XSLT 3 May 25th, 2007 04:27 PM
Adding a <p> in text that has no xml tags dzisaacs XSLT 1 November 1st, 2005 02:14 PM
Extracting text between <body> tags sumedha HTML Code Clinic 2 June 29th, 2005 02:37 PM
Renaming with XML tags? johrik XSLT 1 February 12th, 2004 03:49 PM
Extracting text between tags aware Classic ASP Professional 4 December 24th, 2003 04:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.