Antonio Serrano
Antonio Serrano

Reputation: 942

How to refer to other XML file within a XPath 3 query

I am using the XML editor Pathology for Mac. It is based on Panthro, an open-source implementation of XPath 3.0 in Objective-C/Cocoa.

I want to make a query over the file "Bookstore.xml" referencing to other XML file ("Bookstore2.xml"):

doc("Bookstore.xml")//Magazine[Title = doc("Bookstore2.xml")//Book/Title]

But the program says "Call to unknown function: doc()". How do I refer to other XML files? What am I missing?

BTW, I checked other answers like this one. But I did not get anything clear.

Many thx.

Upvotes: 2

Views: 93

Answers (1)

Todd Ditchendorf
Todd Ditchendorf

Reputation: 11337

Developer of Pathology here. Sorry, but Panthro – the XPath engine which I developed myself and which powers Pathology – doesn't support the doc() function.

The biggest reason I haven't implemented this function is that Pathology is primarily sold through the Mac App Store, and therefore must be a "sandboxed app" according to Apple's rather strict rules for Mac App Store apps. Sandboxed apps cannot open arbitrary files on your Mac without direct user intervention via the GUI, but that's exactly what the doc() function does.

Basically, the doc() function is inherently incompatible with the concept of a sandboxed Mac app, and since the purpose of Panthro is to power Pathology, and Pathology is a Mac app sold via the Mac App Store, I've avoided implementing doc() to avoid this inherent incompatibility.

I know this is not a very satisfying answer, but the situation is a difficult one. Apple's "sandboxing" restrictions have benefits and drawbacks. Unfortunately, this is one of the drawbacks.

Upvotes: 2

Related Questions