Converting XML > Dataset

Hi !

Here's my problem in english :-)

I want to convert the mssecure.xml file from Microsoft into an dataset to 
store it in an SQL-Database.
My code in VB looks like this :

Dim ds As New DataSet
Dim doc As New Xml.XmlDocument
doc.Load("D:\mssecure.xml")
Dim sReader As New StringReader(doc.InnerXml)
ds.ReadXml(sReader)

The problem is : At the ds.readxml(sreader) command i get an error which 
told me, that there is an problem whith a relationship in "ProductFamilies"

I hope my english is good enough to explain...

Please help !

Thanks !!!

Christoph Duesmann 



0
10/28/2004 9:19:47 AM
dotnet.xml 7266 articles. 0 followers. Follow

6 Replies
353 Views

Similar Articles

[PageSpeed] 25

Christoph Duesmann wrote:

> Dim ds As New DataSet
> Dim doc As New Xml.XmlDocument
> doc.Load("D:\mssecure.xml")
> Dim sReader As New StringReader(doc.InnerXml)
> ds.ReadXml(sReader)

That's weird. You load XML into XmlDocument, then serialize back to 
string and read that string to DataSet? Why not just

ds.ReadXml("D:\mssecure.xml")

-- 
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
0
Oleg
10/28/2004 12:37:55 PM
Hi Oleg !

> That's weird. You load XML into XmlDocument, then serialize back to string 
> and read that string to DataSet? Why not just
>
> ds.ReadXml("D:\mssecure.xml")

I tried it but i get the same Error-Message during debugging.
Try it yourself, to bind the mssecure.xml into an Dataset

Thank for your next answer :-)

christoph 



0
10/28/2004 1:10:40 PM
Christoph Duesmann wrote:

>>That's weird. You load XML into XmlDocument, then serialize back to string 
>>and read that string to DataSet? Why not just
>>
>>ds.ReadXml("D:\mssecure.xml")
> 
> 
> I tried it but i get the same Error-Message during debugging.
> Try it yourself, to bind the mssecure.xml into an Dataset

Oh, you mean the mssecure.xml? :)

I believe you can't load it to DataSet. Its schema is a recursive one 
and DataSet can only handle relational schemas. But I may be wrong.

-- 
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
0
Oleg
10/28/2004 1:37:53 PM
Hi Oleg !


> I believe you can't load it to DataSet. Its schema is a recursive one and 
> DataSet can only handle relational schemas. But I may be wrong.

If a dataset doesn't work : What would you do store the xml-Data (like 
Patchname, downloadlocation etc) in an Database ?

Thanks !

Christoph



0
10/28/2004 1:46:33 PM
Idea : If i remove the ProductFamilies Section from the xml document then 
databinding functions correct !!!
Now tell me how to remove this section programmaticly...

This is the section :

<ProductFamilies>
  <ProductFamily ProductFamilyID="1" Name="Windows NT" 
RecentProductVersionID=""/>
  <ProductFamily ProductFamilyID="2" Name="Windows 2000" 
RecentProductVersionID=""/>
  <ProductFamily ProductFamilyID="3" Name="Windows 9x" 
RecentProductVersionID=""/>
  <ProductFamily ProductFamilyID="4" Name="Windows XP" 
RecentProductVersionID=""/>
  ...
  ...
  ...
</ProductFamilies>

thanks

Christoph 



0
10/28/2004 1:57:51 PM
"Christoph Duesmann" <c.duesmann@web.de> wrote in message 
news:uhJ%23cYPvEHA.3948@TK2MSFTNGP15.phx.gbl...
> Idea : If i remove the ProductFamilies Section from the xml document then 
> databinding functions correct !!!
> Now tell me how to remove this section programmaticly...
>
> This is the section :
>
> <ProductFamilies>
>  ...
> </ProductFamilies>

One way you can remove the <ProductFamilies> element programmatically is to 
use an XSLT transform like this:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- the identity transform -->
<xsl:template match="node()|@*">
  <xsl:copy>
    <xsl:apply-templates select="node()|@*/>
  </xsl:copy>
</xsl:template>

<!-- discard the ProductFamilies element and its children -->
<xsl:template match="ProductFamilies"/>

</xsl:transform>

Alternately, you could load the XML into an XmlDocument and remove the 
offending element, or

Cheers,
Stuart Celarier, Fern Creek 


0
Stuart
11/1/2004 8:12:47 AM
Reply:

Similar Artilces:

Default picklist values not appearing on convert from lead to acco
Hi, Converting a lead to an account. I have several picklist fields (on the account) which should bring up a default value. When I create a new account from scratch they all appear. When I convert a lead to an account none of the default values are there. There are no offending mappings or scripts that would explain this. Has anyone else seen this or can offer any guidance. Ta Pete. Default values are not set on enties which are converted or created trough the webservice. The only way to have a default value set for any path is to use the PreCreate Callout. -- Patrick Verbeeten (MC...

Sort Xml using XpathExpression Addsort() #2
hi, i have a xml file <root> <Type /> <Description /> <Category /> <employee > <id>3</id> </employee> <employee> <id>1</id> </employee> <employee> <id>5</id> </employee> </root> and i want output xml as <root> <Type /> <Description /> <Category /> <employee > <id>1</id> </employee> <employee> <id>3</id> </employee> <employee> <id>5</id> </employee> </root> that is i want updated xml to ret...

Write XML File to Web Server File Problems
Hello All, I am about to go mad because of the wonderful error messages that don't provide enough detail. Below is the code I am trying to use to take an updated dataset and write it back to a file on a web server.... ' Create WebClient Dim oClient As New WebClient oClient.Credentials = CredentialCache.DefaultCredentials 'Create Output Stream Dim oStream As Stream = oClient.OpenWrite(sFileUrl, "PUT") ' Create the StreamWriter Dim oXMLTextWriter = New System.Xml.XmlTextWriter(oStream, System.Text.Encodin...

[ANN] Mvp.Xml library v2.0 released
I'm glad to announce release 2.0 of the Mvp.Xml library. This is first Mvp.Xml release for .NET 2.0. Download it at http://www.mvpxml.org Mvp.Xml project is developed by Microsoft MVPs in XML technologies and XML Web Services worldwide. It is aimed at supplementing .NET framework XML processing functionality available through the System.Xml namespace and related namespaces such as System.Web.Services. Mvp.Xml project currently provides .NET implementations of EXSLT, XML Base, XInclude, XPointer as well as a unique set of utility classes such as XmlSerializerCache, IndexingXPathNavi...

Categories deleted converting from Quicken
Hi folks, I just converted from Q2003 Premier to the Money 2005 Trial 2 days ago. I noticed today that a number of categories have been removed from the transactions in my checking account and credit card accounts. What I've noticed so far: 1. All sub-accounts for Utilities were gone. This wasn't too bad because I could use find replace since the payee name has been the same on these for all years I have in Quicken/Money. 2. All sub-accounts under Insurance were gone. 3. The category Groceries came over, but there were no transactions in it. Quicken had several hundred...

Convert Double Space To Single Space
How do you convert double spaced text to single spaced? I don't see an option for this in Outlook. I can paste into Notepad, copy and then paste into Outlook, but I would prefer a way to do it within Outlook. ...

Converting Money 2000 Canadian to Money 2006 Canadian
Hi, Can anyone confirm that such a conversion is possible? I was hoping to convert to Money 2007 but was unsuccessful. I'll live with Money 2006 Canadian but I want to ensure the conversion is possible first. I don't want to drop the money on it to find out it doesn't work. Thanks in advance, In microsoft.public.money, smurfgun wrote: > >Can anyone confirm that such a conversion is possible? I was hoping to >convert to Money 2007 but was unsuccessful. I'll live with Money 2006 >Canadian but I want to ensure the conversion is possible first. I don'...

Windows Update Office 2007 Converter confusion
On my desktop I have Office 2003 (laptop has Office 2007). I recently received an attachment in .docx format (2007). I downloaded the converter to my desktop and opened the document. Now on my desktop (which has Office 2003) I receive update notices for Office 2007. Should I ignore these? Hide them? Install them? Will I still be notified re updates needed for Office 2003? Thank you for whatever insight you can provide. If you can give me some of the background explanation as to why this is happening (I presume related to the 2007 converter viewer install), I can understand bett...

Converting number to text
Is it possible to convert, say 1234 to one thousand two hundred and thirty four Thanks There is no direct functions to convert this. For a VBA solution check out the below links http://www.ozgrid.com/VBA/ValueToWords.htm http://support.microsoft.com/kb/213360 http://www.xldynamic.com/source/xld.xlFAQ0004.html -- Jacob (MVP - Excel) "booshi" wrote: > Is it possible to convert, say 1234 to one thousand two hundred and thirty > four > > > Thanks > > > . > ...

grayscale autoshape changes to color when converting to PDF
When converting from Microsoft Publisher 2007 to Adobe Acrobat 8.0 PDF, the autoshape picture that we changed to grayscale changes back to color when reviewing the created PDF. Are you setting Acrobat to print in black and white? Select the PDF printer, properties, paper/quality tab. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "CDJ" <CDJ@discussions.microsoft.com> wrote in message news:6BE9EE01-97DB-4AB6-BD9C-25E27E0BB68D@microsoft.com... > When converting from Microsoft Publisher 2007 to Adobe Acrobat 8.0 P...

Can I convert from Publisher to Powerpoint?
I am having trouble figuring out if it is possible to convert a flyer I made up in Publisher and insert it into my Powerpoint presentation. You can try to do a copy and paste. -- JoAnn Paules MVP Microsoft [Publisher] ~~~~~ How to ask a question http://support.microsoft.com/KB/555375 "Renee" <Renee@discussions.microsoft.com> wrote in message news:75C511B4-FDB4-4800-AD06-91CF9FBE9C7F@microsoft.com... >I am having trouble figuring out if it is possible to convert a flyer I >made > up in Publisher and insert it into my Powerpoint presentation. Thanks JoAnn, I...

Converting a MFC DLL to a regular DLL
Hi, I have an MFC DLL which i have now removed the single MFC window that popped up error messages. I want to now convert it to a regular DLL. What parts of the code to i need to remove / modify? And what compiler settings need changing? On Aug 4, 6:05=A0am, hamishd <Hamish.D...@gmail.com> wrote: > Hi, I have an MFC DLL which i have now removed the single MFC window > that popped up error messages. > > I want to now convert it to a regular DLL. What parts of the code to i > need to remove / modify? And what compiler settings need changing? I would create a dummy MFC reg...

Long Run Times Importing XML Files
When importing a large number of XML files (typically 10,000+) using a predefined schema, EXCEL 2007spends CPU-hours doing God-only-knows-what before it actually starts to read the XML files from disk. (This occurs on Intel-based systems running Q9650's at 3GHz.) Win/XP's Task Manager shows not a single I/O read nor write operation going on for the several hours after you click on OK in the XML file selection dialog. Once it actually starts importing the data (ref. "Importing" message in status bar) the operation proceeds very quickly to completion. Any ideas what it'...

Converting from Lotus 1, 2, 3 docs
I have a user who has a bunch of Lotus 1, 2, 3 spreadsheets that he is trying to convert to Excel. His version of Lotus is old (version 5), his version of Excel is 2000 sp2. The files convert but they are missing pages or headings or other unacceptable qualities. Anyone any advice? Michael If you open the files using Excel and save them to an .xls format in the current version you are losing data? A while back I needed to do this. I wrote an application in VB that loops through the files, opens them using Excel (add a reference in VB to MS Office 10) and then save them in the current ...

how to convert a CString variable to unsigned short array one?
Hi, In my unicode VC6 app, how to convert a CString variable to unsigned short array? ....... CString strRst; unsigned short strOleChars[100]; strOleChars = strRst; //??? Thank you. Is ConvertStringToBSTR() what you are looking for? AliR. "David" <David_Wang_Xian@hotmail.com> wrote in message news:e6gbA3avFHA.720@TK2MSFTNGP15.phx.gbl... > Hi, > In my unicode VC6 app, how to convert a CString variable to unsigned short > array? > ...... > CString strRst; > unsigned short strOleChars[100]; > strOleChars = strRst; //??? > > Thank you. > > ...

Export or convert .qrp files to HTML
Hi all, great forum - Does anyone know how to export or convert any given .qrp report into an HTML or other web format? Could it be possible to open a .qrp in it's native format? I've seen a company online (Sabletooth) that converts Report Builder (.qrp) files into Crystal, but I think they are only offering consulting services. Thanks in advance for your help. At the top of the report it gives you several options(print, save, etc.) the fourth or fifth from the left(not quite sure which one by memory)is the one to export. It gives you several options. One of which is to expo...

Convert User to Contact
I have a AD user with a mailbox who has left the company to be a contract employee. Is there a way to convert the USER to a CONTACT? I want him in the GAL, but I do not want him to have an Exchange mailbox. In news:C6F8686A-3530-446E-94A7-1550F3EA7312@microsoft.com, DB <DB@discussions.microsoft.com> typed: > I have a AD user with a mailbox who has left the company to be a > contract employee. Is there a way to convert the USER to a CONTACT? I > want him in the GAL, but I do not want him to have an Exchange > mailbox. Mailbox-disable him, and then mail-enable him and ass...

Text to time convert
How can I convert text to time format in cell. i.e text in cell A1 is 163233 - 16 is hour, 32 is min and 33 is sec. I need convert this text to time format: 16:32:33 Thanks for help, Rudo On Sun, 13 Nov 2005 10:54:01 -0800, "Rudo" <Rudo@discussions.microsoft.com> wrote: >How can I convert text to time format in cell. > >i.e text in cell A1 is 163233 - 16 is hour, 32 is min and 33 is sec. >I need convert this text to time format: 16:32:33 > >Thanks for help, Rudo =--TEXT(A1,"00\:00\:00") Format the cell as [hh]:mm:ss (or similar) --ron If y...

Problem converting Quicken to Money 2008
I am trying out the new Money since I'm having so much trouble downloading quotes from Quicken. When I convert, it MOSTLY goes ok, but for some reason, certain transfers dating after Oct. of 2005 do not get converted as transfers. They are generally withdrawals from my checking account that get transfered to the Cash account. Cash transfers that are part of a split show up fine as transfers, but transfers that are not part of a split have nothing in the category section, and Money treats them as expenses. There are also a lot of transfers from checking to pay my credit card that...

How to prevent line breaks in XML file?
I am creating XML from SQL2000 using a vb.net page, then posting it to a remote server as a string. The remote server requires that the xml contain no line breaks, but there are some ntext fields in the database that contain long text with line breaks. How do I get rid of the line breaks? Can I do this with the XmlTextWriter, or do I need to handle each affected field seperately before handing it to the XmlTextWriter? Thanks Leslie les wrote: > How do I get rid of the line breaks? Can I do this with the > XmlTextWriter, or do I need to handle each affected field seperately > bef...

creating a certain chart from a certain dataset
Hi. I have some data about failures. the log file is like this (but really much longer): app1 03/04/2006 08:51 app2 03/04/2006 09:42 app1 03/04/2006 18:33 app3 03/05/2006 00:14 app1 03/05/2006 00:21 app2 03/05/2006 01:52 app1 03/06/2006 02:51 app3 03/06/2006 08:54 I would like to create some charts but don't know how. ex: app 3/4 3/5 3/6 app1 x x x app2 x app3 x ========================================= Where there is a dot or something to indicate the occurrence, and app1 is one row, app2 another row etc. can someone point me in...

Transform fixed length text to xml
can i transform fixed length text to xml using XSL do i have to first load the text to xml and do the transformation? is there any other way to do it? ...

How convert Numeric number in words
Is there any easy formula or way to convert numeric values in words? For example in cell A1 there is an amount 19549. How could it will be automaticaly converted by a formula in cell B1 as Ninteen thousand five hundred and forty-nine. Please give me an easy answer because i am not a programmer but just an excel user. Imran Murtaza There is no direct function to convert this. For a VBA solution check out the below links http://www.ozgrid.com/VBA/ValueToWords.htm http://support.microsoft.com/kb/213360 http://www.xldynamic.com/source/xld.xlFAQ0004.html -- Jacob "...

Book/doc on converting XP program to work nicely on Vista?
Any good books or documentation, things I should know about what worked fine on XP that won't work on Vista, what needs to be modified in the program to get it to work nicely on Vista, umm, stuff like that? What's a better way than Journal Hooks for a program to record it's own keystrokes? Journal hooks was always problematic if other programs were running that didn't process their messages correctly, and now on Vista I hear journal hooks have been disabled. try Microsoft Application Verifier. "David Deley" <deleyd@gte.net> wrote in message news:vTqVi.1...

Converting Access 97 to Access 2003 10-14-05
This is my first conversion. Can anyone offer tips on the easiest and safest way to convert a multi user database which was developed in Access 97 to Access 2003? You can try opening A2003, and before opening any database, choose: Tools | Database Utilities | Convert Database. If you run into problems, see: Converting from Access 97 to 2000, 2002 or 2003 at: http://allenbrowne.com/ser-48.html -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Jane...