How to search for a particular element within a XML variable using studio?

All,
I am using studio 7.0 to develop a webbased application. In this, i need to access
an oracle db using a WLAI Application View from my Workflow. I get some data back
from Oracle as an XML variable and then apply an XPath statement to access the
individual columns returned.
My problem arises when there are no records in the db matching my criteria and
an empty XML variable is returned to me from the app view. In these cases my
XPath statement fails in studio causing an improper exit.
Does anybody know how to check for content in a XML varaible using studio? So
that if there is content i can proceed with XPath and if there is no content,
then i will take a different route.
Thanks in advance
Regards
Sri

If I remember correctly, the adapter will return an XML document that contains
XML elements for each row. You can just simply check the count of these elements
with an XPath statement: ie. count(response/row)
"Sri " <[email protected]> wrote:
>
All,
I am using studio 7.0 to develop a webbased application. In this, i need
to access
an oracle db using a WLAI Application View from my Workflow. I get some
data back
from Oracle as an XML variable and then apply an XPath statement to access
the
individual columns returned.
My problem arises when there are no records in the db matching my criteria
and
an empty XML variable is returned to me from the app view. In these
cases my
XPath statement fails in studio causing an improper exit.
Does anybody know how to check for content in a XML varaible using studio?
So
that if there is content i can proceed with XPath and if there is no
content,
then i will take a different route.
Thanks in advance
Regards
Sri

Similar Messages

  • How to search for a particular word in a string?

    How to search for a particular word in a string?
    thanks for your help....

    This works fine.
    public class Foo {
        public static void main(String[] args) {
        String s = "Now is the time for all good...";
        String s2 = "the time";
        System.out.println(s.contains(s2));
        System.out.println(s.contains("for al"));
        System.out.println(s.contains("not here"));
    }output:true
    true
    falseYou must have something else wrong in your code.
    JJ

  • How to search for a particular word in a long document?

    How to search for a particular word in a long document?

    What program are you using to read the document?
    Good luck.

  • How to search for a particular pattern in a string

    Hi,

    Hi ,
    How to search for a particular pattern in a string?
    I heard about java.util.regex; and used it in my jsp program.
    Program I used:
    <% page import="java.util.regex"%>
    <% boolean b=Pattern.matches("hello world","hello");
    out.println(b);%>
    I run this program using netbeans and am getting the following error message.
    "Cannot find the symbol : class regex"
    "Cannot find the symbol : variable Pattern "
    How to correct the error?

  • How to Search for a specific element in a MultiGraph?

    Hi there
    Im trying to implement a Multigraph ADT in Java. Multigraph is a graph that has multible edges connecting a node. I assume you all know what a Graph ADT looks like.
    So i think ive got all the basic methods functions of a normal graph/mulitgraph and now i want to search for a element in it
    The question is how will i so that?
    Do i use a breadth first search?
    But i thought a BFS traverses all the elements in a graph? And how can i use a BFS to search for a specific element in a graph?
    Thanks

    Hey there
    thanks for your reply but i still some query.
    I thought of doing that but i want to remember the nodes i revisted to get to the target (not all - but the quickest route to that node)
    My design so far is:
    have 3 Interface namely Graph, Node & Edge.
    Classes will inherit those interface to provide the actual implementation as i want the details/coding to be abstract meaning i can give many different way of implementations.
    The graph class will add nodes & edges where when adding edges, edge will store 2 nodes in it respectively source & destination nodes.
    Both Node & Edges will be stored in graph using some data structures atm (arrayList i presume)
    My Design is that i want to (my aim of the task of searching) search for a node in the multigraph by inputting (maybe 2 nodes) into method - start node target node! The method should return a list of nodes to get to the target node.+
    So so far i have this wee algorithm in mind:
    +1. Input start + target node as parameters+
    +2. Use BFS to search the graph+
    +3. When reached target node - halt+
    +4. return the list of nodes that visited to get there (but not all - only the precise & fastest)+
    So will that work?
    If so how do i go about doing implementation?
    Thanks

  • How to search for a particular word in notes app (ios6)

    Sir,
    I can search for a note but i couldnt search for a particular word in a long note in notes app.
    (ios 6)
    is there a way to do it,or is there any app that has this 'search for word' functionality ?

    thank you for your quick reply sir.
    i am asking for other independent notable apps(not notes app) which has this functionality .

  • How to search for the particular ABAP Object

    Hi,
    I am using the SAP 4.6C machine, I need to search for the particular ABAP Object. Plz can anyone help me in this.
    Regards,
    Pralhad P. Teggi

    You'll get a better response if you ask a meaningful question.
    If you want to scan for Business Objects (BOR) use transaction SWO1
    For ABAP classes / objects use a combination of transactions SE24 / SE18 / SE19 and /or SE80
    (SE 18 /  SE 19 are for Badi's)
    Cheers
    Jimbo

  • How to search for a specific String within an ArrayList

    I am creating an inherited class, CD, that has a field of "tracks". I am wondering how you would search through the ArrayList and list the track number that correlates with a search term. For instance, if I have a track called "Radar Love" and it is track number 2, how would I create the search function to find out what track number "Radar Love" is?

    trojansc82 wrote:
    int index = 0;
    boolean found = false;
    while(index < tracks.size() && !found){
    String track = tracks.get(index);
    if(track.contains(searchString)){
    found =true;
    else{
    index++;
    return index;It's still the same code. I attempted putting in a return statement with tracks.get(index), but it didn't work.Edited by: Edward_Kimber on Nov 15, 2008 2:57 PM

  • How to search for a particular word in a given string?

    Ex: I want to search wether the following string contains "java" or not.
    "Java Technology Forums"
    Thanks....................

    The String API might be useful to you. In particular, the contains method.

  • Search for a particular email message

    How do I search for a particular email message, or set of email messages, by sender, topics, etc. on the iphone?

    When searching for email messages from within Mail or when using Spotlight, you can search the To, From, and Subject fields. Search "All" searches all three of these fields. The text, or body, of messages is not searched.

  • How to search for a word in an email?

    How to search for a particular word in an email in 'Mail'?

    You can't search through email content using buil-in search
    If you're using Gmail, you can use their native Google Mail app which will allow you to search through body content and server-stored emails.

  • Problem in digitally signing a particular element of an XML Document

    hi all!!
    I was trying to sign a particular element of an XML document using JSR105 (XML Digital Signatures) API.
    For which i used +#xpointer(id('idvalue'))+ and +#idvalue+ as the URI for the reference i create as below :
    Reference ref = fac.newReference("#xpointer(id('123')) ", fac.newDigestMethod(DigestMethod.SHA1, null), Collections.singletonList(fac.newTransform(Transform.ENVELOPED,(TransformParameterSpec) null)), null, null);
    NOTE: Here 123 is the value of the attribute 'id' of the element i wish to sign in the input XML document.
    But when i try to digest and sign the the above created reference, i get the following exception (which is strange! atleast for me!)
    Exception in thread "main" javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.URIReferenceException: Can't resolve ID: '123' in ''
    at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.calculateDigestValue(ReferenceImpl.java:327)
    at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.sign(ReferenceImpl.java:237)
    at com.ibm.xml.crypto.dsig.dom.XMLSignatureImpl.sign(XMLSignatureImpl.java:158)
    at sent.Generate.main(Generate.java:103)
    Caused by: javax.xml.crypto.URIReferenceException: Can't resolve ID: '123' in ''
    at com.ibm.xml.crypto.dsig.dom.URIDereferencerImpl.dereference(URIDereferencerImpl.java:193)
    at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.calculateDigestValue(ReferenceImpl.java:285)
    +... 3 more+
    javax.xml.crypto.URIReferenceException: Can't resolve ID: '123' in ''
    at com.ibm.xml.crypto.dsig.dom.URIDereferencerImpl.dereference(URIDereferencerImpl.java:193)
    at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.calculateDigestValue(ReferenceImpl.java:285)
    at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.sign(ReferenceImpl.java:237)
    at com.ibm.xml.crypto.dsig.dom.XMLSignatureImpl.sign(XMLSignatureImpl.java:158)
    at sent.Generate.main(Generate.java:103)
    I've given the whole Java code i used to generate the signature and the XML i used below for you to get a clear picture of what i tried...
    Any suggestions are very much welcome..
    thanks..
    ragu
    Generate.java
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.security.InvalidAlgorithmParameterException;
    import java.security.KeyException;
    import java.security.KeyPair;
    import java.security.KeyPairGenerator;
    import java.security.NoSuchAlgorithmException;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.List;
    import javax.xml.crypto.MarshalException;
    import javax.xml.crypto.dsig.CanonicalizationMethod;
    import javax.xml.crypto.dsig.DigestMethod;
    import javax.xml.crypto.dsig.Reference;
    import javax.xml.crypto.dsig.SignatureMethod;
    import javax.xml.crypto.dsig.SignedInfo;
    import javax.xml.crypto.dsig.Transform;
    import javax.xml.crypto.dsig.XMLSignature;
    import javax.xml.crypto.dsig.XMLSignatureException;
    import javax.xml.crypto.dsig.XMLSignatureFactory;
    import javax.xml.crypto.dsig.dom.DOMSignContext;
    import javax.xml.crypto.dsig.keyinfo.KeyInfo;
    import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
    import javax.xml.crypto.dsig.keyinfo.KeyValue;
    import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
    import javax.xml.crypto.dsig.spec.TransformParameterSpec;
    import javax.xml.crypto.dsig.spec.XPathFilterParameterSpec;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.xml.sax.SAXException;
    public class Generate {
          * @param args
          * @throws NoSuchAlgorithmException
          * @throws InvalidAlgorithmParameterException
          * @throws KeyException
          * @throws ParserConfigurationException
          * @throws IOException
          * @throws SAXException
          * @throws FileNotFoundException
          * @throws XMLSignatureException
          * @throws MarshalException
          * @throws TransformerException
         public static void main(String[] args) throws NoSuchAlgorithmException,
                   InvalidAlgorithmParameterException, KeyException,
                   FileNotFoundException, SAXException, IOException,
                   ParserConfigurationException, MarshalException,
                   XMLSignatureException, TransformerException {
              java.security.Security
                        .addProvider(new com.ibm.xml.crypto.IBMXMLCryptoProvider());
              XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM",
                        new com.ibm.xml.crypto.IBMXMLCryptoProvider());
              //reference generation
              //its here where I point the URI to the element i want to digest
              Reference ref = fac.newReference("#xpointer(id('123'))", fac.newDigestMethod(DigestMethod.SHA1, null), Collections.singletonList(fac.newTransform(Transform.ENVELOPED,(TransformParameterSpec) null)), null, null);
              //signedinfo element generation
              SignedInfo si = fac
                        .newSignedInfo(fac.newCanonicalizationMethod(
                                  CanonicalizationMethod.INCLUSIVE,
                                  (C14NMethodParameterSpec) null), fac
                                  .newSignatureMethod(SignatureMethod.RSA_SHA1, null),
                                  Collections.singletonList(ref));
              KeyInfoFactory kif = fac.getKeyInfoFactory();
              //Create a DSA KeyPair
              KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
              kpg.initialize(512);
              KeyPair kp = kpg.generateKeyPair();
              KeyValue kv = kif.newKeyValue(kp.getPublic());
              // Create a KeyInfo and add the KeyValue to it
              KeyInfo ki = kif.newKeyInfo(Collections.singletonList(kv));
              // Instantiate the document to be signed
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              dbf.setNamespaceAware(true);
              Document doc = dbf.newDocumentBuilder().parse(
                        new FileInputStream(new File("shippedPedigree.xml")));
              // Create a DOMSignContext and specify the DSA PrivateKey and
              // location of the resulting XMLSignature's parent element
              DOMSignContext dsc = new DOMSignContext(kp.getPrivate(), doc
                        .getDocumentElement());
              //Create the XMLSignature (but don't sign it yet)
              XMLSignature signature = fac.newXMLSignature(si, ki);
              // Marshal, generate (and sign) the enveloped signature
              signature.sign(dsc);
              //writing the signed document back to the file
              OutputStream os;
              os = new FileOutputStream(new File("shippedpedigree.xml"));
              TransformerFactory tf = TransformerFactory.newInstance();
              Transformer trans = tf.newTransformer();
              trans.transform(new DOMSource(doc), new StreamResult(os));
    the "shippedPedigree.xml" i used to sign:
    <?xml version="1.0" encoding="UTF-8"?>
    <ped:pedigree xmlns:ped="urn:epcGlobal:Pedigree:xsd:1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <ped:shippedPedigree id="123">
    <ped:documentInfo>
    <ped:serialNumber>2233</ped:serialNumber>
    <ped:version>ped:version</ped:version>
    </ped:documentInfo>
    <ped:signatureInfo>
    <ped:signerInfo>
    <ped:name>Joe Doe</ped:name>
    <ped:title>Manager</ped:title>
    <ped:telephone>800-521-6010</ped:telephone>
    <ped:email>[email protected]</ped:email>
    <ped:url>www.kittinginc.com</ped:url>
    </ped:signerInfo>
    <ped:signatureDate>2001-12-31T12:00:00</ped:signatureDate>
    <ped:signatureMeaning>Certified</ped:signatureMeaning>
    </ped:signatureInfo>
    <ped:itemInfo>
         <ped:lot>123</ped:lot></ped:itemInfo>
    </ped:shippedPedigree></ped:pedigree>
    ------------------------------------------------------------------------

    Sabarisri N wrote:
    Hi All,
    my xml is like below.
    <ns1:abcd>
    <ns2:a>1</ns2:a>
    <ns2:b>2</ns2:b>
    </ns1:abcd>
    If i try retrieving the value of the root element of this xml document,
    Node myroot=doc.getDocumentElement();
    String result=myroot.getNodeName();
    My output is ns1:abcd .. i want only "abcd"...
    The parser is returning the correct rootNodeName i.e ns1:abcd. rootNodeName always goes with the given input and returns the root element as is.
    >
    My xml will not always have same namespaces.. from the incoming xml i should first check, for the namespaces..Please give me some idea.
    I guess.. I need some namespace evaluation to be set..
    Refer below link it'll give idea of identifying XML-NAMESPACE-PREFIX
    http://java.sun.com/developer/Books/xmljava/ch03.pdf
    http://download.oracle.com/javaee/1.4/tutorial/doc/JAXPSAX9.html
    Please help me in this regard.
    Thanks,
    Sabarisri. N

  • How can I search for a particular color in an image?

    Hi,
       I am working on images of colored balls.
    I want to search for the particular color (of the ball) and select them .
    How can I do it?
    Your suggestions will be helpful.
    Thanks
    dsk

    Hi Dsk, 
                   you can apply color threshold and extract the required color in the image. Try color threshold in vision assistant.
                  see  here
    Thanks as kudos only

  • When I am searching for any particular song or album from my shared ITUNES folder, the search is conducted  in the apple store and not on the shared library. How to search for the song in the shared library

    I am using IPAD Mini.When I am searching for any particular song or album from my shared ITUNES folder, the search is conducted  in the apple store and not on the shared library. How to search for the song in the shared library

    Search for shared library is impossible, as far as I know.  Searches supported - are local and internet.

  • When I do a search for a particular song in the iTunes store, how can I change the view for the results?

    I have the latest version of iTunes.  Today I did a search for a particular song.  In the past, I used to get a list of the song and the various artists who recorded it, and I could click the little arrow and play a preview of that song before I decided to buy it.  Today the results didn't display that way - instead, I got a page with probably 50 or 100 songs all spread out across the page, and the "writing" was all overlayed so you couldn't quite tell what you're supposed to see!  I want to go back to the "list" view but couldn't find anywhere to change the view preference.  Any idea how?

    Do a malware check with some malware scan programs.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of the database before doing a scan.<br />
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]
    There are other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    *Next Generation Java Plug-in 1.6.0_16 for Mozilla browsers
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

Maybe you are looking for

  • Cost price update

    Hi guys i have a problem in updating cost price for all finished goods we set in MM for all Raw Materials, process chemcials and packaging materials as moving average price and semi and finished goods  items as standard our raw material and packaging

  • Link to Insert Form Error

    I tried to do an URL link to a application form for record insert. The URL link I use is taken from Manage - Call Interface: Show - Example of Call from URL . it is something like: PORTAL30.wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=12803

  • First Workflow

    Hi, I am very new to Workflow and have just read few basics etc. Now I have been assigned to create some notifications etc for my project. But I am stuck in the initial point only. Beow is the description of the same. Actually I have created a workfl

  • Performace scenarion

    Hi All, Would really appriciate, if you could direct me a link/forum/book/blog/whitepaper, where writer discuss the live scenarion of performace issue and also their resolution.

  • Image stabilizing

    i just wondered if FCP does this as good as motion does or wether its worth exporting the clips to motion for stabilizing and then bringing them back into FCP. Or is it worth getting a plugin like coremelt. thanks for any help