![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
This is content of xml file : ?xml version="1.0" standalone="yes"? dstSifarnici xmlns="http://tempuri.org/dstSifarnici.xsd" TipLecenja Sifra>1</Sifra Oznaka>A</Oznaka Opis>Ambulantno</Opis /TipLecenja TipLecenja Sifra>2</Sifra Oznaka>S</Oznaka Opis>Stacionarno</Opis /TipLecenja /dstSifarnici I try with : create variable x XML; select xp_read_file('d:\xml\ef_vrsta.xml') into x; select * from openxml(x,'//*') with (sifra int ':mp:Sifra'); OK last statement is something i need, but i don't know how to write SELECT with openxml. Result of select should be: 1,A,Ambulantno 2,S,Stacionarno TIA |
#3
| |||
| |||
|
|
If you include: xmlns="http://tempuri.org/dstSifarnici.xsd" it doesn't seem to work however. |
|
Hi, I found that this works: select * from openxml('<dstSifarnici><TipLecenja><Sifra>1</Sifra><Oznaka>A</Oznaka><Opis>Ambulantno</Opis></TipLecenja><TipLecenja><Sifra>2</Sifra><Oznaka>S</Oznaka><Opis>Stacionarno</Opis></TipLecenja></dstSifarnici>','/dstSifarnici/TipLecenja') WITH ( Sifra CHAR(2000) 'Sifra', Oznaka CHAR(16) 'Oznaka', Opis CHAR(32) 'Opis'); If you include: xmlns="http://tempuri.org/dstSifarnici.xsd" it doesn't seem to work however. Bofcilo wrote: This is content of xml file : ?xml version="1.0" standalone="yes"? dstSifarnici xmlns="http://tempuri.org/dstSifarnici.xsd" TipLecenja Sifra>1</Sifra Oznaka>A</Oznaka Opis>Ambulantno</Opis /TipLecenja TipLecenja Sifra>2</Sifra Oznaka>S</Oznaka Opis>Stacionarno</Opis /TipLecenja /dstSifarnici I try with : create variable x XML; select xp_read_file('d:\xml\ef_vrsta.xml') into x; select * from openxml(x,'//*') with (sifra int ':mp:Sifra'); OK last statement is something i need, but i don't know how to write SELECT with openxml. Result of select should be: 1,A,Ambulantno 2,S,Stacionarno TIA |
#4
| |||
| |||
|
|
*> If you include: *xmlns="http://tempuri.org/dstSifarnici.xsd" it *> doesn't seem to work however. This is likely because I can't find the page even through a web browser. Kory Hodgson (Sybase iAnywhere) wrote: Hi, I found that this works: select * from openxml('<dstSifarnici><TipLecenja><Sifra>1</Sifra><Oznaka>A</Oznaka><Opis>Ambulantno</Opis></TipLecenja><TipLecenja><Sifra>2</Sifra><Oznaka>S</Oznaka><Opis>Stacionarno</Opis></TipLecenja></dstSifarnici>','/dstSifarnici/TipLecenja') WITH ( Sifra * *CHAR(2000) * *'Sifra', * * * *Oznaka * CHAR(16) * *'Oznaka', * * * *Opis * * CHAR(32) * *'Opis'); If you include: *xmlns="http://tempuri.org/dstSifarnici.xsd" it doesn't seem to work however. Bofcilo wrote: This is content of xml file : ?xml version="1.0" standalone="yes"? dstSifarnici xmlns="http://tempuri.org/dstSifarnici.xsd" * <TipLecenja * * <Sifra>1</Sifra * * <Oznaka>A</Oznaka * * <Opis>Ambulantno</Opis * </TipLecenja * <TipLecenja * * <Sifra>2</Sifra * * <Oznaka>S</Oznaka * * <Opis>Stacionarno</Opis * </TipLecenja /dstSifarnici I try with : create variable x XML; select xp_read_file('d:\xml\ef_vrsta.xml') into x; select * from openxml(x,'//*') with (sifra int ':mp:Sifra'); OK last statement is something i need, but i don't know how to write SELECT with openxml. Result of select should be: 1,A,Ambulantno 2,S,Stacionarno TIA |
. Hidden.
#5
| |||
| |||
|
|
On Nov 24, 7:38 pm, "Kory Hodgson (Sybase iAnywhere)" khodgson (AT) A_SPAM_FREE_sybase (DOT) com> wrote: If you include: xmlns="http://tempuri.org/dstSifarnici.xsd" it doesn't seem to work however. This is likely because I can't find the page even through a web browser. Kory Hodgson (Sybase iAnywhere) wrote: Hi, I found that this works: select * from openxml('<dstSifarnici><TipLecenja><Sifra>1</Sifra><Oznaka>A</Oznaka><Opis>Ambulantno</Opis></TipLecenja><TipLecenja><Sifra>2</Sifra><Oznaka>S</Oznaka><Opis>Stacionarno</Opis></TipLecenja></dstSifarnici>','/dstSifarnici/TipLecenja') WITH ( Sifra CHAR(2000) 'Sifra', Oznaka CHAR(16) 'Oznaka', Opis CHAR(32) 'Opis'); If you include: xmlns="http://tempuri.org/dstSifarnici.xsd" it doesn't seem to work however. Bofcilo wrote: This is content of xml file : ?xml version="1.0" standalone="yes"? dstSifarnici xmlns="http://tempuri.org/dstSifarnici.xsd" TipLecenja Sifra>1</Sifra Oznaka>A</Oznaka Opis>Ambulantno</Opis /TipLecenja TipLecenja Sifra>2</Sifra Oznaka>S</Oznaka Opis>Stacionarno</Opis /TipLecenja /dstSifarnici I try with : create variable x XML; select xp_read_file('d:\xml\ef_vrsta.xml') into x; select * from openxml(x,'//*') with (sifra int ':mp:Sifra'); OK last statement is something i need, but i don't know how to write SELECT with openxml. Result of select should be: 1,A,Ambulantno 2,S,Stacionarno TIA Thanks, it's work. By the way, I did try some version of code from User guide. In the meantime I crash on something because I hate Microsoft. The part <<xmlns="http://tempuri.org/dstSifarnici.xsd" was deleted from my XML, and iSQL still return error ... Notepad add "BOM" on the beginning of XML . Hidden.So, another question... How to setup code page of XML ?? Importing data from XML works, but with wrong code page. |
![]() |
| Thread Tools | |
| Display Modes | |
| |