Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling specific XML structure
Message
De
19/03/2007 22:22:29
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
XML
Titre:
Handling specific XML structure
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01205926
Message ID:
01205926
Vues:
56
I have an XML structure like this:
<?xml version="1.0" ?> 
<Logs xmlns="http://www.mywebsite.com/schemas/compliance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0">
   <Log>
      <Exceptions>
         <Exception>
            <GroupName>Labor Time</GroupName> 
         </Exception>
         <Exception>
            <GroupName>Parts Usage</GroupName> 
         </Exception>
      </Exceptions>
   </Log>
   <Log>
      <Exceptions>
         <Exception>
            <GroupName>Labor Time 2</GroupName> 
         </Exception>
         <Exception>
            <GroupName>Parts Usage 2</GroupName> 
         </Exception>
      </Exceptions>
   </Log>
</Logs>
I used this code to get the node list from my XML class:
loXml.GetXMLNodeList("//ns:Logs/ns:Log/ns:Exceptions/ns:Exception")
Then, I can scan it like this:
        For Each loNodeRecord In loXml.oXmlNodeList
            lnCounter = lnCounter + 1
            loStringBuilder.Append("<TR>")
            loStringBuilder.Append("<TD ALIGN=RIGHT>" + lnCounter.ToString + ".")
            For Each loNodeField In loNodeRecord.ChildNodes
                Select Case loNodeField.Name
                    Case "GroupName"
                        loStringBuilder.Append("<TD>" + Trim(loNodeField.InnerText))
                End Select
            Next
        Next
However, doing it like this means that I will end up with four records because I have those branches that match in the first hierarchy and another two in the second hierarchy. The client wants that I only get the records from the first one. How can I adjust to only get the records from the first one? Is there a way to identify an identifier of 1 in the loXml.GetXMLNodeList() command to let the class know that I want the first occurence only? I think I saw something like that before where we can specify and identifier for such a need.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform