gim, mtg, scn and sfx are all XML format files and share the same key data and filter method. Here are some rule examples.
! 1.png
1. XML Dom Element Reading
name: submesh count in a gim file should be no more than five.
xpath: * /SubMesh. {dom}
condition: ['Satisfy the expression', 'len(d) <= 5'],
rpath: .* gim$,
Rules:
rpath: . gim$, to find the files which satisfy the regular expression, the file filter will be carried out in the whole directory: re.match (rpath, file path). The files that meet the requirement will be executed on.
xpath: /SubMesh. {dom} , extracts the file key data. XML file formats are showed in the above picture. SubMesh is in the second layer. */SubMesh points towards
condition: ['Satisfy the expression', 'len(d) <= 5'] retrieves a data list. The condition is a requirement in the list. Child mesh count in the picture is five and thus it satisfies the requirement.
2. Reading and Filtering XML Attributes and Second-Level Files
name: gim associated files check (read attribute values)
rpath: . gim$,
xpath: / * / FileName:value
filter:artfunc_check_combine_gimsfx
condition: ['Satisfy the expression', 'len(d) > 0'],
func_str:
! 2.png
Rules:
rpath: . gim$ finds gim files.
xpath: / * /FileName:value reads attributes, finds attributes such as FileName, FileName:value through fuzzy matches and retrieves the value under FileName. The data we obtained is a file path. There are two ways to reparse the file. Here we choose filter.
filter:artfunc_check_combine_gimsfx. The file are reparsed by a customized function in filter to check for any associated files. If associated file does not exist, the checking fails according to the rules.
3. XML File Tag Value
name: gim file value extraction (numeric values under the tag)
rpath: .* gim$,
xpath: * /TEST1.name
condition: ['Satisfy the expression', 'len(d) > 1'],
Rules:
rpath . gim$, filter files
xpath: /TEST1.name. To get the value of name in TEST1, we can apply */TEST1.name.
condition: ['Satisfy the expression', 'len(d) > 1'], and custom rules according to the value it returns.