Dataset.GetXml incorrectly renders XMLNS tag, breaks XSLT

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a very simple dataset, just 4 fields in one table. I am using the
GetXml method of the dataset to render the XML into an XmlStream, and then
XmlCompiledTransform to implement an XSLT, then save it to an HTML file.

The Dataset.GetXml method oncorrectly renders the xmlns for my dataset,
though. Since it is a strongly typed dataset, the XSD is added to the root
node, as such:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='ProblemStoreReport.xsl'?>
<ProblemStores xmlns="http://tempuri.org/ProblemStores.xsd">
<ProblemStore>
<SiteNumber>00260</SiteNumber>
<SiteName>00260 - 632 3RD AVE.</SiteName>
<Variance>Daily Sales Number is Missing</Variance>
<Problem>This store has a communications problem</Problem>
</ProblemStore>
<ProblemStore>
<SiteNumber>01209</SiteNumber>
<SiteName>01209 - COUNTY LINe QUEBEC</SiteName>
<Variance>No data at all</Variance>
<Problem>This store has a communications problem</Problem>
</ProblemStore>
<ProblemStore>
<SiteNumber>01598</SiteNumber>
<SiteName>01598 - W. BANK EXPRESSWAY</SiteName>
<Variance>No data at all</Variance>
<Problem>This store has a communications problem</Problem>
</ProblemStore>
</ProblemStores>

The third line should be:

<ProblemStores xmlns:xsd="http://tempuri.org/ProblemStores.xsd">

Why do I care? If you transform it with the first version - the incorrectly
rendered version - the XSD won't find the first node. If you transform it
with the :xsd added, it renders fine.

Is there a workaround?

Thanks.

S
 
Close but no cigar. The XmlNameSpaceManager thinks that the namespace is
"http://www.w3.org/2000/xmlns/" - I think it doesn't handle exactly what I
want to do. I think it wants to take attributesout of the XML node at the
top, and I need the DTD attribute taken out of the main table.
 
Back
Top