Domanda

I'm here with a question that I hope can be answered, which is really quite silly and basic.

I have a file of authors in the format of:

<authorRoot>
<author>
<info tags on author>
</author>
etc
</authorRoot>

and all I wish to do is, through FLWOR, return a list where each 'author' and its information is a different value, so when I run the query, the result should come out looking like

1. <author><info>.....</info></author>
2. <author><info>.....</info></author>
etc

and I am CERTAIN that something as simple as that should just be the following code

xquery version "1.0";
for $x in //author
return $x

yet when I do so, the query result comes out as

1.<author><info>...</info></author><author><info>...</info></author><author><info>...</info></author><author><info>...</info></author><author><info>...</info></author>....etc

I'm relatively new to XQuery, and I'm using AltovaSpy. I've done similar questions as basic as this (where I have a file of similar layout and I use essentially the same code, resulting in an xquery result page of multiple values, not just one long one) but for this file it just doesn't seem to work! Is it something with my code that I'm just not seeing? Or could it be the file, perhaps?

Thank you for whatever input you have on the situation.

È stato utile?

Soluzione

Well, your reasoning is correct. .

It is just a formatting issue, it seems Altova prints the entire sequence in a single line without linebreaks.

You can also try it in my XQuery online tester, there you can see that the sequence is as you expected it to be.

Altri suggerimenti

If you watch this demo video of Altova XMLSpy and advance to 2:35 you will see how clicking on one of the toolbar buttons (which appears to be labeled "Pretty-print") will format the results of your XQuery as nicely indented XML.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top