About substring Xpath expression
Hi,
For getting first 5 letters of a name im using substring(Testname,1,5) It is workng fine.
If im using substring(Testname,0,6) for this also im getting same answer frist 5 characters.. why?
What is the starting position in substring. Why im getting same answers for both conditions?
Thanks
http://www.w3schools.com/xpath/xpath_functions.asp
starting index =1
fn:substring(string,start,len)
fn:substring(string,start) Returns the substring from the start position to the specified length. Index of the first character is 1. If length is omitted it returns the substring from the start position to the end
Example: substring('Beatles',1,4)
Result: 'Beat'
Example: substring('Beatles',2)
Result: 'eatles'
i guess when you start with something < 1, it won't find any characters on this index, but it will count for the length of your search
so (0,6) means, on 0 i won't find anything, on 1 i find the first character, and it will have 5 (6-1) characters left for the subsstring
i hope the not so great explanation makes it a bit clear
Similar Messages
-
Xpath expression substring or contains
Hi ,
I have this inbound source message
<?xml version="1.0" encoding="UTF-8" ?>
- <rfc:Z_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
- <TO_DATA>
- <item>
<LINE>000012E3 ABCD 3I 20070911164941</LINE>
</item>
</TO_DATA>
</rfc:Z_RFC>
and two inbound interfaces
condition is , if "ABCD" exists in the LINE field(type string) then the corresponding Interface mapping should execute.
I know the exact location of "ABCD occurence so I can use either contains or substring functions.
I tried /P1:Z_RFC/TO_DATA/item[substring(LINE,X,Y)="ABCD"] EX no right operand
/P1:Z_RFC/TO_DATA/item[substring(LINE,X,Y)]= "ABCD" with right operand
substring((/P1:Z_RFC/TO_DATA/item/LINE),X,Y) = "ABCD"
similarly I tried around with <b>"contains"</b> function too.
but not able to apply exactly, I tried with different options looking at different blogs in SDN.
so how should be the Xpath expression ?
thank you.
Babuyes,
I have two different interface mappings in interface determination.
I have same sender RFC interface(outbound) and two different target interfaces and so why I have two different interface mapping,MMs.
sender and reciever systems are same in both cases.
.................condition1--interface mapping1--
sender -
|-- |--
Receiver
.................condition2--interface mapping2--
>>>two dfferent interfaces one when the condition satisfies and other when the condition doens'tmacth...
I know why you are asking this,if we have one interface map and two target interfaces then we need to go for enhanced interface determination.
and need not to be just "substring" or "contains" function ,just any function will do.
so any suggestion about the above scenario in ASCII diagram?
thank you.
Babu -
Using substring in the XPATH expression for Receiver Determination
Hello, I need a little help please. In my receiver determination, I have a condition and I need to do a "not like" check. Basically, if the first three positions of the source field does not start with a specific code, then I need to execute the condition. The condition editor does not support a "not like" operand, so I went to the XPATH expression editor. I tried to used the XPATH substring function to get the first three characters and then do a "not equal" operand, but it doesn't appear to work. There are not any runtime errors, but the condition is not executing. Any ideas on this? Does the XPATH expression support the substring function?
Hi Jesse,
Can you please explain what is the meaning of http:// in the statement
/p1:PRODUCT/MATNRhttp://not(substring(.,string-length(.) - 2) = '123')
Please explein, I am having same issue. It is not working here.In My case it is
/p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,\"D\"))]
also tried with
/p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,'D'))]
Thanks in advance! -
Any reference material about XPath expressions???
Hi All
I am using XPath with java. Can someone refer me some good (and simple) Xpath tutorial or other material having some good examples of Xpath expressions.
Thanx.
ArshadAnd if you still feel that you can use some more info then try
wrox press' XSLT Programmers Reference by Michael Kay.
Its complete hand book with actual usage examples,including some complex mathematical examples(calculations)
Khalid Ali -
In XSLT, make XPath expression to retrieve attribute nodes
I have a problem fetching attribute nodes in an Xpath expression.
SOAP Request:
<Create ID=5/>
<Name>Per</Name>
I want to fetch the value of ID and put it into another variable with an XPath expression in a XSLT transformation.
If you look at http://www.w3schools.com/xpath/xpath_syntax.asp
You should be able to do this with "//Create[@ID]" according to the examples, but this is not working at all in JDev.
Any thoughts?
/PerThanks, that worked!
Just thought about it. How do you do the other way around.
<Create>
<ID>7</ID>
to
<Create ID=7>
. -
ORABPEL-09503 Invalid xpath expression in a CASE expression
Hi I have the following case statement in my BPEL process -
<switch name="checkAuthenticateResult">
<case condition="upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_RETURN_STATUS')))='S' AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'">
<bpelx:annotation>
<bpelx:pattern>authenticatePass
</bpelx:pattern>
</bpelx:annotation>
<assign name="assignTktOutput">
<copy>
<from expression="boolean(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')='T')"/>
<to variable="outputVariable" part="payload" query="/client:WshSendTxnToOtmServiceProcessResponse/client:result/ns2:authenticated"/>
</copy>
</assign>
</case>
<otherwise>
<throw name="throwAuthenticateFail" faultVariable="g_faultVariable" faultName="faultError"/>
</otherwise>
</switch>
When I run my process in 10.1.2, it works fine, but when I run it in 10.1.3.1, it errors out with the following error -
<Faulthttp://schemas.xmlsoap.org/soap/envelope/>
<faultcode>env:Server</faultcode>
<faultstring>ORABPEL-09503 Invalid xpath expression. Error while parsing xpath expression "upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_RETURN_STATUS')))='S' AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'", the reason is Unknown expression at EOF: upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_RETURN_STATUS')))='S' AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'..
Please verify the xpath query "upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_RETURN_STATUS')))='S' AND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'" which is defined in BPEL process.
</faultstring><faultactor></faultactor></env:Fault></env:Body></env:Envelope>
Do you think there was a bug in the expression that has surfaced due to some additional validations in 10.1.3.1 or am I missing something here?
Thanks a lot for your help.
Thanks.
RVAND upper-case(string(bpws:getVariableData('g_InvokeAuthenticateTicketOutput','OutputParameters','/ns13:OutputParameters/X_TKT_VALID')bpws:getVariableData('isAuthenticCaller'))) = 'T'"
what is this bold part about? this looks wrong to me..
/clemens -
XPath Expression at Condition Editor in Receiver Determination
Hi,
I have a fixed length flat file coming in into which I have to look at the first line's 4th to 7th positions. Based on that if it is "1234" then I need to route it to the receiver else I will ignore in the receiver determination.
Example input file -
M 0123456789ABCDEFGHIJKL
PR0123456789JIDFJDIFJD0244
PA0123456789JFDJF9384384K
We have module configuration where we are converting this to a line value pair something like this -
<?xml version="1.0" encoding="utf-8"?>
<ns:GMTLog xmlns:ns="http://sap.com/xi/GMStoreConnectivity">
<Line>
<Value>M 0123456789ABCDEFGHIJKL
</Value>
</Line>
<Line>
<Value>PR0123456789JIDFJDIFJD0244
</Value>
</Line>
<Line>
<Value>PA0123456789JFDJF9384384K
</Value>
</Line>
</ns:GMTLog>
When I tried to test my xpath in xpath tester it is working fine with the below xpath expressions -
1. /ns:GMTLog/Line[Value][1] --> This returned the first record completely
2. substring(/ns:GMTLog/Line[Value][1], 4, 4) --> This returned exactly what I am expecting "1234"
But the above 2 are not working in condition editor.
May I know the exact xpath expression to be used in this case to route the message to receiver when 4th to 7th position is "1234".
Thanks a lot in advance.
Regards,
SaratGood day. Can I please have some clarity on what I need to correct on my Receiver expression test.
For the number of instances of the Summary segment, I am required to identify and test the Summary amount of SUMME if this is more than 5.00 (a currency amount). SUMME is a string so I thought I should convert this to a "number" value to test it.
Also ensuring that SUMME is checked when the SUMID is equal to 011.
Now I hope part of my solution below is correct, but the test of the field value is not being done.
Please help. -
Using jaxen to parse xpath expressions
Hi,
I want to parse this XPath expression with jaxen: +$X//employee[@id=0529]/salary+
after parsing i got this: +$X/descendant-or-self::node()/child::employee[(attribute::id = 529.0)]/child::salary+
Jaxen doesn't parse +//employee+ as I expected.
Is descendant-or-self::node()/child::employee equivalent to descendant-or-self::employee ?
Edited by: basti on Oct 28, 2007 2:02 PMIf I had to choose whether I think Jaxen interprets the XPath specs correctly or whether you do, I would choose Jaxen. But if you don't think so, wouldn't it be better to ask questions about Jaxen on the Jaxen mailing list?
-
Xpath expression for a custom SearchBoxEx WebPart to a DataFormWebPart
Hi all,
I have a custom search webpart that has asp controls that are used in my dataview (DataFormWebPart) for retreiving data. This data view has the xslt variable "Rows" with the following xpath expression:
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[
(contains(translate(@Title,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), translate($FilterName,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')) or $FilterName = '')]"/>
*<ParameterBinding Name="FilterName" Location="Control(txtName)" DefaultValue=""/>
This webpart searchs for people by their name. For example:
search for:
jose
results:
jose luis escudero
jorge jose torres
Ok, it works fine there, but what if I want to search for: jose escudero. There won't be any results because the search xpath expressions has a contains function for what you write in the textbox control.
So I think it should be splited by " " and searchs for the each word in the @Title column of the data source.
I don't master xpath expressions so I don't know how to code a correct xpath expression for that, any idea? I would greatly appreciate any help. Thanks.Hi betozg31,
According to your description, the point is that your Xpath code put the “jose escudero” search keyword as a unitary string. So your search would not return any results. I think
if you want to search result using two or more keywords ,you need to deal with the keywords firstly. Separating from the “jose escudero” search keyword , getting “jose” search keyword and “escudero” search keyword. Here is a simple code you
can have a look:
<xsl:if test="$FilterName =' ' ">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[ $FilterName=' ']"/>
</xsl:if>
<xsl:variable name="FormatFN" select="lower-case(normalize-space($FilterName))"/>
<xsl:variable name="FormatT" select="lower-case(@Title)" />
<xsl:if test="matches($FormatFN,' ')">
<xsl:variable name="FilterNameBefore" select="substring-before($FormatFN,' ')"/>
<xsl:variable name="FilterNameAfter" select="substring-after($FormatFN,' ')"/>
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[ contains(contains($FormatT, $FilterNameBefore),$FilterNameAfter )]"/>
</xsl:if>
<xsl:if test="not(matches($FormatFN,' '))">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[ contains($FormatT,$FormatFN)]"/>
</xsl:if>
Hope this helps!
Best Regards,
Eric
Eric Tao
TechNet Community Support -
Xpath expression to get depth child element
Hi
I wanted to find the depth element (sub isuer) in the hierarchy of 93699V issuer through xpath expression .
<?xml version="1.0" encoding="UTF-8"?>
<issuer id="93699V">/>
<subissuer id="06U99A">
<subissuer id="52729N">
<subissuer id="37932J">
<subissuer id="322995"/>
<subissuer id="35906P">
<subissuer id="001575"/> //child of issuer 93699V. since no further child
<subscriber id="771758"/> //child of issuer 93699V.since no further child
</subissuer>//end of 37932J
</subissuer>//end of 52729N
</subissuer> //end of 06U99A
</subissuer>
<subissuer id="06099K">
<subissuer id="06N99R"/>//child of issuer 93699V.since no further child
</subissuer>
<subissuer id="715680"/> ////child of issuer 93699V.since no further child
</issuer>
what is the xpath expression to find the depth child of 93699V.i .e o/p is as follows.Since now we have four depth element.
001575
771758
06N99R
715680
Please let me know the xpath expression to get depth sub issuerNot sure if this helps, there is a section about creating loops in the Workbench ES2 Help at http://help.adobe.com/en_US/livecycle/9.0/workbenchHelp/000187.html#1032146. Another way would be to use a custom component as you suggest but you can do it in Workbench as well.
Hope that helps..
...Gil -
XPath Expression to Check if certain condition does not exists
Dear Experts,
I have an interface scenario with this source message structure:
/Message/Body/Field1
Body have multiple occurence in the Message, and each Body will have only 1 Field1.
at the Interface Determination:
- Interface A: if the /Message/Body/Field1 = "" exists
- Interface B: if the /Message/Body/Field1 = "" does not exists
I have configured Interface A correctly with the following XPath expression:
left operator: /Message/Body[Field1 = ""]
middle operator: EX
right operator:
Somehow I still could not figured out how to check if /Message/Body/Field1 = "" does not exists.
I've tried some XPath expression:
left operator: /Message/Body[Field1 = ""]
middle operator: !=
right operator: EX
(this results in Interface B generated no matter /Message/Body/Field1 = "" exists or not)
left operator: /Message/Body[ (count(Field1 = "") = 0) ]
middle operator: EX
right operator:
(this results an exception raised at Interface Determination when Message/Body/Field1 = "" does not exists)
And some other workaround but still no success.
Any advice would be appreciated.
Thank you,
Suwandi C.Am I getting you right: You want to route the message one way if there is at least one empty Field1in the message and the other way if there is no empty Field1 present?
Maybe you could try:
Left: boolean(/Message/Body[Field1 = '']/
Operator: =
Right: true
Left: boolean(/Message/Body[Field1 = '']/
Operator: !=
Right: false
boolean() should return true if the node-set provided to the function contains at least one node.
I think you should use single quotes for literals.
I'm not sure about the slash at the end of the left operator. -
JAVA XML DOM4J: Invalid XPath expression
Hi everybody,
I am not sure why I am getting an exception for this expression:
Number count= document.numberValueOf("/NODE/SUBNODE/count(*)");
Exception is:
org.dom4j.InvalidXPathException: Invalid XPath expression:
Thanks regards
MarioHello
what about
"count (/NODE/SUBNODE)" as xpath expression
regards franz
reward points if useful -
XPath expression failed to execute.
Hi Everybody ,
I am working AIA PIP 3.1 for JDE E1.I am facing some errors so that i can't proceed.
See the log errors as below:
javax.xml.ws.soap.SOAPFaultException: XPath expression failed to execute. An error occurs while processing the XPath expression; the expression is ora:processXSLT('xsl/Xform_BillOfMaterialsListABM_to_BillOfMaterialsListAXML.xsl',bpws:getVariableData('InitialLoadBillOfMaterialsListReqMsg','InitialLoadBillOfMaterialsList'),bpws:getVariableData('Parameters')). The XPath expression failed to execute; the reason was: oracle.fabric.common.xml.xpath.XPathFunctionException: javax.xml.transform.TransformerException: oramds:/deployed-composites/default/InitialLoadBillOfMaterialsListJDEE1toAgileImpl_rev1.0/xsl/Xform_BillOfMaterialsListABM_to_BillOfMaterialsListAXML.xsl<Line 18, Column 271>: XML-22044: (Error) Extension function error: Error invoking 'lookupXRef':'oracle.tip.xref.exception.RepositoryException: lookup could not find values in column name "AGILE_01" for table name "oramds:/apps/AIAMetaData/xref/ITEM_ITEMID.xref" using reference column name "JDEE1_01" and reference value "731882::M30" Please ensure lookup criteria has a match.'. Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
Please reply me ASAP,
Waiting for your response.....
Regards
Jyoti NayakHi,
Ya i checked the data for same table,but i didn't get any XREF related information in xref_data table.
Did you mean that, data should already present under AIAFPINST_XREF.Probably xref is meant for storing dynamic value.
Please check the above error and reply me soon.
With Regards
Jyoti Nayak -
Namburi,
When you said you used the Reg Exp tool, did you use it only as
preconfigured by the iMT migrate application wizard?
Because the default configuration of the regular expression tool will only
target the files in your ND project directories. If you wish to target
classes outside of the normal directory scope, you have to either modify the
"Source Directory" property OR create another instance of the regular
expression tool. See the "Tool" menu in the iMT to create additional tool
instances which can each be configured to target different sets of files
using different sets of rules.
Usually, I utilize 3 different sets of rules files on a given migration:
spider2jato.xml
these are the generic conversion rules (but includes the optimized rules for
ViewBean and Model based code, i.e. these rules do not utilize the
RequestManager since it is not needed for code running inside the ViewBean
or Model classes)
I run these rules against all files.
See the file download section of this forum for periodic updates to these
rules.
nonProjectFileRules.xml
these include rules that add the necessary
RequestManager.getRequestContext(). etc prefixes to many of the common
calls.
I run these rules against user module and any other classes that do not are
not ModuleServlet, ContainerView, or Model classes.
appXRules.xml
these rules include application specific changes that I discover while
working on the project. A common thing here is changing import statements
(since the migration tool moves ND project code into different jato
packaging structure, you sometime need to adjust imports in non-project
classes that previously imported ND project specific packages)
So you see, you are not limited to one set of rules at all. Just be careful
to keep track of your backups (the regexp tool provides several options in
its Expert Properties related to back up strategies).
----- Original Message -----
From: <vnamboori@y...>
Sent: Wednesday, August 08, 2001 6:08 AM
Subject: [iPlanet-JATO] Re: Use Of models in utility classes - Pease don't
forget about the regular expression potential
Thanks Matt, Mike, Todd
This is a great input for our migration. Though we used the existing
Regular Expression Mapping tool, we did not change this to meet our
own needs as mentioned by Mike.
We would certainly incorporate this to ease our migration.
Namburi
--- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
All--
Great response. By the way, the Regular Expression Tool uses thePerl5 RE
syntax as implemented by Apache OROMatcher. If you're doing lotsof these
sorts of migration changes manually, you should definitely buy theO'Reilly
book "Mastering Regular Expressions" and generate some rules toautomate the
conversion. Although they are definitely confusing at first,regular
expressions are fairly easy to understand with some documentation,and are
superbly effective at tackling this kind of migration task.
Todd
----- Original Message -----
From: "Mike Frisino" <Michael.Frisino@S...>
Sent: Tuesday, August 07, 2001 5:20 PM
Subject: Re: [iPlanet-JATO] Use Of models in utility classes -Pease don't
forget about the regular expression potential
Also, (and Matt's document may mention this)
Please bear in mind that this statement is not totally correct:
Since the migration tool does not do much of conversion for
these
utilities we have to do manually.Remember, the iMT is a SUITE of tools. There is the extractiontool, and
the translation tool, and the regular expression tool, and severalother
smaller tools (like the jar and compilation tools). It is correctto state
that the extraction and translation tools only significantlyconvert the
primary ND project objects (the pages, the data objects, and theproject
classes). The extraction and translation tools do minimumtranslation of the
User Module objects (i.e. they repackage the user module classes inthe new
jato module packages). It is correct that for all other utilityclasses
which are not formally part of the ND project, the extraction and
translation tools do not perform any migration.
However, the regular expression tool can "migrate" any arbitrary
file
(utility classes etc) to the degree that the regular expressionrules
correlate to the code present in the arbitrary file. So first andforemost,
if you have alot of spider code in your non-project classes youshould
consider using the regular expression tool and if warranted adding
additional rules to reduce the amount of manual adjustments thatneed to be
made. I can stress this enough. We can even help you write theregular
expression rules if you simply identify the code pattern you wish to
convert. Just because there is not already a regular expressionrule to
match your need does not mean it can't be written. We have notnearly
exhausted the possibilities.
For example if you say, we need to convert
CSpider.getDataObject("X");
To
RequestManager.getRequestContext().getModelManager().getModel(XModel.class);
Maybe we or somebody else in the list can help write that regularexpression if it has not already been written. For instance in thelast
updated spider2jato.xml file there is already aCSpider.getCommonPage("X")
rule:
<!--getPage to getViewBean-->
<mapping-rule>
<mapping-rule-primarymatch>
<![CDATA[CSpider[.\s]*getPage[\s]*\(\"([^"]*)\"]]>
</mapping-rule-primarymatch>
<mapping-rule-replacement>
<mapping-rule-match>
<![CDATA[CSpider[.\s]*getPage[\s]*\(\"([^"]*)\"]]>
</mapping-rule-match>
<mapping-rule-substitute>
<![CDATA[getViewBean($1ViewBean.class]]>
</mapping-rule-substitute>
</mapping-rule-replacement>
</mapping-rule>
Following this example a getDataObject to getModel would look
like this:
<mapping-rule>
<mapping-rule-primarymatch>
<![CDATA[CSpider[.\s]*getDataObject[\s]*\(\"([^"]*)\"]]>
</mapping-rule-primarymatch>
<mapping-rule-replacement>
<mapping-rule-match>
<![CDATA[CSpider[.\s]*getDataObject[\s]*\(\"([^"]*)\"]]>
</mapping-rule-match>
<mapping-rule-substitute>
<![CDATA[getModel($1Model.class]]>
</mapping-rule-substitute>
</mapping-rule-replacement>
</mapping-rule>
In fact, one migration developer already wrote that rule andsubmitted it
for inclusion in the basic set. I will post another upgrade to thebasic
regular expression rule set, look for a "file uploaded" posting.Also,
please consider contributing any additional generic rules that youhave
written for inclusion in the basic set.
Please not, that in some cases (Utility classes in particular)
the rule
application may be more effective as TWO sequention rules ratherthan one
monolithic rule. Again using the example above, it will convert
CSpider.getDataObject("Foo");
To
getModel(FooModel.class);
Now that is the most effective conversion for that code if that
code is in
a page or data object class file. But if that code is in a Utilityclass you
really want:
>
RequestManager.getRequestContext().getModelManager().getModel(FooModel.class
So to go from
getModel(FooModel.class);
To
RequestManager.getRequestContext().getModelManager().getModel(FooModel.class
You would apply a second rule AND you would ONLY run this rule
against
your utility classes so that you would not otherwise affect yourViewBean
and Model classes which are completely fine with the simplegetModel call.
<mapping-rule>
<mapping-rule-primarymatch>
<![CDATA[getModel\(]]>
</mapping-rule-primarymatch>
<mapping-rule-replacement>
<mapping-rule-match>
<![CDATA[getModel\(]]>
</mapping-rule-match>
<mapping-rule-substitute>
<![CDATA[RequestManager.getRequestContext().getModelManager().getModel(]]>
</mapping-rule-substitute>
</mapping-rule-replacement>
</mapping-rule>
A similer rule can be applied to getSession and other CSpider APIcalls.
For instance here is the rule for converting getSession calls toleverage
the RequestManager.
<mapping-rule>
<mapping-rule-primarymatch>
<![CDATA[getSession\(\)\.]]>
</mapping-rule-primarymatch>
<mapping-rule-replacement>
<mapping-rule-match>
<![CDATA[getSession\(\)\.]]>
</mapping-rule-match>
<mapping-rule-substitute>
<![CDATA[RequestManager.getSession().]]>
</mapping-rule-substitute>
</mapping-rule-replacement>
</mapping-rule>
----- Original Message -----
From: "Matthew Stevens" <matthew.stevens@e...>
Sent: Tuesday, August 07, 2001 12:56 PM
Subject: RE: [iPlanet-JATO] Use Of models in utility classes
Namburi,
I will post a document to the group site this evening which has
the
details
on various tactics of migrating these type of utilities.
Essentially,
you
either need to convert these utilities to Models themselves or
keep the
utilities as is and simply use the
RequestManager.getRequestContext.getModelManager().getModel()
to statically access Models.
For CSpSelect.executeImmediate() I have an example of customhelper
method
as a replacement whicch uses JDBC results instead of
CSpDBResult.
matt
-----Original Message-----
From: vnamboori@y... [mailto:<a href="/group/SunONE-JATO/post?protectID=081071113213093190112061186248100208071048">vnamboori@y...</a>]
Sent: Tuesday, August 07, 2001 3:24 PM
Subject: [iPlanet-JATO] Use Of models in utility classes
Hi All,
In the present ND project we have lots of utility classes.
These
classes in diffrent directory. Not part of nd pages.
In these classes we access the dataobjects and do themanipulations.
So we access dataobjects directly like
CSpider.getDataObject("do....");
and then execute it.
Since the migration tool does not do much of conversion forthese
utilities we have to do manually.
My question is Can we access the the models in the postmigration
sameway or do we need requestContext?
We have lots of utility classes which are DataObjectintensive. Can
someone suggest a better way to migrate this kind of code.
Thanks
Namburi
[email protected]
[email protected]
[Non-text portions of this message have been removed]
[email protected]
[email protected]Namburi,
When you said you used the Reg Exp tool, did you use it only as
preconfigured by the iMT migrate application wizard?
Because the default configuration of the regular expression tool will only
target the files in your ND project directories. If you wish to target
classes outside of the normal directory scope, you have to either modify the
"Source Directory" property OR create another instance of the regular
expression tool. See the "Tool" menu in the iMT to create additional tool
instances which can each be configured to target different sets of files
using different sets of rules.
Usually, I utilize 3 different sets of rules files on a given migration:
spider2jato.xml
these are the generic conversion rules (but includes the optimized rules for
ViewBean and Model based code, i.e. these rules do not utilize the
RequestManager since it is not needed for code running inside the ViewBean
or Model classes)
I run these rules against all files.
See the file download section of this forum for periodic updates to these
rules.
nonProjectFileRules.xml
these include rules that add the necessary
RequestManager.getRequestContext(). etc prefixes to many of the common
calls.
I run these rules against user module and any other classes that do not are
not ModuleServlet, ContainerView, or Model classes.
appXRules.xml
these rules include application specific changes that I discover while
working on the project. A common thing here is changing import statements
(since the migration tool moves ND project code into different jato
packaging structure, you sometime need to adjust imports in non-project
classes that previously imported ND project specific packages)
So you see, you are not limited to one set of rules at all. Just be careful
to keep track of your backups (the regexp tool provides several options in
its Expert Properties related to back up strategies).
----- Original Message -----
From: <vnamboori@y...>
Sent: Wednesday, August 08, 2001 6:08 AM
Subject: [iPlanet-JATO] Re: Use Of models in utility classes - Pease don't
forget about the regular expression potential
Thanks Matt, Mike, Todd
This is a great input for our migration. Though we used the existing
Regular Expression Mapping tool, we did not change this to meet our
own needs as mentioned by Mike.
We would certainly incorporate this to ease our migration.
Namburi
--- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
All--
Great response. By the way, the Regular Expression Tool uses thePerl5 RE
syntax as implemented by Apache OROMatcher. If you're doing lotsof these
sorts of migration changes manually, you should definitely buy theO'Reilly
book "Mastering Regular Expressions" and generate some rules toautomate the
conversion. Although they are definitely confusing at first,regular
expressions are fairly easy to understand with some documentation,and are
superbly effective at tackling this kind of migration task.
Todd
----- Original Message -----
From: "Mike Frisino" <Michael.Frisino@S...>
Sent: Tuesday, August 07, 2001 5:20 PM
Subject: Re: [iPlanet-JATO] Use Of models in utility classes -Pease don't
forget about the regular expression potential
Also, (and Matt's document may mention this)
Please bear in mind that this statement is not totally correct:
Since the migration tool does not do much of conversion for
these
utilities we have to do manually.Remember, the iMT is a SUITE of tools. There is the extractiontool, and
the translation tool, and the regular expression tool, and severalother
smaller tools (like the jar and compilation tools). It is correctto state
that the extraction and translation tools only significantlyconvert the
primary ND project objects (the pages, the data objects, and theproject
classes). The extraction and translation tools do minimumtranslation of the
User Module objects (i.e. they repackage the user module classes inthe new
jato module packages). It is correct that for all other utilityclasses
which are not formally part of the ND project, the extraction and
translation tools do not perform any migration.
However, the regular expression tool can "migrate" any arbitrary
file
(utility classes etc) to the degree that the regular expressionrules
correlate to the code present in the arbitrary file. So first andforemost,
if you have alot of spider code in your non-project classes youshould
consider using the regular expression tool and if warranted adding
additional rules to reduce the amount of manual adjustments thatneed to be
made. I can stress this enough. We can even help you write theregular
expression rules if you simply identify the code pattern you wish to
convert. Just because there is not already a regular expressionrule to
match your need does not mean it can't be written. We have notnearly
exhausted the possibilities.
For example if you say, we need to convert
CSpider.getDataObject("X");
To
RequestManager.getRequestContext().getModelManager().getModel(XModel.class);
Maybe we or somebody else in the list can help write that regularexpression if it has not already been written. For instance in thelast
updated spider2jato.xml file there is already aCSpider.getCommonPage("X")
rule:
<!--getPage to getViewBean-->
<mapping-rule>
<mapping-rule-primarymatch>
<![CDATA[CSpider[.\s]*getPage[\s]*\(\"([^"]*)\"]]>
</mapping-rule-primarymatch>
<mapping-rule-replacement>
<mapping-rule-match>
<![CDATA[CSpider[.\s]*getPage[\s]*\(\"([^"]*)\"]]>
</mapping-rule-match>
<mapping-rule-substitute>
<![CDATA[getViewBean($1ViewBean.class]]>
</mapping-rule-substitute>
</mapping-rule-replacement>
</mapping-rule>
Following this example a getDataObject to getModel would look
like this:
<mapping-rule>
<mapping-rule-primarymatch>
<![CDATA[CSpider[.\s]*getDataObject[\s]*\(\"([^"]*)\"]]>
</mapping-rule-primarymatch>
<mapping-rule-replacement>
<mapping-rule-match>
<![CDATA[CSpider[.\s]*getDataObject[\s]*\(\"([^"]*)\"]]>
</mapping-rule-match>
<mapping-rule-substitute>
<![CDATA[getModel($1Model.class]]>
</mapping-rule-substitute>
</mapping-rule-replacement>
</mapping-rule>
In fact, one migration developer already wrote that rule andsubmitted it
for inclusion in the basic set. I will post another upgrade to thebasic
regular expression rule set, look for a "file uploaded" posting.Also,
please consider contributing any additional generic rules that youhave
written for inclusion in the basic set.
Please not, that in some cases (Utility classes in particular)
the rule
application may be more effective as TWO sequention rules ratherthan one
monolithic rule. Again using the example above, it will convert
CSpider.getDataObject("Foo");
To
getModel(FooModel.class);
Now that is the most effective conversion for that code if that
code is in
a page or data object class file. But if that code is in a Utilityclass you
really want:
>
RequestManager.getRequestContext().getModelManager().getModel(FooModel.class
So to go from
getModel(FooModel.class);
To
RequestManager.getRequestContext().getModelManager().getModel(FooModel.class
You would apply a second rule AND you would ONLY run this rule
against
your utility classes so that you would not otherwise affect yourViewBean
and Model classes which are completely fine with the simplegetModel call.
<mapping-rule>
<mapping-rule-primarymatch>
<![CDATA[getModel\(]]>
</mapping-rule-primarymatch>
<mapping-rule-replacement>
<mapping-rule-match>
<![CDATA[getModel\(]]>
</mapping-rule-match>
<mapping-rule-substitute>
<![CDATA[RequestManager.getRequestContext().getModelManager().getModel(]]>
</mapping-rule-substitute>
</mapping-rule-replacement>
</mapping-rule>
A similer rule can be applied to getSession and other CSpider APIcalls.
For instance here is the rule for converting getSession calls toleverage
the RequestManager.
<mapping-rule>
<mapping-rule-primarymatch>
<![CDATA[getSession\(\)\.]]>
</mapping-rule-primarymatch>
<mapping-rule-replacement>
<mapping-rule-match>
<![CDATA[getSession\(\)\.]]>
</mapping-rule-match>
<mapping-rule-substitute>
<![CDATA[RequestManager.getSession().]]>
</mapping-rule-substitute>
</mapping-rule-replacement>
</mapping-rule>
----- Original Message -----
From: "Matthew Stevens" <matthew.stevens@e...>
Sent: Tuesday, August 07, 2001 12:56 PM
Subject: RE: [iPlanet-JATO] Use Of models in utility classes
Namburi,
I will post a document to the group site this evening which has
the
details
on various tactics of migrating these type of utilities.
Essentially,
you
either need to convert these utilities to Models themselves or
keep the
utilities as is and simply use the
RequestManager.getRequestContext.getModelManager().getModel()
to statically access Models.
For CSpSelect.executeImmediate() I have an example of customhelper
method
as a replacement whicch uses JDBC results instead of
CSpDBResult.
matt
-----Original Message-----
From: vnamboori@y... [mailto:<a href="/group/SunONE-JATO/post?protectID=081071113213093190112061186248100208071048">vnamboori@y...</a>]
Sent: Tuesday, August 07, 2001 3:24 PM
Subject: [iPlanet-JATO] Use Of models in utility classes
Hi All,
In the present ND project we have lots of utility classes.
These
classes in diffrent directory. Not part of nd pages.
In these classes we access the dataobjects and do themanipulations.
So we access dataobjects directly like
CSpider.getDataObject("do....");
and then execute it.
Since the migration tool does not do much of conversion forthese
utilities we have to do manually.
My question is Can we access the the models in the postmigration
sameway or do we need requestContext?
We have lots of utility classes which are DataObjectintensive. Can
someone suggest a better way to migrate this kind of code.
Thanks
Namburi
[email protected]
[email protected]
[Non-text portions of this message have been removed]
[email protected]
[email protected] -
Using the variable placeholder ? in an XPath expression
I'm trying to using the variable operator (?) in an Oracle prepared statement used in a query where clause. Here is the query:
select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
from AUDITED_EVENT_XML_MIN e,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING e.xml_event_content
COLUMNS
APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
VERSION VARCHAR2(255) PATH 'xae:version',
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
EVENT_ID VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
where existsNode(E.XML_EVENT_CONTENT, '/xae:auditable-event[xae:event-type=?]','xmlns:xae="http://gov/va/med/datasharing/audit/endpoint/audit"') = 1This code works when the ? is replaced with "aValue". I need to use the ? so that my Java client can pass a variable value into the query.
Is this a supportable feature or am I doing something wrong?
I didn't see any examples in the Oracle XML DB Developers Guide where there was a ? in an XPath expression.
I also tried "?" with the same issue...
Here is the version info:
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Sep 10 18:41:55 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsAny assistance would be greatly appreciated.
Thanks in advance...
Edited by: flyeagle5683 on Sep 10, 2012 5:49 PMselect xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
from AUDITED_EVENT_XML_MIN e,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING e.xml_event_content
COLUMNS
APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
VERSION VARCHAR2(255) PATH 'xae:version',
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
EVENT_ID VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
where XMLEXISTS(
'declarre namespace xae ="http://gov/va/med/datasharing/audit/endpoint/audit"; (: :)
$XML/xae:auditable-event[xae:event-type=$VALUE]'
passing e.xml_event_content as "XML",
:1 as "VALUE"
) or you can do
select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
from AUDITED_EVENT_XML_MIN e,
XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
'/xae:auditable-event'
PASSING e.xml_event_content
COLUMNS
APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
VERSION VARCHAR2(255) PATH 'xae:version',
EVENT_TYPE VARCHAR2(255) PATH 'xae:event-type',
SENDING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
RECEIVING_SITE VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
EVENT_ID VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
WHERE EVENT_TYPE = :1Edited by: mdrake on Sep 10, 2012 7:23 PM
Edited by: mdrake on Sep 10, 2012 7:24 PM
Maybe you are looking for
-
Error while deploying .EAR on to J2EE Engine..
HI all, I was trying to deploy a .EAR file on to the nw04s J2ee Engine.But it is getting aborted and it is throwing the following error. Caught exception during application deployment from SAP J2EE Engine's deploy API: com.sap.engine.deploy.manager.M
-
Hi like many I am suffering from the Iweb problem of being unable to open domain files with iweb. I'm using Lion latest version etc.. Im currently on the road away from my main machine..where my original site is.. I DO have my Time Machine external d
-
Forms and ... operating systems.
Hi friends, do you know in which operating systems can Forms 6i run? Do you know the link in metalink pages where appears the Certified Platforms (Op.Syst.) for Forms 6i or similar web links? Thanks a lot. Jose.
-
BEFW11S4- Cannot get a SECURED Connection!
I have been using the Easy Link Connect system to hook up my router and wireless laptop. And it does hook up but it is running unsecured. I have tried twice to get Easylink to hook it up and it does go through the motions. But in the end it still sho
-
Deleting inherited attribute using FM 'BBP_UPDATE_ATTRIBUTES'
Hi Forum, I am trying to delete one value for attribute CAT using FM BBP_UPDATE_ATTRIBUTE , this attribute value is Inherited but I am unable to delete it. I tried this: 1. Set the inherited flag to space using the same FM (in PPOSA_BBP I can see tha