I want to write a class with similar funcionality as the .NET ManagementPath
class. On MSDN is a set of articles which handles the format of object paths. However, I don't understand it yet with all special cases
String comparisons that deal with object paths are always case-insensitive. ==> does this also apply to the values of keys when querying for object instances?
Hexadecimal constants for integers. ==> where can they occur? in values of keys only?
Boolean constants for classes with keys that take Boolean values. ==> what are the constants? true / false? 0 / 1?
An assumed local server with a partial namespace path. Thus, specifying the root and default namespace implies the root and default namespace on the local server. ==> does this only mean that if I don't specify a server, that then "." is used as server?
No white space either within an element or between elements. ==> why does the original .NET implementation allow spaces in server names then?
Embedded quotation marks in object paths are allowed but must delimit the quotation mark with escape characters, as in a C or C++ application. ==> ???
Only decimal values are recognized as numeric portions of keys. ==> ???
Everything on this page: http://msdn.microsoft.com/en-us/library/aa389223(v=VS.85).aspx ==> ?
Well, the basic paths that I think are valid look like
\\Server\Namespace
\Namespace
\\Server\Namespace:Class
\Namespace:Class
Class
\\Server\Namespace:Class.KeyName=KeyValue
\Namespace:Class.KeyName=KeyValue
Class.KeyName=KeyValue
\\Server\Namespace:Class=KeyValue
\Namespace:Class=KeyValue
Class=KeyValue
\\Server\Namespace:Class.FirstKey=FirstValue,SecondKey=SecondValue
\Namespace:Class.FirstKey=FirstValue,SecondKey=SecondValue
Class.FirstKey=FirstValue,SecondKey=SecondValue
\\Server\Namespace:Class=@
\Namespace:Class=@
Class=@
as well as all combinations were the \\ is replaced by a // and/or the
\ between server and namespace is replaced by /
Have I forgotten anything here?
This is what can be extracted from MSDN. However, how may the individual tokens look like? This is what I think it may be:
KeyValue = "string" <-- string
1 <-- numeric
0x1 <-- hex
?????????? <-- about the "decimal value" thing and
"embedded quitation mark" thing.
Also, what about whitespaces?
do they have to be abreviated by %20?
KeyName / Class / Server
= string without : or / or \ inside and maybe only [a-z0-9_] ?
Namespace
= string without : or / inside and maybe only [a-z0-9_\]
(.NET implementation also buggy here. accepts forward slashes regardless of
"You cannot use forward slashes within namespace names." on MSDN)
Also, are they allowed to start with \ and end with a : ?
It would be very helpful if for each token a regular expression could be given of how it looks like.
Probably you can get useful information seeing the source code of the class.
If you want to test a string to be a match or not of a regex, you can use a tester.
good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With