XMP with XeLaTeX

I got the hyperxmp package to include XMP copyright information with regular LaTeX but with XeLaTeX there seems to be a problem. I need XeLaTeX for its better font support and typographic features. Is there any way to get hyperxmp working with XeLateX?

Here's a stripped-down version of the hyperxmp package documentation example:

\documentclass{article}

\usepackage{hyperxmp}
\usepackage{hyperref}

\title{Paper}
\author{Nomen Nescio}

\hypersetup{
}

\begin{document}

\maketitle

processes in so-called empty space\dots

\end{document}


XeLaTeX gives this:

** WARNING ** Could not find an object definition for "hyxmp@Metadata".
** WARNING ** Interpreting special command object (pdf:) failed.
** WARNING ** >> at page="1" position="(133.768, 524.256)" (in PDF)
** WARNING ** >> xxx "pdf: object @hyxmp@Metadata << /Type /Metadata /Subtype /XML..."
** WARNING ** >> Reading special command stopped around >>stream\x0a<?xpacket begin="\xc3\xaf\xc2\xbb\xc2\xbf" id="W5M...<<
** WARNING ** Unresolved object reference "hyxmp@Metadata" found!!!


When I open the file and look at the properties, there is no copyright information. I have tried with another file that has them and it shows its copyright information.

-
I have moved your answer from the question to the answer space. Feel free to post your own answer containing the same information: I will then delete the 'community wiki' one I have created. –  Joseph Wright Aug 11 '12 at 8:41

You file runs fine with me. I get the copyright information correctly.

Just to show the xetex version (XeTeX: 0.9997)

You have to click the Additional Metadata... button in the above window (picture). The copyright information which I get

Note: It seems that you may have to update your packages.

-
Thank you for trying it out. This clears the issue, I should have thought about it. It seems that many distros have pretty old versions of XeTeX (I tried Ubuntu and Fedora). Nice to know that it will work in the future. –  Tuomo Sipola Mar 23 '12 at 14:10

[Questioner's own answer, moved from a question-edit to here]

Finally! I found out a way to circumvent this. This message by Pablo Rodríguez gives the answer.

There must be both pdfcopyright and pdflicenseurl, otherwise it will not work.

Here is the code for the preamble:

\makeatletter
\renewcommand*{\hyxmp@embed@packet@dvipdfm}{%
\ifxetex{%
\hyxmp@string@len{\hyxmp@xml}%
<<
/Subtype /XML
>>
}%
\special{pdf:put @catalog
<<
>>
}%
}
\else
\hyxmp@string@len{\hyxmp@xml}%
<<
/Subtype /XML
/Length \the\@tempcnta
>>
stream^^J\hyxmp@xml endstream%
}%
\special{pdf: docview
<<