Editing the XML files using XPaths

The raster dataset or individual raster information is stored in XML files called raster process definition (.RPDef) files. Editing values in the .RPDef XML files can be a tedious process. The fourth option on the Edit Raster Properties Wizard is the Values in the XML files (.RPDefs) using XPaths option. This option enables you to specify or change values in the XML nodes in the raster process definition files. XPath is a language to locate and edit nodes and values using a syntax that addresses the XML document's logical structure or hierarchy.

Using XPaths, you can parse through an XML file to search and replace values.

With the Edit Raster Properties Wizard, you can make multiple types of edits at a time to the following:

The following procedure will guide you to use the Values in the XML files (.RPDefs) using XPaths option in the Edit Raster Properties Wizard.

Schritte:
  1. Click the Image Service drop-down menu on the Image Service Definition Editor toolbar and click Advanced > Edit Raster Properties.

    The Edit Raster Properties Wizard is displayed with a Welcome to the Edit Raster Properties Wizard message in the wizard panel.

  2. Click the Next button.

    The Select what you want to edit wizard panel is displayed.

  3. Select the Values in the XML files (.RPDefs) using XPaths option.
  4. Click the Next button.

    The Define XPaths to replace values in the raster process definition files wizard panel is displayed.

    There are three columns, XPaths, Search for, and Replace with.

  5. Click in the XPaths column.
  6. Type the XPath of the file or node in which you want to search for a value.
  7. Optionally, you can click the Select XPath button to open the Select the source for the XPath wizard panel. You can use this wizard panel to select the source for the XPath either by using the Template option or by using the First raster process definition file.

    Xpathsto replace values in xml

  8. Click the Template option to display a template of an .RPDef file.

    All the nodes are presented on the right side of the wizard panel.

    Xpath source

  9. Optionally, click the First raster process definition file to list its nodes.
  10. Expand the Image Server node and select the XPath of a node.
  11. Select the required XPath node. Based on your selected node, the values you specify in the Replace with column will get replaced in this node.
  12. Click the OK button.
  13. Click in the Search for column.
  14. Type the node or value that you want to search for in the .RPDef file. Optionally, you can use the Select XPath button to locate a value in the .RPDef file.
  15. Click in the Replace with column.
  16. Type a value that you want to replace with the searched value. Optionally, you can use the Select XPath button.
  17. After you have set the required values in all the fields, click the Next button.

    The Do you want to perform additional editing wizard panel is displayed.

  18. Select Yes or No.
    • Select No if you do not want to edit any other raster process definition files.
    • Select Yes if you want to perform additional editing to the raster process definition files and click the Next button. It takes you again to the Select what you want to edit wizard panel. To perform more edits, repeat the steps given above.
  19. Optionally, you can select the Use only the selected raster datasets in the service table option or the Use all the raster datasets in the service table option.
  20. Click the Next button; you can see the summary of the modifications in the Your raster process definition files are ready to be processed wizard panel. In this case, you will get the list of nodes and values you have searched and replaced in the .RPDef files.
  21. Click the Finish button to complete the editing process.

    The Edit Raster Properties reporter window is displayed with the series of actions that are being applied on the current image service.

  22. Click the Close button to dismiss the reporter and load the image service definition.

    You can check the Raster Properties to verify if the values in the XPaths have been modified based on your specifications.

Verwandte Themen


7/10/2012