Xpath, node absolute path and Remote Events for XML (REX)

Folks,
No question here, just a solution to share.
I want to implement Remote Events for XML (REX) in
Actionscript 3. Outgoing rex events require that I find an absolute
xpath expression for my XML DOM nodes that have changes. Incoming
rex events require that I can find the appropriate XML DOM node
using xpath.
nodeAbsolutePath returns a node's absolute xpath expression.
(see below)
xpath-as3 provides xpath.
References
http://www.w3.org/TR/rex/
http://code.google.com/p/xpath-as3/wiki/GettingStarted
http://www.xml.com/pub/a/2004/11/24/py-xml.html
http://forums.oracle.com/forums/thread.jspa?messageID=1439497&#1439497
public function nodeAbsolutePath(node:XML):String {
var name:String = node.name();
var parent:XML = node.parent();
var index:int = 1;
var pos:String;
if (parent) {
for each (var child:XML in parent.children()) {
if (child == node) {
break;
if (child.name() == name) {
index += 1;
pos = "["+String(index)+"]"; /* [1], [2], ... */
switch (node.nodeKind()) {
case 'text':
return nodeAbsolutePath(parent)+"/text()"+pos;
break;
case 'comment':
return nodeAbsolutePath(parent)+"/comment()"+pos;
break;
case 'processing-instruction':
return
nodeAbsolutePath(parent)+"/processing-instruction()"+pos;
break;
case 'attribute':
return nodeAbsolutePath(parent)+"/@"+name;
break;
case 'element':
return nodeAbsolutePath(parent)+"/"+name+pos;
break;
return "/"+name+"[1]"; /* we're at the top baby*/
Here are some links.
http://hollabaugh.com/flex/NodeAbsolutePath.mxml.txt
http://hollabaugh.com/flex/NodeAbsolutePath.swf
Have fun!
Craig

Folks,
No question here, just a solution to share.
I want to implement Remote Events for XML (REX) in
Actionscript 3. Outgoing rex events require that I find an absolute
xpath expression for my XML DOM nodes that have changes. Incoming
rex events require that I can find the appropriate XML DOM node
using xpath.
nodeAbsolutePath returns a node's absolute xpath expression.
(see below)
xpath-as3 provides xpath.
References
http://www.w3.org/TR/rex/
http://code.google.com/p/xpath-as3/wiki/GettingStarted
http://www.xml.com/pub/a/2004/11/24/py-xml.html
http://forums.oracle.com/forums/thread.jspa?messageID=1439497&#1439497
public function nodeAbsolutePath(node:XML):String {
var name:String = node.name();
var parent:XML = node.parent();
var index:int = 1;
var pos:String;
if (parent) {
for each (var child:XML in parent.children()) {
if (child == node) {
break;
if (child.name() == name) {
index += 1;
pos = "["+String(index)+"]"; /* [1], [2], ... */
switch (node.nodeKind()) {
case 'text':
return nodeAbsolutePath(parent)+"/text()"+pos;
break;
case 'comment':
return nodeAbsolutePath(parent)+"/comment()"+pos;
break;
case 'processing-instruction':
return
nodeAbsolutePath(parent)+"/processing-instruction()"+pos;
break;
case 'attribute':
return nodeAbsolutePath(parent)+"/@"+name;
break;
case 'element':
return nodeAbsolutePath(parent)+"/"+name+pos;
break;
return "/"+name+"[1]"; /* we're at the top baby*/
Here are some links.
http://hollabaugh.com/flex/NodeAbsolutePath.mxml.txt
http://hollabaugh.com/flex/NodeAbsolutePath.swf
Have fun!
Craig

Similar Messages

  • Life and work event for any country other than US.

    Hello,
    I have to implement ESS for UAE.
    In ESS we did all country specific settings and thus our "Address" application in Personal Information section is working fine now.
    Now we have to implement the life work event section "My first days".
    There we are getting "Address" application in left panel.
    Now when I am clicking in this application it shows me error :
    Country/Structure do not match application country
    So which means it requires some settings in guided procedure end in portal.
    I am assuming ....Because our address application is already working fine in Personal Information section so same should also work in My first days section using existing configuration settings of R/3.
    So I went through below wiki page :
    http://wiki.sdn.sap.com/wiki/display/profile/LifeandWorkEvents(LWE)-Other+Countries
    In the above page there is a section to update parameters in guided procedure process for address.
    GP Context = X
    PT Family Service = EMPLOYEEPERSINFO_FAMMEMBER_PT_05 - this parameter is going to be created in the backend (transaction PTARQ)._
    I am making changes to existing Life and Work events - US only. (for testing purposes)
    In my case I only updated the Address service :
    sap_xss_service
    sap_xss_menusrv
    With the address service from R/3 which is in my case running under personal information section.
    But still I have been receiving the same error under My First Days address section.
    In the above wiki page there is a line as below :
    VERY IMPORTANT: the parameters need to give in action, after in the block, after in the main block, and after in the process (THIS IS CRUCIAL).
    I feel this is where I am missing something.
    What does this line mean...
    Can anybody help me out with the same...if you have implemented life and work event for any country other than US.
    Edited by: Saurabh Agarwal on Apr 10, 2011 3:03 PM

    Hello,
    In continuation of my question I have also been following below sap Note :
    929447 - Adopting Life and work events for countries other than US
    In the above note there us a section which confuses me :
    Page 3 - Home and Area page customizing
    Step2 - In this step they say that we have to make an entry in
    IMG node access: Cross-applicaiton components -> Homepage framework ->Services -> Define Country-Specific Services (Add Entries) - (Table:V_T7XSSSERSRVCG)
    as
    Service Key:EMPLOYEE_LIFEWORK_FIRSTDAYS
    Country grouping: 01
    Link Resource:EMPLOYEE_LIFEWORK_FIRSTDAYS_DE_SERVICE
    I believe it should not be for FIRSTDAYS....it should be about service which is actually throeing the error "Countr/structure does not match"
    i.e. in this note case it should be :
    EMPLOYEE_PERSINFO_ADDRESS05

  • How to add selection event, change event and click event for dropdownlist for mobile applications

    Please someone help me in writng selection , click and change events for dropdownlist in flex for mobile applications . i have tried but i wasn't able to select the items in dropdown using my mouse or touch in my mobile . Please help me I am struck at this point and i am unable to get solution gfor this. Please................
    Some code for which i neederd help:
    <s:DropDownList id="ddlBranch" x="257" y="475" width="63%" height="80%"
                                    creationComplete="ddlBranch_creationCompleteHandler(event)"
                                    fontFamily="Calibri" fontSize="24"
                                    labelField="BranchName"
                                    prompt="{ddlBranch.selectedItem}"
                                    requireSelection="true"
                                    selectionColor="#7ab342">
                        <s:AsyncListView list="{getBranchResult.lastResult}"/>
                    </s:DropDownList>
    <s:DropDownList id="ddlZone" x="257" y="546" width="63%" height="80%"
                                    creationComplete="ddlZone_creationCompleteHandler(event)"
                                    fontFamily="Calibri" fontSize="24"
                                    labelField="ZoneName"
                                    prompt="{ddlZone.selectedItem}"
                                    requireSelection="true"
                                    selectionColor="#7ab342">
                        <s:AsyncListView list="{getZoneResult.lastResult}"/>
                    </s:DropDownList>
    I will get the list of Branches(first DDL) and Zones(Second DDL) from a webservice written in DOT(.)NET,  what i needded is touch events and selection events for both the dropdown lists and the data in the second DropDown List should bind based on the First Dropdown list item selected.
    Service call for binding data to DDL:
    protected function ddlBranch_creationCompleteHandler(event:FlexEvent):void
                    getBranchResult.token = loginService.getBranch();
                protected function ddlZone_creationCompleteHandler(event:FlexEvent):void
                    getZoneResult.token = loginService.getZone();
    Please help...
    Thank you.

    Therer are two ways you can assign an action to the "OnEnter"-event of your input field:
    1. in method cl_wd_input_field=>new_input_field you have the parameter:
    ON_ENTER
    You just have to assign your action name to this field and it will be called on the OnEnter-event of your InputField.
    e.g:
         lr_input_field = cl_wd_input_field=>new_input_field(
                                                 id = 'INP_MY_INPUT_FIELD'
                                                 on_enter = 'MYACTION'
    2. You can use the method SET_ON_ENTER.
    like:
         lr_input_field->set_on_enter( 'MYACTION' ).
    Just make sure, you have created and implemented this action and its handler.

  • Problem with absolute path and context using Tomcat 4

    I added the following line to my server.xml:
    <Context path="/track" docBase="track" />Now I have used absolute paths(ex: /includes/css/style.css) throughout my code and it worked when I served my application from the ROOT context but when I moved it to the /track - the paths did not include the new root context.
    So instead of looking at http://localhost/track/includes/css/style.css it still looks at http://localhost/includes/css/style.css.
    Is there any kind of setting I am missing in the web.xml or server.xml? I really would like to be able to use absolute paths relative to the context root.
    Please help! Thanks in advance.
    -Chris

    Hi,
    I am not sure what exactly you are asking but here is my shot. If one tomcat is serving more than one application then the only way for tomcat to know which application to refer is by looking at the context path. Since you have the context path of /track then it should appear in all of your urls being directed to the server (for both servlet and jsp). Since you have used absolute path in all the cases either you will have to change the absolute path or you will have to define them relative (which is a better idea) to a base dir. Hope it helps.
    I added the following line to my server.xml:
    <Context path="/track" docBase="track"
    />Now I have used absolute paths(ex:
    /includes/css/style.css) throughout my code and it
    worked when I served my application from the ROOT
    context but when I moved it to the /track - the paths
    did not include the new root context.
    So instead of looking at
    http://localhost/track/includes/css/style.css it still
    looks at http://localhost/includes/css/style.css.
    Is there any kind of setting I am missing in the
    web.xml or server.xml? I really would like to be able
    to use absolute paths relative to the context root.
    Please help! Thanks in advance.
    -Chris

  • Get the absolute path and filename of the file from the command line

    Hi,
    when we run the class we give the command
    java <filename>
    How can I capture the filename given above and get its absolute path inside the
    public static void main(String [] args){}
    args[0] gives me the command line argument after the filename. How do I capture the filename itself from the command line argument and also get that files absolute path
    Thanks

    I don't know of any way to capture the java command input, but there are ways to find out where the application is being run from. (the "absolute path")
    http://forum.java.sun.com/thread.jsp?forum=31&thread=335394

  • OS 10.6.3 and Remote Desktop for windows server, PDF Printer problem

    We are using Remote desktop for mac by windows in the office to work on a remote windows server, On the server we are using a business software (Mamut) for sale. In OS 10.5 we are using the PDF Printer to transfer PDF (invoice) from the business software (Mamut) 'Mamut is seeing the PDF printer as any other printer' to the desk top of your mac, so we can attach the PDF to a mail before we send it out to a customer, but in OS 10.6 the PDF printer is removed! So we need a different way of transfer the PDF from the windows server to the mac desk top.
    So now I am wondering if any one has a suggestion on how to fix this! if not we can't upgrade to OS 10.6, and that would be a shame!

    The thing is that in Mamut, we hit print, and because we us the PDF printer as Printer for Remote desk top, it pup up on the desk top of the mac, as a PDF. But in OS 10.6 there isn't any PDF printer to install, so then we have to make a PDF on the windows server and move it from the server to the mac, by mounting the HD from the Mac to the remote desk top, so it become edible in from the server. I think this is cumbersome.

  • How set ctrl +a event for Jbutton and esc event for closing jinternal frame

    i am doing desktop project in that i need set ctrl event for button ,i am strucking in that area pls anybody help me to overcome this problem ,and also i need button in table when i press button it has to fill value in the next field ,its urgent please

    Read the section from the Swing tutorial on [How to Use Key Bindings|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html]

  • DTD and XSD Validation for xml file

    hi kindly reply to this mail guru'ssss
    i am facing a problem in parising a xml file against dtd and xsd.
    i have the dtd which contains only enitities that can be present in the xml file and the xsd file for validation against elements and attribute.
    when DTD is present then it is throwing errors like the elements should be declared.
    when i take out the doctype line and validate against schema its throwing the error that particular entity is not found or declared.
      public Vector validateSchema(String SchemaUrl, String XmlDocumentUrl)  
          SAXParser parser =new SAXParser();
         try{
             //parser.setNamespaceAware (true);     
             //parser.s
             parser.setFeature("http://xml.org/sax/features/validation",true);
             parser.setFeature("http://apache.org/xml/features/validation/schema",true);
             parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
            // parser.setProperty("http://xml.org/sax/properties/declaration-handler", new DTDHandl());
             parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",SchemaUrl);
            // parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
            // System.out.println(parser.getDTDHandler());
            // UnparsedCache cache = new UnparsedCache();
           //  parser.setDTDHandler(cache);
             InputSource inputSource =new InputSource(new java.io.FileInputStream(new java.io.File(XmlDocumentUrl)));
           //  parser.setDTDHandler(new myDTDHandler());
             //parser.setEntityResolver(new CustomResolver());
         //  parser.setContentHandler(this);
             Validator handler=new Validator();
             parser.setErrorHandler(handler); 
             parser.parse(inputSource);
             if(handler.validationError==true)
               System.out.println("XML Document is not valid");
             else                  
               System.out.println("XML Document is valid");
             for(int i=0;i<ErrorLines.size();i++){
                 System.out.println(ErrorLines.elementAt(i));
       }catch(java.io.IOException ioe){  
         System.out.println("IOException"+ioe.getMessage());   
       }catch (SAXParseException e) {
         System.out.println("SAXParseException "+e.getMessage());   
      }catch (SAXException e) {
         System.out.println("SAXException"+e.getMessage());   
         return ErrorLines;
    what could be soln to this.

    Hi
    Venky_Ferrari.
    Based on your description, your case related to XMLXSD, SO I will move your thread to
    Data Platform Development > XML, System.Xml, MSXML and XmlLite      
    forum for better support.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Xpath expression in Left and Right operand for Receiver determination

    Hi Experts,
    Is it possible to use an Xpath expression in both the Left and Right operand inside the Receiver determination e.g.
    (/Message/line/IDNumber = /Message/line/IDNo)
    Any help will be appreciated.
    Thank you,
    Brendon

    in standard receiver determination you  can only specify value for the right operand.
    that is  one of the reasons you go for enhanced receiver determination
    as mentioned in the sap help
       If you are using the condition editor to define receiver determinations or interface determinations, you can only use the expression editor to create an expression for the left operand. You must specify a value for the right operand.

  • Query Builder - Path and Object name for instance ..

    Hello,
    how to get the Object Name of an Instance "InstanceX" and the Path of the Object with query Builder ..
    Thanks

    Hi Leo,
    It is my understanding that Query Builder, QAAWS and Live Office are Java based, and therefore only work with Tomcat and not WACS. Unless something has changed, you will have to uninstall and reinstall BO with Tomcat in order to use those tools.
    Thanks

  • Linksys WRT400N and Remote Access for VPN

    Hi all
    Let me start by saying I am not a techie; I am trying to troubleshoot my own router (Linksys) issues with using Lync and accessing some sharepoint sites that are internal to my company's network.  If this is not the correct place to be to get help - please say the word and I will move on.
    I am connecting to the Internet using a Linksys router (WRT400N).  When I have my work laptop using RESCUE GFE hardwired directly to the modem - and then connecting to VPN - I can connect to Lync and work normally. 
    However, when I move connection via the router - I can no longer connect to Lync nor access some Sharepoints.  I can access VPN fine but with Lync I get an error stating "Your Lync account does not allow access from outside your organization's network.  Please connect to your organization's network and try again.  However, I am connected via the VPN.
    Thanks very much in advance!  This is driving me nuts as previously, this connection worked with a prior laptop using WinXP (I am no on Win7) and the connection thru router and using VPN worked with Communicator.
    I unfortunately had to reset my router - so I cannot recall if there were port settings established from the last time I had to set up the network.  I didn't save the configuration; note to self - save configuration in future.
    Thanks in advance for any help/direction/insight.

    The router's firewall may be blocking the said access. Adjusting the security settings on the router might help. Log- in to the router's page and disable Block Anonymous Internet Requests under the Security tab. If this doesn't work, you may definitely need to open certain ports. Port forwarding should allow specific applications to work behind the router for this setup to be up and running. I recommend looking for these ports (Google?). For isolation, you can try to connect to VPN and check if Lync works on a different computer.

  • What's the path and file name for the program to make window xp recovery cd?

    I need to replace a hard drive, so I  have to make a set of CDs to install windows XP,  but in ACCESS IBM, I cannot find the program to make window xp recovery cd as instructed on the website. where can I find it? Thanks
    solved, thanks anyway. mine is T43, the hard disk got bad setctors now, so I got a new disk to replace it, so I need to install xp first, that's what I need, but there are no xp installation cd now and I can not find the program to make the cd. I downloaded  xp from internet to solve this problem.
    Message Edited by mary2001 on 07-04-2008 12:05 PM

    Hi mary2001
    I have a similar problem, so where did u downloaded the xp? I have a produkt key on the back of my IBM T43, but no cd.
    Please help me...

  • BI Admin Tool and XSLT transformation for XML data source - How it works ?

    Hello,
    There is a possibility to import data from XML data source using BI Admin Tool.
    In the import window we can point XSLT file. What is the purpose of that XSLT field?
    Why I am asking ?
    I thought it is smth like XSLT processor, but simply it doesnt work.
    What I did:
    - I pointed XML data source file
    - I pointed XSLT transformation file
    - Click OK, and still get the message that the XML file structure is not supported
    After that I transformed that XML file with some desktop XSLT processor using the same XSLT file, and I tried to connect that file directly using BI Admin tool.Then it works. So it means that the transformation is ok.
    So basically one question comes to my mind in that situation:
    What is the purpose of XSLT field in BI Admin Tool when it comes to XML data source ?
    (it doesnt look like XSLT processor)
    Greetings
    /Michal

    Hi Mariano
    Why you need to use XSLT for transforming XML file into ABAP table
    Code is a part of some ABAP report. Looks like it is reading a file from file system and updating table after transformation
    If you have requirement like you need to read XML file and then insert the data into a SAP table
    You can use
    File to RFC
    File to Proxy scenario using SAP PI.
    Please provide more inputs on requirement to help
    Thanks
    Gaurav

  • What is the best cheap/free search and replace software for .xml files?

    Transferring my iTunes library from PC to Mac I have reached the stage where I want to edit the .xml file from PC file paths to Mac ones - which would be the best preferrably free software to do this on?

    Perhaps my comment in your other thread will help.
    tt2
    PS I don't know about the Mac, but Notepad++ will probably do your search & replace on the PC if you have to edit the XML.
    Message was edited by: turingtest2

  • Dreamweaver CS4 and PHP require_once, require, include_once, include absolute paths

    I have a question about Dreamweaver CS4's new functionality that lists required and included files in a second row below the name of the file you are currently editing. It's handy.
    I see that Dreamweaver attempts to list all the included files for a given page so that it is easier to find and edit those files.
    For example.  If I had a HTML document called index.html that linked to a CSS document called style.css, when I open index.html, Dreamweaver CS4 lists style.css in a row below index.html.
    My problem is this.  This new functionality works on absolute paths and relative paths for HTML elements. For example, it can find and link to CSS files regardless of if the src tag is relative  or absolute (/css/style.css)
    REFRESHER: absolute paths start with a "/" as in "/css/style.css" and relative paths do not start with a "/" as in "css/style.css" or "../../css/style.css"
    However, PHP files that are linked to the current page via require, require_once, include, or include_once, only appear to work if you use a relative path.
    So this would work in Dreamweaver:
    require_once('../lib/config.php');
    But this would not
    require_once('/home/matt/mydomain.com/html/lib/config.php');
    As any PHP developer knows, you are never supposed to use relative paths with included or required files.  Especially if your site has multiple levels of sub directories.  Relative paths are relative to the calling php document.  It causes a bunch of problems.  I can explain how if you want.
    How can I tell Dreamweaver that the base directory on my apache web server for my domain...
    /home/matt/mydomain.com/html/
    ... is the equivalent of the base directory on my home computer where dreamweaver accesses my files.
    C:\Users\Matt\Documents\My Websites\mydomain.com\
    So that when I write...
    require_once('/home/matt/mydomain.com/html/lib/config.php');
    ... how can I force dreamweaver understand that "/home/matt/mydomain.com/html/" is the same as "C:\Users\Matt\Documents\My Websites\mydomain.com\" on my home computer. So that way, this new Dreamweaver CS4 submenu feature can find and link to the correct file.
    Essentially, can I define Dreamweaver "include paths" for Dreamweaver to search in if the file I'm trying to include is not in the same directory?

    athensmusician wrote:
    As any PHP developer knows, you are never supposed to use relative paths with included or required files.
    Perhaps you ought to inform the PHP documentation team. All the examples in the PHP manual use relative paths.
    Essentially, can I define Dreamweaver "include paths" for Dreamweaver to search in if the file I'm trying to include is not in the same directory?
    Dreamweaver parses only relative paths in PHP includes. The Related Files feature was a new addition in Dreamweaver CS4, so it's not 100% perfect. Having the ability to define your own include_path for Dreamweaver to parse would be a useful improvement. Make your voice heard by submitting a feature request through the form at https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform.

Maybe you are looking for

  • What is the role of a Policy CA

    Hello All Can someone please help me with the following question please (thanks in advance) I read the following (from another post on this forum regarding Policy CAs) The role of a policy CA is to describe the policies and procedures that an organiz

  • Bluetooth no more working with latest OVI suite

    Since I install latest OVI suite it seems my bluetooth stop working correctly and I cannot sync. however the radio seels OK, since I can pair. I've tried to unpai, repair, to clean. sometimes it works but afer the first disconnection, it no more work

  • Odd I-bar behavior

    In firefox on the browser if I click, and I-bar/cursor appears every time. Same thing happens if I click in the preview pain of an entourage email, the i-bar appears like I can start typing. I cannot, but it is there. Anyone seen this? Very odd and a

  • ITunes 10 not using Media folder

    I recently upgraded a machine to iTunes 10 and notice that when I now add music, it does so to a "Music" folder that is at the same level in the file structure as the "iTunes Media" folder. It is not adding music to the Music folder inside of the "iT

  • Problem in compiling JAVA SWING

    Dear frens, I'm new in java swing. I have some knowledge in developing java in DOS, but dont have any knowledge in developing java in gui. I have write a program but it is unable to compile. I compile like this ----> javac HelloWorldSwing.java please