Sponsored Content
Top Forums Programming [XQuery] How to Convert from JSON Message to XML Message with XQuery Post 302579855 by tien86 on Tuesday 6th of December 2011 10:19:24 PM
Old 12-06-2011
well i will do it in easier way for my hurry job...

Now, in above example, i can make a loop to get the value column.

John
null
Smith
false
21 2nd Street
....
//in here $string is the restful input message

for $c in fn:tokenize($string, ",") where fn:string-length($c) != 0
let $cut := fn:tokenize($c, ":")[last()]
let $value := fn:replace($cut,"\{|\}","")
let $seq1 := fn:insert-before($seq1,1,$value)
return <param value="{ $value }" />

====================================

So what i want to do now is : create a $seq with value is ("John", "null", "Smith" .... ) . This code is not work. Would you please take a look at my code?

Tien86
 

8 More Discussions You Might Find Interesting

1. Programming

How to limit max no of message in a posix message queue

Hii can anyone pls tell how to limit the max no of message in a posix message queue. I have made changes in proc/sys/fs/mqueue/msg_max But still whenever i try to read the value of max. message in the queue using attr.mq_curmsgs (where struct mq_attr attr) its giving the default value as 10.... (0 Replies)
Discussion started by: mohit3884
0 Replies

2. Shell Programming and Scripting

Need to extract XML message from log

I need help to extract a following SOAP-ENV:Header XML message from the log. XML message need to be extracted: *************************** <SOAP-ENV:Header> <ServiceGatewayHeader> <SourceApplicationId>OXL</SourceApplicationId> <Version>1.0</Version> <UserId>TEST</UserId>... (4 Replies)
Discussion started by: tjshankar
4 Replies

3. Shell Programming and Scripting

Move xml files from unix to message queue.

Hi, I need to move the XML files from the UNIX to the message queue. Please help me out to write the code.. Thanks, Mohana Krishnan (0 Replies)
Discussion started by: krishnan_6015@y
0 Replies

4. UNIX for Dummies Questions & Answers

Unable to extract a tag from a very long XML message

Hi I have a log file which contain XML message. I want to extract the value between the tag : <businessEventId>13201330</businessEventId> i.e., 13201330. I tried the following commands but as the message is very long, unable to do it. Attached is the log file. Please provide inputs. --... (3 Replies)
Discussion started by: Sapna_Sai
3 Replies

5. Programming

Validate queries XQUERY

Hi! I am working in an application jsp-java-xml , and i need to validate queries in xquery. For example If I put (in a text field) "for $x in XXX/yyy return data($x/tittle)" I need a bean(class) that show if the text is correct or not. And, if were posible, show the syntax error too. ... (2 Replies)
Discussion started by: avatarrr
2 Replies

6. Shell Programming and Scripting

Extract XML message from a log file using awk

Dear all I have a log file and the content like this file name: temp.log <?xml version="1.0" encoding="cp850"?> <!DOCTYPE aaabbb SYSTEM '/dtdpath'> <aaabbb> <tranDtl> <msgId>000001</msgId> </tranDtl> ..... </aaabbb> ... ... (1 Reply)
Discussion started by: on9west
1 Replies

7. Programming

[Xquery] How to do a increment in a For loop

Hello men. How can i build a simple increment for $a by Xquery such as ? let $a := 0 for $i in (1 to 10) let $a := $a + 1 return $a why a in this loop always is '1' Thank you for reading, its will really helpful for my job if i can solve this problem :D:D (3 Replies)
Discussion started by: tien86
3 Replies

8. Shell Programming and Scripting

Convert json to xml

Hello everyone, I have created a workflow that will pull down data via a RESTful API in JSON, then my code parses and modifies said data. The problem I have is that these APIs I am working with only accept XML to PUT/POST data, and I am looking for an easy way to convert my JSON file to XML. ... (2 Replies)
Discussion started by: Zaphod_B
2 Replies
basex(1)							 The XML Database							  basex(1)

NAME
basex - XML database system and XPath/XQuery processor (command line mode) SYNOPSIS
basex [-bcdiLosuvVwxz] [query] DESCRIPTION
basex is a fast and powerful, yet light-weight and platform independent XML database system and XPath/XQuery processor. OPTIONS
A short description of option can be obtained from $ basex -h or by browsing http://docs.basex.org/wiki/Startup_Options#BaseX_Standalone DATABASE COMMANDS
A list of supported Database commands can be obtained from $ basex -c help or by browsing http://docs.basex.org/wiki/Commands EXAMPLES
o XQuery evaluation (no database, no interaction, script mode): $ basex -Lq 19+23 42 $ basex -Lq "<answer>{ 23+19 }</answer>" <answer>42</answer> o Import an XML file into database, output its content (query its root) and be verbose: $ basex -Vc "CREATE DB input /usr/share/doc/basex/examples/input.xml; XQUERY /" Database 'input' created in 136.84 ms. <html> <!-- Header --> <head id="0"> <title>XML</title> </head> <!-- Body --> <body id="1" bgcolor="#FFFFFF" text="#000000" link="#0000CC"> <h1>Databases &amp; XML</h1> <div align="right"> <b>Assignments</b> <ul> <li>Exercise 1</li> <li>Exercise 2</li> </ul> </div> </body> <?pi bogus?> </html> Query: / Compiling: Result: root() Parsing: 5.08 ms Compiling: 27.2 ms Evaluating: 0.87 ms Printing: 13.7 ms Total Time: 46.86 ms Hit(s): 1 Item Updated: 0 Items Printed: 358 Bytes Query executed in 42.52 ms. o XPath evaluation (with existing database): $ basex -Lc "OPEN input; XQUERY //li[1]" <li>Exercise 1</li> o Retrieve XML from the web and perform XPath query: $ basex -Lq "doc('http://files.basex.org/examples/input.xml')//li" <li>Exercise 1</li> <li>Exercise 2</li> o W3C XQuery Full-Text (make use of full-text index and perform fuzzy query with a typing error): $ basex BaseX 7.1 [Standalone] Try "help" to get more information. > SET FTINDEX on Full-Text Index: ON > CREATE DB input /usr/share/doc/basex/examples/input.xml Database 'input' created in 94.42 ms. > XQUERY //b[text() contains text 'Asisgnment' using fuzzy] <b>Assignments</b> Query executed in 8.37 ms. o Update the database and show result: > XQUERY delete node //ul Query executed in 2.79 ms. > XQUERY replace value of node //b with 'Debian rules' Query executed in 2.94 ms. > XQUERY //div <div align="right"> <b>Debian rules</b> </div> Query executed in 1.01 ms. o Open an input xml file, execute a query and write result into file: $ basex -Li /usr/share/doc/basex/examples/input.xml -q //div -o out.xml $ cat out.xml <div align="right"> <b>Assignments</b> <ul> <li>Exercise 1</li> <li>Exercise 2</li> </ul> </div> o Query an already existing database called 'input'. If a file named 'input' exists in current working directory it takes precedence: $ basex -Li input -q //div <div align="right"> <b>Assignments</b> <ul> <li>Exercise 1</li> <li>Exercise 2</li> </ul> </div> o Let basex process query input from standard in: $ echo '19+23' | basex -Lq- 42 o Execute commands from script file: $ cat commands.txt create db debian <debian_db/> xquery / list $ basex -LC commands.txt | grep debian <debian_db/> debian 1 4639 debian.xml o Parse non well-formed HTML (needs libtagsoup-java installed): $ cat bad.html <html> <ul> <li>A <li>B </ul> </html> $ basex -c 'set parser html; set htmlopt method=html,nons=true; create db htmldb bad.html' $ basex -q "doc('htmldb')" <html> <body> <ul> <li>A</li> <li>B</li> </ul> </body> </html> For further documentation on how to configure the HTML Parser refer to http://docs.basex.org/wiki/Parsers#HTML_Parser SEE ALSO
basexgui(1), basexserver(1), basexclient(1) ~/.basex BaseX (standalone and server) properties ~/.basexgui BaseX additional GUI properties ~/.basexperm user name, passwords, and permissions ~/.basexevents contains all existing events ~/BaseXData Default database directory ~/BaseXData/.logs Server logs ~/BaseXRepo Package repository BaseX Documentation Wiki: http://docs.basex.org HISTORY
BaseX started as a research project of the Database and Information Systems Group (DBIS) at the University of Konstanz in 2005 and soon turned into a feature-rich open source XML database and XPath/XQuery processor. LICENSE
New (3-clause) BSD License AUTHOR
BaseX is developed by a bunch of people called 'The BaseX Team' <http://basex.org/about-us/> led by Christian Gruen <cg@basex.org>. The man page was written by Alexander Holupirek <alex@holupirek.de> while packaging BaseX for Debian GNU/Linux. 26 June 2012 basex(1)
All times are GMT -4. The time now is 07:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy