?
Solved

DataSet cannot expand entities.

Posted on 2006-07-14
7
Medium Priority
?
866 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

800 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