Hi,

If i have a tree structure, where the names can have ANY character in
them, what would be the best method for finding a 'unique series of
characters' to use as a separator when writing a path to an XML file?

For instance, the structure could look like this:

!"=A3$%^&*()_+1234567890-
QWERTYUIOP{}qwertyuiop[]
ASDFGHJKL:@~asdfghjkl;'#
|ZXCVBNM<>?\zxcvbnm,./`=AC

then im stuck for using a single character (lets pretend that all the
extended characters have been used aswell - it could happen ... and
probably will when i least want it to), so i have to use two characters
for the separator. But of course, all the two character combinations
could have been used up aswell in a gargantuan super path! So i would
need to use three (or more - getting more and more unlikely, i know).

All good suggestees will have a planet named after them,
James.

Re: Creating a unique path separator by Ulrich

Ulrich
Wed Jul 19 06:36:34 CDT 2006

pigeonrandle@hotmail.com wrote:
> If i have a tree structure, where the names can have ANY character in
> them, what would be the best method for finding a 'unique series of
> characters' to use as a separator when writing a path to an XML file?
>
> For instance, the structure could look like this:
>
> !"£$%^&*()_+1234567890-
> QWERTYUIOP{}qwertyuiop[]
> ASDFGHJKL:@~asdfghjkl;'#
> |ZXCVBNM<>?\zxcvbnm,./`¬
>
> then im stuck for using a single character (lets pretend that all the
> extended characters have been used aswell - it could happen ... and
> probably will when i least want it to), so i have to use two characters
> for the separator. But of course, all the two character combinations
> could have been used up aswell in a gargantuan super path! So i would
> need to use three (or more - getting more and more unlikely, i know).

Errm, how about using XML to separate parts of the path from one another?
Otherwise, use the simple, well-known way that C and C++ escape certain
characters like "'\. Another way would be to know in advance how long each
part of the path is, i.e. use a size/data combo.

Uli



Re: Creating a unique path separator by Heinz

Heinz
Wed Jul 19 06:55:49 CDT 2006

<pigeonrandle@hotmail.com> schrieb
> If i have a tree structure, where the names can have ANY character in
> them, what would be the best method for finding a 'unique series of
> characters' to use as a separator when writing a path to an XML file?

You cannot write a path (or anything else) containing ANY character to an
XML file. At least you have to encode '<' as something like <lt> (or
<lt/>?). So you can easily encode separators as <separator/> or something
similiar.

Or, if you write to a plain text file, you could prefix each piece of a path
by its length, enclosed in, say, braces. So "First Piece/Second Part/And all
the rest" would become "{12}First Piece{11}Second Part{16}And all the
rest{}". For readabiliy, you can even insert line breaks just ahead of any
'{'.

Of cause you can also determine the length of the longest part of a path,
say n, and use a string of n+1 instances of any character different from the
first character of the first part. Then first write the separator followed
by the path, its parts separated by the separator string.

> All good suggestees will have a planet named after them,

If you need more names for planets, I'm sure I can make up some other
suggestions

HTH
Heinz


Re: Creating a unique path separator by pigeonrandle

pigeonrandle
Wed Jul 19 07:26:58 CDT 2006

Heinz,

That helps alot, thankyou.

Believe it or not, there is already a little known moon obiting saturn
called 'Heinz Ozwirk' . Hopefully i can just repay the favour in
information at a later date?

Cheers,
James.

Heinz Ozwirk wrote:
> <pigeonrandle@hotmail.com> schrieb
> > If i have a tree structure, where the names can have ANY character in
> > them, what would be the best method for finding a 'unique series of
> > characters' to use as a separator when writing a path to an XML file?
>
> You cannot write a path (or anything else) containing ANY character to an
> XML file. At least you have to encode '<' as something like <lt> (or
> <lt/>?). So you can easily encode separators as <separator/> or something
> similiar.
>
> Or, if you write to a plain text file, you could prefix each piece of a path
> by its length, enclosed in, say, braces. So "First Piece/Second Part/And all
> the rest" would become "{12}First Piece{11}Second Part{16}And all the
> rest{}". For readabiliy, you can even insert line breaks just ahead of any
> '{'.
>
> Of cause you can also determine the length of the longest part of a path,
> say n, and use a string of n+1 instances of any character different from the
> first character of the first part. Then first write the separator followed
> by the path, its parts separated by the separator string.
>
> > All good suggestees will have a planet named after them,
>
> If you need more names for planets, I'm sure I can make up some other
> suggestions
>
> HTH
> Heinz


Re: Creating a unique path separator by pigeonrandle

pigeonrandle
Wed Jul 19 07:28:06 CDT 2006

Ulrich,
Thanks for your input. I think i'm going with the size method.

James.

Ulrich Eckhardt wrote:
> pigeonrandle@hotmail.com wrote:
> > If i have a tree structure, where the names can have ANY character in
> > them, what would be the best method for finding a 'unique series of
> > characters' to use as a separator when writing a path to an XML file?
> >
> > For instance, the structure could look like this:
> >
> > !"=A3$%^&*()_+1234567890-
> > QWERTYUIOP{}qwertyuiop[]
> > ASDFGHJKL:@~asdfghjkl;'#
> > |ZXCVBNM<>?\zxcvbnm,./`=AC
> >
> > then im stuck for using a single character (lets pretend that all the
> > extended characters have been used aswell - it could happen ... and
> > probably will when i least want it to), so i have to use two characters
> > for the separator. But of course, all the two character combinations
> > could have been used up aswell in a gargantuan super path! So i would
> > need to use three (or more - getting more and more unlikely, i know).
>
> Errm, how about using XML to separate parts of the path from one another?
> Otherwise, use the simple, well-known way that C and C++ escape certain
> characters like "'\. Another way would be to know in advance how long each
> part of the path is, i.e. use a size/data combo.
>=20
> Uli