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 April 25th, 2006, 04:10 AM
Authorized User
 
Join Date: Oct 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to monuindia2002
Default Load CDATA Section into DataSet

Hi
Is it possible to read a CDATA section from an xml file and load just a CDATA section into a dataset.
Example of XML file

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <msgName>schema</msgName>
    </soapenv:Header>
    <soapenv:Body>
        <msgResponse>
         <origMsgName> getSchema </origMsgName>
        <msgStatus> PASS </msgStatus>
        <response>
        <msgText>
        <Script>
            <![CDATA[
            <?xml version="1.0" standalone="yes"?>
            <xs:schema id="NewDataSet" xmlns=""xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
            <xs:element name="NewDataSet" msdata:IsDataSet="true">
                <xs:complexType>
                  <xs:choice maxOccurs="unbounded">
                    <xs:element name="FORECAST_TYPE" msprop:BaseTable.0="FORECAST_TYPE">
                <xs:complexType>
                    <xs:sequence>
                    <xs:element name="FORECAST_TYPE_CODE" msprop:OraDbType="126" msprop:BaseColumn="FORECAST_TYPE_CODE" type="xs:string" minOccurs="0" />
                    <xs:element name="CODE_DESC" msprop:OraDbType="126" msprop:BaseColumn="CODE_DESC" type="xs:string" minOccurs="0" />
                      <xs:element name="ASSIGNMENT_ID" msprop:OraDbType="107" msprop:BaseColumn="ASSIGNMENT_ID" type="xs:decimal" minOccurs="0" />
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:choice>
            </xs:complexType>
          </xs:element>
        </xs:schema>
        ]]>

        </Script>
</msgText>
    <warnings>Warnings Text</warnings>
    </response>
        </msgResponse>
    </soapenv:Body>
</soapenv:Envelope>

i just want to load this CDATA section form this XML file into a datset.

Regards



Mahesh
__________________
Mahesh
 
Old April 25th, 2006, 05:14 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you're using XSLT, the fact that it's a CDATA section is irrelevant: CDATA is just an alternative way of escaping special characters. So

<a><![CDATA[<<<]]></a>

is just another way of writing

<a>&lt;&lt;&lt;</a>

But you can output the content of the <Script> element to a file using:

<xsl:stylesheet ...

<xsl:output method="text"/>
<xsl:template match="/">
  <xsl:value-of select="//Script"/>
</xsl:template>

</xsl:stylesheet>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Add a CDATA section; add nodeset to CDATA section kssudhish XSLT 3 January 3rd, 2008 07:13 AM
CDATA Section using XSLT misanaka XSLT 2 March 29th, 2007 06:53 PM
Problem with the CData Section while using Xslt Vered XSLT 2 September 21st, 2006 11:21 AM
XSD CDATA Section chrisjonmcdonald XML 4 July 12th, 2006 08:15 AM
CDATA section kai77 Beginning VB 6 0 October 31st, 2004 04:50 PM





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