[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Anyone have XSLT that generates XML showing a Wind

Subject: Re: Anyone have XSLT that generates XML showing a Windows folder structure?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 May 2020 19:55:44 -0000
Re:  Anyone have XSLT that generates XML showing a Wind
Hi Roger,

There are too-many characters that are allowed in a directory-name that
will break the syntax for an XML element name:

seems like any character except:  (0 to 31)!codepoints-to-string(.),  \, /
, ?,:, *, ", <, >, |

So you can have commas, whitespace (consecutive spaces), %, ;, +, &, etc.
For reference see for example this:
https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file    ,

Therefore, a safer way to represent a directory structure would be to make
the file and directory names values, not names.

Even in this case, the & (ampersand) character must be watched for and
escaped properly.

Also, given an XML file in this format, that is believed to represent a
directory, may actually not represent a real windows filesystem directory,
as there are reserved names that have special meaning and are not allowed
to be used:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9,
LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these
names followed immediately by an extension; for example, NUL.txt

One more thing: you might have a problem if the length of a full
filepath exceeds 250.

HTH, :)

Cheers,
Dimitre

On Wed, May 13, 2020 at 5:52 AM Costello, Roger L. costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> Do you have XSLT code that does this: Given a root folder, show all the
> subfolders and files within it, repeat for each subfolder.
>
> Example, for this folder structure:
>
> root
>     persons
>         local
>             JohnDoe.xml
>             MarySmith.xml
>         remote
>             BillAnderson.xml
>
> the XSLT code outputs this XML:
>
> <root>
>      <persons>
>           <local>
>               <john>JoeDoe.xml</john>
>               <mary>MarySmith.xml</mary>
>         </local>
>         <remote>
>              <bill>BillAnderson.xml</bill>
>        </remote>
>     </persons>
> </root>
>
> If someone has already done this, would you mind sharing it, please?
>
> /Roger

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.