目录扫描 [英] Directory Scanning

查看:59
本文介绍了目录扫描的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将目录结构扫描成XML,以便在HTML / XSL页面中提供导航

功能。


我的问题是:


1.在
XML中存储可变深度层次结构的最佳结构(即目录结构的不同分支将具有不同的
不同''深度'')。


2.我目前正在使用VBA准备页面并导出到XML并且

想知道是否有任何工具围绕哪个将节省我

编码''腿部工作''? (即直接将目录结构转换为XML格式的




任何关于这两点的提示对我都有很大的帮助。
<非常感谢,

Alan Searle。

I would like to scan a directory structure into XML to offer navigation
functionality in HTML / XSL pages.

My questions are:

1. Which is the best structure to store variable depth heirarchies in
XML (i.e. different branches of the directory structure will have
different ''depths'').

2. I am currently using VBA to prepare the pages and export to XML and
was wondering if there are any tools around which will save me the
coding ''leg-work''? (i.e. directly transfer the directory structures
into XML)

Any tips on either of these points would be a great help to me.

Many thanks,
Alan Searle.

推荐答案

Alan,


存储dirs我使用类似HTML的语法,例如


< ul>

< li> usr
< ul>

< li> local< / li>

< / ul>

< / li>

< / ul>


有两个优点:


1)用于HTML输出我可以使用一个简单的xsl:copy-of ...

2)对于创建和操作,你可以使用递归,这使你的代码变薄你只需要一个方法如果有
孩子,那就自称。


希望有所帮助。


干杯,
Dominik

Alan,

to store dirs i use normaly the HTML-like syntax like

<ul>
<li>usr
<ul>
<li>local</li>
</ul>
</li>
</ul>

that has 2 advantages:

1) For HTML-Output i can use a simple xsl:copy-of ...
2) For creating and manipulation you can use recursivity, that makes
your code thin you just need one method that calls itself, if there are
children.

Hope that helps.

Cheers,
Dominik


fedro写道:
Alan,

存储dirs我使用类似HTML的语法,如

< ul>
< li> usr
< ul>
< ; li> local< / li>
< / ul>
< / li>
< / ul>

有两个优点: />
1)对于HTML-Output,我可以使用简单的xsl:copy-of ...
2)对于创建和操作,你可以使用递归,这使你的代码变薄了你如果有孩子,只需要一种自称的方法。

希望有所帮助。

干杯,
Dominik
Alan,

to store dirs i use normaly the HTML-like syntax like

<ul>
<li>usr
<ul>
<li>local</li>
</ul>
</li>
</ul>

that has 2 advantages:

1) For HTML-Output i can use a simple xsl:copy-of ...
2) For creating and manipulation you can use recursivity, that makes
your code thin you just need one method that calls itself, if there are
children.

Hope that helps.

Cheers,
Dominik




这对于目录结构来说确实是一个糟糕的xml格式。

标签应该说明数据。


我希望这样做更好:


< file name =" dir1">

< file name =" dir2">

<文件名=" file.xml" />

< / file>

< file name =" config .txt">

< / file >


您也可以将目录视为文件。

一个问题:符号链接会导致无休止的递归。



That is really a bad xml format for a directory structure.
The tags should say something about the data.

I would like this better:

<file name="dir1">
<file name="dir2">
<file name="file.xml"/>
</file>
<file name="config.txt">
</file>

You can view directories as files too.
One problem: symbolic links can result in endless recursion.


On Sun,2006年2月19日18:49:05 +0100,Tjerk Wolterink

< tj *** @ wolterinkwebdesign.com>写道:
On Sun, 19 Feb 2006 18:49:05 +0100, Tjerk Wolterink
<tj***@wolterinkwebdesign.com> wrote:
您也可以将目录视为文件。
You can view directories as files too.




虽然在XML中不是一个好主意。 目录是一个有趣的

类文件的想法是文件系统的一些_implementations的一个人工制品。

就数据建模而言,它不是那种应该被保留为更抽象的巧合因素

代表。


对于一件事(与XML / DTD设计相关),内容

模型应该为这个文件或目录的子代提供什么? ;节点?它是否b / b
是否有子节点(作为目录)或不具有(作为文件)?

借用 HTML元素也是糟糕的软件设计,因为它是混淆了这些是完全独立的元素的事实,因为它们是从不同的命名空间中获取的。依赖于copy-of work和

给出与local-name()属性匹配的元素是穷人的b / b
软件工程。这样的事情是什么时候从后面查阅一本教科书(20世纪80年代?)并查找耦合的概念。



Not a good idea in XML though. The idea that "directories are a funny
sort of file" is an artefact of some _implementations_ of file systems.
As far as data modelling goes it''s not the sort of coincidental factor
that should be preserved into a more abstract representation.

For one thing (and relevant to XML / DTD design) what should the content
model be for the children of this "file or directory" node ? Does it
have child nodes (as a directory does) or not (as a file does) ?
"Borrowing" HTML elements is bad software design too because it''s
confusing the fact that these are entirely separate elements because
they''re taken from separate namespaces. Relying on copy-of working and
giving the elements matching local-name() properties is piss-poor
software engineering. Look up a textbook from back when such things were
last taught (1980s ?) and lookup the concept of "coupling".


这篇关于目录扫描的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆