-
Notifications
You must be signed in to change notification settings - Fork 72
Implementations of innerSerialize lack proper namespace #1537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @ralfhergert - to confirm, I think you are identifying an enhancement and a bug:
Is that correct? For the first item - just to clarify, the existing |
Hi @rjrudin. Yes my issue is both, a feature request and a bug issue. I think they are connected: as soon as a method like Concering the class, since |
Thanks @ralfhergert , you're right - We've captured both the enhancement request and the bug report. We'll let you know soon about either a 6.1.x bug release for the latter or a 6.2.0 for both. |
Thank you for the notification, Rob Rudin!
I'm looking forward to 6.2.0 and will come back if issues arrise.
Best regards
Am Di., 28. März 2023 um 15:12 Uhr schrieb Rob Rudin <
***@***.***>:
… Hi @ralfhergert <https://github.com/ralfhergert> - we're planning our
6.2.0 release and looking to include this. Just wanted to confirm - when I
use the existing serialize() method to write a query to a String, I don't
run into any issues with incorrect namespaces. So the existing serialize()
feature seems to be working correctly. The bug you pointed out then is
something we're likely to run into when we try to support
serialize(XMLStreamWriter), correct?
So basically, this is an enhancement request to support
serialize(XMLStreamWriter), and you're also giving us a heads' up that we
may run into issues with incorrect namespaces in the output of that method?
—
Reply to this email directly, view it on GitHub
<#1537 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDY7UDT4PSWZ7BT2CR2L4DW6LPTXANCNFSM6AAAAAAVU7BS2Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Viele Grüße
Ralf Hergert
--
Ferdinand-Weiß-Str. 123a
79106 Freiburg
+49 151 20295146
+49 761 2171323
|
Hey @ralfhergert - we're planning our 6.2.0 release and looking to include this. Do you have a code snippet to share where you're using |
Ah - I see why |
@ralfhergert Take a look at the simple test I wrote in 4373679 . That produces the correct result, but it relies on the user doing the following:
If you do that, then I'm wondering if those requirements are feasible for you though - particularly the need for a wrapper element. If not, I am thinking it would be necessary to modify the existing serialization implementation so that the Search namespace is always applied when an element is started. That's feasible, I just wanted to check on the above approach with you first. |
Hmm - having said the above, it looks simple to just modify the few dozen places where the Java Client starts an element so that the Search namespace is always used. I can't think of any downsides to this. I did some testing of this with a default namespace, and STaX behaves the way you'd expect - i.e. if the default namespace is the Search namespace, it won't e.g. create a new namespace prefix or anything funky like that. So I'm now thinking the right way to address this is:
|
@ralfhergert Sorry one more question - is your use case here to construct a combined query document - e.g. https://docs.marklogic.com/guide/rest-dev/search#id_84389 - using STaX? Or are you constructing some other kind of document? |
Resolved via #1543 . We'll release 6.2.0 soon. |
@ralfhergert 6.2.0 is now available, though we're still in the process of updating the Javadocs. But the method you're looking for is now there. |
(Concerning marklogic-java-client in 6.1.0) The StructuredQueryBuilder currently only allows to serialize a given StructuredQueryDefinition into a String. In cases in which the query needs to be embedded into another XML this makes it necessary to parse the query again.
Here I would kindly request the following feature: Could you please create a public accessible method like:
StructuredQueryBuilder#serialize(XMLStreamWriter)
?This would vastly improve the possibilities for serialization. For instance org.jdom2.input.StAXStreamWriter could be used to directly serialize a query into a JDOM.
Meanwhile to get access to the method
java-client-api/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
Line 1239 in c3dc589
StructuredQueryBuilder
.By using org.jdom2.input.StAXStreamWriter we noticed, that the namespaces are wrong. What should look like
was created as:
Notice how the default namespace on
word-query
is reset.If not mistaken I would believe this is due to the fact that the elements (like the word-query) are created with no namespaceUri. c.f.
java-client-api/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
Line 1851 in c3dc589
Shouldn't it?
The text was updated successfully, but these errors were encountered: