Hash character in XML element name

I'm running into an issue where I need to use a hashtag in the name of an XML node, and the hashtag is causing parsing errors. I've tried encoding the # without luck, perhaps I implemented the coding wrong.

<?xml version="1.0" encoding="UTF-8"?> <dataset> <properties#tags pk1="1" pk2="1" /> </dataset> 

1 Answer

According to the XML specification, # is not a valid character in an XML name, so it won't work. You need to find another character.

Even trying to encode with &#35; or &#x23; for # will not allow you to use a character that isn't valid for an XML name.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like