I'm wondering, is there any standard way to parse such path-like string:
Server[@Name='MyServerName']/Database[@Name='MyDatabaseName']/Table[@Name='MyTableName' and @Schema='MySchemaName']
The result must be:
- ItemName (Server)
- PropertyName (Name), PropertyValue (MyServerName)
- ItemName (Database)
- PropertyName (Name), PropertyValue (MyDatabaseName)
- ItemName (Table)
- PropertyName (Name), PropertyValue (MyTableName)
- PropertyName (Schema), PropertyValue (MySchemaName)
Most obvious here is to make a regular expression (and, of course, String.Split
), but may be there's a better, standard way?
For the information: the string comes from SMO's Urn.Value
.
UPDATE.
The answer is found, see below.