Alistair,

That's an annoying error that usually indicates there's bad data in the 
XML you're trying to PUT.

I see two mistakes in your attempt:

1)  You shouldn't wrap your datastream in FOXML.  Just PUT the plain old 
xml you want to be in the datastream;  the metadata you encode in the 
FOXML should be passed as query string parameters in the REST URL.

https://wiki.duraspace.org/display/FEDORA36/REST+API#RESTAPI-modifyDatastream

2)  Your namespace declaration is incorrect in your dcterms XML.  It 
should read:

<dct:dcterms xmlns:dct="http://purl.org/dc/terms/";>

I was able to successfully update a test datastream in a test object I 
created containing your datastream using the following curl command:

curl -i -X PUT --upload-file t2.xml -u fedoraAdmin:XXXXXX 
'http://localhost:8080/fedora/objects/test:t1/datastreams/DCTERMS?dsLabel=DCMI%20Record&versionable=false&dsState=A&mimeType=text/xml'

Here are the contents of the file t2.xml that I PUT with that command:

<dct:dcterms xmlns:dct="http://purl.org/dc/terms/";>
   <dct:title>Test</dct:title>
   <dct:description>Test</dct:description>
   <dct:creator>Test</dct:creator>
   <dct:date>2012-09-26 12:23:32</dct:date>
   <dct:format>application/zip</dct:format>
   <dct:identifier>_6666</dct:identifier>
   <dct:rights>Third party license - read attached terms and 
conditions</dct:rights>
   <dct:publisher>Test</dct:publisher>
   <dct:subject>Test1</dct:subject>
   <dct:subject>Test2</dct:subject>
</dct:dcterms>

Hope this helps,

-- Scott

On 09/26/2012 06:51 AM, Alistair Young wrote:
> I tried extracting the existing datastream, writing to file and sending
> it straight back as-is, as mentioned here:
> http://fedora-commons.1317035.n2.nabble.com/Error-Content-is-not-allowed-in-prolog-td5065394.html
> but it's the same error.:
>
> 'Content is not allowed in prolog'
>
> Alistair
>
> --
> mov eax,1
> mov ebx,0
> int 80h
>
> From: Alistair Young <[email protected]
> <mailto:[email protected]>>
> Reply-To: "Support and info exchange list for Fedora users."
> <[email protected]
> <mailto:[email protected]>>
> Date: Wednesday, 26 September 2012 12:26
> To: "Support and info exchange list for Fedora users."
> <[email protected]
> <mailto:[email protected]>>
> Subject: [fcrepo-user] Example file for modifyDatastream
>
> Would anyone have an example for the multipart file for REST API-M
> modifyDatastream?
>
> I'm sending this but getting 'Content is not allowed in prolog':
>
> <?xml version="1.0"?>
> <fox:datastream … ID="DCTERMS" STATE="A" CONTROL_GROUP="X"
> VERSIONABLE="false">
> <fox:datastreamVersion ID="DCTERMS.0" MIMETYPE="text/xml" LABEL="DCMI
> Record">
> <fox:xmlContent>
> <dct:dcterms xmlns:dcterms="http://purl.org/dc/terms/";
> <http://purl.org/dc/terms/";>>
> <dct:title>Test</dct:title>
> <dct:description>Test</dct:description>
> <dct:creator>Test</dct:creator>
> <dct:date>2012-09-26 12:23:32</dct:date>
> <dct:format>application/zip</dct:format>
> <dct:identifier>_6666</dct:identifier>
> <dct:rights>Third party license - read attached terms and
> conditions</dct:rights>
> <dct:publisher>Test</dct:publisher>
> <dct:subject>Test1</dct:subject>
> <dct:subject>Test2</dct:subject>
> </dct:dcterms>
> </fox:xmlContent>
> </fox:datastreamVersion>
> </fox:datastream>
>
> thanks,
>
> Alistair
>
> --
> mov eax,1
> mov ebx,0
> int 80h
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>
> _______________________________________________
> Fedora-commons-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users


-- 
Scott Prater
Shared Development Group
General Library System
University of Wisconsin - Madison
[email protected]
5-5415


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to