Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • IBM Web Experience Factory wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category Web Experience Factory 8 Documentation WebSphere Portlet Factory 7 Documentation WebSphere Portlet Factory 7.0.1 Documentation Custom Search Scope...
Search
Community Articles > Web Experience Factory > Samples and Techniques for Web Experience Factory > Specifying Page Location Using XPath
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Rob Flynn
Contribution Summary:
  • Articles authored: 237
  • Articles edited: 298
  • Comments Posted: 2

Recent articles by this author

JAX-WS Handler Sample using IBM Web Experience Factory

Overview The Web Experience Factory (WEF) 8.0 release contains an enhancement to the web service call builders that gives you an option to define a global JAXWS handler class. This handler makes it possible for models to intercept and process the inbound and outbound SOAP envelopes associated ...

WebSphere Dashboard Framework 7.0.1.1 Fix pack now available

The WebSphere Dashboard Framework 7.0.1.1 Fix pack has been released.

IBM Web Experience Factory Version 7.0.1.4 Fix Pack is now available

This fix pack includes new fixes and updates for Web Experience Factory Version 7.0.1. and is now available on Fix Central and can be downloaded from here: ...

IBM Web Experience Factory WCAG 2.0 Compliance

IBM Web Experience Factory, developed and tested compliant to WCAG 2.0, can produce output (web pages, sites and content) that can be WCAG 2.0 Level A and Level AA compliant. IBM Web Experience Factory neither enforces nor prevents this compliance. Application developers must know and understand ...

Yeah!!! New IBM Web Experience Factory V8.0 is announced!!!

A quick snapshot of what's new in IBM Web Experience Factory... IBM Web Experience Factory is all about making it quick and easy to develop applications (portlets) that are included as part of an exceptional web experience. We've seen our customers doing some awesome stuff, whether it be ...

Community articleSpecifying Page Location Using XPath

Added by Rob Flynn | Edited by IBM contributor Rob Flynn on January 15, 2010 | Version 12
  • Edit
  • More Actions Show Menu▼
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: Code samples, User Interface

Background information

This sample model shows how one can use XPath, an XML Path Language to select a specific node on a page. This is best used to select a specific generated node which may have the same name as several other generated nodes.



Sample description

XPath Page Location Sample


This sample provides a simple example of how to use XPath in the advanced page location section of a builder. Fist off you will want to make sure Fully Parse Page is checked in the advanced section of the page builder you are referencing. After that you can reference html tags using XPath. This is particularly useful when using a Data Page builder or some other builder that will generate multiple tags with the same class name. In this case the datapage is generating multiple rows with the name


"DisplayField". You will use XPath to slowly drill down the html until you find the appropriate tag. You will want to start at the top of your html page with the first tag (HTML) and work your way down. Any tags that open and close before you get to the tag you wish to reference can be ignored. Only tags that remain open once you reach the tag you wish to reference must be listed in the XPath. Pay close attention to any generated tags which will need to be reference but may not show up on the actual html page. You can see these tags by clicking on the WebApp Tree tab and selecting your page builder. This will show you the html including all generated tags. In this case, there are multiple instances of the tag HTMLWRAPPER which must be referenced for the XPath to work. In my example I decided to add an attribute builder to make the first cell in the third row span multiple columns. To reference this third column I drill down to the appropriate level


HTML/BODY/FORM/DIV/TABLE/TR/TD/SPAN/HTMLWRAPPER/TABLE/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/TR 


I then add a [2] to reference the third row, which is index 2, starting at 0.


HTML/BODY/FORM/DIV/TABLE/TR/TD/SPAN/HTMLWRAPPER/TABLE/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/TR[2] 


I then add /TD to reference the specific cell.


HTML/BODY/FORM/DIV/TABLE/TR/TD/SPAN/HTMLWRAPPER/TABLE/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/HTMLWRAPPER/TR[2]/TD 


Now that my XPath statement is complete, I open up the builder I want to go on this tag, and select advanced in the location technique section under page location. I then type in Page XPath . After running the model we can see via webpage appearance or the html source that the attribute colspan="4" has been added to the correct tag.



Notes on running the sample and prerequisites


Import the attached zip file into your project using the Import WebSphere Portlet Factory Archive command and then open the PageLocation model.



Download



xpathpagelocation.zip


  • Edit
  • More Actions Show Menu▼


expanded Attachments (1)
collapsed Attachments (1)
Edit the article to add or modify attachments.
File TypeSizeFile NameCreated On
application/x-zip 1 KB xpathpagelocation.zip 6/17/08 8:34 AM
expanded Versions (11)
collapsed Versions (11)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (12)Jan 15, 2010 5:42:02 PMRob Flynn  IBM contributor
11Jan 4, 2010 12:33:12 PMRob Flynn  IBM contributor
10Jan 4, 2010 12:32:01 PMRob Flynn  IBM contributor
9Oct 27, 2008 2:37:51 PMDeAnna Steiner  IBM contributor
8Sep 5, 2008 11:14:52 AMDeAnna Steiner  IBM contributor
7Jun 30, 2008 1:36:58 PMRob Flynn  IBM contributor
6Jun 26, 2008 1:32:34 PMJonathan Booth  IBM contributor
5Jun 23, 2008 11:41:00 AMRob Flynn  IBM contributor
4Jun 17, 2008 8:37:48 AMRob Flynn  IBM contributor
3Jun 17, 2008 8:37:24 AMRob Flynn  IBM contributor
1Jun 17, 2008 8:35:54 AMRob Flynn  IBM contributor
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • BlogsIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkIBM Collaboration Solutions
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use