1. ashworth's Avatar
    Hello everyone,

    I have had more then one person want to create their own XML files for my applications so I though I would share this little How To.

    First off please make sure you have read the following: How To Place XML Files on the SD card / Device Memory
    BBGPSGolf - A Free Golf GPS application for the BlackBerry smartphone


    Please note this will only work when you select Files from Micro SD card of files from Device Memory option. The other two options have hard coded links that will go to BBGPSGolf - A Free Golf GPS application for the BlackBerry smartphone to get the xml files.

    Ok so first you need to create a BBGPSGolf folder on the root of your Micro SD or Device memrory.

    Then from here you need to have a file called course.xml

    The course.xml file is like the master list file that has all of the golf courses. If you only want to have one course then only list one course within the xml file and it will only show one course.

    For the example below I will be using the following data:
    The course in the example will be an 18 hole course called Pike Lake Golf and CC - Links.

    There is an example of the XML layout for the course.xml file:

    Code:
    <Course>
      <NameOfTheGolfCourse>
        <CourseName>Name of the Golf course</CourseName>
        <NumberOfHoles>18</NumberOfHoles>
        <XMLData>NameOfTheXMLFileOnTheSDCard.xml</XMLData>
        <State>The state or province that the golf course is in</State> 
        <Country>The Country</Country> 
        <Address>This is the place for the Address</Address> 
        <Distance>The distance from your current location to the golf course. Filled in by the server</Distance> 
        <CourseID>The course ID number that is within the Database</CourseID> 
      </NameOfTheGolfCourse >
    </Course>
    Note: that the NameOfTheXMLFileOnTheSDCard.xml must also be in the same folder as the course.xml (within the BBGPSGolf Folder. UPDATE: this BBGPSGolf folder is not created for you if one does not exist when you
    select Files from Micro SD card of files from Device Memory option. UPDATE 2: I added Distance, this is for a new option coming down the road.

    So If I wanted to make an XML file for Pike Lake Golf and CC - Links it would look like this:

    Code:
    <Course>
      <PikeLakeGolfandCCLinks>
        <CourseName>Pike Lake Golf and CC - Links</CourseName>
        <NumberOfHoles>18</NumberOfHoles>
        <XMLData>PikeLakeGolfandCCLinks.xml</XMLData>
        <Par>36</Par> 
        <State>Ontario</State> 
        <Country>Canada</Country> 
        <Address>This is the place for the Address</Address> 
        <Distance>23</Distance> 
        <CourseID>7</CourseID> 
      </PikeLakeGolfandCCLinks>
    </Course>
    If you wanted to have more then one course then the XML file would look like this:
    Code:
    <Course>
      <PikeLakeGolfandCCLinks>
        <CourseName>Pike Lake Golf and CC - Links</CourseName>
        <NumberOfHoles>9</NumberOfHoles>
        <XMLData>PikeLakeGolfandCCLinks.xml</XMLData>
        <Par>36</Par> 
        <State>Ontario</State> 
        <Country>Canada</Country> 
        <Address>This is the place for the Address</Address> 
        <CourseID>7</CourseID> 
      </PikeLakeGolfandCCLinks>
      <RebelCreekGolfClub>
        <CourseName>Rebel Creek Golf Club</CourseName>
        <NumberOfHoles>18</NumberOfHoles>
        <XMLData>RebelCreekGolfClub.xml</XMLData>
        <Par>72</Par> 
        <State>Ontario</State> 
        <Country>Canada</Country> 
        <Address>This is the place for the Address</Address> 
        <CourseID>8</CourseID> 
      </RebelCreekGolfClub>
    </Course>
    EDIT:
    I have just added the following new items to the XML file:
    • <Par>72</Par>
    • <State>Ontario</State>
    • <Country>Canada</Country>
    • <Address>This is the place for the Address</Address>
    • <CourseID>8</CourseID>

    That is about all for the course.xml file. Now we need to go to the XML File on the NameOfTheXMLFileOnTheSDCard.xml.

    I also created a My Custom course.xml menu item when you login to the web site, that will create the xml file for you, you just need to copy and past it into notepad and then save it as course.xml within the BBGPSGolf folder.

    This file is a little bit different.

    Here is a layout of the PikeLakeGolfandCCLinks.xml file:
    Code:
    <PikeLakeGolfandCCLinks>
     <Hole1>
      <Frontlat>43.964782</Frontlat>
      <Frontlon>-80.816841</Frontlon>
      <Middlelat>43.964689</Middlelat>
      <Middlelon>-80.816669</Middlelon>
      <Backlat>43.964581</Backlat>
      <Backlon>-80.816545</Backlon>
      <tlat>43.9647970421396</tlat> 
      <tlon>-80.8202683925629</tlon> 
      <par>4</par> 
      <Hint>Try and keep right over the water</Hint> 
      <Handicap>1</Handicap> 
      <ID>325</ID> 
     </Hole1>
     <Hole2>
      <Frontlat>43.964148</Frontlat>
      <Frontlon>-80.820102</Frontlon>
      <Middlelat>43.964299</Middlelat>
      <Middlelon>-80.820134</Middlelon>
      <Backlat>43.964419</Backlat>
      <Backlon>-80.82015</Backlon>
      <tlat>43.9639012536392</tlat> 
      <tlon>-80.8162021636963</tlon> 
      <par>4</par> 
      <Handicap>0</Handicap> 
      <ID>326</ID> 
     </Hole2>
     <Hole3>
      <Frontlat>0</Frontlat>
      <Frontlon>0</Frontlon>
      <Middlelat>0</Middlelat>
      <Middlelon>0</Middlelon>
      <Backlat>0</Backlat>
      <Backlon>0</Backlon>
     </Hole3>
     <Hole4>
      <Frontlat>0</Frontlat>
      <Frontlon>0</Frontlon>
      <Middlelat>0</Middlelat>
      <Middlelon>0</Middlelon>
      <Backlat>0</Backlat>
      <Backlon>0</Backlon>
     </Hole4>
     <Hole5>
      <Frontlat>0</Frontlat>
      <Frontlon>0</Frontlon>
      <Middlelat>0</Middlelat>
      <Middlelon>0</Middlelon>
      <Backlat>0</Backlat>
      <Backlon>0</Backlon>
     </Hole5>
     <Hole6>
      <Frontlat>0</Frontlat>
      <Frontlon>0</Frontlon>
      <Middlelat>0</Middlelat>
      <Middlelon>0</Middlelon>
      <Backlat>0</Backlat>
      <Backlon>0</Backlon>
     </Hole6>
     <Hole7>
      <Frontlat>0</Frontlat>
      <Frontlon>0</Frontlon>
      <Middlelat>0</Middlelat>
      <Middlelon>0</Middlelon>
      <Backlat>0</Backlat>
      <Backlon>0</Backlon>
     </Hole7>
     <Hole8>
      <Frontlat>0</Frontlat>
      <Frontlon>0</Frontlon>
      <Middlelat>0</Middlelat>
      <Middlelon>0</Middlelon>
      <Backlat>0</Backlat>
      <Backlon>0</Backlon>
     </Hole8>
     <Hole9>
      <Frontlat>0</Frontlat>
      <Frontlon>0</Frontlon>
      <Middlelat>0</Middlelat>
      <Middlelon>0</Middlelon>
      <Backlat>0</Backlat>
      <Backlon>0</Backlon>
     </Hole9>
    </PikeLakeGolfandCCLinks>
    Note: Please know that the file must go for the number of holes listed in the course.xml file or the BlackBerry Application could crash.

    If you have 0 listed for the Front Middle or Back of the green then that hole will not show-up when you play. It will take you to a screen to upload the data to my database once you add them in.

    An example of a full xml file would like something like this:
    Code:
    <PikeLakeGolfandCCLinks>
     <Hole1>
      <Frontlat>43.964782</Frontlat>
      <Frontlon>-80.816841</Frontlon>
      <Middlelat>43.964689</Middlelat>
      <Middlelon>-80.816669</Middlelon>
      <Backlat>43.964581</Backlat>
      <Backlon>-80.816545</Backlon>
    
      <tlat>43.9647970421396</tlat>
      <tlon>-80.8202683925629</tlon>
      <par>4</par>
      <Hint>Try and keep right over the water</Hint>
      <Handicap>1</Handicap>
      <ID>325</ID>
     </Hole1>
     <Hole2>
      <Frontlat>43.962044</Frontlat>
      <Frontlon>-80.815902</Frontlon>
      <Middlelat>43.961936</Middlelat>
      <Middlelon>-80.815848</Middlelon>
      <Backlat>43.961839</Backlat>
      <Backlon>-80.815832</Backlon>
      <tlat>43.9639012536392</tlat>
      <tlon>-80.8162021636963</tlon>
      <par>4</par>
      <Handicap>0</Handicap>
      <ID>326</ID>
     </Hole2>
     <Hole3>
      <Frontlat>43.960299</Frontlat>
      <Frontlon>-80.815703</Frontlon>
      <Middlelat>43.960194</Middlelat>
      <Middlelon>-80.815655</Middlelon>
      <Backlat>43.960106</Backlat>
      <Backlon>-80.815655</Backlon>
      <tlat>43.9611327184528</tlat>
      <tlon>-80.8159017562866</tlon>
      <par>3</par>
      <Handicap>0</Handicap>
      <ID>327</ID>
     </Hole3>
     <Hole4>
      <Frontlat>43.959032</Frontlat>
      <Frontlon>-80.818444</Frontlon>
      <Middlelat>43.95899</Middlelat>
      <Middlelon>-80.818557</Middlelon>
      <Backlat>43.958963</Backlat>
      <Backlon>-80.818681</Backlon>
      <tlat>43.9597696404845</tlat>
      <tlon>-80.8158642053604</tlon>
      <par>4</par>
      <Handicap>0</Handicap>
      <ID>328</ID>
     </Hole4>
     <Hole5>
      <Frontlat>43.956058</Frontlat>
      <Frontlon>-80.818525</Frontlon>
      <Middlelat>43.956022</Middlelat>
      <Middlelon>-80.81862</Middlelon>
      <Backlat>43.956001</Backlat>
      <Backlon>-80.81873</Backlon>
      <tlat>43.9587540691481</tlat>
      <tlon>-80.8177417516708</tlon>
      <par>4</par>
      <Handicap>0</Handicap>
      <ID>353</ID>
     </Hole5>
     <Hole6>
      <Frontlat>43.952602</Frontlat>
      <Frontlon>-80.816645</Frontlon>
      <Middlelat>43.952625</Middlelat>
      <Middlelon>-80.816458</Middlelon>
      <Backlat>43.952633</Backlat>
      <Backlon>-80.816337</Backlon>
      <tlat>43.9558424109974</tlat>
      <tlon>-80.8190828561783</tlon>
      <par>5</par>
      <Handicap>0</Handicap>
      <ID>354</ID>
     </Hole6>
     <Hole7>
      <Frontlat>43.951398</Frontlat>
      <Frontlon>-80.817524</Frontlon>
      <Middlelat>43.951358</Middlelat>
      <Middlelon>-80.817639</Middlelon>
      <Backlat>43.95132</Backlat>
      <Backlon>-80.817795</Backlon>
      <tlat>43.9518763022786</tlat>
      <tlon>-80.8165454864502</tlon>
      <par>3</par>
      <Handicap>0</Handicap>
      <ID>702</ID>
     </Hole7>
     <Hole8>
      <Frontlat>43.952269</Frontlat>
      <Frontlon>-80.814007</Frontlon>
      <Middlelat>43.952146</Middlelat>
      <Middlelon>-80.813768</Middlelon>
      <Backlat>43.952129</Backlat>
      <Backlon>-80.813581</Backlon>
      <tlat>43.9513974163258</tlat>
      <tlon>-80.8175110816956</tlon>
      <par>4</par>
      <Handicap>0</Handicap>
      <ID>703</ID>
     </Hole8>
     <Hole9>
      <Frontlat>43.95668</Frontlat>
      <Frontlon>-80.81473</Frontlon>
      <Middlelat>43.956824</Middlelat>
      <Middlelon>-80.814742</Middlelon>
      <Backlat>43.956985</Backlat>
      <Backlon>-80.814751</Backlon>
      <Other1Dis>Top of hill on right</Other1Dis>
      <Other1lat>43.95454</Other1lat>
      <Other1lon>-80.813967</Other1lon>
      <Other2Dis>End of Fairway</Other2Dis>
      <Other2lat>43.955856</Other2lat>
      <Other2lon>-80.81446</Other2lon>
      <Other3Dis>Carry water</Other3Dis>
      <Other3lat>43.956381</Other3lat>
      <Other3lon>-80.814724</Other3lon>
      <tlat>43.9528649578457</tlat>
      <tlon>-80.8135199546814</tlon>
      <par>5</par>
      <Handicap>0</Handicap>
      <ID>355</ID>
     </Hole9>
    </PikeLakeGolfandCCLinks>
    Let me know if you have any questions.

    Feel free to E-Mail/Forum Post/PIN me!

    EDIT:

    I have now made some changes to the XML files. for the golf course xml files I have now added the following Tags:
    • <tlat>43.9647970421396</tlat>
      • This is the Tee Lat
    • <tlon>-80.8202683925629</tlon>
      • This is the Tee Long
    • <par>4</par>
      • This is the Holes Par
    • <Hint>Try and keep right over the water</Hint>
      • This is the Holes hint
    • <Handicap>1</Handicap>
      • This is the Holes Handicap
    • <ID>325</ID>
      • this is the ID from my database. This is going to be required going forward IF you want to do an update to the hole or track your scoring



    NEW with version 1.0.17

    You can now place your clubs and clubdistnaces xml files on your SD card.

    The name of the files HAVE to be your username you have configured within Options of BBGPSGolf and yourusernameClubDistance.xml. So for example, if my user name is justin then I have to have two files within the BBGPSGolf folder called justin.xml and justinClubDistance.xml

    Here is a screenshot of the Options Screen and the BBGPSGolf folder on my SD Card:
    [attachment=1]option.png[/attachment]
    As you can see above my user name is justin so now I have to place the justin.xml and justinClubDistance.xml within the BBGPSGolf folder on my SD card as shown below:
    [attachment=0]folder.png[/attachment]

    Here is what the XML file looks like for the username.xml file:
    Code:
    <MyClub>
      <Club>Driver</Club>
      <Club>2 Wood</Club>
      <Club>3 Wood</Club>
      <Club>4 Wood</Club>
      <Club>5 Wood</Club>
      <Club>7 Wood</Club>
      <Club>9 Wood</Club>
      <Club>11 Wood</Club>
      <Club>Hybrid</Club>
      <Club>Hybrid 2</Club>
      <Club>Hybrid 3</Club>
      <Club>Hybrid 4</Club>
      <Club>Hybrid 5</Club>
      <Club>1 Iron</Club>
      <Club>2 Iron</Club>
      <Club>3 Iron</Club>
      <Club>4 Iron</Club>
      <Club>5 Iron</Club>
      <Club>6 Iron</Club>
      <Club>7 Iron</Club>
      <Club>8 Iron</Club>
      <Club>9 Iron</Club>
      <Club>PW</Club>
      <Club>GW</Club>
      <Club>Gap Wedge</Club>
      <Club>SW</Club>
      <Club>Sand Wedge</Club>
      <Club>LW</Club>
      <Club>Lob Wedge</Club>
      <Club>Putter</Club>
    </MyClub>
    And here is the XML code for the usernameClubDistance.xml file:
    Code:
    <MyClub>
      <Club>Driver</Club>
      <Distance>260</Distance>
      <Club>2 Wood</Club>
      <Distance>250</Distance>
      <Club>3 Wood</Club>
      <Distance>225</Distance>
      <Club>4 Wood</Club>
      <Distance>220</Distance>
      <Club>5 Wood</Club>
      <Distance>218</Distance>
      <Club>7 Wood</Club>
      <Distance>200</Distance>
      <Club>9 Wood</Club>
      <Distance>180</Distance>
      <Club>11 Wood</Club>
      <Distance>150</Distance>
      <Club>Hybrid</Club>
      <Distance>220</Distance>
      <Club>Hybrid 2</Club>
      <Distance>215</Distance>
      <Club>Hybrid 3</Club>
      <Distance>213</Distance>
      <Club>Hybrid 4</Club>
      <Distance>210</Distance>
      <Club>Hybrid 5</Club>
      <Distance>200</Distance>
      <Club>1 Iron</Club>
      <Distance>250</Distance>
      <Club>2 Iron</Club>
      <Distance>225</Distance>
      <Club>3 Iron</Club>
      <Distance>200</Distance>
      <Club>4 Iron</Club>
      <Distance>195</Distance>
      <Club>5 Iron</Club>
      <Distance>185</Distance>
      <Club>6 Iron</Club>
      <Distance>175</Distance>
      <Club>7 Iron</Club>
      <Distance>160</Distance>
      <Club>8 Iron</Club>
      <Distance>150</Distance>
      <Club>9 Iron</Club>
      <Distance>145</Distance>
      <Club>PW</Club>
      <Distance>140</Distance>
      <Club>GW</Club>
      <Distance>105</Distance>
      <Club>Gap Wedge</Club>
      <Distance>120</Distance>
      <Club>SW</Club>
      <Distance>120</Distance>
      <Club>Sand Wedge</Club>
      <Distance>105</Distance>
      <Club>LW</Club>
      <Distance>90</Distance>
      <Club>Lob Wedge</Club>
      <Distance>90</Distance>
      <Club>Putter</Club>
      <Distance>1</Distance>
    </MyClub>
    Please note: that the username.xml and usernameClubDistance.xml have to match 100%. So if you have a 3 iron in one file IT HAS TO BE IN THE OTHER FILE!!!!

    If you have already selected your club and club distances on my web site then you can download them from the following link:
    http://www.bbgpsgolf.com/user/

    Thanks,
    Justin
    06-13-11 09:38 AM
  2. titsmigee's Avatar
    Thanks Justin for this I would just like to add one thing for Mac OSX users. When using TextEdit.app (OSX notepad equivalent) to compile course.xml make sure to format to plain text (Shift,Command,T), then change the file extension from TXT to XML. Otherwise it will not save in a readable format as shown below.


    I did not realize the problem at first because when I opened the file in textedit (on the right) it looked identical to what it should. However in preview (left) you could tell what app is reading.
    12-13-11 03:45 PM
  3. Tony Dearsley's Avatar
    Thanks Justin and Ash but the link above does not work. http://www.bbgpsgolf.com/user/. Can you tell me please how to find the . XML code for my clubs and distances which I have already selected/added on the web site. Many thanks, Tony
    02-01-13 07:50 AM
LINK TO POST COPIED TO CLIPBOARD