具有多个名称空间的Xml路径(Xml path that have multiple namespaces)
我无法弄清楚需要使用哪些命名空间来跟随Xml(示例):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ResponseCharge xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ResponseInfo xmlns="http://www.example.net"> <ResponseDetail> <ResponseCode>00</ResponseCode> <RequestIdentifier>1029034</RequestIdentifier> <RetrievalReferenceNumber>634716660366</RetrievalReferenceNumber> <ProcessingTime>00:03:314</ProcessingTime> </ResponseDetail> <ResponseTransactionDetail> <AVSResponseCode /> <CVVResponseCode /> <AuthorizationSourceCode /> <AuthorizationNumber>004454</AuthorizationNumber> </ResponseTransactionDetail> <EMVResponseData /> </ResponseInfo> </ResponseCharge> </s:Body> </s:Envelope>
我的代码看起来像这个atm:
XmlDocument doc = new XmlDocument(); doc.Load(responseXmlFile); var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("s", "http://schemas.xmlsoap.org/soap/envelope/"); //nsmgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); //nsmgr.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema"); //nsmgr.AddNamespace("", "http://www.example.net"); // getting NULL here XmlNode node = doc.SelectSingleNode("/s:Envelope/s:Body/ResponseCharge/ResponseInfo/ResponseTransactionDetail/AuthorizationNumber", nsmgr);
我正在关注这篇文章: 需要命名空间管理器或XsltContext
I can't figure out what namespaces need to be used for following Xml (sample):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ResponseCharge xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ResponseInfo xmlns="http://www.example.net"> <ResponseDetail> <ResponseCode>00</ResponseCode> <RequestIdentifier>1029034</RequestIdentifier> <RetrievalReferenceNumber>634716660366</RetrievalReferenceNumber> <ProcessingTime>00:03:314</ProcessingTime> </ResponseDetail> <ResponseTransactionDetail> <AVSResponseCode /> <CVVResponseCode /> <AuthorizationSourceCode /> <AuthorizationNumber>004454</AuthorizationNumber> </ResponseTransactionDetail> <EMVResponseData /> </ResponseInfo> </ResponseCharge> </s:Body> </s:Envelope>
My code looks like this atm:
XmlDocument doc = new XmlDocument(); doc.Load(responseXmlFile); var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("s", "http://schemas.xmlsoap.org/soap/envelope/"); //nsmgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); //nsmgr.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema"); //nsmgr.AddNamespace("", "http://www.example.net"); // getting NULL here XmlNode node = doc.SelectSingleNode("/s:Envelope/s:Body/ResponseCharge/ResponseInfo/ResponseTransactionDetail/AuthorizationNumber", nsmgr);
I'm following this post: Namespace Manager or XsltContext needed
原文:https://stackoverflow.com/questions/41141186
更新时间:2024-02-15 06:02
最满意答案
不要使用
RewriteRule
。 请改用以下内容:Order Deny,Allow Deny from all Allow from 127.0.0.1 <Files /index.php> Order Allow,Deny Allow from all </Files> <Directory "/public"> Allow from all </Directory>
Don't use a
RewriteRule
. Use the following instead:Order Deny,Allow Deny from all Allow from 127.0.0.1 <Files /index.php> Order Allow,Deny Allow from all </Files> <Directory "/public"> Allow from all </Directory>
相关问答
更多-
如何通过htaccess子域访问zf2中的公用文件夹[复制](How to access public folder in zf2 by htaccess subdomain [duplicate])[2022-05-17]
在/zend/目录中设置htaccess文件: RewriteEngine On RewriteBase /zend/ RewriteRule ^(?!public/)(.*)$ public/$1 [L] Setup an htaccess file in your /zend/ directory: RewriteEngine On RewriteBase /zend/ RewriteRule ^(?!public/)(.*)$ public/$1 [L] -
.htaccess拒绝所有(.htaccess deny from all)[2021-11-17]
Deny from all 是.htaccess命令(您尝试查看的该文件的实际内容)。 不拒绝能够编辑文件。 只需在所选择的文本查看器中重新打开.htaccess文件,并根据需要进行更改,保存,然后将其重新上传到您选择的文件夹。 虽然我认为无意中你甚至阻止自己上传后查看该应用程序。 我会做一些像: order deny,allow deny from all allow from 127.0.0.1 这将拒绝所有人,但allow from线路上的IP,您将更改IP以匹配您可以从http://www.w ... -
我只需将includes文件夹从web-root中移出,但如果要阻止直接访问整个includes文件夹,则可以将.htaccess文件放在该文件夹中,其中只包含: deny from all 这样,您无法从该文件夹打开任何文件,但您可以将它们包含在php中,没有任何问题。 I would just move the includes folder out of the web-root, but if you want to block direct access to the whole include ...
-
我注册了新的主机,现在没有folder2。 /home/myaccount/public_html/ .htaccess文件。 /home/myaccount/public_html/folder1的Html文件以下代码适用于我 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/folder1/$1\.html -f Rew ...
-
Options -Indexes Options -Indexes
-
如果你在/secret/文件夹中有pdf,并且你在该文件夹中有一个htaccess文件,那么无论访问者或访问者是谁 , 都可以在访问pdf的任何时候获取文件。 对于网络服务器和htaccess文件中的内容,唯一的区别在于,从谷歌搜索结果列表中访问该PDF的人与正在设置的链接到他们的页面之间的区别是引用者。 从谷歌,推荐人将看起来像: https://www.google.com/search?q=secret+pdf : https://www.google.com/search?q=secret+pdf ...
-
要指定要从设置存档源中排除的文件,请使用Excludes参数: [Files] Source: "Src\*"; Excludes: "Src\SubFolder\FileToExclude.exe"; DestDir:"{app}"; Flags: ignoreversion recursesubdirs createallsubdirs To specify the file you want to exclude from your setup archive source use the Excl ...
-
有可能在特定的子文件夹中使用.htaccess全部拒绝 您可以使用简单的禁止规则来拒绝任何人访问特定文件夹中的任何内容,如下所示: RewriteRule ^admin/folder - [F] 它会返回一个错误403消息,如下所示: Forbidden You don't have permission to access ADDRESS on this server. 以上将禁止任何人访问文件夹public_html/admin/folder 或者你可以简化,只需将一个.htaccess文件夹放在 ...
-
据我所知,不,你不能。 浏览器(当直接尝试访问mp3文件时)和Flash播放器都在客户端工作,并向服务器发出完全相同的请求来检索mp3。 如果您可以修改Flash文件,则可以将mp3嵌入到Flash文件中,这样客户端就无法直接访问它。 As far as I can tell, no you can't. Both the browser (when directly trying to access the mp3 files) and the flash player works on the clie ...
-
拒绝所有用htaccess删除一个文件夹和一个文件[复制](Deny all exept one folder and one file with htaccess [duplicate])[2023-08-17]
不要使用RewriteRule 。 请改用以下内容: Order Deny,Allow Deny from all Allow from 127.0.0.1Order Allow,Deny Allow from all Allow from all Don't use a RewriteRule. Use the following instead: ...