Current location: Hot Scripts Forums » Programming Languages » Visual Basic » [SOLVED] Help Reading xml


Help Reading xml

Closed Thread
  #1 (permalink)  
Old 04-08-10, 02:14 PM
niekv niekv is offline
New Member
 
Join Date: Apr 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Help Reading xml

Dear people.

I am newby here not with vb.

I am creating for a flight simulator game a addon.

I want to read only the departure name and the destination name of the xml file.
The file is a .pln file but its structure is like an xml.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document Type="AceXML" version="1,0">
    <Descr>AceXML Document</Descr>
    <FlightPlan.FlightPlan>
        <Title>CZML to SAWT</Title>
        <FPType>VFR</FPType>
        <CruisingAlt>17500</CruisingAlt>
        <DepartureID>CZML</DepartureID>
        <DepartureLLA>N51° 43' 47.76",W121° 19' 48.31",+003127.00</DepartureLLA>
        <DestinationID>SAWT</DestinationID>
        <DestinationLLA>S51° 36' 39.47",W72° 13' 41.33",+000906.00</DestinationLLA>
        <Descr>CZML, SAWT</Descr>
        <DeparturePosition>32</DeparturePosition>
        <DepartureName>108 Mile</DepartureName>
        <DestinationName>28 De Noviembre</DestinationName>
        <AppVersion>
            <AppVersionMajor>10</AppVersionMajor>
            <AppVersionBuild>60905</AppVersionBuild>
        </AppVersion>
        <ATCWaypoint id="CZML">
            <ATCWaypointType>Airport</ATCWaypointType>
            <WorldPosition>N51° 43' 47.76",W121° 19' 48.31",+003127.00</WorldPosition>
            <ICAO>
                <ICAOIdent>CZML</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="SAWT">
            <ATCWaypointType>Airport</ATCWaypointType>
            <WorldPosition>S51° 36' 39.47",W72° 13' 41.33",+000906.00</WorldPosition>
            <ICAO>
                <ICAOIdent>SAWT</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
    </FlightPlan.FlightPlan>
</SimBase.Document>
thnx for help
  #2 (permalink)  
Old 04-09-10, 07:05 AM
niekv niekv is offline
New Member
 
Join Date: Apr 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by niekv View Post
Dear people.

I am newby here not with vb.

I am creating for a flight simulator game a addon.

I want to read only the departure name and the destination name of the xml file.
The file is a .pln file but its structure is like an xml.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document Type="AceXML" version="1,0">
    <Descr>AceXML Document</Descr>
    <FlightPlan.FlightPlan>
        <Title>CZML to SAWT</Title>
        <FPType>VFR</FPType>
        <CruisingAlt>17500</CruisingAlt>
        <DepartureID>CZML</DepartureID>
        <DepartureLLA>N51° 43' 47.76",W121° 19' 48.31",+003127.00</DepartureLLA>
        <DestinationID>SAWT</DestinationID>
        <DestinationLLA>S51° 36' 39.47",W72° 13' 41.33",+000906.00</DestinationLLA>
        <Descr>CZML, SAWT</Descr>
        <DeparturePosition>32</DeparturePosition>
        <DepartureName>108 Mile</DepartureName>
        <DestinationName>28 De Noviembre</DestinationName>
        <AppVersion>
            <AppVersionMajor>10</AppVersionMajor>
            <AppVersionBuild>60905</AppVersionBuild>
        </AppVersion>
        <ATCWaypoint id="CZML">
            <ATCWaypointType>Airport</ATCWaypointType>
            <WorldPosition>N51° 43' 47.76",W121° 19' 48.31",+003127.00</WorldPosition>
            <ICAO>
                <ICAOIdent>CZML</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="SAWT">
            <ATCWaypointType>Airport</ATCWaypointType>
            <WorldPosition>S51° 36' 39.47",W72° 13' 41.33",+000906.00</WorldPosition>
            <ICAO>
                <ICAOIdent>SAWT</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
    </FlightPlan.FlightPlan>
</SimBase.Document>
thnx for help
[Resolved]
Working code i found edited.

Code:
            Dim departure, destination, xmlDoc, ElemList

            xmlDoc = CreateObject("Msxml2.DOMDocument")
            xmlDoc.load("" + flight.Value + "")

            ElemList = xmlDoc.getElementsByTagName("DepartureName")
            departure = ElemList.item(0).Text
            Label6.Text = departure

            ElemList = xmlDoc.getElementsByTagName("DestinationName")
            destination = ElemList.item(0).Text
            Label7.Text = destination
  #3 (permalink)  
Old 04-11-10, 04:30 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Thank you for posting your solution niekv.

Pete
__________________
Closed Thread

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a Node from XML to VB.NET label MistyJoy Windows .NET Programming 2 07-16-09 12:38 AM
Reading XML in a C++ program jpthomas82 C/C++ 1 09-26-08 03:32 PM
XML Reading infoscripts ASP 1 12-15-06 02:05 PM
reading a remote xml file into a variable bdee1 PHP 1 12-20-05 12:32 PM
XML (You'll groan while reading this) liljoeyjordison HTML/XHTML/XML 1 08-19-05 11:14 PM


All times are GMT -5. The time now is 01:18 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.