XML

M

Mark Fox

Hello,

I'm new to XML in ASP.NET and have some XML:


<Reason>

<ReasonCategory>Death</ReasonCategory>
<Contacts>
<Contact>
<Name></Name>
<Phone></Phone>

<Address></Address>

<CityStateZip></CityStateZip>

<Relation></Relation>

<IsMember></IsMember>
</Contact>
</Contacts>
<ReasonDetails>

<PlaceOfDeath></PlaceOfDeath>

<CauseOfDeath></CauseOfDeath>

<FuneralLocationName></FuneralLocationName>

<FuneralLocationAddress></FuneralLocationAddress>

<FuneralLocationCity></FuneralLocationCity>

<FuneralLocationState></FuneralLocationState>

<FuneralLocationZip></FuneralLocationZip>

<FuneralLocationPhone></FuneralLocationPhone>

<FuneralDateTime></FuneralDateTime>

<FoodRequirements></FoodRequirements>
<ReasonDetails>
<RequestedServices>
<RequestedService>

<OfferedServiceID></OfferedServiceID>

<OfferedServiceName></OfferedServiceName>

<AssignedTo></AssignedTo>

<FollowUpID></FollowUpID>
</RequestedService>
</RequestedServices>
<FormDetails>

<CompletedBy></CompletedBy>

<CompletedDate></CompletedDate>

<InformationProvider></InformationProvider>
<Notes></Notes>
</FormDetails>
</Reason>

That I'm looking to parse and write. Using XmlTextReader
with a switch(reader.Name) is pretty tedious. Is there a
way to just load the whole string into a tree-like object
where I could do a

foreach(Node Contact in Contacts)

type of thing and just reference nodes by a

string Notes = Node["Notes"].Value;

type of code? Any help would be appreciated! Thanks so
much!
 
S

Scott M.

This is pretty basic XML. Look into the XMLDocument object. That is what
it is there for.
 
M

Mark Fox

Scott,

The XMLDocument is exactly what I was looking for.
Thanks for pointing me to it!
-----Original Message-----
This is pretty basic XML. Look into the XMLDocument object. That is what
it is there for.


Mark Fox said:
Hello,

I'm new to XML in ASP.NET and have some XML:


<Reason>

<ReasonCategory>Death</ReasonCategory>
<Contacts>
<Contact>
<Name></Name>
<Phone></Phone>

<Address></Address>

<CityStateZip></CityStateZip>

<Relation></Relation>

<IsMember></IsMember>
</Contact>
</Contacts>
<ReasonDetails>

<PlaceOfDeath></PlaceOfDeath>

<CauseOfDeath></CauseOfDeath>

<FuneralLocationName></FuneralLocationName>

<FuneralLocationAddress></FuneralLocationAddress>

<FuneralLocationCity></FuneralLocationCity>

<FuneralLocationState></FuneralLocationState>

<FuneralLocationZip></FuneralLocationZip>

<FuneralLocationPhone></FuneralLocationPhone>

<FuneralDateTime></FuneralDateTime>

<FoodRequirements></FoodRequirements>
<ReasonDetails>
<RequestedServices>
<RequestedService>

<OfferedServiceID></OfferedServiceID>

<OfferedServiceName></OfferedServiceName>

<AssignedTo></AssignedTo>

<FollowUpID></FollowUpID>
</RequestedService>
</RequestedServices>
<FormDetails>

<CompletedBy></CompletedBy>

<CompletedDate></CompletedDate>

<InformationProvider></InformationProvider>
<Notes></Notes>
</FormDetails>
</Reason>

That I'm looking to parse and write. Using XmlTextReader
with a switch(reader.Name) is pretty tedious. Is there a
way to just load the whole string into a tree-like object
where I could do a

foreach(Node Contact in Contacts)

type of thing and just reference nodes by a

string Notes = Node["Notes"].Value;

type of code? Any help would be appreciated! Thanks so
much!


.
 
S

Scott M.

No problem. HTH

Mark Fox said:
Scott,

The XMLDocument is exactly what I was looking for.
Thanks for pointing me to it!
-----Original Message-----
This is pretty basic XML. Look into the XMLDocument object. That is what
it is there for.


Mark Fox said:
Hello,

I'm new to XML in ASP.NET and have some XML:


<Reason>

<ReasonCategory>Death</ReasonCategory>
<Contacts>
<Contact>
<Name></Name>
<Phone></Phone>

<Address></Address>

<CityStateZip></CityStateZip>

<Relation></Relation>

<IsMember></IsMember>
</Contact>
</Contacts>
<ReasonDetails>

<PlaceOfDeath></PlaceOfDeath>

<CauseOfDeath></CauseOfDeath>

<FuneralLocationName></FuneralLocationName>

<FuneralLocationAddress></FuneralLocationAddress>

<FuneralLocationCity></FuneralLocationCity>

<FuneralLocationState></FuneralLocationState>

<FuneralLocationZip></FuneralLocationZip>

<FuneralLocationPhone></FuneralLocationPhone>

<FuneralDateTime></FuneralDateTime>

<FoodRequirements></FoodRequirements>
<ReasonDetails>
<RequestedServices>
<RequestedService>

<OfferedServiceID></OfferedServiceID>

<OfferedServiceName></OfferedServiceName>

<AssignedTo></AssignedTo>

<FollowUpID></FollowUpID>
</RequestedService>
</RequestedServices>
<FormDetails>

<CompletedBy></CompletedBy>

<CompletedDate></CompletedDate>

<InformationProvider></InformationProvider>
<Notes></Notes>
</FormDetails>
</Reason>

That I'm looking to parse and write. Using XmlTextReader
with a switch(reader.Name) is pretty tedious. Is there a
way to just load the whole string into a tree-like object
where I could do a

foreach(Node Contact in Contacts)

type of thing and just reference nodes by a

string Notes = Node["Notes"].Value;

type of code? Any help would be appreciated! Thanks so
much!


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top