So you're struggling with Links and not anchors?
Where do you input spacename.pagename#Hmyheading ?
In a wiki page? From:
http://www.xwiki.org/xwiki/bin/view/XWiki/XWikiSyntax#HLinks I see that the syntax of a link with an anchor is different:
So your link should be [[a
label>>spacename.pagename||anchor=Hmyheading]] (which is written just