示例文件xml 1
enter code here
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>`
<genre>Test1</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
示例文件xml 2
enter code here
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Test2</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
需要获取“GENRES”的值然后创建每个文件夹吗?
答案 0 :(得分:1)
使用移动文件部分:
Get-ChildItem *.xml | % {
[xml]$x=get-content $_ ;
$newpath=$x.catalog.book.genre
new-item "$newpath"-type Directory -ErrorAction SilentlyContinue
if ( test-path "$newpath" ) {
move-item "$_" -destination "$newpath"
}
}
答案 1 :(得分:0)
我知道你想要一个xml文件中找到的每个类型的目录,所以,如果每个文件都有一本书:
'Here I assume that, you will call PopulateServices to populate servicesList checkbox list
PopulateServices()
'You didn't mention fieldName, so I assume that field in database is :
'savedServices - This will be li tags like, <li>item 1</li><li>item 2</li>
'Now loop through all items within checkbox list
For Each chk As ListItem In servicesList.Items
'You need to check whether this item saved in database or not?
'If item already saved in database, display as selected
If savedServices.Contains("<li>" & chk.Text & "</li>") Then
'display item as selected
chk.selected = true
End If
Next