Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Element Names
Message
General information
Forum:
ASP.NET
Category:
XML
Title:
Miscellaneous
Thread ID:
01362922
Message ID:
01363306
Views:
8
>>Just really digging into designing my own XML file. And I have a question.
>>
>>I have a section that list the fields in a table. Is using the field name as the element name OK as in this example:
>>
>>
>><?xml version="1.0"?>
>><DataFiles>
>>  <DataFile Source="" FileType="DBF" FileName="run.dbf">
>>    <Fields>
>>      <NM />
>>      <DEPT />
>>      <CO />
>>      <AD />
>>      <CTY />
>>      <ST />
>>      <ZIP />
>>    </Fields>
>>  </DataFile>
>></DataFiles>
>>
>>Or should I do
>>
>>  <Field Name="NM" />
>>
>
>I guess it depends on how you want to use it. If you embed it in a Fields collection it's easier to iterate over just those elements (assuming you have other types of "collections" that will be added). If there isn't any other collection in the XML, then that isn't as much of a benefit.

I can't trust that the data file hasn't changed, so currently I'm using SelectSingleNode with a full path to locate them. (Partial paths don't seem to work or I don't know the syntax.) The path syntax seemed simpler for doing it this way, so that was part of what I liked. There is another collection because DataFiles is also a collection. I'm using this XML to track the file as it goes through a conversion process. It will retain some information such as the original field name and what the field is used for that cannot be stored in a free table.

They're are a lot of XML techniques I don't really know yet, and I may have some confusion on how it all works. So... any sample code you can point me to on "iterate over just those elements "? At the moment, that seems harder to do with 'Field Name="NM"' than it is with just the element "NM" because I have to do a lookup for the name attribute, rather than the just looking at the nodes name property.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform