Newbie... Parse String into A XML Schema/dataset

Newbie... Parse String into A XML Schema/dataset

Post by Ric Pulle » Wed, 30 Apr 2003 20:06:13



Hi , I have no idea if this is possible or how to achieve it.

I have a large string that contains repeating data and is formated so:

0*SUCCESS*M00*PULLEN*RICK*PAUL*02121961* **M*M*6000731116^0* D003260*29
LEOPOLD
AVENUE*CHELMSFORD*ESSEX**M13*********1*8*02121961********************TETNUS*
*M14******

I have data sets in here M00 & M13 & M14 that contain specific data
Some of these groups contain a numeric number of how many repeating items
exist in the group, but for example the output is defined as having max 5
reapeating then the output would look like

Eg *3*test1*name*value*test2*name2*value2*test3*name3*value3*******

I am building an XML file which i will convert into a  schema to incorporate
this...  HOW do i get the data into this xml format within my application.
IE I can get to each value how do i then create the XML document so i could
view the data in Internet explorer (as its going to be a web service in the
end!)

 
 
 

Newbie... Parse String into A XML Schema/dataset

Post by Dino Chiesa [MSFT » Thu, 01 May 2003 11:09:27


I feel like every time someone asks a question, my answer is "XML
Serialization", but here I go again.

The way I would do this is to tokenize the string and generate a collection
of objects, then serialize the objects to xml.

XML serialization in .NET is so darn slick, if you have not seen it you will
grin ear to ear, especially if you are used to coding to the DOM.
Basically once you have a collection of objects (array, arraylist, etc), you
can serialize it to an XML file with about 4 lines of code.  So you really
don't need to worry about xml at all.  The big issue is tokenizing the
string, and I presume you have that issue nailed with regex and whatnot.

-Dino


Quote:> Hi , I have no idea if this is possible or how to achieve it.

> I have a large string that contains repeating data and is formated so:

> 0*SUCCESS*M00*PULLEN*RICK*PAUL*02121961* **M*M*6000731116^0* D003260*29
> LEOPOLD

AVENUE*CHELMSFORD*ESSEX**M13*********1*8*02121961********************TETNUS*
Quote:> *M14******

> I have data sets in here M00 & M13 & M14 that contain specific data
> Some of these groups contain a numeric number of how many repeating items
> exist in the group, but for example the output is defined as having max 5
> reapeating then the output would look like

> Eg *3*test1*name*value*test2*name2*value2*test3*name3*value3*******

> I am building an XML file which i will convert into a  schema to
incorporate
> this...  HOW do i get the data into this xml format within my application.
> IE I can get to each value how do i then create the XML document so i
could
> view the data in Internet explorer (as its going to be a web service in
the
> end!)


 
 
 

Newbie... Parse String into A XML Schema/dataset

Post by Pure Krom » Thu, 08 May 2003 20:48:01


Dino, could you be so kind to either
1) Explain what XML Serialization is (with examples)
2) Provide some links to explain Xml Serialization.

thank you kindly...

justina *-a_t-* stargatetech *d_o_t* com *d_o_t* au

Quote:>-----Original Message-----
>I feel like every time someone asks a question, my
answer is "XML
>Serialization", but here I go again.

< snip >
 
 
 

1. Xml Schema and Datasets -- Defining Schema Possible?

I have a dataset that looks like:

<NewDataSet>
    <Table>
        <plan_id>6</plan_id>
        <plan_name>Full Plan</plan_name>
        <fee>0</fee>
        <quote>82.95</quote>
    </Table>
    <Table>
        <plan_id>7</plan_id>
        <plan_name>Full Travel Plan with Trip Cancellation</plan_name>
        <fee>4</fee>
        <quote>122</quote>
    </Table>
</NewDataSet>

How would I simply transform the dataset into an XmlDocument looking like:

<plans>
    <plan>
        <plan_id>..etc
     </plan>
    <plan>
        ....etc
    </plan>
</plans>

Do i need to use a xlst? Can I do it with a couple simple commands using C#?

I know that I can transform the DataSet into an XmlDocument using

XmlDataDocument MatchingPlansXml = new XmlDataDocument(dsMyDataSet);
XmlDocument thisXml = new XmlDocument();
thisXml = (XmlDocument) MatchingPlansXml;

but how can I change (rename) the XmlElements during this transformation?

Thank You in Advance for any assistance...

-Kevin

2. function for Modulo 2 division

3. XML Newbie question, getting a value from an XML string

4. SAS/C 6.3 Bug?

5. Netaddress of USA.NET?

6. Please help newbie to parse xml

7. Communication Between a figure and Matlab

8. vb.net newbie needs help with basic XML parsing?

9. Parse an xml string.

10. C# - parsing an XML string

11. How to Parse Xml String in DotNet 2003 C#.

12. Parse an xml string.