Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DataSet cannot expand entities.

Posted on 2006-07-14
7
Medium Priority
?
872 Views
Last Modified: 2012-05-05
I have a XML file categories.xml like this

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="Products.xsd">
<Products>
<Description>500 ds yxHkx tM+h&cwfV;ksa o lk/kw lU;kfl;ksa dh vkSkf/k;kWa vkSj pqVdqyksa ls cus lSdM+ksa jksfx;ksa ij vktek;s uqL[ksA</Description>
</Products>
</dataroot>

I want to read this in a Dataset. I am using this code
dstCategories.ReadXml (HttpContext.Current.Request.MapPath("Categories.xml"))

The dataset cannot correctly read this XML file since I beleive due to characters + & ; etc in the node <Description> I cannot remove these characters. How can I possibly read these characters in data SET
The error returned is :

DataSet cannot expand entities. Use XmlValidatingReader and set the EntityHandling property accordingly.
0
Comment
Question by:skvikram
  • 4
  • 3
7 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17110252
Hi skvikram,

your XML is not valid
you either need to replace the & by &amp;
or add a doctype to expand the entity &cwfV;

If you need the second option, I can show you hox,
but I think you need the first option

since & starts an entity, you need a special entity to indicate &, which is &amp;

Cheers!
0
 
LVL 7

Author Comment

by:skvikram
ID: 17113683
I know I cannot include & in XML-nodes.
But I still need to have it which I already clarified in my original question.
I mean I cannot change the contents of nodes.

Is there any way I can disable XML Validation
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17114176
> Is there any way I can disable XML Validation

not if you send this document to an XML processor such as an XSLT engine.
XML tools require XML
what you have there is strictly speaking not an XML document (it is not wellformed)
it is only something that looks like one.

The one who gave you this XML did a bad job.
You can recover from this with a pre-process
you can use some regular expressions (in Python, Perl, or Java...) to replace the & with &amp;
and then send it to the XSLT

cheers

Geert
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Author Comment

by:skvikram
ID: 17120037
Dear Gertone,
The node contents of this XML file is some encrypted message so it has to remain this way else the entire purpose of encryption will be defeated.

What I need is any mechanism by which this XML file can be successfully transferred to DATASET.
0
 
LVL 7

Author Comment

by:skvikram
ID: 17160615
There are no acceptable solution to my original problem?
what's is happening experts??

Can I safely assume that I'll not be getting any further solution and assume this question as abandoned?
Page editor please look into the matter.
Thanks.
0
 
LVL 7

Author Comment

by:skvikram
ID: 17176274
Can I delete this questions as I am not getting any responses.
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 17211847
Hi, I was on holidays for some time.
As I stated before... the XML is not wellformed
If you want to include an encryption mechanism in your XML
you have to make sure the encryption mechanism doesn't contain an "&" or an "<"
so you are using an encryption mechanism that is unsafe for XML

the only other option you have is to wrap the encrypted string in a CDATA section,
like this

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="Products.xsd">
    <Products>
        <Description><![CDATA[500 ds yxHkx tM+h&cwfV;ksa o lk/kw lU;kfl;ksa dh vkSkf/k;kWa vkSj pqVdqyksa ls cus lSdM+ksa jksfx;ksa ij vktek;s uqL[ksA]]></Description>
    </Products>
</dataroot>

hope this helps

cheers

Geert
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month9 days, 18 hours left to enroll

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question