Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT 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 3rd, 2006, 10:36 AM
Authorized User
Join Date: Aug 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Extract the XML file from CDATA


Can someone tell me how to navigate and extract the XML data in CDATA section? The task that I am trying to achieve here is that I need to be able to navigate the element and extract the necessary elements in the CDATA section and convert them to another XML file. I tried to take out the file in CDATA, but it's all text based that I could not be able to navigate through it. Can someone give me some suggestions?

Thanks in advance!


Old August 3rd, 2006, 11:02 AM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

There is no XML data in a CDATA section. CDATA means "character data" - it's only purpose is to tell the parser that anything inside it, even if it looks like XML, isn't actually XML but plain text.

If someone makes the design mistake of putting XML in a CDATA section (and it's often done), then the only thing you can do is extract the character data and supply it as input to an XML parser, which will interpret it as XML.

In Saxon the saxon:parse() extension function can be used to do this.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Old August 3rd, 2006, 02:01 PM
Authorized User
Join Date: Aug 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for the suggesiton. Will give it try.

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server 2005 XML: FOR XML PATH -> cdata? stoves SQL Server 2005 1 July 8th, 2008 02:40 AM
how to extract THIS node from XML in ASP?? zoreli XML 1 July 21st, 2006 09:51 AM
extract xml using asp daddycool2k Classic ASP XML 0 November 17th, 2003 12:13 PM
CDATA Set with For XML Explicit Yehuda SQL Server 2000 0 August 13th, 2003 01:50 PM
CDATA in XML - convert to HTML suri XSLT 1 July 31st, 2003 08:22 AM

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