Xpath with another xpath between single quotes
Hello,
Im using an xpath expression to find a node in a xml variable. In this xpath I need to equal the text part of the resolved node to the value returned from the xpath from another xml variable. The value returned from the second xpath needs to be between single quotes in the first xpath, but it is not working. I already tried this:
/path_to_xml1/root_node/node[text = '/path_to_xml2/root_node/node']
string(/path_to_xml1/root_node/node[text = '/path_to_xml2/root_node/node'])
string(/path_to_xml1/root_node/node[text = 'string(/path_to_xml2/root_node/node')])
thank you
When you say : "...I need to equal the text part of the resolved node", are you talking about a text attribute of the node or just the value of that node?
If it's just the value of the node then you should just use /path_to_xml1/root_node/node /path_to_xml2/root_node/node
Jasmin
Similar Messages
-
RWRUN60: Problem with parameter value containing space between single quote
Hi All
I'm using RWRUN60 to generate my report by following way:
C:\orant\BIN\RWRUN60.EXE userid=DBUser/dbpasswor@db BACKGROUND="NO" BATCH="YES" DESFORMAT="pdf" DESNAME="C:\report.pdf" DESTYPE="FILE" ORIENTATION="LANDSCAPE" PARAMFORM="NO" P_REPORTID="2431" P_REPORTNAME="Report Name" report="C:\report.rdf" P_WHERE="StartDate>=to_date('2011-07-14 10-37-00','YYYY-MM-DD HH24-MI-SS')"
When I tried to run given command above nothing was executed executed and any log didnt created.
I found out that problem occurs when text between two single quotes contains spaces. In my case it is a parameter P_WHERE. I need to keep such format because it is part of report query.
When I removed last parameter from command RWRUN60 successfully genereate pdf document.
Further I added new test parameter P_TEST(it is ignored by rdf) in the end of command line following:
P_TEST="test '11'" - rwrun60 generates report
P_TEST="test '1 1'" - rwrun60 doesn't; generate report
Can somebody help how to resolve given problem. Is it parsing bug or what else?Spaces on command lines a very often a bad idea. Get rid of them by changing the command, e.g.:
to_date('2011-07-14:10-37-00','YYYY-MM-DD:HH24-MI-SS') -
Problem with lookup-table and single quotes
SOA Suite 10.1.3.3. I have an ESB project with an XSLT map that uses orcl:lookup-table to translate values. I use this instead of lookup-dvm because I want non-IT users to manage the mappings without having access to the ESB Console.
According to the doco:-
G.1.79 lookup-table
orcl:lookup-table(table, inputColumn, key, outputColumn, datasource)
This function returns a string based on the SQL query generated from the parameters.
The string is obtained by executing:
SELECT outputColumn FROM table WHERE inputColumn = key
The problem I'm having is that it seems if "key" contains a single quote (i.e an apostrophe), then lookup-table fails to find the corresponding value - even though the value in table.inputColumn also contains the single quote.
I've put the incoming into an XSL variable, but to no avail.
<xsl:variable name="incoming">
<xsl:value-of select="/obj1:DEV_MESSAGE_TYP/DATA1"/>
</xsl:variable>
<xsl:variable name="dvm-text">
<xsl:value-of select="orcl:lookup-table('MYTABLE','INVAL',$incoming,'OUTVAL','ds/dev')"/>
</xsl:variable>
Are there any XSLT Gurus out there that have come across this or can think of ways around it?
Thanks in advance...
Regards,
GregOk - the above was on the right track but wasn't 100% because it can't handle more than 1 single quote (apostrophe) in the input to lookup-table.
I've since found a better solution - an XSLT re-usable template that operates recursively and so can replace multiple occurances of single quotes. I've modified it to handle a null input value, otherwise lookup-table will just return the value of the first row in the lookup table - doh! The way I've done it below, if null is passed in, then null will be returned.
This goes at the top of your XSLT map file...
<!-- reusable replace-string function -->
<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="from"/>
<xsl:param name="to"/>
<xsl:choose>
<xsl:when test="contains($text, $from)">
<xsl:variable name="before" select="substring-before($text, $from)"/>
<xsl:variable name="after" select="substring-after($text, $from)"/>
<xsl:value-of select="$before"/>
<xsl:value-of select="$to"/>
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$after"/>
<xsl:with-param name="from" select="$from"/>
<xsl:with-param name="to" select="$to"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text=''">NULL</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Then you call it from within the XSLT map as follows:-
<!-- if contains a single quote, replace with 2x single quotes. This makes lookup-table work! -->
<xsl:variable name="incoming">
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="inp1:myinputfield"/>
<xsl:with-param name="from">'</xsl:with-param>
<xsl:with-param name="to" select="'&apos;&apos;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="dvm-text">
<xsl:value-of select="orcl:lookup-table('MYLOOKUPTABLE','INVAL',$incoming,'OUTVAL','ds/dev')"/>
</xsl:variable>
<!-- lookup-table returns null if input value not found. Output original value instead -->
<xsl:choose>
<xsl:when test="$dvm-text=''">
<xsl:value-of select="inp1:myinputfield"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$dvm-text"/>
</xsl:otherwise>
</xsl:choose>
Much Thanks to everyone who shares information and methods on the Internet!
Cheers,
Greg -
How to pre-execute a variable between single quote?
Hi, All,
I have a stored procedure, part of it looks like:
select emp_id in emp_id_v
from emp
where last_name like 'emp_id_in%';
emp_id_in is a input parameter.
This wouldn't work because it takes "emp_id_in" as characters instead of a variable.
How to make this work?
Any comment would be greatly appreciated!Thanks for your replay. I know this is an option. Is there any other option? like Unix's ` operator?
-
JSF inputText takes apostrophe (single quote) as end of string
Hi,
I run into a problem with JSF when apostrophe(single quote) is in input text:
<h:inputText id="input1" styleClass="field" size="20" maxlength="20" value="#{bean.property1}" />
When user inputs string contains apostrophe (single quote), for example "John's task", the bean only gets "John". The text after the apostrophy is gone. It seems that the inputText takes apostrohe as end of the string.
I also test with escaple sequence, for example, input is "John\' task", the result in bean is still "John"
input is "John\\\' task", the result in bean is "John
It doesn't have problem with other special characters, such as "<">", "@" , double quote etc.
Finally, I fix the problem by replacing apostrohy with "& # 0 3 9".
I just wonder if anyone has similar prolbem and wehether this is some bug in certain version of JSTL or some configuration issue ( for example, some definittion for end of the string in some config file, etc).
Your insight is appreciated.
ThanksWithout the actual code we can't be of any meaning for you. Create a small reprocudeable test case and post the actual code here. For example:
JSF<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<f:view>
<html>
<head>
<title>test</title>
</head>
<body>
<h:form>
<h:inputText value="#{myBean.value}" />
<h:commandButton value="submit" action="#{myBean.action}" />
<h:outputText value="#{myBean.value}" />
</h:form>
</body>
</html>
</f:view>MyBeanpackage mypackage;
public class MyBean {
private String value;
public void action() {
System.out.println(value);
public String getValue() {
return value;
public void setValue(String value) {
this.value = value;
}faces-config:<faces-config>
<managed-bean>
<managed-bean-name>myBean</managed-bean-name>
<managed-bean-class>mypackage.MyBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>Which works fine by the way. -
Jstl inputText takes apostrophe (single quote) as end of string
Hi,
I run into a problem with jstl when apostrophe(single quote) is in input text:
<h:inputText id="input1" styleClass="field" size="20" maxlength="20" value="#{bean.property1}" />
When user inputs string contains apostrophe (single quote), for example "John's task", the bean only gets "John". The text after the apostrophy is gone. It seems that the inputText takes apostrohe as end of the string.
I also test with escaple sequence, for example, input is "John\' task", the result in bean is still "John"
input is "John\\\' task", the result in bean is "John\\".
It doesn't have problem with other special characters, such as "<".">",""", "@" etc.
Finally, I fix the problem by replacing apostrohy with "'".
I just wonder if anyone has similar prolbem and wehether this is some bug in certain version of JSTL or some configuration issue ( for example, some definittion for end of the string in some config file, etc).I'm using JSTL 1.1.1.2.
Your insight is appreciated.
ThanksThis isn't JSTL, it's JSF. There's a separate forum for this: http://forum.java.sun.com/forum.jspa?forumID=427
I think the escape character for a single quote is the single quote itself. Give that a shot.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
---------------------------------------------------------------- -
Single Quote causing problem in XPATH
The workflow was working fine until one of the fields had a single quote in the string and caused the update action to stall.
Using the Execute SQL query module I am updating data in an Oracle table. The query looks like this
UPDATE GSI_FEEDBACK_FORM_HEADERS
SET SITE_STREET = '{$ /process_data/xfaform/object/data/xdp/datasets/data/form1/Details/site_street $}',
SITE_STREET2 = '{$ /process_data/xfaform/object/data/xdp/datasets/data/form1/Details/site_street2 $}'
One of the forms had the street value
"Connah's Quay Deeside". I figured out that the single quote is causing the module to read it as the end of the XPATH, hence causing a "SQL command not ended properly" error.
Any suggestions to oversome this issue.
AdityaNo problem
It also:
Makes your SQL look much neater.
You can type in "test" values for the parameters, so that you can test your SQL statement and see the results.
Howard
http://www.avoka.com -
Hi,
I am firing following Xpath Query.
String xpath = "/////FEEDPUBNAME[contains(translate(.,'abcdefghijklmnopqrstuvwxyz',"
+ " 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'),'"+strPubName.toUpperCase().trim()+"')]";
String xpath1="NLAPUBLISHINGLIST/NLAPUBLICATIONS/*[@NAME='"+ strPubName.trim() +"']/PUBLOOKUP/FEEDPUBNAME";suppose if value of strPubName is Single's
Exception is thrown
how can fire Xpath query when a string having Single Quote in it.
Any suggestion or solutions will be appriciated.
eagrly waiting for a reply
Thanks.My bet is that you need to escape the quote somehow. Since this is not an Xpath forum, you might want to ask "how" somewhere else.
-
Dynamic SQL and Data with Single Quotes in it.
Hi There,
I have a problem in that I am using dynamic SQL and it happens that one of the columns does contain single quotes (') in it as part of the data. This causes the resultant dynamic SQL to get confused as the single quote that is part of the data is taken to mean end of sting, when in fact its part of the data. This leaves out a dangling single quote that was meant to enclose the string. Here is my dynamic SQL and the result of the parsed SQL that I have captured:
****Dynamic SQL*****
l_sql:='select NOTE_TEMPLATE_ID '||
'FROM TMP_NOTE_TEMPLATE_VALUES '||
'where TRIM(LEGACY_NOTE_CODE)='''||trim(fp_note_code)||''' '||
'and TRIM(DISPLAY_VALUE)='''||trim(fp_note_text)||''' ';
execute immediate l_sql INTO l_note_template_id;
Because the column DISPLAY_VALUE contains data with single quotes, the resultant SQL is:
******PARSED SQL************
select NOTE_TEMPLATE_ID
FROM TMP_NOTE_TEMPLATE_VALUES
where TRIM(LEGACY_NOTE_CODE)='INQ' and TRIM(DISPLAY_VALUE)='Cont'd'
And the problem lies with the single quote between teh characters t and d in the data field for DISPLAY_ITEM. How can I handle this?
Many thanks,I have been reliably informed that if one doesn't enclose char/varchar2 data items in quotes, the right indices may not be usedI am into oracle for past 4 years and for the first time i am hearing this.
Your reliable source is just wrong. Bind variables are variables that store your value and which are used in SQL. They are the proper way to use values in your SQL. By default all variables in PL/SQL is bind variable.
When you can do some thing in just straight SQL just do it. Dynamic SQL does not make any sense to me here.
Thanks,
Karthick. -
String with embedded single quote
Hi, all. We're trying to pass a string from one procedure to another, which will then do an EXECUTE IMMEDIATE on it. However, there are single quotes withing the string, and they're driving us nuts! This is what the concatenated string should look like when passed to the pw_execDDL procedure:
insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values ('MEAG', to_date('02-OCT-05','DD-MMM-YY'), 'Y',1);
Here's the concatenation process that doesn't work, and there are functions being called within the string:
chr_sql := 'insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values (' || '''' || prm_inoc_id || '''' || ', ' || 'to_date(' || '''' || prm_proof1 || ''''||','||'''' ||'DD-MMM-YY'||''''||')' || ', ' || '''' || fw_is_proof_valid(prm_birth_date, prm_proof1) || '''' || ',1);';
pw_execDDL(chr_sql); /* call the procedure to do the EXECUTE IMMEDIATE */
Help! We've tried every combination -- using two single quotes together, three, and four, and still no luck. Thanks.insert into appimmunization.wsrprfs (inoc_id, proof,
is_valid,proof_num) values ('MEAG',
to_date('02-OCT-05','DD-MMM-YY'), 'Y',1);
This statement can be made in a string with the following affectation:
chr_sql := 'insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values (''MEAG'', to_date(''02-OCT-05'',''DD-MMM-YY''), ''Y'',1)';
Note please that each single quote in your original string must be specified using two single quotes and that is all. It is more readable and more easy to do it this way.
Michel. -
Any way to generate a single quote (') with XSLT?
Hi:
I guess this is really an XSLT question. I'm using the Transform() method of an XMLType variable to apply a style sheet. The XML in the variable is just something simple like
<TBL>
<LAST_NAME>LIKE|JONES</LAST_NAME>
<FIRST_NAME>=|MARY</FIRST_NAME>
<AGE>=|50</AGE>
</TBL>
I am trying to get a stylesheet to transform something like the above into SQL such as
Select * from foo where LAST_NAME like 'JONES'
and FIRST_NAME ='MARY'
and AGE = 50But to do this, I need to generate the single quotes around the search terms and I can't get anything but LAST_NAME LIKE 'JONES'. Is there a way to do this? For now I am generating a ~ and replacing ~ for ' throughout the generated SQL text but that's a pretty sorry solution.
I thought that something like <xsl:text disable-output-escaping="yes">&</xsl:text> was going to work but then found out it has been deprecated. I was thinking character-map might work but that's an XSLT 2.0 thing and apparently 10g is on XSLT 1.0? In any case, it had no idea what I was trying to do with a character map.
So, am I overlooking an obvious way to get my stylesheet to insert apostrophes?
Thanks.It's 10.2.0.4.
Here's the procedure that accepts the XML/XSL clobs and tries to produce a SQL statement.
PROCEDURE GetSQLQueryFromXML(XMLClob in CLOB, XSLStylesheet in CLOB,
SQLQuery out CLOB, status out integer) IS
-- Define the local variables
xmldata XMLType; -- The XMLType format of the XML to transform
xsldata XMLType; -- The XMLType format of the stylesheet to apply
sqlQuery_XMLType XMLType; -- The XMLType format of the SQL query.
v_SQLQuery Clob; -- Holds XML Clob before translating ~ to '
BEGIN
status := -1; -- Initially unsuccessful
-- Get the XML document using the getXML() function defined in the database.
-- Since XMLType.transform() method takes XML data as XMLType instance,
-- use the XMLType.createXML method to convert the XML content received
-- as CLOB into an XMLType instance.
xmldata := XMLType.createXML(XMLClob);
-- Get the XSL Stylesheet using the getXSL() function defined in the database.
-- Since XMLType.transform() method takes an XSL stylesheet as XMLType instance,
-- use the XMLType.createXML method to convert the XSL content received as CLOB
-- into an XMLType instance.
xsldata := XMLType.createXML(XSLStylesheet);
-- Use the XMLtype.transform() function to get the transformed XML instance.
-- This function applies the stylesheet to the XML document and returns a transformed
-- XML instance.
sqlQuery_XMLType := xmldata.transform(xsldata);
-- Return the transformed XML instance as a CLOB value.
v_SQLQuery := sqlQuery_XMLType.getClobVal();
-- Change tildas to apostrophes. Currently unable to get an XSLT transformation
-- to insert single quotes, so we're inserting ~ instead. Now we need to
-- translate all ~s to 's in our query.
SQLQuery := translate(to_char(v_SQLQuery),'~','''');
status := 1; -- Everything went fine to get here
EXCEPTION
WHEN OTHERS THEN
raise_application_error
(-20102, 'Exception occurred in GetSQLQueryFromXML :'||SQLERRM);
END GetSQLQueryFromXML;The XML it works off of is
someXML CLOB :=
to_clob('<?xml version="1.0" encoding="windows-1252" ?>
<variable table_name="SOME_PERSON_TABLE" query_type="PERSON">
<item>
<fieldName><![CDATA[PERSON_KEY]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[Integer]]></fieldType>
<value><![CDATA[123456789]]></value>
</item>
<item>
<fieldName><![CDATA[LAST_NAME]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value><![CDATA[DOE]]></value>
</item>
<item>
<fieldName><![CDATA[FIRST_NAME]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value><![CDATA[JOHN]]></value>
</item>
<item>
<fieldName><![CDATA[MIDDLE_NAME]]></fieldName>
<criteria><![CDATA[-]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value />
</item>
<item>
<fieldName><![CDATA[SUFFIX]]></fieldName>
<criteria><![CDATA[-]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value />
</item>
</variable>');And the corresponding XSLT that should translate it is:
myStylesheet CLOB :=
to_clob('<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- <xsl:preserve-space elements="list-of-element-names"/> -->
<!-- We just want the SQL text output. No XML declaration etc. -->
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
<!-- Apostrophes will be made tildas and the PL/SQL will translate those to -->
<!-- apostrophes for the final SQL string. -->
<xsl:variable name="apos">~</xsl:variable>
<xsl:template match="/">
select * from
<xsl:value-of select="variable/@table_name"/>
where 1=1
<xsl:for-each select="variable/child::node()">
<xsl:choose>
<!-- if the value node is not null... -->
<xsl:when test="./value/text()[normalize-space(.)]">
<!-- There is another predicate. Add the AND term and the predicate -->
AND <xsl:value-of select="./fieldName"/>
<xsl:text> </xsl:text>
<xsl:value-of select="./criteria"/>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="string(./fieldType)=''String''">
<xsl:copy-of select="$apos" />
<xsl:value-of select="./value"/>
<xsl:copy-of select="$apos" />
</xsl:when>
<xsl:when test="string(./fieldType)=''Clob''">
<xsl:copy-of select="$apos" />
<xsl:value-of select="./value"/>
<xsl:copy-of select="$apos" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>');Basically if the VALUE element has a value then the fieldType is checked. If fieldType is String or Clob then we'll need the apostrophes. For now I'm putting in tildas and changing them later. -
XSLT with XML XPath references
I have not used XSLT, and don't need to much, but have questions on creating XML that will be used by client's XSLT.
We are using a tool (xstream) that automatically transforms a Java object into XML. When it has multiple references to the same object, instead of expanding it in each place, it refers to the previous location of the object. It can do this in two ways (examples below).
My question is, can XSLT use the XPath or RefID to navigate the XML? I know XSLT uses XPath, but I'm not sure if it uses it in this way.
-- Note in the following examples how 'type' and 'item' are the exact same object, and the second instance of the object refers to the first location in the XML doc.
<saleLineItemGrouping>
<item class="item">
<id>3000</id>
<retailPrice>
<type>
<code>USD</code>
<description>US Dollars</description>
<decimalPlaces>2</decimalPlaces>
<locale>en_US</locale>
</type>
<amount>400000000</amount>
</retailPrice>
<markdownAmount>
<type reference="../../retailPrice/type"/>
<amount>0</amount>
</markdownAmount>
</item>
<lineItems>
<saleLineItem>
<item class="item" reference="../../../item"/>
<saleLineItemGrouping id="1">
<item class="item" id="2">
<id>3000</id>
<retailPrice id="3">
<type id="4">
<code>USD</code>
<description>US Dollars</description>
<decimalPlaces>2</decimalPlaces>
<locale id="5">en_US</locale>
</type>
<amount>400000000</amount>
</retailPrice>
<markdownAmount id="6">
<type reference="4"/>
<amount>0</amount>
</markdownAmount>
</item>
<lineItems id="7">
<saleLineItem id="8">
<item class="item" reference="2"/>So as I read your answer, I understand XSLT cannot
"construct XPath expressions." But, can it read in
XML with that XPath notation?Sure, it can read in that XML. It's well-formed XML so why not? But I gather you want your XSLT to take those attributes, whose values are strings, and interpret those strings as XPath expressions. That, XSLT can't do.
To put it another way, the XPath expressions in an XSLT stylesheet have to be basically hard-coded there. So you could possibly solve your problem by first transforming the XML into an XSLT containing those expressions; e.g.<type reference="../../retailPrice/type"/>could be transformed into<xsl:value-of select="../../retailPrice/type"/>and then use that XSLT to do the actual transforming. But it would be extremely difficult to make that work -- I wouldn't want to have to do it myself.
The second idea, using reference="2" to refer to <item class="item" id="2">, is much more feasible.
Thank you for your replies and your patience.You're welcome. Have fun with XSLT. -
How to handle single quote between two single quotes in ABAP?
Dear SAP Gurus
I have a question regarding handling a string data.
Say I have a string ABCD'\&%$!!ABC'AAA123. Please notice that there are single quotes in my string.
I am writing a parser code in ABAP and getting into problem with if statement to check if the character read is a single quote.
When I type the following with a singleQuote between 2 singleQuoes as below, it gives error.
If CHAR = '''.
ENDIF.
How do I handle that? I searched for escape sequence and couldn't get any useful info.
Any feedback will be highly appreciated.
Thanks
RamOr just use string literals
if char = `'`. "note that ` is the "backquotation" mark not a regular quotation mark '
Regards
Marcin -
How to handle XML string with Single Quotes as a parameter to SP dynamically?
Hi,
I would like to know if there is a way to handle the Single Quotes in XML value when it is passed to Stored Procedure?
I should be able to handle it without adding another Single Quote to it.
Thanks,
Chandra ShekarHi Chandra,
Your requirement is not precise. Based on my understanding and guessing, are you metioning something like the below sample?
/*If the xml is generated you have no need to escape the singe quote(')*/
DECLARE @xmlTbl TABLE (ID INT,name VARCHAR(99));
INSERT INTO @xmlTbl VALUES(1,'Eric''s')
INSERT INTO @xmlTbl VALUES(2,'Zhang''s')
DECLARE @xmlDoc1 XML
SELECT @xmlDoc1
FROM @xmlTbl FOR XML PATH('PERSON'),ROOT('PERSONS')
EXEC yourProcedure @xmlDoc1
/*If your copy and paste the xml, you have to escape the single quote(') with 2s('')*/
DECLARE @xmlDoc2 XML
SET @xmlDoc2 = '<PERSONS>
<PERSON>
<ID>1</ID>
<name>Eric''s</name>
</PERSON>
<PERSON>
<ID>2</ID>
<name>Zhang''s</name>
</PERSON>
</PERSONS>'
EXEC yourProcedure @xmlDoc2
If that is not regarding your requirement, please elaborate with more details.
Eric Zhang
TechNet Community Support -
Query with Apostrophe (single quote)
Hi all,
I have noticed that when you enter a search string with an apostrophe (eg. Tito's Station) in a textbox on a form linked to a table and hit the Query button, it generates an sql error. I think this is cos u cannot have an apostrophe (single quote) in the search string in a "where" clause.
I am using Portal version 3.0.6.6.5 on an 8.1.7 database.
I have logged a tar (1744105.999) for this but it is said to be a bug (1759202). I wish to enquire whether any of you have had this problem with a later version or at which version leve this bug has been fixed.
Does any1 know how to limit the text typed into a texbox, so that it wont accept certain characters (eg. the apostrophe key) ??
ThanksHi Rene'
Thanks for your help! This will definitely help me alot! I am a little baffled with your code for delimiting the single quote. I tried it and it doesnt work.
Thanks very much for the response
Naseem
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rene' Castle ([email protected]):
This is still an issue in 3.0.8.9.8. You can use a Javascript validation routine to disallow special characters.
If you want to check to see that they only enter certain things you can do:
var s = theElement.value;
var filter=/^[a-zA-Z]{1,}$/;
if (s.length == 0 ) return true;
if (filter.test(s))
return true;
else
alert(" Please input a valid character" );
theElement.focus();
theElement.select();
return false;
The above code would only allow one or more alphabetic characters. You could make it [a-zA-Z0-9] to allow alphanumeric characters. You could also allow anything but specific characters by doing the following:
var s = theElement.value;
var filter=/[^']*/;
if (s.length == 0 ) return true;
if (filter.test(s))
alert(" Please input a string without a single quote (') in it" );
theElement.focus();
theElement.select();
return false;
else
return true;
Hope this gets you started.
Rene'<HR></BLOCKQUOTE>
null
Maybe you are looking for
-
Netboot and DHCP Issue - Setting up AST Diagnostic Gateway
Hi everyone, I recently set up a new Mac Mini as a stand-alone server for the Apple Service Toolkit Diagnostic Gateway. Here are the specs of the Mini, if needed by anyone: Mac OS X 10.6 Server (patched to 10.6.8) 2.66GHz Core 2 Duo 8 GB DDR3 RAM I h
-
A source distribution was made for a VI using 32-bit LabView 2009. The distribution was verified to work on another machine that ran 32-bit LabView 2009. However, when opened on a 64-bit LabView 2009, the VI was broken as indicated by the attached e
-
F4 (dashboard) now loads Luacher
I just updated to osx 10.8.3 and my dashboard button (f4) on the kayboard now loads the app launcher. I have checked every single setting for the keyboard to change F4 back, and it says it should work. (Note that Fn F4 brings up the dashboard, but it
-
Wifi says connected but can't connect to internet, email etc
my ipad wifi says it's connected but can't get internet, email etc.
-
Changing Clusterware and DB software owner
Hi folks, we have the following scenario. Our oracle user has installed CRS and RDBMS into seperate ORACLE_HOMEs. However, we are in a SAP implementation and the owner of the database software should be ora<SID>. I'm wondering whether a large chown o