/[zanavi_public1]/navit/cmake/navit_xml_parser.cmake
ZANavi

Contents of /navit/cmake/navit_xml_parser.cmake

Parent Directory Parent Directory | Revision Log Revision Log


Revision 56 - (show annotations) (download)
Sun Mar 19 08:44:36 2017 UTC (5 years, 4 months ago) by zoff99
File size: 886 byte(s)
updates
1 file(STRINGS "${SRC}" TEXT_LINES REGEX "_\\(")
2 file(WRITE ${DST} "// Strings from navit_shipped.xml\n")
3
4 foreach (LINE ${TEXT_LINES})
5 string(REGEX REPLACE ".*(_\\(\"[^\"]*\"\\)).*" "\\1\n" OUTPUT_LINE ${LINE})
6 file(APPEND ${DST} ${OUTPUT_LINE})
7 endforeach()
8
9 file(READ "${SRC}" SRC_CONTENT)
10
11 string(REGEX MATCHALL "<text>([^<>]*)</text>" TEXT_ELEMENTS "${SRC_CONTENT}")
12
13 foreach (LINE ${TEXT_ELEMENTS})
14 string(REGEX REPLACE ".*<text[^>]*>([^<>]*)</text>.*" "_(\"\\1\")" OUTPUT_LINE ${LINE})
15 string(REPLACE "\n" "\\n" OUTPUT_LINE ${OUTPUT_LINE})
16 file(APPEND ${DST} "${OUTPUT_LINE}\n")
17 endforeach()
18
19 string(REGEX MATCHALL "<vehicleprofile [^<>]*name=\"[^\"]+\"" ATTRS "${SRC_CONTENT}")
20
21 foreach (LINE ${ATTRS})
22 string(REGEX REPLACE ".* name=\"([^\"]+)\"" "_(\"\\1\")" OUTPUT_LINE ${LINE})
23 file(APPEND ${DST} "${OUTPUT_LINE}\n")
24 endforeach()
25

   
Visit the ZANavi Wiki