Parsing the XML File

He’s back …

After yesterday’s XML 101 course, I’m now at the point of reading the XML file back into the app and working with it. I’d been going down the “NextChild” loop when I found ListXMLNodes. According to the LR (nothing about this in the User Guide: Framework book), I should be able to look for nodes by name and get their values or attribute assignments.

In my code, I have:

myXMLDocument.LoadXml(GetFolderItem(BRUArchivesPath + "/" + MyActiveTapeRecord.trArchives(0) + "/" _ + MyActiveTapeRecord.trArchives(0) + "_Studiodata.xml", FolderItem.PathTypeShell)) If myXML.LastError = 0 Then nodes = myXMLDocument("\\\\Still") // there is only one "Still" element Else // error loading End If
However, when run, myXMLDocument is properly populated and can be examined in the debugger, but the ‘nodes’ assignment results in an XmlException with no further details.

Ideas?

Looks like you’re meaning to do myXMLDocument.XQL("\\Still")

I hadn’t followed that thread, but this line looks wrong to me:

        nodes = myXMLDocument("\\\\Still") // there is only one "Still" element

That should be… darn, Jim beat me to it.

Sorry Jim, bad edit on my part. Yes I am using the .XQL method.

Corrected since I can’t edit it for some ethereal reason:

myXMLDocument.LoadXml(GetFolderItem(BRUArchivesPath + "/" + MyActiveTapeRecord.trArchives(0) + "/" _ + MyActiveTapeRecord.trArchives(0) + "_Studiodata.xml", FolderItem.PathTypeShell)) If myXML.LastError = 0 Then nodes = myXMLDocument.Xql("\\\\Still") // there is only one "Still" element Else // error loading End If

The error occurs on that call.

Can you post the actual XML?

Here’s the main body with the EncodeBase64 image data reduced:

[code]<?xml version="1.0" encoding="UTF-8"?>

009-2019992
A DJ’s Life
The Road to Ibiza
1
3
TOLIS Group Studios
TOLIS Group, Inc.
Documentary|Musical
English

Tim Jones
Mike Holiday
Documentation|Post-Production Production|Sound
Dailies|Edit Decision List (EDL)|Main Unit|On-Set Audio Capture|Post-Viz|Pre-Viz|Raw Camera Takes|Second Unit
1
2014-02-18 13:48:36
Burbank 2
Mike Holiday
480-505-0488
mike@tgstudios.com
Cras venenatis augue sed metus faucibus lobortis. Duis tincidunt urna vitae eleifend aliquam. Cras tincidunt quis urna vitae facilisis. Nulla adipiscing lectus id feugiat placerat. Suspendisse vestibulum odio et posuere tristique. Pellentesque ultrices, sem sed congue ornare, nibh libero fermentum leo, ut lacinia arcu urna at lectus. In porta turpis leo, quis porttitor mi tristique quis. Vestibulum sed mauris quis eros faucibus ornare sed sed tellus. Pellentesque at dui ut metus faucibus pretium sit amet eget lectus. Vestibulum et libero ac diam rutrum fringilla.

Morbi convallis ante in cursus malesuada. Donec scelerisque imperdiet convallis. Quisque in libero in lectus tempor hendrerit vel nec mauris. Maecenas iaculis lacinia erat, et posuere enim fermentum nec. Etiam posuere lobortis accumsan. Ut eget varius dui. Vivamus quis tellus at arcu viverra euismod vel id nulla. Donec ac tortor eget dolor venenatis suscipit vitae sit amet magna.
iVBORw0KGgoAAAANSUhEUgAAAUoAAAFkCAYAAABGj3JDAAAACXBIWXMAAAsTAAALEwEAmpwYAABA
AElEQVR4AeydB5xfxXXvZyWtOgKDAIEEKiCBAAPGFBuDTXcBJ3Zemp8dx4kb6YlL3IJxEuwkLthO
eXFcktiOjXtPDLbpxTTRq4REE01CEqhrJa3e7/s7c+69/5UgxVq9z0t0pf3fOzNnTpszZ87M3NK3
RUfZwcf/A5I7WMKd5HZqYKcGhksDfX19w4X6GfGOesaSn7Gg6wzzOs+Jemg683eed2pgpwZ2amCo
BoY6yEznGfju9dD6P0t6uztKnF86QM6Dg4Pmj3OWZXkyPjSd+TvPOzWwUwM7NTDU+ZHOvxEjRjTX
5OFLsmx7am67Osp0hDC4efNmM80ZJ9n9S7h0kHnenoLtxLVTAzs18N9DAzg+jnSAnHGQ/I0cOdL5


[/code]

Oh, wait, you used backslashes in the query. It should be forward-slashes.

D’oh - Facepalm!

I just tested with your data and it works like a charm.

I am now officially a grad-jee-ate of the Xojo Forum school of hard knocks XML 101 course. Creating, writing, reading, and modifying - Jethro Bodine would be so proud (I know I am) :P.

I’m sure someone’s already asking you this, but just in case… Would you be better off using a SQLiteDatabase instead?

Nope - the user’s use case requires an XML file formatted in the manner we’ve worked towards in the other conversation. They access the resulting XML file from a number of different management tools and devices.

You DON’T want to hear the story behind the QR Code formatting they need. Thank goodness for MBS and the barcode plugin part…

Good, as long as you’ve explored your options.