Parsing XML Document

This poor guy

Dont try & parse it manually

Use an XPath query (at least)

try Path

/TheRoot/Entry1/EntryId/Eno

I’d suggest

  1. get the NumberOfEntries
  2. iterate over all those iwht with revised XPath queries for each one
2 Likes

OMG someone suggested using chatgpt and that really scares me

2 Likes

This is what happens when you tell your most enthusiastic & experienced customers that they’re not your desired audience.

5 Likes

Hello all,
I’ve never worked with XML. Can anyone explain why it should not be parsed manually, or apparently coded normally in Xojo?

Appreciate understanding more.
Tim

there are ways to deal with XML that dont require you to write loops to find certain nodes as the poster in question was trying to do

XPath as I pointed out lets you write a “Query” of an xml document and get back every node that matches that query (SQL for XML sort of) (there are newer technologies that actually do almost exactly this but are unsupported by Xojo’s XML plugin)

  1. its quite simple

  2. I used the LEAST flexible way of dealing with it by basically hard coding a path through the XML. There are other ways to say “find me all the nodes of this type” regardless of the structure. That can insulate you from changes in the XML structure (ie. inserting more hierarchy etc)

#2 is, IMHO, the most valuable thing

EDIT - you do still have to write code to process the data in the nodes BUT … you can apply path queries to those as well to get contents etc

So instead of writing code that finds the first child then the third child etc you write code that says “get me all the nodes that are of type X, and from each of those get me the ones that are Y, then the data from that”

more or less

There is the ideal way of doing things and there is what can be done with xojo…

The XML part of the framework is extremely outdated. I tried to parse xml files the “right” way BUT doing it “manually” with loops and some Extend functions was a lot faster.

1 Like

Damnit xojo.

shoves xojo in trash

rushes to trash to pick it up again

I still need it for a few things… :smiley:

1 Like

LOL
Thats extremely generous
The last update to Sablotron I can find was 12 years ago
And I"m not sure this wasnt just someone plopping it into a GitHub repo with no changes

IIRC, Monkeybread has a much more modern XML parser based on an open source library. It’s pathetic that Xojo’s XML library is over a decade old and missing what many people need.

But then I’m not surprised since stable genius doesn’t value keeping things modern and up to date but more than wiling to rearrange the deck chairs for meaningless changes for the sake of change.

5 Likes

Way back when, I used the MBS PHP plugin to deal with these types of issues when I could not trust Xojo’s results.

I used it for Date Parsing and other things that Xojo might spawn an exception…

But that’s what his target audience wants, they wanna re-do their apps in a new language with the same limitations as the old.

I do have to thank Geoff, as if he wasn’t so abrasive, I may not have made the jump to a more capable product.

2 Likes

Same. I’m making way more money, have better benefits, have way less stress, and working with a language that is better and seems to do the cross platform thing better (tho no UI at the moment).

3 Likes

Oh there are several that do x-platform without UI way better than Xojo
Go & Rust spring to mind
And with Rust getting support in Linux I expect the use of these will just grow & UI’s will come

1 Like

Indeed. Wails has spent a year adding Linux and making their UI support better. Hopefully they’ll finish up ‘soon’ as I’d like to start working with it. Not looking forward to learning Svelt or Vue but that’s just the price to pay to play.

Interesting because you can create console apps on Windows and Linux with Swift also, there’s a whole section “Swift on Server” that I intend to check out in a few years to port my only Xojo web app over too.

I kinda glossed over it, because no UI.