{"action":"opened","issue":{"url":"https://api.github.com/repos/marklogic/java-client-api/issues/918","repository_url":"https://api.github.com/repos/marklogic/java-client-api","labels_url":"https://api.github.com/repos/marklogic/java-client-api/issues/918/labels{/name}","comments_url":"https://api.github.com/repos/marklogic/java-client-api/issues/918/comments","events_url":"https://api.github.com/repos/marklogic/java-client-api/issues/918/events","html_url":"https://github.com/marklogic/java-client-api/issues/918","id":320400270,"number":918,"title":"Missing namespace in properties","user":{"login":"brunovianarezende","id":487537,"avatar_url":"https://avatars1.githubusercontent.com/u/487537?v=4","gravatar_id":"","url":"https://api.github.com/users/brunovianarezende","html_url":"https://github.com/brunovianarezende","followers_url":"https://api.github.com/users/brunovianarezende/followers","following_url":"https://api.github.com/users/brunovianarezende/following{/other_user}","gists_url":"https://api.github.com/users/brunovianarezende/gists{/gist_id}","starred_url":"https://api.github.com/users/brunovianarezende/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brunovianarezende/subscriptions","organizations_url":"https://api.github.com/users/brunovianarezende/orgs","repos_url":"https://api.github.com/users/brunovianarezende/repos","events_url":"https://api.github.com/users/brunovianarezende/events{/privacy}","received_events_url":"https://api.github.com/users/brunovianarezende/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-04T19:31:52Z","updated_at":"2018-05-04T19:31:52Z","closed_at":null,"author_association":"NONE","body":"### Version of MarkLogic Java Client API: 4.0.1\r\n### Version of MarkLogic Server: 9.0.4\r\n### Java version: openjdk version \"1.8.0_161\"\r\n### OS and version: Cent0S version 7\r\n\r\nNot sure if this is an issue in java-client-api or mlcp. I'll report it here, please correct me if I'm wrong.\r\n\r\nI'm trying to save a document with properties by using java and after a lot of debugging I see that what is sent as metadata to MarkLogic rest api is something like:\r\n\r\n```\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?><rapi:metadata xmlns:rapi=\"http://marklogic.com/rest-api\" xmlns:prop=\"http://marklogic.com/xdmp/property\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"><prop:properties><schemaVersion xsi:type=\"xs:string\">1.0</schemaVersion><test xsi:type=\"xs:string\">my test1</test></prop:properties></rapi:metadata>\r\n```\r\n\r\nas you can see, the `xs:` prefix is defined in the document. If I go to query console and check the properties of the related document, by using `xdmp:document-properties`, I get:\r\n\r\n```\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<prop:properties xmlns:prop=\"http://marklogic.com/xdmp/property\">\r\n  <schemaVersion xsi:type=\"xs:string\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">1.0</schemaVersion>\r\n  <test xsi:type=\"xs:string\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">my test1</test>\r\n</prop:properties>\r\n```\r\nnote that there is no `xs` definition.\r\n\r\nI then use mlcp to export the content from the database:\r\n\r\n`mlcp.sh export -host localhost -port 8000 -username user -password password -output_file_path /var/opt/MarkLogic/path -output_type archive`\r\n\r\nand when I try to re-import:\r\n\r\n`mlcp.sh import -host localhost -port 8000 -username user -password password -input_file_path /var/opt/MarkLogic/path/ -input_file_type archive -input_compressed true`\r\n\r\nI get the error `ERROR contentpump.DatabaseContentWriter: Error setting document properties for data://.../c6a13df8-6f85-e06c-0000-5ae9faffcbb0.json: No namespace binding for prefix`.\r\n\r\nI reported this error at mlcp (https://github.com/marklogic/marklogic-contentpump/issues/76#issuecomment-386377504) and got as an answer: \r\n\r\n> In your property, you missed namespace declaration for xs.\r\n\r\nI then changed the content of the document, by using query console and `xdmp:document-set-properties`:\r\n\r\n```\r\nreturn xdmp:document-set-properties(\r\n  \"data://development-tenant/patients/340c82e5-1885-dc2b-0000-0000d4190e28.json\",\r\n<prop:properties xmlns:prop=\"http://marklogic.com/xdmp/property\">\r\n  <schemaVersion xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xsi:type=\"xs:string\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">1.0</schemaVersion>\r\n  <test xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xsi:type=\"xs:string\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">my test1</test>\r\n</prop:properties>)\r\n```\r\nnote that I defined the `xs` prefix. And when I use  `xdmp:document-properties` I get exactly what I set:\r\n\r\n```\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<prop:properties xmlns:prop=\"http://marklogic.com/xdmp/property\">\r\n  <prop:properties>\r\n    <schemaVersion xsi:type=\"xs:string\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">1.0</schemaVersion>\r\n    <test xsi:type=\"xs:string\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">my test1</test>\r\n  </prop:properties>\r\n</prop:properties>\r\n```\r\n\r\nbesides that, now the mlcp export and import works without any problem.\r\n\r\nGiven the info above, I wonder who is the culprit:\r\n\r\n1. mlcp for requiring the `xs` namespace definition\r\n2. java-client-api for not sending some info (although I believe it sends all)\r\n3. rest-api for not saving the `xs` namespace definition\r\n4. me for being doing something wrong"}}
{"actor":{"display_login":"brunovianarezende"}}