How to find the existence of a tag in  XML file through  XSLT Mapping?

Hello Friends,
Working on an SAP XI interface ,I have come across a situation where I need to map the values only when a particular tag exists in the inbound XML file.I need to use the XSLT mapping for the same.
Requesting your advice on as to how may I validate the existence of a tag through XSLT mapping?
Thanks.

Hello Friends
After research , I could also find another way to check the existence of a node .We can even use CHOOSE to check the existence.
<xsl:choose>
      <xsl:when test="(/mynode)">
          your action if the mynode is found
      </xsl:when>
      <xsl:otherwise>
                action if mynode is not found
      </xsl:otherwise>
</xsl:choose>
Thanks.
Wishes
Richa

Similar Messages

  • How to find the users who r assigned to profile sap_all through su01

    how to find the users who r assigned to profile sap_all through su01

    you can get into SUIM-->where used lists, check for users with profile SAP_ALL you can get a list of users who have
    it. and you can get into SUIM through SU01 from user information system link.
    you can execute RSUSR002 from SA38/SE38.
    RSUSR002  is the report which gets you the whereused list for profiles within roles, users.
    you can get it from transaction SECR ofcourse you are executing the same report.
    you can get from UST04 table and obviously USR04 also because sometimes you  miss some details from UST04 because of sync problems.

  • How to find the number of data items in a file written with ArryToFile function?

    I have written an array of number in 2 column groups to a file using the LabWindows/CVI function ArrayToFile...Now if I want to read the file with FileToArray Function then how do I know the number of items in the file. during the write time I know how many array items to write. but suppose I want the file to read at some later time then How to find the number of items in the file,So that I can read the exact number and present it. Thanks to all
    If you are young work to Learn, not to earn.
    Solved!
    Go to Solution.

    What about:
    OpenFile ( your file );
    cnt = 0;
    while ((br = ReadLine ( ... )) != -2) {
    if (br == -1) {
    // I/O error: handle it!
    break;
    cnt++;
    CloseFile ( ... );
    There are some ways to improve performance of this code, but if you are not reading thousands of lines it's quite fast.
    After this part you can dimension the array to pass to FileToArray... unless you want to read it yourself since you already have it open!
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to get the position of a tag in XML,when i am using the org.xml.sax

    Hi,
    I am able to parse a xml document.I want to get the position of a tag in the document.So that by keeping that as reference, i can access other tags.Plz help me.I am using org.xml.sax API.

    Hello Friends
    After research , I could also find another way to check the existence of a node .We can even use CHOOSE to check the existence.
    <xsl:choose>
          <xsl:when test="(/mynode)">
              your action if the mynode is found
          </xsl:when>
          <xsl:otherwise>
                    action if mynode is not found
          </xsl:otherwise>
    </xsl:choose>
    Thanks.
    Wishes
    Richa

  • How to pick up values of particular tag from XMl file & store into an array

    Hi , i m using sax parser to read below xml file.
    <dvd-list>
    <dvd>
    <id>001</id>
         <title>Bollywood</title>
         <name>Lord of the rings</name>
         <length>150</length>
         <actor>Jonathan Austin</actor>
         <actor>Nicole Kidman</actor>
    </dvd>
    <dvd>
    <id>002</id>
         <title>Hollywood</title>
         <name>Taare Zamin pe</name>
         <length>200</length>
         <actor>Amir Khan</actor>
         <actor>Darsheel</actor>
    </dvd>
    <dvd>
    <id>003</id>
         <title>Bollywood</title>
         <name>Matrix reloaded</name>
         <length>150</length>
         <actor>Mickel</actor>
         <actor>Hally Berry</actor>
    </dvd>
    </dvd-list>
    & i want to store it into an arraylist .
    I declared arraylist a class var .
    i want to store all ids into an arraylist ...
    below is my code public void endElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
             if(qName.equals("id"))
       for (int i = 0; i < atts.getLength (); i++) {
                    list.add(i,atts.getValue (i));
           // showData ("</"+qName+">");
        }not working ... plz help me in this regard
    thanks a lot

    thanks , my id tag has no attribute...
    but sir again i m facing 1 problem
    to pick up values of tag i wrote below code public void startElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
             System.out.println("localName"+qName);
             str=qName;
        public void characters (char buf [], int offset, int len)
        throws SAXException
             String s = new String(buf, offset, len);
          System.out.println("char>>"+s);
          s.trim();
          if(str.equals("id"))
               list.add(s);
              if(str.equals("name"))
                   list.add(s);
              if(str.equals("title"))
                   list.add(s);
              if(str.equals("length"))
                   list.add(s);
              if(str.equals("actor"))
                   list.add(s);   
        public void endElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
        }here my list size shud be 5 ideally but it is showing 30!!!!
    also debug stmt sysout(char>>+s); is showing series of
    char>> ...it means charactes(0 method is being called several times ...while my xml contains
    <dvd-list>
    <dvd>
    <id>001</id>
         <title>Bollywood</title>
         <name>Lord of the rings</name>
         <length>150</length>
         <actor>Jonathan Austin</actor>
    </dvd>
    </dvd-list>
    plz help me in this regard to understand this flow....
    thanks a lot in advance

  • How to find the material received in warehouse for work order through table

    Dear All ,
    I am creating alerting system We have  requrirement that if the notification or work order is pending for 10 days then alert to be sent to planner and 20 days to his senior and 30n days to his senior
    We have created FM for this  every day program will run and check open work orders and notification pending for some days
    Now my question in the FM I want to add fields for material receipt
    Idea is say for refuebsihment order pending material is received in warehouse now when this is received alert to be send in the work order planner that material is arrived
    From which tables I can track this and how to know for the alerting system that material is arrived in warehouse so alert to be send
    please reply
    Regards
    pratap
    Edited by: Pratap bhikai  Ingole on Jun 5, 2010 9:20 AM

    Hi ,
    With reference to your second point , if your looking for some alret then whenever you have goods receipt or goods issue of stock material you can have a mail triggerred through workflow .. in our project what we did was , we had a user status ALMR - All Material received and this is SET by a  Z programme which checks whether all stock materials or non stock materials against the order have been received and sets the user status and this programme is run as a batch job with 30min frequency ....
    regrds
    pushpa

  • How to read the content in one node of XML in Java? Pls help

    My dear brothers,
    I am a newbie of XML, I have a exercise which is creating a Tree View from XML file. But the trouble is I do not know how to read the content in one node of XML file. I decide to use the algorithm as following:
    1. Create a GUI form which gives the ability for user to choose a XML file (ok)
    2. Load XML and return the file (ok)
    3. Read the file from node to node to create the node in Tree View (?!)
    Please help me, and if you are enough kind, please give me an small example to easy understand. Thanks in advance.
    Hoang Yen Binh

    I hope this one helps you.
         <ABC Type="ProductBased" ProdName="One" Location="India">
              <CEO>Raj</CEO>
              <Finance>Vikram</Finance>
              <HR>Karthik</HR>
              <Technical>Satish</Technical>
         </ABC>
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Attr;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Node;
    import org.w3c.dom.DOMException;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import java.io.File;
    import java.io.IOException;
    public class XmlReading {
         Document doc;
         Element element;
         public static void main(String[] args) throws Exception{
              XmlReading xr = new XmlReading();
              xr.getXmlParser(args);
         public void getXmlParser(String[] args) {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   if(args.length != 1) {
                        System.err.println("Argument Required");
              try {
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   doc = builder.parse(new File(args[0]));
              }catch(ParserConfigurationException e1) {
              }catch(SAXException e2) {
              }catch(IOException e3) {
              getAttributes();
         public void getAttributes() {
              // Retrive the entire Document from the Dom Tree
              element = doc.getDocumentElement();
    //          System.out.println(element);
              NamedNodeMap attrs = element.getAttributes();
              // Get number of attributes in the element
         int numAttrs = attrs.getLength();
         // Process each attribute
              for (int i=0; i<numAttrs; i++) {
                   Node node = attrs.item(i);
                   // Get attribute name and value
                   String attrName = node.getNodeName();
                   String attrValue = node.getNodeValue();
                   System.out.println(attrName + ": " + attrValue);
              String s1 = element.getTagName();
              System.out.println(s1);
              // To get all the elements in a DOM Tree
              NodeList nl1 = element.getElementsByTagName("*");
              int i2 = nl1.getLength();
              System.out.println(i2);
              for(int i=0; i<i2; i++) {
                   System.out.println(nl1.item(i) + "\n");
    }

  • How to update/change the value of elements in an xml file?

    Hi Everyone,
    Could any one of u tell me how to update the value of elements in an XML file, using java? The reason is i want to use an XML file as a data source (i.e. more or less like a database), without using any RDBMS, for simple applications such as to read a record and update the record. By the way, my XML file will have only one record, such as the current weather information, with fields such as temperature, humdity etc. for 1 city only.
    Thanks in advance.

    Here is a solution how to check a particular value or element name in an xml and update the changes e to an xml.
    Sample.xml
    <URLConstructor>
    <application name="cp_outage">
    <resource>hello</resource>
    <value>val</value>
    </application>
    <application name="cp_outage">
    <resource>hello</resource>
    <value>val</value>
    </application>
    </URLConstructor>
    XMLWriter.java
    package com;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.JDOMException;
    import org.jdom.input.DOMBuilder;
    import org.jdom.output.XMLOutputter;
    // used for printing
    import org.apache.xml.serialize.XMLSerializer;
    import org.jdom.output.XMLOutputter;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.Iterator;
    import java.util.List;
    class XMLWriter{
    public void update(File fileName)
    try {
              DOMBuilder domBuilder=new DOMBuilder();
              Document doc=domBuilder.build(fileName);
              Element element=doc.getRootElement();
              getChildren(element);
              writeToXML(doc,fileName);
              getChildren(element);
    } catch (Exception e) {
    e.printStackTrace();
         * @param doc
         private void writeToXML(Document document,File filePath)
                   XMLOutputter xmloutputter = new XMLOutputter();
                        try
                             FileOutputStream fileOutputStream = new FileOutputStream(filePath);
                             xmloutputter.output(document, fileOutputStream);
                             fileOutputStream.close();
                        catch (FileNotFoundException e)
                             e.printStackTrace();
                        catch (IOException e)
                             e.printStackTrace();
         public void getChildren(Element element)
                        if(!element.hasChildren())
                             return;
                        List childrenList = element.getChildren();
                        Iterator itr=childrenList.iterator();
                        while(itr.hasNext())
                             Element childElement=(Element) itr.next();
                             if(childElement.hasChildren())
                                       getChildren(childElement);
    //                                   System.out.println("Name "+childElement.getName());
    //                                   System.out.println("Value "+childElement.getText());
                                       if(childElement.getText().equals("hello") || (childElement.getName().equals("resource")))
                                            updateInfo(childElement,"New_Resource","AddedText");
         * @param childElement
         * @param string
         * @param string2
         private void updateInfo(Element element, String elementName, String value)
              element.setName(elementName);
              element.setText(value);          
    static public void main(String[] args)
    XMLWriter xmlWriter=new XMLWriter();
    xmlWriter.update(new File("c:/sample.xml"));
    After execution the file will be changed to
    <URLConstructor>
    <application name="cp_outage">
    <New_Resource>AddedText</New_Resource>
    <value>val</value>
    </application>
    <application name="cp_outage">
    <New_Resource>AddedText</New_Resource>
    <value>val</value>
    </application>
    </URLConstructor>
    Regards,
    Maheswar

  • How to find the number of links in a website

    hi every body
    can any one clear my doubt
    my doubt is that
    in a website how to find the number of links the hole website contains
    is there any navigation tool to find that
    plz help me yar
    i am waiting for the reply

    If you're talking about commercial sites (sites you don't have the source code for) I'm not sure.
    If you want to count the links in site that you have the source code for, it should be relatively easy to write a Java application to do it. All you really need to do is have a list of the files you want to count links in, read each file line by line and check for the existance of the <a> tag in each line. Anywhere their is an <a> tag there is a link.
    Hope this helps.

  • How to find the size of an arrayList through Expression Builder.

    Hai OTN,
    How to find the size of an arrayList through Expression. I have a managed bean in View Scope.I am using Jdeveloper 11.1.1.2 with ADF Faces components.
    Managed Bean :
    ArrayList<IllnessEmployeesObj> employeeGridList =
    new ArrayList<IllnessEmployeesObj>();
    JSPX :
    Value="#{viewScope.PandIVH.employeeGridList.size}"
    Error : java.lang.NumberFormatException: For input string: "size"

    Hi Dinil,
    I have provided you with a sample that would show you the how you can get the size of an arraylist
    the sample has a page untitled1 and a bean named test.
    I have run in on jdev 11.1.2 and it is ok, it will be ok on 11.1.3
    after running the sample you will see the 2.
    please remember that you must add the JSTL taglib on the viewcontroller.
    just right click on viewcontroller, go to tag lib select the jstl.
    page
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>untitled1</title>
    </head>
    <body>
    <h:form>
    <h:outputText value="#{fn:length(test.a)}"/>
    </h:form>
    </body>
    </html>
    </f:view>
    bean
    import java.util.ArrayList;
    public class Test {
    public Test() {
    a= new ArrayList();
    Object o=new Object();
    a.add(o);
    a.add(o);
    ArrayList a;
    public void setA(ArrayList a) {
    this.a = a;
    public ArrayList getA() {
    return a;
    I hope this sample came handy.
    regards,

  • How to find the navigation bar at the apps, PDF reader Lite? after i zoom in, the navigation bar dissapear~ what should i do to make the navigation bar reappear?

    How to find the navigation bar at the apps, PDF reader Lite? after i zoom in, the navigation bar dissapear~ what should i do to make the navigation bar reappear?

    Hello,
    Yes it will be in your page template. You just need to move #NAVIGATION_BAR# substitution under the #LOGO# substitution tag, probably something like this should work
    #LOGO#&lt;div>#NAVIGATION_BAR#&lt;/div>
    Carl

  • How to find the number of entries in a master data table

    Hi Experts,
    I am trying to find the entries in 0CUSTOMER master data.
    BW>LISTCUBE>Data target: 0CUSTOMER and selected the fields that I need.
    I would like to know how to find the "number of entrees". I tried to run the SUM for a count field, but it is taking forever as there are huge number of records .

    Hi Dev,
    Go to the change/display mode of the info object (0CUSTOMER) in your case. Go to the Master data/Text tab. Here you will find the master data tables according to your settings (P orQ or X or Y). Double click on the table name and it will take you to the SE11 display. From there, you can check the number of records as you do in any transparent table.
    Hope this helps.
    Thanks and Regards
    Subray Hegde

  • How to find the number of times method being called.....

    hi,
    can any one pls tell me how to find the number of times the method being called......herez the example....
    Refrence ref = new Refrence();
    for(int i = 0;i < arr.length; i++){
    if(somecondition){
    ref.getMethod();
    here i want to know how many times the getMethod() is calling...Is there any method to do this.. i have seen StrackTraceElement class..but not sure about that....pls tell me the solution....

    can any one pls tell me how to find the number of times the method being called......
    herez the example.... http://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal ? in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes.

  • How to find the number of fetched lines from select statement

    Hi Experts,
    Can you tell me how to find the number of fetched lines from select statements..
    and one more thing is can you tell me how to check the written select statement or written statement is correct or not????
    Thanks in advance
    santosh

    Hi,
    Look for the system field SY_TABIX. That will contain the number of records which have been put into an internal table through a select statement.
    For ex:
    data: itab type mara occurs 0 with header line.
    Select * from mara into table itab.
    Write: Sy-tabix.
    This will give you the number of entries that has been selected.
    I am not sure what you mean by the second question. If you can let me know what you need then we might have a solution.
    Hope this helps,
    Sudhi
    Message was edited by:
            Sudhindra Chandrashekar

  • How to find the number of occurance of a string in text field of Infopath form?

    Hi All,
    In Infopath text field, How to find the number of occurrence of a particular string in that field?
    Thanks in advance!

    You can check to see if it contains a string once by using the contains function, but there isn't a very clean way to do what you want. If you wanted to guess at the maximum number of occurrences, then you could:
    Box A has your initial. Set Box B to do a concat of string-before and string-after of Box A where it copies Box A minus the string we're looking for. Then we have Box C that does the same thing to Box B. Repeat as many times as you see necessary.
    Example:
    String: "1"
    Box A - "123451234512345"
    Box B - "23451234512345"
    Box C - "2345234512345"
    Box D - "234523452345"
    etc.
    We then have a field that has nested ifs looking backwards from Z -> A looking for a non-blank. Based on that, we return the number of occurrences. Again, this isn't clean, but it will work if you think there's a predefinable maximum.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

Maybe you are looking for

  • Windows XP LAN driver needed for my Satellite A100-784

    I bought Satellite A100-784 with Windows Vista. I've removed Vista and installed Windows XP (taken from other non-Toshiba notebook)) and then SP2. Now I can't use the internet because there's no LAN driver. The drivers downloaded from this Toshiba si

  • I keep receiving a message, everytime I open iTunes, asking me if I want to accept incoming network connections.

    After trying to delete the .plist I realised my iTunes had become corrupted and needed to be reinstalled. This may not be a fix for everyone, but here is how I uninstalled and reinstalled. iTunes comes preinstalled as part of OS X, and is considered

  • Text Mining Dictionary

    Hi, Gurus! Is there a way to customize the dictionary employed in the text mining facility? Thanks! Manoy

  • Replicated database

    hi all ora 8i on sunsolaris I want to replicate the production database with the standby database. Both are having almost equal resources, which is the best option to create replicated database, it should be COST EFFECTIVE. we generate millions of re

  • Activating FM

    when I am activating Fund management in the following IMG path Path: - SPRO- Public sector management – Funds management government – Actual and Commitment Update/Integration – Activate/Deactivate Funds Management When tried to activate Funds managem