none
how to set xpath expression

    Question


  • HI,
           here i am including one xml code snippet in which i have to change the input file path . so how can i use xpath expression to change the path .
     the lines that are shown as red need to be change in the path

    <ENVELOPEX>
    <INFO>
    <VERSION>2.10</VERSION>
    <COMMENT>Default Template</COMMENT>
    <FILE_TEMPLATE></FILE_TEMPLATE>
    <KEY_TYPE>HASP SRM</KEY_TYPE>
    </INFO>
    <FILE_PROFILE>
    <FILE_SETTINGS type="WIN32" >
    <DEBUG_CHECK>1</DEBUG_CHECK>
    <BACKGROUND_CHECK>300</BACKGROUND_CHECK>
    <QUIZ_MASTER>12</QUIZ_MASTER>
    <CRYPTO_MODULES>12</CRYPTO_MODULES>
    <DRIVER_WAIT>0</DRIVER_WAIT>
    <DATA_LOADER_KEY>qdVue27y</DATA_LOADER_KEY>
    <ENCRYPTION_LEVEL>4</ENCRYPTION_LEVEL>
    </FILE_SETTINGS>
    <FILE_SETTINGS type="DOTNET" >
    <OBFUSCATE>1</OBFUSCATE>
    <COMPRESS>1</COMPRESS>
    <RS_ENCODE>1</RS_ENCODE>
    <BACKGROUND_CHECK>300</BACKGROUND_CHECK>
    </FILE_SETTINGS>
    <FILE_ENTRY type="WIN32" id="11914136661" name="Bounce" >
    <FILE_INOUT_PATH>
    <INPUT_FILE>..\..\..\..\..\..\..\..\ProgramFiles\Aladdin\HASPSRM\VendorTools\VendorSuite\samples\Bounce.exe</INPUT_FILE>
    <OUTPUT_FILE>..\Protected\Bounce.exe</OUTPUT_FILE>
    </FILE_INOUT_PATH>
    <HASPHL_FEATURES>
    <FEATURE_ID>0</FEATURE_ID>
    <PROGNUM_FEATURETYPE>0</PROGNUM_FEATURETYPE>
    <ACCESS_MODE>2</ACCESS_MODE>
    <LOGIN_PROCESS>0</LOGIN_PROCESS>
    </HASPHL_FEATURES>
    <FILE_DETAILS>
    <OVERLAY_SUPPORT>0</OVERLAY_SUPPORT>
    <SHOW_WAITBOX>0</SHOW_WAITBOX>
    <INCLUDE_MASK_FILTERS/>
    <EXCLUDE_MASK_FILTERS/>
    </FILE_DETAILS>
    <FILE_ADVANCED_SETTINGS>
    <LOGIN_SCOPE></LOGIN_SCOPE>
    <LOCKING_TYPE>HASP HL and HASP SL</LOCKING_TYPE>
    <CHECK_SYSTEM_DEBUGGER>1</CHECK_SYSTEM_DEBUGGER>
    <CALLCONV_COMPATIBILITY>0</CALLCONV_COMPATIBILITY>
    <SYMBOLS_COMPATIBILITY>0</SYMBOLS_COMPATIBILITY>
    <DISABLE_TS_CHECK>0</DISABLE_TS_CHECK>
    <DRIVERLESS_NETWORK_CLIENT>0</DRIVERLESS_NETWORK_CLIENT>
    <MESSAGE_OUTPUT_MODE>1 (windows)</MESSAGE_OUTPUT_MODE>
    <IMAGE_EMULATION>0</IMAGE_EMULATION>
    <SET_IDLE_TIME>10</SET_IDLE_TIME>
    <ENCRYPTION_RATIO>100</ENCRYPTION_RATIO>
    <SUSPEND_THREADS>1</SUSPEND_THREADS>
    <EXCLUDE_SECTION></EXCLUDE_SECTION>
    </FILE_ADVANCED_SETTINGS>
    </FILE_ENTRY>
    <FILE_ENTRY type="DOTNET" id="11914142561" name="dot_NET_bounce" >
    <FILE_INOUT_PATH>
    <INPUT_FILE>..\..\..\..\..\..\..\..\ProgramFiles\Aladdin\HASPSRM\VendorTools\VendorSuite\samples\dot_NET_bounce.exe</INPUT_FILE>
    <OUTPUT_FILE>..\Protected\dot_NET_bounce.exe</OUTPUT_FILE>
    </FILE_INOUT_PATH>
    <HASPHL_FEATURES>
    <FEATURE_ID>0</FEATURE_ID>
    <PROGNUM_FEATURETYPE>0</PROGNUM_FEATURETYPE>
    <ACCESS_MODE>0</ACCESS_MODE>
    <LOGIN_PROCESS>0</LOGIN_PROCESS>
    </HASPHL_FEATURES>
    <FILE_DETAILS>
    <WIN32_SHELL>0</WIN32_SHELL>
    <ASSEMBLY_NAME>BounceNET</ASSEMBLY_NAME>
    <PROTECT>
    <CLASS>Aladdin.BouncingBall.BounceForm</CLASS>
    <CLASS>Aladdin.BouncingBall.Sample</CLASS>
    </PROTECT>
    </FILE_DETAILS>
    <FILE_ADVANCED_SETTINGS>
    <LOGIN_SCOPE></LOGIN_SCOPE>
    <LOCKING_TYPE>HASP HL and HASP SL</LOCKING_TYPE>
    <SET_IDLE_TIME>10</SET_IDLE_TIME>
    </FILE_ADVANCED_SETTINGS>
    </FILE_ENTRY>
    </FILE_PROFILE>
    <HASPHL_PROFILE>
    <DEMO_VENDOR>0</DEMO_VENDOR>
    <PATH_VENDOR_CODE>C:\Documents and Settings\ashishm\My Documents\Aladdin\HASP SRM 2.10\VendorCodes\GTZTO.hvc</PATH_VENDOR_CODE>
    <VENDOR_CODE>xW3jIBqyTy4v66wi9sMotF8UkbS2X9KfkMdGhQJigcxAa8nCk2LNlmAE6L82t3Q8N+HcKCuW980Jw/COGmevCBsZ2F5Xhn0iihtEsiLfPiWQnW+2KjBfOzMnwFfvnusO9StL6XrhmxH4be12AJcaxsufFkgPqzGnPODQBp89iJdQeV4vThPutdI1FN4dYAQ89Ex5xEbESa7FE1kaQAoR6bGZbuJfjI0Gj8Qi/BFce2hGsK+cXgXB5ENWd9PB7+3u5O+W/UTbNK34wrQXyXr7QOMU4UFvqtNtGIgiIEh+tUt4Zvh/TgwghySiSbDt/Pf1x63BXK/OVfIV1x8wrGxb/EQz6wQ0wpRqtxEVYBDENjRCDlpivfywUwO73AicqrrycEepvg6SFlhF9AEyT4xRFYIv8v5xVvMcDaC9KrmGzEsSYpKnXautoUWSFtheQCR8VI+FbajVjU//z8QNTHSTrTwMFhx8NBf9iD/KLPixiDPpMlzg2MUQtY+kWKDyRDzQmneDvRpaAIxQtC7bVTuxIOzshbnH53N974uSIbOg6vCeucspWoiIgElG7jW9kvgAzKAl9QdO6MHQlJ2eQJki0CwAzNdis/JzVcpaXH6BeWzheFYBR+YNHPGzrvfDZKXbCecf3U9QarBnW10QzgWX4VBoFhSsKoTZkET9a+mfuGYi1KGc3AG95x9br9RPoEDcm4U/UQwYL8T+WrEzfEbP2gBMW2hPxgshvUzV+M6p+VttE/1Y/iDroafTcgOKIB9/1FNJa/62zfpknl22U6h3trdEtvyg50stKw7etxIxCSO5T9J74M+bNRJTq6PyzyhOL2sQgC0dSQGdPUsDvJc9g4BKYEI0DdWg0rD/B2G++Eva5Ec0VHmIGuMELrxDbhIUguVdS8Xh4Ux8d04jPUWnQoZUcpft4f0a3aXGVsFtN1c=</VENDOR_CODE>
    <BATCH_CODE></BATCH_CODE>
    </HASPHL_PROFILE>
    <MESSAGES>
    <MESSAGE_SET>
    <COMMENT>English Messages</COMMENT>
    <LANGUAGE_CODE>en</LANGUAGE_CODE>
    <MESSAGE_ENTRY key="CAPTION" >HASP SRM Protection System</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="WARN_WAITBOX" >Decryption will take a few moments...</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_MEM_RANGE" >Invalid memory address</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_PROGNUM_OPT" >Unknown/invalid feature id option</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INSUF_MEM" >Memory allocation failed</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_TMOF" >Too many open features</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_ACCESS_DENIED" >Feature access denied</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INCOMPAT_FEATURE" >Incompatible feature</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_HASP_NOT_FOUND" >HASP not found</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_TOO_SHORT" >Encryption/decryption length too short</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_HND" >Invalid handle</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_FILEID" >Invalid file id / memory descriptor</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_OLD_DRIVER" >Driver or support daemon version too old</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_NO_TIME" >Real time support not available</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_SYS_ERR" >Generic error from host system call</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_NO_DRIVER" >HASP driver not found</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_FORMAT" >Unrecognized info format</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_REQ_NOT_SUPP" >Request not supported</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_UPDATE_OBJ" >Invalid update object</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_KEYID_NOT_FOUND" >Key with requested id was not found</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_UPDATE_DATA" >Update data consistency check failed</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_UPDATE_NOTSUPP" >Update not supported by this key</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_UPDATE_CNTR" >Update counter mismatch</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_VCODE" >Invalid vendor code</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_ENC_NOT_SUPP" >Requested encryption algorithm not supported. Maybe a HASP4 key connected?</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_TIME" >Invalid date / time</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_NO_BATTERY_POWER" >Clock has no power</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_NO_ACK_SPACE" >Update requested acknowledgement, but no area to return it</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_TS_DETECTED" >Terminal services (remote terminal) detected</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_FEATURE_TYPE_NOT_IMPL" >Feature type not implemented</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_UNKNOWN_ALG" >Unknown algorithm</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_SIG" >Signature check failed</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_FEATURE_NOT_FOUND" >Feature not found</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_NO_LOG" >Trace log is not enabled</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_LOCAL_COMM_ERR" >Unable to access HASP SRM Run-time Environment</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_UNKNOWN_VCODE" >Vendor code unknown to API library</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_SPEC" >Invalid XML spec</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_SCOPE" >Invalid XML scope</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_TOO_MANY_KEYS" >Too many keys connected</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_TOO_MANY_USERS" >Too many users</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_BROKEN_SESSION" >HASP session broken</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_REMOTE_COMM_ERR" >Communication error between local and remote HASP LM</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_FEATURE_EXPIRED" >The feature is expired</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_OLD_LM" >HASP LM version too old</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_DEVICE_ERR" >HASP SL secure storage I/O error or USB request error</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_UPDATE_BLOCKED" >Update installation not allowed</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_TIME_ERR" >System time has been tampered</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_SCHAN_ERR" >Secure channel communication error</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_STORAGE_CORRUPT" >Secure storage contains garbage</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_NO_VLIB" >Vendor library cannot be found</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INV_VLIB" >Vendor library cannot be loaded</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_SCOPE_RESULTS_EMPTY" >No matching feature found</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_VM_DETECTED" >Virtual machine detected</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_HARDWARE_MODIFIED" >HASP update incompatible with this hardware</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_USER_DENIED" >Login denied because of user restrictions</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_UPDATE_TOO_OLD" >Update was already installed</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_UPDATE_TOO_NEW" >Another update must be installed first</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_NO_EXTBLOCK" >No classic memory extension block available</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_NOT_IMPL" >Capability isn't available</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="HASP_INT_ERR" >Internal API error</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_FILE" >Errors in the executable file</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_MEMORY" >Cannot allocate memory</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_INTERNAL" >Envelope internal error</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_PROTECTION" >Envelope decryption failed</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_DRIVER" >Cannot open HASP drivers</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_OS_NOT_SUPPORTED" >Operating system not supported</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_DEBUGGER" >Debugger detected</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_UNKNOWN" >Envelope unknown error</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_STATUS_DRIVER_TOO_OLD" >The native runtime library haspenv.dll is too old.</MESSAGE_ENTRY>
    <MESSAGE_ENTRY key="ERR_STATUS_DRIVER_NOT_FOUND" >Could not find native runtime library haspenv.dll.</MESSAGE_ENTRY>
    </MESSAGE_SET>
    </MESSAGES>
    </ENVELOPEX>

    Thursday, October 04, 2007 4:39 AM

Answers

  • Afaik, XPath only allows you to navigate/point to certain elements in the document... If you want a transformation you'll have to write an XSL file...

    The other approach would be to load the xml into an XmlDocument, use Select(Single)Node(s) to navigate to the node you want to change... (If i'm not mistaken you'll have to make sure to include a namespace in the xpath query)
    Thursday, October 04, 2007 5:41 AM