Error XML "conatins"

 Hello, here is my xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<form>
    <description>
        <desc_id>048/26/SMD/HRD/9/00</desc_id>
        <title>Title2</title>
        <dates>3/21/1999</dates>
        <author>Smart Co</author>
        <file_name>Policy2</file_name>
        <type>pdf</type>
        <category>memorandum</category>
        <status>expired</status>
        <year>1983</year>
    </description>


    <description>
        <desc_id>11/HRD/HD/2/1998</desc_id>
        <title>Title5</title>
        <dates>2/22/1997</dates>
        <author>Smart</author>
        <file_name>Policy5</file_name>
        <type>pdf</type>
        <category>memorandum</category>
        <status>expired</status>
        <year>1984</year>
    </description>
</form>
 

Here is my path :

path="form/description[contains(<%=request.Form("search_by")%>, '<%=request.Form("txtSearch")%>')]//*";

it replied an error. The error said that "unknown method"

0
deean
6/12/2008 9:07:21 AM
asp.net.xml-datasource 7181 articles. 0 followers. Follow

9 Replies
481 Views

Similar Articles

[PageSpeed] 47

 Hi,

 

You are missing some single quotes and need to escape some of your characters: e.g.

 

 

Entity

Value

Usage

amp

&

&amp;

apos

'

&apos;

gt

&gt;

lt

&lt;

quot

"

&quot;


Something like this

path="form/description[contains('" + <%=request.Form("search_by")%> + "'", .....


If I was helpful, please mark "answered" so I can get credit. Thanks!
0
Bonekrusher
6/12/2008 11:09:46 AM

I tried this :

path="form/description[contains(" + <%=request.Form("search_by")%> + "," +"&apos;<%=request.Form("txtSearch")%>&apos;" + "]//*"; 

 

but it still an error..can you help me which error actually...The error said tha it was unknown method

Crying

 

Thanks
 

0
deean
6/12/2008 11:20:02 AM

 What is the error?

 


If I was helpful, please mark "answered" so I can get credit. Thanks!
0
Bonekrusher
6/12/2008 12:16:08 PM
The error is "unknown method"
0
deean
6/12/2008 12:28:34 PM

 Can you post  your complete code?

 


If I was helpful, please mark "answered" so I can get credit. Thanks!
0
Bonekrusher
6/12/2008 1:24:21 PM

Here is the code:


<html>
<head>
<title>Search Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.class1 A:link {COLOR: #000000; TEXT-DECORATION: none; font-weight: bold}
.class1 A:active {COLOR: #0066CC; TEXT-DECORATION: underline}
.class1 A:visited {COLOR: #0066CC; TEXT-DECORATION: none; font-weight: bold}
.class1 A:hover {COLOR: #ff6600; TEXT-DECORATION: underline}

body
{
font-family: Tahoma;
color: #999999;
background: url(image/black1.jpg);
}
               
body table tr td
{
font
color: #999999;
}
#header
{
background: url(image/black-vintage.jpg)
}
</style>
</head>

<body>
<p><img src="image/grey-garden-resize1.jpg" width="977" height="150"></p>
<table width="1056" border="0" cellpadding="2" cellspacing="2">
  <tr>
    <td width="975">
    <div align="right">
        <strong><font size="2">Date:<%response.write(date())%>&nbsp;:: </font></strong>
        <strong><font size="2">Time:<%response.write(time())%></font></strong>
    </div>
    </td>
  </tr>
</table>
<p align="right"><font size="2" face="Century Gothic"><strong><font color="#000000">
  </font></strong></font><font size="4" face="Century Gothic"> </font>
<div align="center"><font size="4" face="Century Gothic">
  <p>&nbsp;
<p>
    <%
'Check if user is logged in
if Session("name") = "" then
    'If not, go to login page
    Response.Redirect("login.asp")
else
    'If, build page
    Response.Write("<title>ASP Page</title>")
    Response.write("<center><h2>Welcome <b>" & Session("name")& "</h2>")
   
   
end if
%>
  <p align="right">&nbsp; </p>
  </font>
<form name="form1" method="post" action="search_home.asp">
    <p>&nbsp;
    <table align="center">
    <tr>
    <td>
    Search by
    </td>
    <td>
    :
    </td>
        <td> <select name="search_by" size="1" id="search_by">
            <option value="desc_id">desc_id</option>
            <option value="title">title</option>
            <option value="dates">dates</option>
            <option value="author">author</option>
            <option value="file_name">file_name</option>
            <option value="type">type</option>
            <option value="category">category</option>
            <option value="status">status</option>
            <option value="year">year</option>
          </select> </td>
    </tr>
    </table></p>
    <p>&nbsp;</p><p>
      <input name="txtSearch" type="text" id="txtSearch2">
      &nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" name="Submit" value="Search">
    </p>
  </form>
  </div>
<%
set db=server.createobject("ADODB.Connection")
    db.open"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("users.mdb")
    set rsShow = server.createobject("ADODB.recordset")
    strsql="select * from desclist"
    rsShow.open strSQL,db,1,3
    %>   
<script type="text/javascript">
var xmlDoc=null;
if (window.ActiveXObject)
{
// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)
{// code for Firefox, Mozilla, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("description2.xml");
path="form/document[contains(" + <%=request.Form("search_by")%> + "," +"&apos;<%=request.Form("txtSearch")%>&apos;" + "]//*";


document.write("<table border='2'>");

var nodes=xmlDoc.selectNodes(path);
for (i=0;i<nodes.length;i++)

{
    if (nodes[i].nodeName=="file_name")
    {
   
    document.write("<tr align=left>");
    document.write("<td>");
    var x = "\documents\\"+nodes[i].childNodes[0].nodeValue+"."+nodes[i+1].childNodes[0].nodeValue;

    document.write("<a href="+x+">");
    document.write(nodes[i].childNodes[0].nodeValue);
    document.write(".");
    document.write(nodes[i+1].childNodes[0].nodeValue);
      document.write("<br />");
    document.write("</a>");
    document.write("</td>");
    //document.write("</td>");
    document.write("</tr>");
   

    }
    else
    {
    //document.write("<tr>");
    //document.write("<td>");
    //document.write(nodes[i].nodeName);
    //document.write("<td>");
    //document.write(nodes[i].childNodes[0].nodeValue);
  //    document.write("<br />");

    //document.write("</td>");
    //document.write("</td>");
    //document.write("</tr>");
   
    }
   
}
document.write("</table>");
}
</script>

<div align="right">
  <table border="0" cellspacing="2" cellpadding="2" background="image/black_white_21_th.jpg">
    <tr>
      <td width="1000" class="class1"><div align="right"><font size="1" face="Century Gothic">::<A href=Javascript:history.back()>Back</a>::<a href="logout.asp">Logout</a>::</font><font size="1" face="Tahoma">
          </font> </div></td>
    </tr>
  </table>
 
</div>
</body>
</html>

 Here is my XML:

<form> 

 <document>
        <desc_id>11/22/HRD/HRSD/2/2000</desc_id>
        <title>Kebijakan7</title>
        <dates>6/8/2007</dates>
        <author>Smart</author>
        <file_name>Policy7</file_name>
        <type>doc</type>
        <category>surat_keputusan</category>
        <status>Masih berlaku</status>
        <year>1981</year>
    </document>
</form>

0
deean
6/12/2008 1:37:15 PM

 Hi, I think you need a slash before your root element

 

path="/form/document[contains(" + <%=request.Form("search_by")%> + "," +"&apos;<%=request.Form("txtSearch")%>&apos;" + "]//*"; 

 

Also "//*" means you want to select all nodes. Is this you intention?

 


If I was helpful, please mark "answered" so I can get credit. Thanks!
0
Bonekrusher
6/12/2008 6:53:17 PM

I tried this:

 path="/form/document[contains(" + <%=request.Form("search_by")%> + "," +"&apos;" + <%=request.Form("txtSearch")%> +" &apos;" + "]//*"; 

 

but it still error : " 'type' is undefined  "

 "type" here means the value of search_by. So, if I choose "author", the error will appear "author" is undefined

 

"//*" means select all nodes.

 

When I tried this:

path="/form/document[contains(" + <%=request.querystring("search_by")%> + "," +"&apos;" + <%=request.querystring("txtSearch")%> +" &apos;" + "]//*";

it shows an error: "Unknown method" 

 

 

0
deean
6/13/2008 4:31:34 AM

Hi deean ,

deean:
path="/form/document[contains(" + <%=request.querystring("search_by")%> + "," +"&apos;" + <%=request.querystring("txtSearch")%> +" &apos;" + "]//*";

I think this is wrong , it will cause  an error: "Unknown method" . This is because you pass the wrong parameter to this function. The first parameter of this function must be the type of string.

Let's see the contain function :

fn:contains(string1,string2) Returns true if string1 contains string2, otherwise it returns false

Example: contains('XML','XM')
Result: true

So if you pass one tag name as the first parameter , it will be treated as one function. But it does not recognize this function , so the error occurs.

In general , we will pass one funtion to the parameter and the function will return one string.

For example:

//*[contain(name(),'abcdefg')]

 

 

 



Samu Zhang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Samu
6/16/2008 10:44:06 AM
Reply:

Similar Artilces:

datawindow.import(XML!,"file.xml") syntax error
I am using Pocket PowerBuilder 1.5 build 360 from the help file I saw [ImportFile method (DataWindows)] long dwcontrol.ImportFile ( {saveastype importtype}, string filename {, long startrow {, long endrow {, long startcolumn {, long endcolumn {, long dwstartcolumn } } } } } ) This statement inserts all the data in the file D:\TMP\EMPLOYEE.CSV into dw_employee starting at the first column: dw_employee.ImportFile("D:\TMP\EMPLOYEE.CSV") This statement inserts all the data in the file D:\TMP\EMPLOYEE.XML into dw_employee starting at the first column: dw_em...

superreview requested: [Bug 219355] XML Parsing Error: undefined entity on files with Mime-Type: application/xhtml+xml, including about:, or "text/xml" : [Attachment 131594] use NS_GRE_DIR
Benjamin Smedberg <bsmedberg@covad.net> has asked Darin Fisher <darin@meer.net> for superreview: Bug 219355: XML Parsing Error: undefined entity on files with Mime-Type: application/xhtml+xml, including about:, or "text/xml" http://bugzilla.mozilla.org/show_bug.cgi?id=219355 Attachment 131594: use NS_GRE_DIR http://bugzilla.mozilla.org/attachment.cgi?id=131594&action=edit ...

superreview granted: [Bug 219355] XML Parsing Error: undefined entity on files with Mime-Type: application/xhtml+xml, including about:, or "text/xml" : [Attachment 131594] use NS_GRE_DIR
Darin Fisher <darin@meer.net> has granted Benjamin Smedberg <bsmedberg@covad.net>'s request for superreview: Bug 219355: XML Parsing Error: undefined entity on files with Mime-Type: application/xhtml+xml, including about:, or "text/xml" http://bugzilla.mozilla.org/show_bug.cgi?id=219355 Attachment 131594: use NS_GRE_DIR http://bugzilla.mozilla.org/attachment.cgi?id=131594&action=edit ...

When I get .XML document with Request.Form["xml"].ToString(); it gets error.
XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Request.Form["xml"].ToString());  I want system doesn't interrupt the code execution. How can I do system doesn't give error message?  Thanks.  Error Message  A potentially dangerous Request.Form value was detected from the client (xml="...8859-9" ?><BORCELIK><Tarih>09/...").  ...

superreview requested: [Bug 251274] Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line:
Boris Zbarsky <bzbarsky@mit.edu> has asked neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> for superreview: Bug 251274: Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line: 684"] https://bugzilla.mozilla.org/show_bug.cgi?id=251274 Attachment 193251: Fix https://bugzilla.mozilla.org/attachment.cgi?id=193251&action=edit ------- Additional Comments from Boris Zbarsky <bzbarsky@mit.edu> This just makes su...

"There was an error generating the XML document" error
Using PB10.5.2 Build 7016 Generated proxies for Web Service using .NET (not EasySoap) Most functions work, but getting this error when calling a particular function whose 1st parameter is a complex datatype (which PB converts to structure) consisting of other complex data types (which PB converts to structures). The function is: SetTerminalsApplicationCharacteristics ( ggws_fwMTSetAppCharacteristics AppCharacteristics, string terminals[] ) returns ggws_sendmessageresponses ggws_fwMTSetAppCharacteristics has 17 fields that are structures. Each of these structures has 2-5 fields ...

superreview granted: [Bug 251274] [FIX]Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Lin
neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> has granted Boris Zbarsky <bzbarsky@mit.edu>'s request for superreview: Bug 251274: [FIX]Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line: 684"] https://bugzilla.mozilla.org/show_bug.cgi?id=251274 Attachment 193251: Fix https://bugzilla.mozilla.org/attachment.cgi?id=193251&action=edit ------- Additional Comments from neil@parkwaycc.co.uk <neil.parkwa...

New Install: <?xml version="1.0" encoding="UTF-8" ?> error
Hi,I'm new to .net.  I'm trying to install DotNetNuke on my XP Pro with IIS 5.0 box.  I've made all the changes to web.config, created the db with permissions and I'm still getting the same error.Can't figure it out!Here's the error:  Server Error in '/DotNetNuke' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Stream is not a valid resource file.Source Error: Line 1...

Parser Error
What do I make to solve that problem? Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Stream is not a valid resource file.Source Error: Line 1: <?xml version="1.0" encoding="utf-8" ?> Line 2: <locales> Line 3: <inactive>Source File: /dotnetnuke320/App_GlobalResources/Locales.Portal.xml.resources    Line: 1 Version Information: Microsoft .NET Framework Versio...

XML "out of memory" error
We're testing an application we developed which passes information back and forth with another application using XML and Indy components. Recently, we've seen some attempted connections which are not instigated by our application. When these happen, we're getting "out of memory" exceptions. This occurs on the server when the IdTCPServer1Execute event is triggered. A snippet of the code is below: with AContext.Connection.IOHandler do begin DataStream := TStringStream.Create(''); try ReadStream(DataStream); try xmlIncoming := LoadXMLDat...

superreview granted: [Bug 428847] XML Parsing Error with ":" in href attribute of xml-stylesheet processing instruction : [Attachment 316114] Fix, with tests.
Jonas Sicking (:sicking) <jonas@sicking.cc> has granted Johnny Stenback (:jst) <jst@mozilla.org>'s request for superreview: Bug 428847: XML Parsing Error with ":" in href attribute of xml-stylesheet processing instruction https://bugzilla.mozilla.org/show_bug.cgi?id=428847 Attachment 316114: Fix, with tests. https://bugzilla.mozilla.org/attachment.cgi?id=316114&action=edit ...

superreview requested: [Bug 428847] XML Parsing Error with ":" in href attribute of xml-stylesheet processing instruction : [Attachment 316114] Fix, with tests.
Johnny Stenback (:jst) <jst@mozilla.org> has asked Jonas Sicking (:sicking) <jonas@sicking.cc> for superreview: Bug 428847: XML Parsing Error with ":" in href attribute of xml-stylesheet processing instruction https://bugzilla.mozilla.org/show_bug.cgi?id=428847 Attachment 316114: Fix, with tests. https://bugzilla.mozilla.org/attachment.cgi?id=316114&action=edit ...

"Attempt to use an "XML" extension that has not been registered..."
Hello, I am using Reporting Service in server mode.I currently have a report in which in include a few subreports. All of them use the same datasource (sqlserver 2005 database connectionstring)I have to add another report which is based on XML data. To do so, I created a new shared datasource, designed my query, added the report parameters, tested the query... This works but when I try to deploy this report on the report server I am getting an error I do not understand:"Attemps to use an "XML" extension of data that has not been registered for this report server"I do...

How can I solve this error "XML Parsing Error: no element found"
 heres my code behind in UploadImage.aspx.vb _____________________________________________________________________________________________________________________________Imports System.Data.SqlClientImports System.ConfigurationImports System.IOPartial Class UploadImage    Inherits System.Web.UI.Page    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click        Dim conn As New SqlConnection        Dim comm As New SqlCommand  ...

Web resources about - Error XML "conatins" - asp.net.xml-datasource

Resources last updated: 12/24/2015 11:01:17 AM