Could not open file, it was not valid XML error

34 views
Skip to first unread message

Suhas K

unread,
Apr 16, 2025, 4:51:40 AMApr 16
to Ukelele Users
I am trying to create a keyboard for my mothertongue (Kannada) in the Dvorak format, so I thought of trying to use the "New from Current Input Source" on Kannada - Standard and then using the drag and drop feature. However, I get this error. Why is this happening? What can I do to have this error not occur?
I am on macOS Ventura 13.7.4.

John Brownie

unread,
Apr 16, 2025, 6:54:58 AMApr 16
to ukelel...@googlegroups.com
The usual way to fix this is to go to the Settings window and turn on the option to have non-ASCII characters encoded for XML. There’s some sort of bug in Apple’s XML parser that occasionally rejects valid XML due to some valid Unicode code point.

John

Suhas K

unread,
Apr 16, 2025, 7:11:39 AMApr 16
to Ukelele Users
Apologies if this is a little silly, but I can't find that setting in the settings screen of Ukelele or the System Settings. Where would I find this setting?

John Brownie

unread,
Apr 16, 2025, 7:19:08 AMApr 16
to ukelel...@googlegroups.com

You want to set “XML has code points (e.g. ⌘)”.

--
You received this message because you are subscribed to the Google Groups "Ukelele Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukelele-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ukelele-users/f1c9d8cd-135b-42ad-98ab-fd08ba798375n%40googlegroups.com.

Suhas K

unread,
Apr 16, 2025, 7:21:48 AMApr 16
to Ukelele Users
Ah, alright. What exactly is the difference between these two modes?

Suhas K

unread,
Apr 16, 2025, 7:23:25 AMApr 16
to Ukelele Users
I enabled that, it still shows the same error.

John Brownie

unread,
Apr 16, 2025, 7:26:18 AMApr 16
to ukelel...@googlegroups.com
Did you save the file again? Make some simple change, save, then undo the change and save again. That will force the file to be rewritten with the code points.

Suhas K

unread,
Apr 16, 2025, 7:43:00 AMApr 16
to Ukelele Users
I don't have any file for the keyboard that I am trying to capture if that is the file you mean. I tried what you suggested on a different layout and then try to capture the input source, but that also seems to not be working.

Gé van Gasteren

unread,
Apr 16, 2025, 7:52:17 AMApr 16
to ukelel...@googlegroups.com
Hi Suhas, John,

I tried to import the Kannada layouts into Ukelele, and indeed, both the Inscript and the Qwerty layouts give the error "Invalid XML".
Only the Transliteration layout can be imported with "New From Current Input Source".

I guess this is because the other two aren’t simple keyboard layouts but more complex Input Methods, meaning they can’t be edited in Ukelele?

--
You received this message because you are subscribed to the Google Groups "Ukelele Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukelele-user...@googlegroups.com.

Suhas K

unread,
Apr 16, 2025, 7:55:26 AMApr 16
to Ukelele Users
There is a transcription layout available? Could you tell what the name of that is or link that to me? I checked both Kannada - Standard and Kannada - QWERTY, those are the only two available and neither are transcription.

John Brownie

unread,
Apr 16, 2025, 7:56:06 AMApr 16
to ukelel...@googlegroups.com
I see that it’s a different problem. Unfortunately, there’s a bug somewhere in the Apple code that gets used to create the XML file from the current keyboard input source, so that it sometimes generates XML that it claims is invalid, and so the conversion fails. There’s currently no way around this problem.

What is the source keyboard layout? If I have it on my computer, I can try to see what happens, though I’m on Sequoia rather than Ventura.

Suhas K

unread,
Apr 16, 2025, 8:03:16 AMApr 16
to Ukelele Users
The keyboard layout I want is "Kannada - Standard".

Gé van Gasteren

unread,
Apr 16, 2025, 8:07:28 AMApr 16
to ukelel...@googlegroups.com
On Wed, Apr 16, 2025 at 1:55 PM Suhas K <suhas...@gmail.com> wrote:
There is a transcription layout available? Could you tell what the name of that is or link that to me? I checked both Kannada - Standard and Kannada - QWERTY, those are the only two available and neither are transcription.

Maybe Apple added that after Ventura.
I attach the bundle resulting from importing Sequoia’s layout "Kannada – Transliteration" into Ukelele.

In Sequoia, there is no "Kannada Standard":
image.png


Kannada Transliteration (copied from Sequoia).bundle.zip

Tom

unread,
Apr 16, 2025, 8:41:35 AMApr 16
to Ukelele Users
Inscript and Standard are the same thing.

John Brownie

unread,
Apr 16, 2025, 8:46:11 AMApr 16
to ukelel...@googlegroups.com
After a lot of digging, I discovered that the Kannada - InScript keyboard layout has an invalid character as the terminator for one of the states, U+FFFF. That causes the XML parser to reject the file. Given that the keyboard layout is illegal, it’s no surprise that the form converted to XML doesn’t work, either. The only way to deal with this is to work from a fixed form of the XML. I’ve attached the fixed version.

John
Kannada – InScript.keylayout

Gé van Gasteren

unread,
Apr 16, 2025, 9:18:01 AMApr 16
to ukelel...@googlegroups.com
So I learned two things today – I think:
• It seems "real" input methods are only needed for CJK and similarly complex scripts, these days.
• The error "Invalid XML" isn’t coming from Apple’s conversion software, but from Ukelele – meaning that John has a way to get at the "raw" XML from converted macOS keyboard layouts.

On Wed, Apr 16, 2025 at 2:46 PM 'John Brownie' via Ukelele Users <ukelel...@googlegroups.com> wrote:
After a lot of digging, I discovered that the Kannada - InScript keyboard layout has an invalid character as the terminator for one of the states, U+FFFF. That causes the XML parser to reject the file. Given that the keyboard layout is illegal, it’s no surprise that the form converted to XML doesn’t work, either. The only way to deal with this is to work from a fixed form of the XML. I’ve attached the fixed version.

John

--
You received this message because you are subscribed to the Google Groups "Ukelele Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukelele-user...@googlegroups.com.

John Brownie

unread,
Apr 16, 2025, 9:35:30 AMApr 16
to ukelel...@googlegroups.com
Yes, the operation looks like this:
  • Save the current keyboard input source as a ‘uchr' resource in a file
  • Run Apple’s tool to turn that into an XML file
  • Read the XML file to create the Ukelele document
Ukelele deletes the XML file after reading it in, so it’s not available unless you can run Ukelele in the debugger and put in a breakpoint so that you can copy the file elsewhere…

John 

Gé van Gasteren

unread,
Apr 16, 2025, 10:11:12 AMApr 16
to ukelel...@googlegroups.com
On Wed, Apr 16, 2025 at 3:35 PM 'John Brownie' via Ukelele Users <ukelel...@googlegroups.com> wrote:
Yes, the operation looks like this:
  • Save the current keyboard input source as a ‘uchr' resource in a file
  • Run Apple’s tool to turn that into an XML file
  • Read the XML file to create the Ukelele document
Ukelele deletes the XML file after reading it in, so it’s not available unless you can run Ukelele in the debugger and put in a breakpoint so that you can copy the file elsewhere…


Thanks for that :-)

Now I think of it, it was obvious, because before the conversion, it’s not XML, so it can’t be "invalid XML".

Is it possible that "uchr" has been the resource name for the last 40 years?
I seem to remember that name from fiddling around with keyboard resources using ResEdit.

John Brownie

unread,
Apr 16, 2025, 10:36:13 AMApr 16
to ukelel...@googlegroups.com
Yes, the original resources were KCHR, which could only output single 8-bit characters, while uchr was developed to support Unicode.

Gé van Gasteren

unread,
Apr 16, 2025, 10:53:09 AMApr 16
to ukelel...@googlegroups.com
Right, "kchr" it was back then!
image.png


--
You received this message because you are subscribed to the Google Groups "Ukelele Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukelele-user...@googlegroups.com.

Suhas K

unread,
Apr 16, 2025, 12:37:27 PMApr 16
to Ukelele Users
I tried this out, it seems to not be transliterating. Why would that be?

Tom

unread,
Apr 16, 2025, 12:42:17 PMApr 16
to Ukelele Users
I think transliteration keyboards for Indic scripts are also "input methods", like CJK.  They rely on a dictionary of possible matches to the Latin input sequence.  So a custom layout may not work.  T

Gé van Gasteren

unread,
Apr 16, 2025, 1:06:52 PMApr 16
to ukelel...@googlegroups.com
On Wed, Apr 16, 2025 at 6:42 PM Tom <thge...@gmail.com> wrote:
I think transliteration keyboards for Indic scripts are also "input methods", like CJK.  They rely on a dictionary of possible matches to the Latin input sequence.  So a custom layout may not work.  T

On Wednesday, April 16, 2025 at 9:37:27 AM UTC-7 Suhas K wrote:
I tried this out, it seems to not be transliterating. Why would that be?


Now that John has fixed the "Kannada – Standard" layout for you, that is your best bet.
If you’re not used to InScript, don’t worry, you’ll learn it quickly.

Suhas K

unread,
Apr 16, 2025, 1:27:40 PMApr 16
to Ukelele Users
Yeah, I figured that was the issue. I anyways plan on remapping the keys to suit my needs in Dvorak, so probably won't ever end up using the inscript one (except on my phone). Thanks a bunch for your help guys!

Gé van Gasteren

unread,
Apr 16, 2025, 3:15:04 PMApr 16
to ukelel...@googlegroups.com
On Wed, Apr 16, 2025 at 7:27 PM Suhas K <suhas...@gmail.com> wrote:
Yeah, I figured that was the issue. I anyways plan on remapping the keys to suit my needs in Dvorak, so probably won't ever end up using the inscript one (except on my phone). Thanks a bunch for your help guys!

No problem! But please help me a little here ;-)
I don’t really understand the problem with InScript.

Dvorak may be optimized for typing English, but certainly not for Kannada.
Also, the alphabets are so different that I don’t think you can create a keyboard layout that looks somewhat like Dvorak.

I’d say you might as well bite the bullet and get used typing in InScript, no?

Tom

unread,
Apr 16, 2025, 3:21:57 PMApr 16
to Ukelele Users
On the phone, is the transliteration keyboard not a lot easier?  Or does it have some drawbacks?

Rajanna M

unread,
Apr 16, 2025, 3:30:30 PMApr 16
to ukelel...@googlegroups.com, Ukelele Users
Hello Suhas

What layout are you trying to build for Kannada?

On Apr 16, 2025, at 12:27 PM, Suhas K <suhas...@gmail.com> wrote:

Yeah, I figured that was the issue. I anyways plan on remapping the keys to suit my needs in Dvorak, so probably won't ever end up using the inscript one (except on my phone). Thanks a bunch for your help guys!
--
You received this message because you are subscribed to the Google Groups "Ukelele Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukelele-user...@googlegroups.com.

Tom

unread,
Apr 16, 2025, 3:32:47 PMApr 16
to Ukelele Users
People used to typing English can find the arrangement of Inscript pretty awkward, so Apple normally also provides qwerty versions of Indic keyboards.  I can see how someone used to typing English with Dvorak would welcome that layout for Kannada too.  I once made a Dvorak layout for Hindi for someone long ago.
Reply all
Reply to author
Forward
0 new messages