- Print
- PDF
Replace XML and JSON Tag References Within Patterns and Rearranges
If the structure of the XML or JSON data (that a form processes) changes, you might need to change the form’s patterns and rearranges to refer to differently-named XML or JSON tags.
Example
The StatementDetail pattern (see the upper panel on the left side of the image below) refers to the DeliveryData/StatementEntries/StatementEntryDetail
tag in the incoming XML data.
The two selected rearranges (see the lower panel on the left side), which are within the selected StatementDetail pattern, refer to data in the TransactionDescription
tag (in the incoming XML data).
These tag references were correct when the form was designed. However, the structure of the incoming XML has changed:
StatementEntryDetail
is nowStatementDetail
TransactionDescription
is nowDescription
The loaded grab file (see the center panel) is an example of the new XML structure, which uses the new tag names. Because the XML structure has changed, the selected pattern and rearranges no longer correspond to any tags within the XML. As a result, the XML does not contain highlighted lines that show which data the pattern and its rearranges are linked to.
You can use the Replace tag name window to find and replace text within patterns’ and rearranges’ tag references.
In this example, this action has corrected the tag reference for the StatementDetail pattern.
You could repeat this action in the lower panel to correct the tag reference for the transaction description rearranges.
Steps
To replace XML and JSON tag references within patterns and rearranges, follow these steps:
In the Form Editor, click the View menu and then click Patterns. The Patterns panel opens to the left of the data area where the Form Editor displays grab files.
Your next step depends on whether you want to replace references in patterns or rearranges:
Patterns: In the upper area of the Patterns panel, right-click Sheet or a listed pattern, then click Replace tag name.
Rearranges
If you want to modify rearranges that are not part of a pattern:
In the upper area of the Patterns panel, click Sheet. The lower area of the panel lists rearranges that are not part of a pattern.
Right-click a rearrange in the lower area of the Patterns panel.
Click Replace tag name.
If you want to modify rearranges that are part of a pattern:
In the upper area of the Patterns panel, click the pattern that contains those rearranges. The lower area of the panel lists rearranges that are part of that pattern.
Right-click a rearrange in the lower area of the Patterns panel.
Click Replace tag name.
In the Replace tag name window:
Use the Find what box to specify the tag text that you want to search for.
Use the Replace with box to specify the text you want to replace it with.
Select Match whole word and Match case if necessary.
Click Find Next to search for the next occurrence of the specified tag text.
Click Replace to replace the occurrence of the specified tag text in the currently selected pattern or rearrange. After doing so, Lasernet finds the next occurrence.
Click Replace All to replace all occurrences.
Use the Direction options (Up and Down) to specify which direction to search in (in the list of patterns in the upper area and the list of rearranges in the lower area).
Click Close. Your changes are applied in the Form Editor window.