Jump to content

Rusty Pin workflow: XML Parse Error (works OK in Alfred 4)


gingerbeardman
 Share

Recommended Posts

I'm getting the following error in Rusty Pin pinboard workflow, which works fine in Alfred 4.

 

Obviously the XML is wrong, but as I say it works in Alfred 4.

 

[09:49:08.193] WARNING: Rusty Pin[Script Filter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 65.)'. Row 7, Col 24: 'attributes construct error' in XML:
<?xml version="1.0" encoding="UTF-8"?>
<items>
    <item arg="tax" autocomplete="tax">
        <title>tax</title>
        <subtitle>NEW TAG</subtitle>
        <icon>tag.png</icon>
        <mod key="ctrl"<mod subtitle="Mark the bookmark as TOREAD."/>
        <mod key="alt"<mod subtitle="Post the bookmark as private."/>
    </item>
    <item arg="syntax" autocomplete="syntax">
        <title>syntax</title>
        <subtitle>4</subtitle>
        <icon>tag.png</icon>
        <mod key="alt"<mod subtitle="Post the bookmark as private."/>
        <mod key="ctrl"<mod subtitle="Mark the bookmark as TOREAD."/>
    </item>
</items>

 

Edited by gingerbeardman
Link to comment
Share on other sites

The XML parsing hasn't changed between Alfred 4 and Alfred 5, the only difference is Alfred 4 is currently built on Big Sur, and Alfred 5 is built on Monterey. There could be a change to Apple's underlying XML framework which makes it more strict in Monterey.

 

As the Script Filter XML output has long been deprecated, I can't make any significant changes to this code, so the answer here is to update the XML so that it's valid.

 

For anybody reading this who needs to update the XML, the error is in the 4 <mod lines where there is an invalid additional <mod half way through the line. The correct XML would look like this:

 

<?xml version="1.0" encoding="UTF-8"?>
<items>
    <item arg="tax" autocomplete="tax">
        <title>tax</title>
        <subtitle>NEW TAG</subtitle>
        <icon>tag.png</icon>
        <mod key="ctrl" subtitle="Mark the bookmark as TOREAD."/>
        <mod key="alt" subtitle="Post the bookmark as private."/>
    </item>
    <item arg="syntax" autocomplete="syntax">
        <title>syntax</title>
        <subtitle>4</subtitle>
        <icon>tag.png</icon>
        <mod key="alt" subtitle="Post the bookmark as private."/>
        <mod key="ctrl" subtitle="Mark the bookmark as TOREAD."/>
    </item>
</items>

 

Cheers,

Andrew

Link to comment
Share on other sites

Posted (edited)

OK, the mystery goes deeper!

 

The author says that the output of the workflow is JSON so how on earth did I get the XML.

 

The answer is that i got it from the Alfred debug panel

 

What's going on here? How can a Workflow that produces JSON be displaying XML in the debug panel?

 

alf.png

Edited by gingerbeardman
Link to comment
Share on other sites

I am the workflow's author. I think I figured out why you are getting XML.

The code checks for older version of Alfred to see if they support JSON vs XML

Since you are on a new release of Alfred, it's possible the logic for version check breaks and then code believes it's been run on an older version of Alfred, hence spits out XML. However I have to test this theory to be completely sure.

Link to comment
Share on other sites

Hello @Andrew

This workflow uses a Rust library that follows semantic versioning, Alfred's early access seems to report its version as "5.0 EA5" which is not a "valid" version.

Would it be possible for you, in future releases, to report such versions to be compliant with semantic versioning? something like "5.0.0-EA5" will work.

Meanwhile I will push an update to workflow to take care of special version numbers like this.

 

Thanks

Link to comment
Share on other sites

Posted (edited)

I think it's possible Andrew intended to refer to 5.0.0-EA7 because the most recent build, as you mention, is EA6 which was released a couple of days ago.

 

Stephen

Edited by Stephen_C
To clarify
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...