- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
<分区>
我有一个名为 processDeleteForm() 的 PHP 函数,用于从名为 structure.xml 的 xml 文档中删除指定的节点。到目前为止我遇到的唯一问题是在 processDeleteForm() 中,它通过循环遍历父节点的每个子节点来搜索要删除的节点,并通过“名称”属性匹配它,但我没有'能够为循环获取正确数量的子节点,因此它在到达正确的节点之前停止。相关代码:
function processDeleteForm($dir, $filename)
{
echo "Processing delete request.<br/>";
echo "Request to delete ".$filename." from ".$dir.".<br/>";
$xmlDoc = new DOMDocument();
$xmlDoc->load("structure.xml");
$node = dirDOMNodeWritable($dir, $xmlDoc);
$target;
echo "Working directory has ".count($node->childNodes)." child(ren).<br/>";
for($x = 0; $x < count($node->childNodes); $x++)
{
if($node->childNodes->item($x)->getAttribute("name") == $filename)
{
$target = $node->childNodes->item($x);
echo "Target found.<br/>";
}
else
{
echo "Searching for target...<br/>";
}
}
if($target->getAttribute("type") != "directory")
{
$fstored = "uploads/".$target->childNodes->item(0)->wholeText;
unlink($fstored);
}
$node->removeChild($target);
$file = fopen("structure.xml", "w");
fwrite($file, $xmlDoc->saveXML());
}
结构.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<directory name="root" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="directory">
<directory name="music" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="directory">
<directory name="She" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="directory">
<directory name="Chiptek" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="directory">
<directory name="mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="directory">
<file name="intro.mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/mpeg">intro.mp3</file>
<file name="music.mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/mpeg">music.mp3</file>
<file name="supersonic.mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/mpeg">supersonic.mp3</file>
<file name="memories.mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/mpeg">memories.mp3</file>
<file name="chiptek.mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/mpeg">chiptek.mp3</file>
<file name="intermission.mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/mpeg">intermission.mp3</file>
<file name="kicks.mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/mpeg">kicks.mp3</file>
<file name="1997.mp3" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/mpeg">1997.mp3</file>
</directory>
<directory name="ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="directory">
<file name="intro.ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/ogg">intro.ogg</file>
<file name="music.ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/ogg">music.ogg</file>
<file name="supersonic.ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/ogg">supersonic.ogg</file>
<file name="memories.ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/ogg">memories.ogg</file>
<file name="chiptek.ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/ogg">chiptek.ogg</file>
<file name="intermission.ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/ogg">intermission.ogg</file>
<file name="kicks.ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/ogg">kicks.ogg</file>
<file name="1997.ogg" owner="elarsen" read="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" write="aclum,ahoffman,apavlowski,bvollmer,dpotts,drichardson,epiatt,jcantrell,jreeve,kdouglas,kjab,lbrewer,lholliday,mfriedman,norty,pmoore,rlongwell,scatlett,sketcherside,tperkins" type="audio/ogg">1997.ogg</file>
</directory>
</directory>
</directory>
</directory>
<directory name="test01" owner="elarsen" read="0" write="0" type="directory"/>
<directory name="test02" owner="elarsen" read="0" write="0" type="directory"/>
<directory name="test03" owner="elarsen" read="0" write="0" type="directory"/>
</directory>
*上面应该是一个xml文件的内容,但我不知道如何显示它。如果对在 stackoverflow 上格式化 xml 有更多了解的人可以修复它,我将非常感激。
查看负责创建名为“test01”、“test02”和“test03”的目录的代码可能也很有用:
function processNewForm($dir, $dirName, $readPrivs, $writePrivs)
{
$readString = "";
$writeString = "";
$dirOwner = $_SESSION["user"];
for($x = 0; $x < count($readPrivs); $x++)
{
$readString += $readPrivs[$x].",";
}
for($x = 0; $x < count($writePrivs); $x++)
{
$writeString += $writePrivs[$x].",";
}
$xmlDoc = new DOMDocument();
$xmlDoc->load("structure.xml");
$node = dirDOMNodeWritable($dir, $xmlDoc);
$newDir = $xmlDoc->createElement("directory");
$newDir->setAttribute("name", $dirName);
$newDir->setAttribute("owner", $dirOwner);
$newDir->setAttribute("read", $readString);
$newDir->setAttribute("write", $writeString);
$newDir->setAttribute("type", "directory");
$node->appendChild($newDir);
$file = fopen("structure.xml", "w");
fwrite($file, $xmlDoc->saveXML());
}
当前输出如下所示:
Received delete request.
Validating delete request... Request is valid.
Processing delete request.
Request to delete test03/ from /.
Working directory has 1 child(ren).
Searching for target...
Notice: Undefined variable: target in E:\aepi\dev\fileshare.php on line 540
Fatal error: Call to a member function getAttribute() on a non-object in E:\aepi\dev\fileshare.php on line 540
我有一个问题需要分而治之解决。有一个包含 N 个点的集合 S。如果有一个平行于轴的正方形,只包含S中的两个点p1和p2,则我们称p1和p2为 friend 点。 现在,我需要使用分而治之算法来计算 S
为 iPad 编程时,字体(和其他)大小以“磅”为单位指定。我已经看到将点作为独立于屏幕分辨率的像素的引用。但是我无法确定一个点的实际大小(即以英寸为单位)。一个点是否等于标准 iPad 屏幕上的一个
我有一个来自 Hadley Wickham 的 ggplot2 书中的问题。 我在这里有这个数据框: class % group_by(class) %>% summarise(n = n
好的,这是一些代码( pdfDocument 是 com.itextpdf.text.Document ): PdfPTable table = new PdfPTable(1); PdfPCell
我正在尝试添加一个 if 语句,如果小于 17,则将另一张牌添加到 DealerHand 中。 目前,它只是记录: 7 19 [ { suit: '♦', value: 9, points: 9 },
我正在编写一个程序,我需要: 对图像的每个像素进行测试 如果测试结果为真,我必须向点云中添加一个点 如果测试结果为假,什么都不做 我已经在 CPU 端 C++ 上编写了一个工作代码。现在我需要使用 C
我是一名优秀的程序员,十分优秀!