标签: searching-xml

在个人网站上使用谷歌Chrome的OmniBox [TAB]功能?

我认为标题解释了这一切,但我还是更深入地研究了我的问题:

如何在我的网站上使用Chrome的Omnibox [TAB]功能?

由于许多用户要求我在网站上实现该功能,我对OpenSearchDescription进行了研究,并且在使用FireFox和IE7/IE8搜索栏时非常成功.

然而,实施对Chrome Omnibox [TAB]功能并不起作用.

你能帮帮我吗?

我的OSD.xml代码:

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                       xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>MySite</ShortName>
<Description>My Site</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://MySite.com/favicon.ico</Image>
<Url type="application/x-suggestions+json" method="GET"
     template="http://ff.search.yahoo.com/gossip?output=fxjson&amp;command={searchTerms}" />
<Url type="text/html" method="POST" template="http://MySite.com/query.php">
  <Param name="sString" value="{searchTerms}"/>
</Url>
<Url type="application/x-suggestions+json" template="suggestionURL"/>
<moz:SearchForm>http://www.MySite.com</moz:SearchForm>
</OpenSearchDescription>
Run Code Online (Sandbox Code Playgroud)

这是我页面上osd文件的链接:

<link rel="search" type="application/opensearchdescription+xml" title="MySite" href="/opensearch.xml" />
Run Code Online (Sandbox Code Playgroud)

google-chrome searching-xml opensearch

14
推荐指数
2
解决办法
1万
查看次数

使用C#在XML文档中查找特定值的好方法是什么?

我正在调用Oracle公开的WebService,它接受ItemID的输入并返回相应的Item Number.我想获取已从响应中包含的XML返回的Item Number.

XML看起来像这样:

<env:Envelope
  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:ns0="http://dev1/MyWebService1.wsdl">
 <env:Header>
  <wsse:Security
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    env:mustUnderstand="1"/>
 </env:Header>
 <env:Body>
  <ns0:getItemNbrByItemIdResponseElement>
   <ns0:result>1010603</ns0:result>
  </ns0:getItemNbrByItemIdResponseElement>
 </env:Body>
</env:Envelope>
Run Code Online (Sandbox Code Playgroud)

我有兴趣只抓住<ns0:result>1010603</ns0:result>特别是1010603.

我没有做过很多使用C#解析XML的工作,到目前为止我正在使用一些不同的方法.建议的方法是什么?

我在VS2008上(所以XPath可用等)

c# xml xpath searching-xml

6
推荐指数
2
解决办法
3064
查看次数

SelectSingleNode返回null - 即使是命名空间

我知道之前已经以类似的方式询问过这个问题,但我似乎无法让这个问题起作用.

我有一些xml:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
    <Research xmlns="http://www.rixml.org/2005/3/RIXML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" createDateTime="2011-03-29T15:41:48Z" language="eng" researchID="MusiJvs3008">
    <Product productID="MusiJvs3008">
    <StatusInfo currentStatusIndicator="Yes" statusDateTime="2011-03-29T15:41:48Z" statusType="Published" />
    <Source>
    <Organization type="SellSideFirm" primaryIndicator="Yes">
    <OrganizationID idType="Reuters">9999</OrganizationID> 
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用xpath读取值:

XPathDocument xmldoc = new XPathDocument(xmlFile); 
XPathNavigator nav = xmldoc.CreateNavigator(); 
XmlNamespaceManager nsMgr = new XmlNamespaceManager(nav.NameTable);
nsMgr.AddNamespace(string.Empty, "http://www.rixml.org/2005/3/RIXML"); 
XPathNavigator result = nav.SelectSingleNode("/Research", nsMgr); // <-- Returns null!
Run Code Online (Sandbox Code Playgroud)

但即使是简单的根节点选择也会返回null!我确信我的命名空间有问题.有人可以帮忙吗?

理想情况下,我想要简单的线条,让我从xml文件中选择值,即

String a = xmlDoc.SelectSingleNode(@"/Research/Product/Content/Title").Value;
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我没有(直接)控制XML文件内容.

.net c# xml namespaces searching-xml

3
推荐指数
1
解决办法
4952
查看次数

标签 统计

searching-xml ×3

c# ×2

xml ×2

.net ×1

google-chrome ×1

namespaces ×1

opensearch ×1

xpath ×1