p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XML
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 27th, 2004, 05:34 PM
Authorized User
Points: 196, Level: 3
Points: 196, Level: 3 Points: 196, Level: 3 Points: 196, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: , , Latvia.
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old August 27th, 2004, 06:12 PM
Friend of Wrox
Points: 318, Level: 6
Points: 318, Level: 6 Points: 318, Level: 6 Points: 318, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can substitute < with &lt; and > with &gt;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old August 28th, 2004, 03:34 AM
joefawcett's Avatar
Wrox Author
Points: 8,994, Level: 40
Points: 8,994, Level: 40 Points: 8,994, Level: 40 Points: 8,994, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old August 28th, 2004, 04:01 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: subang jaya, selangor, Malaysia.
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 ?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old August 28th, 2004, 07:09 AM
Authorized User
Points: 196, Level: 3
Points: 196, Level: 3 Points: 196, Level: 3 Points: 196, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: , , Latvia.
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?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old August 28th, 2004, 01:25 PM
joefawcett's Avatar
Wrox Author
Points: 8,994, Level: 40
Points: 8,994, Level: 40 Points: 8,994, Level: 40 Points: 8,994, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old August 28th, 2004, 05:28 PM
Authorized User
Points: 196, Level: 3
Points: 196, Level: 3 Points: 196, Level: 3 Points: 196, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: , , Latvia.
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #8 (permalink)  
Old August 28th, 2004, 05:43 PM
joefawcett's Avatar
Wrox Author
Points: 8,994, Level: 40
Points: 8,994, Level: 40 Points: 8,994, Level: 40 Points: 8,994, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #9 (permalink)  
Old August 28th, 2004, 05:58 PM
Authorized User
Points: 196, Level: 3
Points: 196, Level: 3 Points: 196, Level: 3 Points: 196, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: , , Latvia.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #10 (permalink)  
Old August 29th, 2004, 04:49 AM
joefawcett's Avatar
Wrox Author
Points: 8,994, Level: 40
Points: 8,994, Level: 40 Points: 8,994, Level: 40 Points: 8,994, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find text within range of two tags dipsut XSLT 3 May 25th, 2007 05: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 03: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



All times are GMT -4. The time now is 07:20 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc