Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > How to add schema information into xmldocument from typed dataset

Reply
Thread Tools

How to add schema information into xmldocument from typed dataset

 
 
Whoever
Guest
Posts: n/a
 
      11-16-2004
Hi,

I'm trying to return an XmlDocument or XmlNode converted from a typed
dataset.

public XmlNode whatever() {
MyTypedDataSet ds = new MyTypedDataSet();
return new XmlDataDocument(ds);
}

In WSDL, it shows returned type as xml; in the result, it shows the xml
data.

How do I put schema information in both places?

Thanks.


 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      11-16-2004
You don't have to have all the XML in one XML document.

You can first load up the DataSet with the schema:
dataset.ReadXMLSchema(xmlSchemaNode)
and then read in the data from a different node:
dataset.ReadXML(xmlDataNode)

Be sure to read the schema in first though.


"Whoever" <(E-Mail Removed)> wrote in message
news:ewwRLZ$(E-Mail Removed)...
> Hi,
>
> I'm trying to return an XmlDocument or XmlNode converted from a typed
> dataset.
>
> public XmlNode whatever() {
> MyTypedDataSet ds = new MyTypedDataSet();
> return new XmlDataDocument(ds);
> }
>
> In WSDL, it shows returned type as xml; in the result, it shows the xml
> data.
>
> How do I put schema information in both places?
>
> Thanks.
>
>



 
Reply With Quote
 
 
 
 
Whoever
Guest
Posts: n/a
 
      11-16-2004
Thanks for the reply. I'm not try to read, but to write. I already have
data in the dataset and trying to return it from a web service as
xmldocument of course.

Just saw there's a ds.WriteXml(????, XmlWriteMode.WriteSchema)

But all examples I can find are trying to write to a file. I need to write
into an XmlNode/XmlDocument/XmlDataDocument and return it.

Of course, it's better to have the schema information in WSDL as well.

Any ideas?


"Scott M." <(E-Mail Removed)> wrote in message
news:e7r383$(E-Mail Removed)...
> You don't have to have all the XML in one XML document.
>
> You can first load up the DataSet with the schema:
> dataset.ReadXMLSchema(xmlSchemaNode)
> and then read in the data from a different node:
> dataset.ReadXML(xmlDataNode)
>
> Be sure to read the schema in first though.
>
>
> "Whoever" <(E-Mail Removed)> wrote in message
> news:ewwRLZ$(E-Mail Removed)...
> > Hi,
> >
> > I'm trying to return an XmlDocument or XmlNode converted from a typed
> > dataset.
> >
> > public XmlNode whatever() {
> > MyTypedDataSet ds = new MyTypedDataSet();
> > return new XmlDataDocument(ds);
> > }
> >
> > In WSDL, it shows returned type as xml; in the result, it shows the xml
> > data.
> >
> > How do I put schema information in both places?
> >
> > Thanks.
> >
> >

>
>



 
Reply With Quote
 
Dino Chiesa [Microsoft]
Guest
Posts: n/a
 
      11-16-2004
The WriteXml method on the DataSet allows you to write to a string or to a
stream.
http://msdn.microsoft.com/library/en...teXmlTopic.asp

You do not need to write to a file.

You can also call GetXmlSchema method on the dataset, and put that into a
string.
http://msdn.microsoft.com/library/en...chematopic.asp

Consider using 2 methods - one that returns the schema and one that returns
the data. Either that or put them into different XmlDocuments.



-Dino



"Whoever" <(E-Mail Removed)> wrote in message
news:%23G4EG8$(E-Mail Removed)...
> Thanks for the reply. I'm not try to read, but to write. I already have
> data in the dataset and trying to return it from a web service as
> xmldocument of course.
>
> Just saw there's a ds.WriteXml(????, XmlWriteMode.WriteSchema)
>
> But all examples I can find are trying to write to a file. I need to
> write
> into an XmlNode/XmlDocument/XmlDataDocument and return it.
>
> Of course, it's better to have the schema information in WSDL as well.
>
> Any ideas?
>
>
> "Scott M." <(E-Mail Removed)> wrote in message
> news:e7r383$(E-Mail Removed)...
>> You don't have to have all the XML in one XML document.
>>
>> You can first load up the DataSet with the schema:
>> dataset.ReadXMLSchema(xmlSchemaNode)
>> and then read in the data from a different node:
>> dataset.ReadXML(xmlDataNode)
>>
>> Be sure to read the schema in first though.
>>
>>
>> "Whoever" <(E-Mail Removed)> wrote in message
>> news:ewwRLZ$(E-Mail Removed)...
>> > Hi,
>> >
>> > I'm trying to return an XmlDocument or XmlNode converted from a typed
>> > dataset.
>> >
>> > public XmlNode whatever() {
>> > MyTypedDataSet ds = new MyTypedDataSet();
>> > return new XmlDataDocument(ds);
>> > }
>> >
>> > In WSDL, it shows returned type as xml; in the result, it shows the xml
>> > data.
>> >
>> > How do I put schema information in both places?
>> >
>> > Thanks.
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      11-16-2004
I would use the GetXML and GetXMLSchema methods that return their respective
data as strings.

"Dino Chiesa [Microsoft]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The WriteXml method on the DataSet allows you to write to a string or to
> a stream.
> http://msdn.microsoft.com/library/en...teXmlTopic.asp
>
> You do not need to write to a file.
>
> You can also call GetXmlSchema method on the dataset, and put that into a
> string.
> http://msdn.microsoft.com/library/en...chematopic.asp
>
> Consider using 2 methods - one that returns the schema and one that
> returns the data. Either that or put them into different XmlDocuments.
>
>
>
> -Dino
>
>
>
> "Whoever" <(E-Mail Removed)> wrote in message
> news:%23G4EG8$(E-Mail Removed)...
>> Thanks for the reply. I'm not try to read, but to write. I already have
>> data in the dataset and trying to return it from a web service as
>> xmldocument of course.
>>
>> Just saw there's a ds.WriteXml(????, XmlWriteMode.WriteSchema)
>>
>> But all examples I can find are trying to write to a file. I need to
>> write
>> into an XmlNode/XmlDocument/XmlDataDocument and return it.
>>
>> Of course, it's better to have the schema information in WSDL as well.
>>
>> Any ideas?
>>
>>
>> "Scott M." <(E-Mail Removed)> wrote in message
>> news:e7r383$(E-Mail Removed)...
>>> You don't have to have all the XML in one XML document.
>>>
>>> You can first load up the DataSet with the schema:
>>> dataset.ReadXMLSchema(xmlSchemaNode)
>>> and then read in the data from a different node:
>>> dataset.ReadXML(xmlDataNode)
>>>
>>> Be sure to read the schema in first though.
>>>
>>>
>>> "Whoever" <(E-Mail Removed)> wrote in message
>>> news:ewwRLZ$(E-Mail Removed)...
>>> > Hi,
>>> >
>>> > I'm trying to return an XmlDocument or XmlNode converted from a typed
>>> > dataset.
>>> >
>>> > public XmlNode whatever() {
>>> > MyTypedDataSet ds = new MyTypedDataSet();
>>> > return new XmlDataDocument(ds);
>>> > }
>>> >
>>> > In WSDL, it shows returned type as xml; in the result, it shows the
>>> > xml
>>> > data.
>>> >
>>> > How do I put schema information in both places?
>>> >
>>> > Thanks.
>>> >
>>> >
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Whoever
Guest
Posts: n/a
 
      11-17-2004
Thanks again for your follow up.

When returning a string, how can I add the schema information to WSDL so
that the service client have access to the data structure at design time?


"Scott M." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I would use the GetXML and GetXMLSchema methods that return their

respective
> data as strings.
>
> "Dino Chiesa [Microsoft]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > The WriteXml method on the DataSet allows you to write to a string or

to
> > a stream.
> >

http://msdn.microsoft.com/library/en...teXmlTopic.asp
> >
> > You do not need to write to a file.
> >
> > You can also call GetXmlSchema method on the dataset, and put that into

a
> > string.
> >

http://msdn.microsoft.com/library/en...chematopic.asp
> >
> > Consider using 2 methods - one that returns the schema and one that
> > returns the data. Either that or put them into different XmlDocuments.
> >
> >
> >
> > -Dino
> >
> >
> >
> > "Whoever" <(E-Mail Removed)> wrote in message
> > news:%23G4EG8$(E-Mail Removed)...
> >> Thanks for the reply. I'm not try to read, but to write. I already

have
> >> data in the dataset and trying to return it from a web service as
> >> xmldocument of course.
> >>
> >> Just saw there's a ds.WriteXml(????, XmlWriteMode.WriteSchema)
> >>
> >> But all examples I can find are trying to write to a file. I need to
> >> write
> >> into an XmlNode/XmlDocument/XmlDataDocument and return it.
> >>
> >> Of course, it's better to have the schema information in WSDL as well.
> >>
> >> Any ideas?
> >>
> >>
> >> "Scott M." <(E-Mail Removed)> wrote in message
> >> news:e7r383$(E-Mail Removed)...
> >>> You don't have to have all the XML in one XML document.
> >>>
> >>> You can first load up the DataSet with the schema:
> >>> dataset.ReadXMLSchema(xmlSchemaNode)
> >>> and then read in the data from a different node:
> >>> dataset.ReadXML(xmlDataNode)
> >>>
> >>> Be sure to read the schema in first though.
> >>>
> >>>
> >>> "Whoever" <(E-Mail Removed)> wrote in message
> >>> news:ewwRLZ$(E-Mail Removed)...
> >>> > Hi,
> >>> >
> >>> > I'm trying to return an XmlDocument or XmlNode converted from a

typed
> >>> > dataset.
> >>> >
> >>> > public XmlNode whatever() {
> >>> > MyTypedDataSet ds = new MyTypedDataSet();
> >>> > return new XmlDataDocument(ds);
> >>> > }
> >>> >
> >>> > In WSDL, it shows returned type as xml; in the result, it shows the
> >>> > xml
> >>> > data.
> >>> >
> >>> > How do I put schema information in both places?
> >>> >
> >>> > Thanks.
> >>> >
> >>> >
> >>>
> >>>
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
Whoever
Guest
Posts: n/a
 
      11-18-2004
Just picked up a message I posted a few days ago where Dan Rogers points
out some confusion I had all these time.

Basically DataSet has type any in WSDL and schema as part of the return data
at run time. The truth is schema information should be in WSDL to
facilitate design time reference. I have already done that through custom
collection, but still kind of stucked with the idea of making schema part of
the return data, which is mostly uneccessary (Excel web query still
complains it has no schema, but I think I'll pass that one).

So seems fine tuning the custom collection with XmlAttribute is a more
practical approach.

Thanks for everyone's help. Really appreicate it.

BTW, if anyone has a good example of using typed dataset and still be able
to have a perfect WSDL, I wouldn't mind rewrite all my codes. Somehow Typed
DataSet always sounds better.



"Whoever" <(E-Mail Removed)> wrote in message
news:ewwRLZ$(E-Mail Removed)...
> Hi,
>
> I'm trying to return an XmlDocument or XmlNode converted from a typed
> dataset.
>
> public XmlNode whatever() {
> MyTypedDataSet ds = new MyTypedDataSet();
> return new XmlDataDocument(ds);
> }
>
> In WSDL, it shows returned type as xml; in the result, it shows the xml
> data.
>
> How do I put schema information in both places?
>
> Thanks.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 2 10-31-2003 01:05 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 1 10-31-2003 02:39 AM
loading xmlcontent from one xmldocument into another xmldocument Shoval Tomer ASP .Net 0 07-09-2003 04:29 PM



Advertisments