Re: XML -best method to read/write in NETcf??

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



ds.WriteXml("test.xml") won't write schema, so attempt to read it via
dsXML.ReadXmlSchema(XMLreader) would sure fail.

Use DataSet.WriteXml() overload which takes XmlWriteMode and specify
XmlWriteMode.WriteSchema to ensure schema has been included.

To read it back simply use ds.ReadXml("fileName"), it would recognize and
load schema automatically.



Also, keep in mind there are no relative paths on CF and you have to specify
the exact location for a saved file.


Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"mikeb" <mike@xxxxxxxxxxxxxxxxxx> wrote in message
news:eNdJyjgcFHA.3492@xxxxxxxxxxxxxxxxxxxxxxx
> I'm trying to use XML to send data to / from a scanner (ppc). Our current
> vb netcf app connects directly with the sqlserver - however some scanners
> have no network access and the SQLserver is in another location - the host
> application developers are asking us to give the scanners options to
> import/export data via xml files - the xml files will be sent via archaic
> means. They are letting us spec the xml files.
>
> For XML being THE thing, it sure is proving to be a pain getting this all
> working. Basically, I our netcf app is working under this scenario:
>
> To receive data from sql server into ppc
> (SQLserver data)->SQLStoredProcedure -->PPCdataset->SQLceDB
>
> To send updated data from ppc into sql server
> SQLceDB--> SQLStoredProcedure->(SQLserver data)
>
>
> Similarly I need to remove the stored procedure call and replace it with
> XML import/exports.
>
> Receive data from xml into ppc
> XMLfile -->PPCdataset->SQLceDB
>
> Send updated data from ppc into xml
> SQLceDB--> XMLfile
>
>
> I have been able to do a test by reading the sql server data into a
> dataset via the stored procedure (using a data adapter) - and then writing
> that out to XML [ ds.WriteXml("test.xml") ]
>
> Ok, that gave me a test XML file to play with - but I can't even read that
> XML file in to a dataset now. Trying to use:
> Dim XMLreader as New XmlTextReader(New StreamReader("test.xml")
> dsXML.ReadXmlSchema(XMLreader)
> dsXML.ReadXml(XMLreader)
>
> Are there any sample programs out there that contain a sample XML file
> that gets read into a dataset, and then maybe even exports an xml file
> containing modified data?
>
> I'm trying to do my homework - but dang. It just seems that if XML is
> the thing these days, it would be easier than this. Flat ascii files are
> sure easier and even make more sense to the naked eye. ??
>
> Thanks for any guidance.
>


.



Relevant Pages

  • Re: Decimal Type in a XSD Schema and problems with DataAdapter
    ... for the element in the schema) if you want the empty elements to valdiate ... against the schema. ... the type of guarantyPercent is decimal. ... > In the XML file the guarantyPercent can be empty: ...
    (microsoft.public.dotnet.xml)
  • Re: InvalidOperationException: ReadElementContentAsString method is not supported on node type None
    ... I want to import a user uploaded XML file into a database. ... XmlReaderSettings readerSettings = new XmlReaderSettings; ... now I have an XmlReader object with a schema so I check for validation. ...
    (microsoft.public.dotnet.xml)
  • Re: How to cast in an xml based dataset SELECT method?
    ... How do I force the strong-typed dataset using an existing schema? ... here is the top portion of the XML file I am bringing into the ... When you read an XML file in this manner, how do you cast the columns ... to another type for a SELECT filter expression? ...
    (microsoft.public.dotnet.general)
  • Re: cant create schema for qualified attributes in element with default namespace
    ... in your XML file you are using namespace prefix e3 without defining ... > I'm trying to regnerate the xsd I already have because I changed the xml> file on which the schema was based. ... > where the attributes are in a different name space to the element (NB> element prefix is now e3), but on creating the schema for this doc, I am> simply told e3 is an undeclared namespace. ...
    (microsoft.public.dotnet.xml)
  • Re: Converting a Schema message to a string message and vice-versa
    ... it will create a schema for you. ... Now, to put a string in to the tag, use an expression shape with code like ... > In Biztalk 2004 I simply want to have a receive location folder to ... > drop an xml file into, and Biztalk pass this xml to the web method ...
    (microsoft.public.biztalk.general)