Hi Everyone, Still in my quest to make angularjs and basex work without other serverside solutions.
I'm trying to copy a node and to update an attribute before adding it to the db.
(:~
: Add datamodel node types
:)
declare
%rest:path("/addNodeTypes")
%output:method("json")
%output:json("format=attributes")
%output:json("lax=yes")
function _:addNodeTypes(
) {
let $db := db:open("simplePLM_test1")
let $insert-node := $db//objectType[@name="nodes"]/template/nodeType
return
copy $copyNode := $insert-node
modify (
replace value of node $insert-node/@id with 100,
insert node $insert-node as first into $db//nodeTypes
)
return $copyNode
};
The syntax seems ok but I get this error which I don't really understand :
<title>Error 400 Stopped at C:/Program Files (x86)/BaseX/webapp/BOM/BOM.xqm, 85/55:
[XUDY0014] db:open-pre("simplePLM_test1",17) was not created by copy clause.</title>
</head>
<body><h2>HTTP ERROR 400</h2>
<p>Problem accessing /addNodeTypes. Reason:
<pre> Stopped at C:/Program Files (x86)/BaseX/webapp/BOM/BOM.xqm, 85/55:
[XUDY0014] db:open-pre("simplePLM_test1",17) was not created by copy clause.</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
does any one know where I'm wrong?