archerz Posted October 20, 2011 Report Share Posted October 20, 2011 Sveiki. Ir PHP MYSQL web lapa kas domata pavadzimjuizrakstisanai, datu apstradei. Nepieciesams izveidot datu importu/exportu lai sagatavoto informaciju varetu importet/exportet uz/no gramatvedibas programmam (sakuma xml formata, velak CSV, xls) Ludzu sniegt ieteikumus pa kuru celu labak/vieglak iet: sakuma importejamos datus (no xml, xls, ...) konvertet uz csv(vai ko citu), tad no izveidota csv faila importet web lapa vai katram formatam taisit savu importu? ka izveidot xml failu no MySQL pieprasijuma? Archers Quote Link to comment Share on other sites More sharing options...
codez Posted October 20, 2011 Report Share Posted October 20, 2011 Nu, ja tu zini XML formātu, tad paņem kādu php XML bibliotēku, piemēram: http://www.php.net/manual/en/book.simplexml.php Tad eksprotu no web taisi: 1)Selecto datus no mysql 2)saformē datus xml objektā un uzģenerē xml Improtu uz web: 1)Ieviedo xml dokumenta satur xml objektā 2)Ej cauri objektam un vajadzīgos datus ar kverijiem ievieto mysql. Quote Link to comment Share on other sites More sharing options...
archerz Posted October 20, 2011 Author Report Share Posted October 20, 2011 Izdod kludu:http://www.poss.lv/xml/xml.php Kas vainas xml kodam: <I04> <I04_OP_RUSIS>1</I04_OP_RUSIS> <I04_OP_DATA>30.09.2011</I04_OP_DATA> <I04_MOKETOJAS>2</I04_MOKETOJAS> <I04_KODAS_SS>2623</I04_KODAS_SS> <I04_KODAS_KS>40003151743 </I04_KODAS_KS> <I04_PAV>40103249680</I04_PAV> <I04_APRASYMAS>40103249680</I04_APRASYMAS> <I04_SUMA> 70.05</I04_SUMA> <I04_SUMA_VAL> 70.05</I04_SUMA_VAL> <I05> <I05_DOK_NR>20110928</I05_DOK_NR> <I05_SUMA> 70.05</I05_SUMA> <I05_KODAS_SS>2631</I05_KODAS_SS> <I05_SUMA_VAL> 70.05</I05_SUMA_VAL> <I05_SUMA_VAL_S> 70.05</I05_SUMA_VAL_S> <I05_KODAS_IS>KASE1 </I05_KODAS_IS> <I05_KODAS_MS></I05_KODAS_MS> </I05> </I04> Quote Link to comment Share on other sites More sharing options...
briedis Posted October 20, 2011 Report Share Posted October 20, 2011 (edited) izmanto htmlspecialchars() uz vērtībām ko liec tagos un atribūtos. XML nevar saturēt <, >, & u.c. simbolus, tie visi ir attiecīgi jānokodē - < > & utt. Edited October 20, 2011 by briedis Quote Link to comment Share on other sites More sharing options...
marcis Posted October 20, 2011 Report Share Posted October 20, 2011 @briedis iekš CDATA var saturēt da jebko :) Quote Link to comment Share on other sites More sharing options...
archerz Posted October 20, 2011 Author Report Share Posted October 20, 2011 Nu nav seit tadu simbolu! Tikai "." ja liek: $string = <<<XML <I04> <I04_OP_RUSIS>1</I04_OP_RUSIS> <I04_OP_DATA>30.09.2011</I04_OP_DATA> <I04_MOKETOJAS>2</I04_MOKETOJAS> <I04_KODAS_SS>2623</I04_KODAS_SS> <I04_KODAS_KS>40003151743 </I04_KODAS_KS> <I04_PAV>40103249680</I04_PAV> <I04_APRASYMAS>40103249680</I04_APRASYMAS> <I04_SUMA> 70.05</I04_SUMA> <I04_SUMA_VAL> 70.05</I04_SUMA_VAL> <I05> <I05_DOK_NR>20110928</I05_DOK_NR> <I05_SUMA> 70.05</I05_SUMA> <I05_KODAS_SS>2631</I05_KODAS_SS> <I05_SUMA_VAL> 70.05</I05_SUMA_VAL> <I05_SUMA_VAL_S> 70.05</I05_SUMA_VAL_S> <I05_KODAS_IS>KASE1 </I05_KODAS_IS> <I05_KODAS_MS></I05_KODAS_MS> </I05> </I04> XML; tad viss ok, bet ja to pasu ielade : if (file_exists('c:/Temp/Bank_In.xml')) { $string = simplexml_load_file('c:/Temp/Bank_In.xml'); tad rada kludas Quote Link to comment Share on other sites More sharing options...
briedis Posted October 20, 2011 Report Share Posted October 20, 2011 @briedis iekš CDATA var saturēt da jebko :) Pareizi, aizmirsu par šo maģisko lietu :) archerz, neredzu XML atverošo tagu. <?xml version="1.0"?> Quote Link to comment Share on other sites More sharing options...
archerz Posted October 24, 2011 Author Report Share Posted October 24, 2011 Jauna problema: XML faila: <?xml version="1.0" encoding="windows-1257"?> WWW encodings:<pre id="line1"><meta http-equiv="Content-Type" content="text/html; charset=windows-1257">MySQL kodejums:utf8_latvian_ciImportejot datus no XML faila rezultats:insert into poss1.i07 (uploads_id) VALUES ( 'Pamatlīdzeklu Izveide ', 'Pamatlīdzeklu Izveide ', 'Pamatlīdzeklu Izveide </pre> Ka parveidot lai butu Latviski? (windows-1257) Quote Link to comment Share on other sites More sharing options...
briedis Posted October 24, 2011 Report Share Posted October 24, 2011 pēc konekcijas mysql_query("SET NAMES UTF8"); Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 25, 2011 Report Share Posted October 25, 2011 (edited) 2)saformē datus xml objektā un uzģenerē xml ne vienmēr vajag veidot XML objektu, biezi pietiek vienkarši ar echo izvadīt uz scrīna .. iepriekš protams izvadot XML haideri peim: echo '<?xml version="1.0" encoding="windows-1257"?>'; pec tam vienk cikla vadit ara echo '<xml tags>'.$mani_dati_konkretajam tāgam.'</xml tags>'; ---- jo ja būs ļoti daudz datu un failu izmantos reti, tad šāds piegājiens dažreiz ir vienkāršāks tik nevajag aizmirst ka pirms XML taga izvades nekas cits nedrīkst būt izvadīts ;) Edited October 25, 2011 by Grey_Wolf Quote Link to comment Share on other sites More sharing options...
archerz Posted October 26, 2011 Author Report Share Posted October 26, 2011 Vel: No gramatvedibas programmas nak ara xml: <I06> <I06_OP_TIP> 1</I06_OP_TIP> <I06_VAL_POZ>0</I06_VAL_POZ> <I06_PVM_TIP>0</I06_PVM_TIP> <I06_OP_DATA>06.04.2011 00:00</I06_OP_DATA> <I06_DOK_DATA>06.04.2011 00:00</I06_DOK_DATA> <I06_KODAS_KS>40103165665 </I06_KODAS_KS> <I06_PAV>BALTIJAS BIROJU SERVISS, SIA </I06_PAV> <I06_KODAS_VL> </I06_KODAS_VL> <I06_KODAS_XS>PVN </I06_KODAS_XS> <I06_PASTABOS> </I06_PASTABOS> <I06_SUMA> 281.97</I06_SUMA> <I06_SUMA_PVM> 62.03</I06_SUMA_PVM> <I06_KURSAS> 0.0000000000</I06_KURSAS> <I07> <I07_TIPAS>3</I07_TIPAS> <I07_KODAS>1240 </I07_KODAS> <I07_KODAS>1240 </I07_KODAS> <I07_KODAS>1240 </I07_KODAS> <I07_KODAS>1240 </I07_KODAS> <I07_KODAS>1240 </I07_KODAS> <I07_PAV>PamatlīēļščžņķāēīļķņšžčĀĒŠČŽĶĻŅŽdzeklu Izveide </I07_PAV> <I07_KODAS_IS>PUBLICUM </I07_KODAS_IS> <I07_KODAS_OS> </I07_KODAS_OS> <I07_KIEKIS> 100</I07_KIEKIS> <I07_VAL_KAINA> 0.0000</I07_VAL_KAINA> <I07_SUMA_VAL> 0.00</I07_SUMA_VAL> <I07_KAINA_BE> 180.3279</I07_KAINA_BE> <I07_PVM> 39.67</I07_PVM> <I07_SUMA> 180.33</I07_SUMA> </I07> </I06> Lai vinu apstradatu vajag pielikt klat: <?xml version="1.0" encoding="windows-1257"?> <doc> </doc> Ka starp <DOC> ielikt informaciju no faila? $dom = new DOMDocument('1.0', 'windows-1257'); $element = $dom->createElement('DOC', '...SEIT...'); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.