formatting xml with namespaces

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • printdude1968@gmail.com

    formatting xml with namespaces

    Hi Everyone...

    I'm a newbie to this stuff so bear with me.

    I have a well formed xml document (I use jdom to verify)

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <print-control>
    <destinations
    xmlns:destinati on0="http://mydomain.com/destinations/dest0"
    xmlns:destinati on1="http://mydomain.com/destinations/dest1"
    xmlns:destinati on2="http://mydomain.com/destinations/dest2"
    xmlns:destinati on3="http://mydomain.com/destinations/dest3"
    xmlns:destinati on4="http://mydomain.com/destinations/dest4"
    xmlns:destinati on5="http://mydomain.com/destinations/dest5"
    xmlns:destinati on6="http://mydomain.com/destinations/dest6"
    xmlns:destinati on7="http://mydomain.com/destinations/dest7"
    xmlns:destinati on8="http://mydomain.com/destinations/dest8"
    xmlns:destinati on9="http://mydomain.com/destinations/dest9">
    </destinations>
    <production
    xmlns:lp10="htt p://mydomain.compri nters/lp10"
    xmlns:lp20="htt p://mydomain.compri nters/lp20"
    xmlns:lp22="htt p://mydomain.compri nters/lp22"
    xmlns:lp80="htt p://mydomain.compri nters/lp80"
    xmlns:lp110="ht tp://mydomain.compri nters/lp110"
    xmlns:lp320="ht tp://mydomain.compri nters/lp320"
    xmlns:lp322="ht tp://mydomain.compri nters/lp322"
    xmlns:lp650="ht tp://mydomain.compri nters/lp650"
    xmlns:lp651="ht tp://mydomain.compri nters/lp651"
    xmlns:lp652="ht tp://mydomain.compri nters/lp652"
    xmlns:lp700="ht tp://mydomain.compri nters/lp700"
    xmlns:lp701="ht tp://mydomain.compri nters/lp701"
    xmlns:lp702="ht tp://mydomain.compri nters/lp702"
    xmlns:lp703="ht tp://mydomain.compri nters/lp703"
    xmlns:lp856="ht tp://mydomain.compri nters/lp856"
    xmlns:lp900="ht tp://mydomain.compri nters/lp900">
    <destination1 >
    <lp10:configura tion>
    <lp10:mapsBackT oBCISClass>W</lp10:mapsBackTo BCISClass>
    <lp10:queueType >psfOther</lp10:queueType>
    <lp10:formfontF ilters>/dev/fs/E/PrintApps/LBM/filters/</lp10:formfontFi lters>
    <lp10:formfontP ath>/dev/fs/E/PrintApps/LBM</lp10:formfontPa th>
    <lp10:jobName>$ (cat ${optionsInputT extFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp10:jobName>
    <lp10:optionsIn putTextFile>${L PSDIR}/${DEST}/o.${SEQ}</lp10:optionsInp utTextFile>
    <lp10:dataInput TextFile>${LPSD IR}/${DEST}/p.${SEQ}</lp10:dataInputT extFile>
    <lp10:chequeOut putPCLFile>${LP SDIR}/${DEST}/cheque.${SEQ}</lp10:chequeOutp utPCLFile>
    <lp10:pclOutput PCLFile>${LPSDI R}/${DEST}/file.${SEQ}</lp10:pclOutputP CLFile>
    <lp10:billsOutp utTextFile>${da taInputTextFile }.bill</lp10:billsOutpu tTextFile>
    <lp10:changeDat e>$(date "+%Y-%m-%d")</lp10:changeDate >
    <lp10:splitOn>$ ( head -n 1 ${dataInputText File} | cut
    -c2-4)</lp10:splitOn>
    <lp10:logicalQu eue>PD${localQu eueDestCode}PSF 1</lp10:logicalQue ue>
    <lp10:media>$ ( cat ${optionsInputT extFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp10:media>
    <lp10:spliton>$ ( head -n 1 ${dataInputText File} | cut
    -c2-4)</lp10:spliton>
    <lp10:countpage >${TOTAL_PAGES} </lp10:countpage>
    <lp10:startpage >1</lp10:startpage>
    <lp10:endpage>2 00</lp10:endpage>
    <lp10:numfile>1 </lp10:numfile>
    <lp10:get_optio ns>""</lp10:get_option s>
    <lp10:defaultMe dium>3hol</lp10:defaultMed ium>
    </lp10:configurat ion>
    <lp700:configur ation>
    <lp700:mapsBack ToBCISClass>N/A</lp700:mapsBackT oBCISClass>
    <lp700:queueTyp e>PassThrough</lp700:queueType >

    <lp700:logicalQ ueue>PD${localQ ueueDestCode}PT 1</lp700:logicalQu eue>
    <lp700:fileName >$(cat ${optionsInputT extFile} | awk '{print $2}' |
    awk -F= '{print $2}' )</lp700:fileName>
    <lp700:plex>$(c at ${optionsInputT extFile} | awk '{print $7}' | awk
    -F= '{print $2}' )</lp700:plex>
    <lp700:fileName Part1>$( echo ${dev_file_name } | awk -F'_' '{print
    $1}')</lp700:fileNameP art1>
    <lp700:fileName Part2>$( echo ${dev_file_name } | awk -F'_' '{print
    $2}')</lp700:fileNameP art2>
    <lp700:underwri terCode>$( echo ${fileNamePart2 } | cut
    -c1-4)</lp700:underwrit erCode>
    <lp700:repCode> $( echo ${fileNamePart2 } | cut
    -c5-8)</lp700:repCode>
    <lp700:series>$ ( echo ${fileNamePart2 } | cut -c9-9)</lp700:series>
    <lp700:group> $( echo ${fileNamePart2 } | cut -c10-12)</lp700:group>
    <lp700:roomText >$(cat ${optionsInputT extFile} | awk '{print $6}' |
    awk -F= '{print $2}' )</lp700:roomText>
    <lp700:media>$( cat ${optionsInputT extFile} | awk '{print $4}' |
    awk -F= '{print $2}' )</lp700:media>
    <lp700:defaultM ediaCode>"defau lt-medium=${media} "</lp700:defaultMe diaCode>
    </lp700:configura tion>
    </destination1>
    <destination2 >
    </destination2>
    <destination3 >
    </destination3>
    <destination4 >
    <lp110:configur ation>
    <lp110:mapsBack ToBCISClass>H</lp110:mapsBackT oBCISClass>
    <lp110:queueTyp e>psfOther</lp110:queueType >
    <lp110:logicalQ ueue>PD${localQ ueueDestCode}PS F3</lp110:logicalQu eue>
    <lp110:defaultM edium>3hol</lp110:defaultMe dium>
    <lp110:form>$ ( cat ${optionsInputT extFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp110:form>
    <lp110:formfont Filters>/dev/fs/E/PrintApps/LBM/filters/</lp110:formfontF ilters>
    <lp110:formfont Path>/dev/fs/E/PrintApps/LBM</lp110:formfontP ath>
    <lp110:jobName> $(cat ${optionsInputT extFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp110:jobName>
    <lp110:optionsI nputTextFile>${ LPSDIR}/${DEST}/o.${SEQ}</lp110:optionsIn putTextFile>
    <lp110:dataInpu tTextFile>${LPS DIR}/${DEST}/p.${SEQ}</lp110:dataInput TextFile>
    <lp110:chequeOu tputPCLFile>${L PSDIR}/${DEST}/cheque.${SEQ}</lp110:chequeOut putPCLFile>
    <lp110:pclOutpu tPCLFile>${LPSD IR}/${DEST}/file.${SEQ}</lp110:pclOutput PCLFile>
    <lp110:billsOut putTextFile>${d ataInputTextFil e}.bill</lp110:billsOutp utTextFile>
    <lp110:changeDa te>$(date "+%Y-%m-%d")</lp110:changeDat e>
    <lp110:lpsdirWi n>"E:\\ROC\\OM\ \server"</lp110:lpsdirWin >
    <lp110:splitOn> $( head -n 1 ${dataInputText File} | cut
    -c2-4)</lp110:splitOn>
    </lp110:configura tion>
    </destination4>
    <destination5 >
    </destination5>
    <destination6 >
    <lp650:configur ation>
    <lp650:mapsBack ToBCISClass>CHE QQB</lp650:mapsBackT oBCISClass>
    <lp650:queueTyp e>PassThrough</lp650:queueType >
    <lp650:formfont Mode>Dynamic</lp650:formfontM ode>
    <lp650:formfont Filters>/dev/fs/E/PrintApps/LBM/filters/</lp650:formfontF ilters>
    <lp650:formfont Path>/dev/fs/E/PrintApps/LBM</lp650:formfontP ath>
    <lp650:jobName> $(cat ${optionsInputT extFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp650:jobName>
    <lp650:optionsI nputTextFile>${ LPSDIR}/${DEST}/o.${SEQ}</lp650:optionsIn putTextFile>
    <lp650:dataInpu tTextFile>${LPS DIR}/${DEST}/p.${SEQ}</lp650:dataInput TextFile>
    <lp650:chequeOu tputPCLFile>${L PSDIR}/${DEST}/cheque.${SEQ}</lp650:chequeOut putPCLFile>
    <lp650:pclOutpu tPCLFile>${LPSD IR}/${DEST}/file.${SEQ}</lp650:pclOutput PCLFile>
    <lp650:billsOut putTextFile>${d ataInputTextFil e}.bill</lp650:billsOutp utTextFile>
    <lp650:changeDa te>$(date "+%Y-%m-%d")</lp650:changeDat e>
    <lp650:lpsdirWi n>"E:\\ROC\\OM\ \server"</lp650:lpsdirWin >
    <lp650:splitOn> $( head -n 1 ${dataInputText File} | cut
    -c2-4)</lp650:splitOn>
    <lp650:logicalQ ueue>PD${localQ ueueDestCode}PT 2</lp650:logicalQu eue>
    <lp650:media>$( cat ${optionsInputT extFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp650:media>
    <lp650:form>$(c at ${optionsInputT extFile} | awk '{print $8}' | awk
    -F= '{print $2}')</lp650:form>
    <lp650:room>$(c at ${optionsInputT extFile} | awk '{print $9}' | awk
    -F= '{print $2}')</lp650:room>
    <lp650:programm erText>$(cat ${optionsInputT extFile} | awk '{print
    $3 " " $1 " " $10}')</lp650:programme rText>
    <lp650:programm erTextSpaced>$( echo $programmerText | sed "s/=/
    /g")</lp650:programme rTextSpaced>
    <lp650:programm erTextReplaced> $(echo $programmerText Spaced| awk
    '{print $2 "." $4 "." $6}')</lp650:programme rTextReplaced>
    </lp650:configura tion>
    <lp651:configur ation>
    <lp651:mapsBack ToBCISClass>CHE QQB2</lp651:mapsBackT oBCISClass>
    <lp651:queueTyp e>PassThrough</lp651:queueType >
    <lp651:formfont Mode>Static</lp651:formfontM ode>
    <lp651:formfont Filters>/dev/fs/E/PrintApps/LBM/filters/</lp651:formfontF ilters>
    <lp651:formfont Path>/dev/fs/E/PrintApps/LBM</lp651:formfontP ath>
    <lp651:jobName> $(cat ${optionsInputT extFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp651:jobName>
    <lp651:optionsI nputTextFile>${ LPSDIR}/${DEST}/o.${SEQ}</lp651:optionsIn putTextFile>
    <lp651:dataInpu tTextFile>${LPS DIR}/${DEST}/p.${SEQ}</lp651:dataInput TextFile>
    <lp651:chequeOu tputPCLFile>${L PSDIR}/${DEST}/cheque.${SEQ}</lp651:chequeOut putPCLFile>
    <lp651:pclOutpu tPCLFile>${LPSD IR}/${DEST}/file.${SEQ}</lp651:pclOutput PCLFile>
    <lp651:billsOut putTextFile>${d ataInputTextFil e}.bill</lp651:billsOutp utTextFile>
    <lp651:changeDa te>$(date "+%Y-%m-%d")</lp651:changeDat e>
    <lp651:lpsdirWi n>"E:\\ROC\\OM\ \server"</lp651:lpsdirWin >
    <lp651:splitOn> $( head -n 1 ${dataInputText File} | cut
    -c2-4)</lp651:splitOn>
    <lp651:logicalQ ueue>PD${localQ ueueDestCode}PT 2</lp651:logicalQu eue>
    <lp651:componen tCombo>$(cat ${optionsInputT extFile} | awk '{print
    $3 " " $1 " " $10}')</lp651:component Combo>
    <lp651:comboNoD elimiter>$(echo ${componentComb o} | sed "s/=/
    /g")</lp651:comboNoDe limiter>
    <lp651:comboDot Delimiter>$(ech o ${comboNoDelimi ter}| awk '{print $2
    "." $4 "." $6}')</lp651:comboDotD elimiter>
    <lp651:room>$(c at ${optionsInputT extFile} | awk '{print $9}' | awk
    -F= '{print $2}')</lp651:room>
    <lp651:commentL ine>"${dev_room }:${form}:Filen ame:${comboDotD elimiter}"</lp651:commentLi ne>
    </lp651:configura tion>
    <lp652:configur ation>
    <lp652:mapsBack ToBCISClass>WQB </lp652:mapsBackT oBCISClass>
    <lp652:queueTyp e>psfOther</lp652:queueType >
    <lp652:logicalQ ueue>PD${localQ ueueDestCode}PS F1</lp652:logicalQu eue>
    <lp652:defaultM edium>3hol</lp652:defaultMe dium>
    <lp652:logicalQ ueue>PD${localQ ueueDestCode}PS F1</lp652:logicalQu eue>
    <lp652:form>$ ( cat ${optionsInputT extFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp652:form>
    <lp652:formfont Filters>/dev/fs/E/PrintApps/LBM/filters/</lp652:formfontF ilters>
    <lp652:formfont Path>/dev/fs/E/PrintApps/LBM</lp652:formfontP ath>
    <lp652:logOutpu tTextFile>${LPS DIR}/adm/log</lp652:logOutput TextFile>
    <lp652:topLevel >/dev/fs/E/</lp652:topLevel>
    <lp652:jobName> $(cat ${optionsInputT extFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp652:jobName>
    <lp652:optionsI nputTextFile>${ LPSDIR}/${DEST}/o.${SEQ}</lp652:optionsIn putTextFile>
    <lp652:dataInpu tTextFile>${LPS DIR}/${DEST}/p.${SEQ}</lp652:dataInput TextFile>
    <lp652:chequeOu tputPCLFile>${L PSDIR}/${DEST}/cheque.${SEQ}</lp652:chequeOut putPCLFile>
    <lp652:pclOutpu tPCLFile>${LPSD IR}/${DEST}/file.${SEQ}</lp652:pclOutput PCLFile>
    <lp652:billsOut putTextFile>${d ataInputTextFil e}.bill</lp652:billsOutp utTextFile>
    <lp652:changeDa te>$(date "+%Y-%m-%d")</lp652:changeDat e>
    <lp652:lpsdirWi n>"E:\\ROC\\OM\ \server"</lp652:lpsdirWin >
    <lp652:splitOn> $( head -n 1 ${dataInputText File} | cut
    -c2-4)</lp652:splitOn>
    </lp652:configura tion>
    <lp701:configur ation>
    <lp701:mapsBack ToBCISClass>N/A</lp701:mapsBackT oBCISClass>
    <lp701:queueTyp e>PassThrough</lp701:queueType >
    <lp701:logicalQ ueue>PD${localQ ueueDestCode}PT 1</lp701:logicalQu eue>
    <lp701:fileName >$(cat ${optionsInputT extFile} | awk '{print $2}' |
    awk -F= '{print $2}' )</lp701:fileName>
    <lp701:plex>$(c at ${optionsInputT extFile} | awk '{print $7}' | awk
    -F= '{print $2}' )</lp701:plex>
    <lp701:fileName Part1>$( echo ${dev_file_name } | awk -F'_' '{print
    $1}')</lp701:fileNameP art1>
    <lp701:fileName Part2>$( echo ${dev_file_name } | awk -F'_' '{print
    $2}')</lp701:fileNameP art2>
    <lp701:underwri terCode>$( echo ${fileNamePart2 } | cut
    -c1-4)</lp701:underwrit erCode>
    <lp701:repCode> $( echo ${fileNamePart2 } | cut
    -c5-8)</lp701:repCode>
    <lp701:series>$ ( echo ${fileNamePart2 } | cut -c9-9)</lp701:series>
    <lp701:group> $( echo ${fileNamePart2 } | cut -c10-12)</lp701:group>
    <lp701:roomText >$(cat ${optionsInputT extFile} | awk '{print $6}' |
    awk -F= '{print $2}' )</lp701:roomText>
    <lp701:media>$( cat ${optionsInputT extFile} | awk '{print $4}' |
    awk -F= '{print $2}' )</lp701:media>
    <lp701:defaultM ediaCode>"defau lt-medium=${media} "</lp701:defaultMe diaCode>
    </lp701:configura tion>
    </destination6>
    <lp702:configur ation>
    </lp702:configura tion>
    </destination7>
    <destination8 >
    </destination8>
    <destination9 >
    </destination9>
    </production>
    <development
    xmlns:lp10="htt p://mydomain.com/printers/lp10"
    xmlns:lp20="htt p://mydomain.com/printers/lp20"
    xmlns:lp22="htt p://mydomain.com/printers/lp22"
    xmlns:lp80="htt p://mydomain.com/printers/lp80"
    xmlns:lp110="ht tp://mydomain.com/printers/lp110"
    xmlns:lp171="ht tp://mydomain.com/printers/lp171"
    xmlns:lp173="ht tp://mydomain.com/printers/lp173"
    xmlns:lp174="ht tp://mydomain.com/printers/lp174"
    xmlns:lp175="ht tp://mydomain.com/printers/lp175"
    xmlns:lp176="ht tp://mydomain.com/printers/lp176"
    xmlns:lp320="ht tp://mydomain.com/printers/lp320"
    xmlns:lp322="ht tp://mydomain.com/printers/lp322"
    xmlns:lp650="ht tp://mydomain.com/printers/lp650"
    xmlns:lp651="ht tp://mydomain.com/printers/lp651"
    xmlns:lp652="ht tp://mydomain.com/printers/lp652"
    xmlns:lp700="ht tp://mydomain.com/printers/lp700"
    xmlns:lp701="ht tp://mydomain.com/printers/lp701"
    xmlns:lp702="ht tp://mydomain.com/printers/lp702"
    xmlns:lp703="ht tp://mydomain.com/printers/lp703"
    xmlns:lp856="ht tp://mydomain.com/printers/lp856"
    xmlns:lp900="ht tp://mydomain.com/printers/lp900">
    <destination1 >
    <lp173:configur ation>
    <lp173:mapsBack ToBCISClass>PDF CHE2</lp173:mapsBackT oBCISClass>
    <lp173:queueTyp e>N/A</lp173:queueType >
    <lp173:formfont Mode>Static</lp173:formfontM ode>
    <lp173:logicalQ ueue>pdfOnly</lp173:logicalQu eue>
    <lp173:pdfChang eTime>$( date "+%H.%M.%S" )</lp173:pdfChange Time>
    <lp173:pdfChang eDate>$( date "+%Y-%m-%d")</lp173:pdfChange Date>
    <lp173:pdfProgr ammerText>$( grep "programmer "
    ${optionsInputT extFile} | awk '{print $3}' | awk -F= '{print
    $2}')</lp173:pdfProgra mmerText>
    <lp173:pdfJobna me>$( grep "job" ${optionsInputT extFile} | awk
    '{print $1}' | awk -F= '{print $2}' )</lp173:pdfJobnam e>
    <lp173:pdfOutpu tFile>${LPDEST}/pdfOutputFile.$ {SEQ}</lp173:pdfOutput File>
    <lp173:pdfRepna me>$( grep "room" ${optionsInputT extFile} | awk
    '{print $9}' | awk -F= '{print $2}')</lp173:pdfRepnam e>
    <lp173:pdfForm> $( grep "room" ${optionsInputT extFile} | awk '{print
    $7}' | awk -F= '{print $2}')</lp173:pdfForm>
    <lp173:pdfRoom> ( grep "room" ${optionsInputT extFile}| awk '{print
    $9}' | awk -F= '{print $2}')</lp173:pdfRoom>
    <lp173:pdfOutpu tFileName>${pdf ProgrammerText}-${pdfJobname}-${pdfRepname}-${SEQ}</lp173:pdfOutput FileName>
    <lp173:pdfDocNa me>${pdfChangeD ate}-${pdfForm}-${pdfOutputFile Name}.${pdfChan geTime}.pdf
    </lp173:pdfDocNam e>
    </lp173:configura tion>
    <lp700:configur ation>
    <lp700:logicalQ ueue>PD${localQ ueueDestCode}PT 1</lp700:logicalQu eue>
    <lp700:fileName >$(cat ${optionsInputT extFile} | awk '{print $2}' |
    awk -F= '{print $2}' )</lp700:fileName>
    <lp700:plex>$(c at ${optionsInputT extFile} | awk '{print $7}' | awk
    -F= '{print $2}' )</lp700:plex>
    <lp700:fileName Part1>$( echo ${dev_file_name } | awk -F'_' '{print
    $1}')</lp700:fileNameP art1>
    <lp700:fileName Part2>$( echo ${dev_file_name } | awk -F'_' '{print
    $2}')</lp700:fileNameP art2>
    <lp700:underwri terCode>$( echo ${fileNamePart2 } | cut
    -c1-4)</lp700:underwrit erCode>
    <lp700:repCode> $( echo ${fileNamePart2 } | cut
    -c5-8)</lp700:repCode>
    <lp700:series>$ ( echo ${fileNamePart2 } | cut -c9-9)</lp700:series>
    <lp700:group> $( echo ${fileNamePart2 } | cut -c10-12)</lp700:group>
    <lp700:roomText >$(cat ${optionsInputT extFile} | awk '{print $6}' |
    awk -F= '{print $2}' )</lp700:roomText>
    <lp700:media>$( cat ${optionsInputT extFile} | awk '{print $4}' |
    awk -F= '{print $2}' )</lp700:media>
    <lp700:defaultM ediaCode>"defau lt-medium=${media} "</lp700:defaultMe diaCode>
    </lp700:configura tion>
    </destination2>
    <destination3 >
    <lp20:configura tion>
    <lp20:mapsBackT oBCISClass>C</lp20:mapsBackTo BCISClass>
    <lp20:queueType >psfOther</lp20:queueType>
    <lp20:formfontF ilters>/dev/fs/E/PrintApps/LBM/filters/</lp20:formfontFi lters>
    <lp20:formfontP ath>/dev/fs/E/PrintApps/LBM</lp20:formfontPa th>
    <lp20:logOutput TextFile>${LPSD IR}/adm/log</lp20:logOutputT extFile>
    <lp20:topLeve l>/dev/fs/E/</lp20:topLevel>
    <lp20:jobName>$ (cat ${optionsInputT extFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp20:jobName>
    <lp20:optionsIn putTextFile>${L PSDIR}/${DEST}/o.${SEQ}</lp20:optionsInp utTextFile>
    <lp20:dataInput TextFile>${LPSD IR}/${DEST}/p.${SEQ}</lp20:dataInputT extFile>
    <lp20:chequeOut putPCLFile>${LP SDIR}/${DEST}/cheque.${SEQ}</lp20:chequeOutp utPCLFile>
    <lp20:pclOutput PCLFile>${LPSDI R}/${DEST}/file.${SEQ}</lp20:pclOutputP CLFile>
    <lp20:billsOutp utTextFile>${da taInputTextFile }.bill</lp20:billsOutpu tTextFile>
    <lp20:changeDat e>$(date "+%Y-%m-%d")</lp20:changeDate >
    <lp20:lpsdirWin >"E:\\ROC\\OM\\ server"</lp20:lpsdirWin>
    <lp20:splitOn>$ ( head -n 1 ${dataInputText File} | cut
    -c2-4)</lp20:splitOn>
    <lp20:logicalQu eue>doNotPrint</lp20:logicalQue ue>
    </lp20:configurat ion>
    <lp900:configur ation>
    <lp900:mapsBack ToBCISClass>WO</lp900:mapsBackT oBCISClass>
    <lp900:queueTyp e>psfOther</lp900:queueType >
    <lp900:logicalQ ueue>PD${localQ ueueDestCode}PS F1</lp900:logicalQu eue>
    <lp900:defaultM edium>3hol</lp900:defaultMe dium>
    <lp900:logicalQ ueue>PD${localQ ueueDestCode}PS F1</lp900:logicalQu eue>
    <lp900:form>$ ( cat ${optionsInputT extFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp900:form>
    <lp900:formfont Filters>/dev/fs/E/PrintApps/LBM/filters/</lp900:formfontF ilters>
    <lp900:formfont Path>/dev/fs/E/PrintApps/LBM</lp900:formfontP ath>
    <lp900:logOutpu tTextFile>${LPS DIR}/adm/log</lp900:logOutput TextFile>
    <lp900:topLevel >/dev/fs/E/</lp900:topLevel>
    <lp900:jobName> $(cat ${optionsInputT extFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp900:jobName>
    <lp900:optionsI nputTextFile>${ LPSDIR}/${DEST}/o.${SEQ}</lp900:optionsIn putTextFile>
    <lp900:dataInpu tTextFile>${LPS DIR}/${DEST}/p.${SEQ}</lp900:dataInput TextFile>
    <lp900:chequeOu tputPCLFile>${L PSDIR}/${DEST}/cheque.${SEQ}</lp900:chequeOut putPCLFile>
    <lp900:pclOutpu tPCLFile>${LPSD IR}/${DEST}/file.${SEQ}</lp900:pclOutput PCLFile>
    <lp900:billsOut putTextFile>${d ataInputTextFil e}.bill</lp900:billsOutp utTextFile>
    <lp900:changeDa te>$(date "+%Y-%m-%d")</lp900:changeDat e>
    <lp900:lpsdirWi n>"E:\\ROC\\OM\ \server"</lp900:lpsdirWin >
    <lp900:splitOn> $( head -n 1 ${dataInputText File} | cut
    -c2-4)</lp900:splitOn>
    </lp900:configura tion>
    </destination3>
    </development>
    </print-control>


    What I need is an xsl or something which will let me go through the
    document and create a table
    Pseudo code
    for each destination d in production
    for each printer (ie. lp10) in d
    format a line for each attribute
    done
    done
    for each destination d in developement
    for each printer (ie. lp10) in d
    format a line for each attribute
    done
    done


    I've played around with xsl and xslt and seem to run into issues when I
    find that I need to process the
    namespaces....

    There must be an easy way to do it
    Here's what I'd like my output to look like

    Production
    lp110
    BackToBCISClass =>H
    queueType=>psfO ther
    logicalQueue=PD ${localQueueDes tCode}PSF3
    defaultMedium=> 3hol
    form=>$( cat ${optionsInputT extFile} | awk '{print $7}' | awk -F=
    '{print $2}')
    formfontFilters =>/dev/fs/E/PrintApps/LBM/filters/
    formfontPath=>/dev/fs/E/PrintApps/LBM
    jobName=>$(cat ${optionsInputT extFile} | awk '{print $1}' | awk
    -F= '{print $2}')
    optionsInputTex tFile=>${LPSDIR }/${DEST}/o.${SEQ}
    dataInputTextFi le=>${LPSDIR}/${DEST}/p.${SEQ}
    chequeOutputPCL File=>${LPSDIR}/${DEST}/cheque.${SEQ}
    pclOutputPCLFil e=${LPSDIR}/${DEST}/file.${SEQ}
    billsOutputText File=>${dataInp utTextFile}.bil l
    changeDate=>$(d ate "+%Y-%m-%d")
    lpsdirWin=>"E:\ \ROC\\OM\\serve r"
    splitOn=>$( head -n 1 ${dataInputText File} | cut -c2-4)

    Is this possible using xsl or xslt and if so, how do I reconcile the
    namespaces?

  • Richard Light

    #2
    Re: formatting xml with namespaces

    In message <1163941565.968 192.318020@h48g 2000cwc.googleg roups.com>,
    "printdude1968@ gmail.com" <printdude1968@ gmail.comwrites
    >What I need is an xsl or something which will let me go through the
    >document and create a table
    >Pseudo code
    for each destination d in production
    for each printer (ie. lp10) in d
    format a line for each attribute
    done
    done
    for each destination d in developement
    for each printer (ie. lp10) in d
    format a line for each attribute
    done
    done
    >
    >
    >I've played around with xsl and xslt and seem to run into issues when I
    >find that I need to process the
    >namespaces.. ..
    The local-name() function allows you to access the name of an element
    irrespective of its namespace URI, and name() gives you the whole name,
    namespace prefix included. So you could do:

    <xsl:template match="*[local-name()='configu ration']">
    <div>
    <div>
    <xsl:value-of select="substri ng-before(name(), ':')"/>
    </div>
    <div>
    <xsl:apply-templates mode="descripti on"/>
    </div>
    </div>
    </xsl:template>

    <xsl:template match="*" mode="descripti on">
    <div>
    <xsl:value-of select="concat( local-name(), '=>', text())"/>
    </div>
    </xsl:template>

    where I have used <divelements to indicate whatever structure you
    might like to put around your output.

    Richard Light
    >There must be an easy way to do it
    >Here's what I'd like my output to look like
    >
    >Production
    lp110
    BackToBCISClass =>H
    queueType=>psfO ther
    logicalQueue=PD ${localQueueDes tCode}PSF3
    defaultMedium=> 3hol
    form=>$( cat ${optionsInputT extFile} | awk '{print $7}' |
    >awk -F=
    >'{print $2}')
    formfontFilters =>/dev/fs/E/PrintApps/LBM/filters/
    formfontPath=>/dev/fs/E/PrintApps/LBM
    jobName=>$(cat ${optionsInputT extFile} | awk '{print $1}' |
    >awk
    >-F= '{print $2}')
    optionsInputTex tFile=>${LPSDIR }/${DEST}/o.${SEQ}
    dataInputTextFi le=>${LPSDIR}/${DEST}/p.${SEQ}
    chequeOutputPCL File=>${LPSDIR}/${DEST}/cheque.${SEQ}
    pclOutputPCLFil e=${LPSDIR}/${DEST}/file.${SEQ}
    billsOutputText File=>${dataInp utTextFile}.bil l
    changeDate=>$(d ate "+%Y-%m-%d")
    lpsdirWin=>"E:\ \ROC\\OM\\serve r"
    splitOn=>$( head -n 1 ${dataInputText File} | cut -c2-4)
    >
    >Is this possible using xsl or xslt and if so, how do I reconcile the
    >namespaces?
    >
    --
    Richard Light
    SGML/XML and Museum Information Consultancy
    richard@light.d emon.co.uk

    Comment

    • Manuel Collado

      #3
      Re: formatting xml with namespaces

      printdude1968@g mail.com escribió:
      Hi Everyone...
      >
      I'm a newbie to this stuff so bear with me.
      >
      I have a well formed xml document (I use jdom to verify)
      Sorry, no. There is at least one unmatched tag: </destination7>.
      >
      <?xml version="1.0" encoding="ISO-8859-1"?>
      <print-control>
      <destinations
      xmlns:destinati on0="http://mydomain.com/destinations/dest0"
      xmlns:destinati on1="http://mydomain.com/destinations/dest1"
      ...
      </destinations>
      <production
      xmlns:lp10="htt p://mydomain.compri nters/lp10"
      xmlns:lp20="htt p://mydomain.compri nters/lp20"
      ...
      <destination1 >
      <lp10:configura tion>
      <lp10:mapsBackT oBCISClass>W</lp10:mapsBackTo BCISClass>
      <lp10:queueType >psfOther</lp10:queueType>
      <lp10:formfontF ilters>/dev/fs/E/PrintApps/LBM/filters/</lp10:formfontFi lters>
      <lp10:formfontP ath>/dev/fs/E/PrintApps/LBM</lp10:formfontPa th>
      <lp10:jobName>$ (cat ${optionsInputT extFile} | awk '{print $1}' |
      awk -F= '{print $2}')</lp10:jobName>
      <lp10:optionsIn putTextFile>${L PSDIR}/${DEST}/o.${SEQ}</lp10:optionsInp utTextFile>
      <lp10:dataInput TextFile>${LPSD IR}/${DEST}/p.${SEQ}</lp10:dataInputT extFile>
      <lp10:chequeOut putPCLFile>${LP SDIR}/${DEST}/cheque.${SEQ}</lp10:chequeOutp utPCLFile>
      <lp10:pclOutput PCLFile>${LPSDI R}/${DEST}/file.${SEQ}</lp10:pclOutputP CLFile>
      <lp10:billsOutp utTextFile>${da taInputTextFile }.bill</lp10:billsOutpu tTextFile>
      <lp10:changeDat e>$(date "+%Y-%m-%d")</lp10:changeDate >
      <lp10:splitOn>$ ( head -n 1 ${dataInputText File} | cut
      -c2-4)</lp10:splitOn>
      ...
      </lp900:configura tion>
      </destination3>
      </development>
      </print-control>
      >
      >
      What I need is an xsl or something which will let me go through the
      document and create a table ...
      >
      I've played around with xsl and xslt and seem to run into issues when I
      find that I need to process the
      namespaces....
      >
      There must be an easy way to do it
      ...
      Is this possible using xsl or xslt and if so, how do I reconcile the
      namespaces?
      Any programming language with decent XML libraries can be used instead of XSLT.

      Your data contains some references to AWK. Perhaps you could try xmlgawk:

      Free, secure and fast downloads from the largest Open Source applications and software directory - SourceForge.net


      Regards.
      --
      Manuel Collado - http://lml.ls.fi.upm.es/~mcollado

      Comment

      • printdude1968@gmail.com

        #4
        Re: formatting xml with namespaces

        Hi

        I was able to solve it... basically I took out all the namespaces.
        Once I did that, adding the xslt to display it was pretty easy.

        Richard Light wrote:
        In message <1163941565.968 192.318020@h48g 2000cwc.googleg roups.com>,
        "printdude1968@ gmail.com" <printdude1968@ gmail.comwrites
        What I need is an xsl or something which will let me go through the
        document and create a table
        Pseudo code
        for each destination d in production
        for each printer (ie. lp10) in d
        format a line for each attribute
        done
        done
        for each destination d in developement
        for each printer (ie. lp10) in d
        format a line for each attribute
        done
        done


        I've played around with xsl and xslt and seem to run into issues when I
        find that I need to process the
        namespaces....
        >
        The local-name() function allows you to access the name of an element
        irrespective of its namespace URI, and name() gives you the whole name,
        namespace prefix included. So you could do:
        >
        <xsl:template match="*[local-name()='configu ration']">
        <div>
        <div>
        <xsl:value-of select="substri ng-before(name(), ':')"/>
        </div>
        <div>
        <xsl:apply-templates mode="descripti on"/>
        </div>
        </div>
        </xsl:template>
        >
        <xsl:template match="*" mode="descripti on">
        <div>
        <xsl:value-of select="concat( local-name(), '=>', text())"/>
        </div>
        </xsl:template>
        >
        where I have used <divelements to indicate whatever structure you
        might like to put around your output.
        >
        Richard Light
        >
        There must be an easy way to do it
        Here's what I'd like my output to look like

        Production
        lp110
        BackToBCISClass =>H
        queueType=>psfO ther
        logicalQueue=PD ${localQueueDes tCode}PSF3
        defaultMedium=> 3hol
        form=>$( cat ${optionsInputT extFile} | awk '{print $7}' |
        awk -F=
        '{print $2}')
        formfontFilters =>/dev/fs/E/PrintApps/LBM/filters/
        formfontPath=>/dev/fs/E/PrintApps/LBM
        jobName=>$(cat ${optionsInputT extFile} | awk '{print $1}' |
        awk
        -F= '{print $2}')
        optionsInputTex tFile=>${LPSDIR }/${DEST}/o.${SEQ}
        dataInputTextFi le=>${LPSDIR}/${DEST}/p.${SEQ}
        chequeOutputPCL File=>${LPSDIR}/${DEST}/cheque.${SEQ}
        pclOutputPCLFil e=${LPSDIR}/${DEST}/file.${SEQ}
        billsOutputText File=>${dataInp utTextFile}.bil l
        changeDate=>$(d ate "+%Y-%m-%d")
        lpsdirWin=>"E:\ \ROC\\OM\\serve r"
        splitOn=>$( head -n 1 ${dataInputText File} | cut -c2-4)

        Is this possible using xsl or xslt and if so, how do I reconcile the
        namespaces?
        >
        --
        Richard Light
        SGML/XML and Museum Information Consultancy
        richard@light.d emon.co.uk

        Comment

        • printdude1968@gmail.com

          #5
          Re: formatting xml with namespaces

          I didn't include the entire XML document as I was just trying to show a
          snippet of the document (it's over 1500 lines long).

          Manuel Collado wrote:
          printdude1968@g mail.com escribió:
          Hi Everyone...

          I'm a newbie to this stuff so bear with me.

          I have a well formed xml document (I use jdom to verify)
          >
          Sorry, no. There is at least one unmatched tag: </destination7>.
          >

          <?xml version="1.0" encoding="ISO-8859-1"?>
          <print-control>
          <destinations
          xmlns:destinati on0="http://mydomain.com/destinations/dest0"
          xmlns:destinati on1="http://mydomain.com/destinations/dest1"
          ...
          </destinations>
          <production
          xmlns:lp10="htt p://mydomain.compri nters/lp10"
          xmlns:lp20="htt p://mydomain.compri nters/lp20"
          ...
          <destination1 >
          <lp10:configura tion>
          <lp10:mapsBackT oBCISClass>W</lp10:mapsBackTo BCISClass>
          <lp10:queueType >psfOther</lp10:queueType>
          <lp10:formfontF ilters>/dev/fs/E/PrintApps/LBM/filters/</lp10:formfontFi lters>
          <lp10:formfontP ath>/dev/fs/E/PrintApps/LBM</lp10:formfontPa th>
          <lp10:jobName>$ (cat ${optionsInputT extFile} | awk '{print $1}' |
          awk -F= '{print $2}')</lp10:jobName>
          <lp10:optionsIn putTextFile>${L PSDIR}/${DEST}/o.${SEQ}</lp10:optionsInp utTextFile>
          <lp10:dataInput TextFile>${LPSD IR}/${DEST}/p.${SEQ}</lp10:dataInputT extFile>
          <lp10:chequeOut putPCLFile>${LP SDIR}/${DEST}/cheque.${SEQ}</lp10:chequeOutp utPCLFile>
          <lp10:pclOutput PCLFile>${LPSDI R}/${DEST}/file.${SEQ}</lp10:pclOutputP CLFile>
          <lp10:billsOutp utTextFile>${da taInputTextFile }.bill</lp10:billsOutpu tTextFile>
          <lp10:changeDat e>$(date "+%Y-%m-%d")</lp10:changeDate >
          <lp10:splitOn>$ ( head -n 1 ${dataInputText File} | cut
          -c2-4)</lp10:splitOn>
          ...
          </lp900:configura tion>
          </destination3>
          </development>
          </print-control>


          What I need is an xsl or something which will let me go through the
          document and create a table ...

          I've played around with xsl and xslt and seem to run into issues when I
          find that I need to process the
          namespaces....

          There must be an easy way to do it
          ...
          Is this possible using xsl or xslt and if so, how do I reconcile the
          namespaces?
          >
          Any programming language with decent XML libraries can be used instead ofXSLT.
          >
          Your data contains some references to AWK. Perhaps you could try xmlgawk:
          >
          Free, secure and fast downloads from the largest Open Source applications and software directory - SourceForge.net


          Regards.
          --
          Manuel Collado - http://lml.ls.fi.upm.es/~mcollado

          Comment

          • Joe Kesselman

            #6
            Re: formatting xml with namespaces

            A smaller (and complete) sample would have been more useful; easier to
            read and to discuss. So would a more specific description of what
            "issues" you run into when you "need to process the namespaces".

            Handling namespaces in XSLT should be easy enough -- to reference a
            namespaced element or attribute, you need to define a prefix in the XSLT
            that refers to the same namespace, and use that in your paths and
            patterns. It's common, but not necessary, to use the same prefix in the
            stylesheet that you use in your source documents. One complication: In
            their 1.0 versions, XPath and XSLT can't set a default namespace; you
            must use a prefix in the stylesheet even if your source document used
            the default shorthand.

            As others have noted, if you want to deliberately ignore the namespaces
            -- which is a VERY BAD idea, since you wouldn't have used namespaces in
            the first place if they weren't semantically significant! -- you can
            kluge that by using wildcard patterns combined with predicates that
            explicitly test only the localname, or (if you want to completely bollox
            the intent and make other developers curse your name) the prefix and/or
            qname.

            --
            () ASCII Ribbon Campaign | Joe Kesselman
            /\ Stamp out HTML e-mail! | System architexture and kinetic poetry

            Comment

            Working...