Issue with linebreak using REST since 7.7.1
Tuesday, 24 September 2013 · 2 messages · last reply 25 Sep 2013
YM
Yoann Maingon24 Sep 2013 14:19 #
Hi,
I've got a simple node move PHP script (sorry for my terrible code, I'm an electronician!)
1. // get the node
2. $xquery = "XQUERY //noteitem[@id='$movedID']";
3. $saveNode = $session->execute($xquery);
4.
5. // delete the node
6. $xquery = "XQUERY delete node //noteitem[@id='$movedID']";
7. $content = $session->execute($xquery);
8. // insert the node
9. if ($nextID == 'last') {
10. $xquery =
"XQUERY insert node ($saveNode) as last into
//meeting[@id='$meetingID']/items "
;
11. $content = $session->execute($xquery);
12. } else {
13. echo $saveNode;
14. $xquery =
"XQUERY insert node ($saveNode) before
//meeting[@id='$meetingID']/items/noteitem[@id='$nextID'] "
;
15. $content = $session->execute($xquery);
16. }
17. $contentFull = "<MN>$content</MN>";
18. echo $contentFull;If I look into the content that is saved, deleted and inserted I have the following:
<noteitem status="new" commentsCounter="0" created_on="Tue, 24 Sep 13
12:09:29 +0000" modified_on="Tue, 24 Sep 13 12:09:29 +0000"
id="MnNo524180f9587c1" genid="MnNo524180f9587c1" owner="1" type="question">
<notecontent>...</notecontent>
</noteitem>It worked fine until the latest update. Where apparently the query breaks with the line break.
It creates an error saying that the closing </noteitem> tag is missing. Just got back to 7.6 and it works well.
any idea?
Yoann Maingon
CEO - mydatalinx
+33664324966
CG
Christian Grün25 Sep 2013 10:51 #
Dear Yoann,
I tried to reproduce your example, using the following query:
$session = new Session("localhost", 1984, "admin", "admin");
$xml = $session->execute("XQUERY <x><y/></x>");
print $xml;
$session->execute("XQUERY insert node $xml into <xml/>");
$session->close();This one runs without problems on my machine; can you run it, too?
If it fails, it could well be that you were running the code with an older snapshot (I remember there was an issue with line breaks). You could also try the very latest snapshot [2].
It it succeeds, it could well be that I’ve probably misinterpreted the problem, and it would be great if you could provide us with a little example that runs out of the box.
Thanks,
Christian
[1] http://files.basex.org/releases/latest/
___________________________
2013/9/24 Yoann Maingon <yoann.maingon at mydatalinx.com>:
Quoted text · Yoann Maingon · 52 lines
> Hi, > > I've got a simple node move PHP script (sorry for my terrible code, I'm an > electronician!) > > // get the node > $xquery = "XQUERY //noteitem[@id='$movedID']"; > $saveNode = $session->execute($xquery); > > // delete the node > $xquery = "XQUERY delete node //noteitem[@id='$movedID']"; > $content = $session->execute($xquery); > // insert the node > if ($nextID == 'last') { > $xquery = "XQUERY insert node ($saveNode) as last into > //meeting[@id='$meetingID']/items "; > $content = $session->execute($xquery); > } else { > echo $saveNode; > $xquery = "XQUERY insert node ($saveNode) before > //meeting[@id='$meetingID']/items/noteitem[@id='$nextID'] "; > $content = $session->execute($xquery); > } > $contentFull = "<MN>$content</MN>"; > echo $contentFull; > > > If I look into the content that is saved, deleted and inserted I have the > following: > > <noteitem status="new" commentsCounter="0" created_on="Tue, 24 Sep 13 > 12:09:29 +0000" modified_on="Tue, 24 Sep 13 12:09:29 +0000" > id="MnNo524180f9587c1" genid="MnNo524180f9587c1" owner="1" type="question"> > <notecontent>...</notecontent> > </noteitem> > > It worked fine until the latest update. Where apparently the query breaks > with the line break. > It creates an error saying that the closing </noteitem> tag is missing. > Just got back to 7.6 and it works well. > > any idea? > > Yoann Maingon > CEO - mydatalinx > +33664324966 > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery