Tengo dias tratando de meter datos a un xml (plantilla), desde un .csv....
encontre un bash pero no logro correrlo por un error de xmlscarlet.
queria saber si existe algo parecido en php para utilizarlo.
El codigo es este.
Código HTML:
#!/bin/bash xmlstarlet_command=( ) read_header=0 while IFS=, read AUFNR GAMNG GLTRS GSTRS; do if (( read_header == 0 )); then read_header=1; continue; fi xmlstarlet_command+=( -s /qs:query_batch/qs:body -t elem -n E1FKOL -v '' ) xmlstarlet_command+=( -i '/qs:query_batch/qs:body/*[last()]' -t attr -n AUFNR -v "$AUFNR" ) xmlstarlet_command+=( -i '/qs:query_batch/qs:body/*[last()]' -t attr -n match -v fuzzy ) xmlstarlet_command+=( -i '/qs:query_batch/qs:body/*[last()]' -t attr -n GAMNG -v "$GAMNG" ) xmlstarlet_command+=( -i '/qs:query_batch/qs:body/*[last()]' -t attr -n GLTRS -v $GLTRS ) xmlstarlet_command+=( -i '/qs:query_batch/qs:body/*[last()]' -t attr -n GSTRS -v "$GSTRS" ) done <LISTOTA.csv xmlstarlet ed -N qs=http://www.crossref.org/qschema/2.0 "${xmlstarlet_command[@]}" <template.xml
Código HTML:
AUFNR,GAMNG,GLTRS,GSTRS AC2M93,AC2M94,21042603,21042603 AC2M94,AC2M95,21042604,21042603 AC2M95,AC2M96,21042605,21042603 AC2M96,AC2M97,21042606,21042603 AC2M97,AC2M98,21042607,21042603 AC2M98,AC2M99,21042608,21042603 AC2M99,AC2M100,21042609,21042603
Ojala se pudiera.
saludos.