Click here to Skip to main content
13,192,855 members (55,511 online)
Click here to Skip to main content
Add your own
alternative version


50 bookmarked
Posted 28 Jul 2005

XPathEditor: A Tool for Building XPath Expression Base on XML Schema

, 28 Jul 2005
Rate this:
Please Sign up or sign in to vote.
A tool for building XPath expression base on XML Schema
Sample screenshot


(Note: This paper is not final and needs editing. All source code is available to download.)

XPath expression is efficient filtering of XML Documents. Building XPath expression based on XML Document can be easily implemented with some tools such as Altova, Stylus.

Our application workflow designer needs to have an XPath expression based on XML Schema, so I wrote this tool. Prior to writing this tool, I just saw how the Oracle BPEL helps user create XPath based on XML schema. But it seems to be complex to use. After a month of working, the tool has been released with the following features:

  • Open an XML schema document and parse it into Tree view
  • Create location path expression from Tree view
  • Create Xpath expression with Core Function Library and basic operators
  • XPath expression syntax coloring
  • Validate an XPath expression

Preparing the Ground

The XML Path expression defines the syntax for addressing parts of an XML document. XPath expressions are evaluated against a document’s logical tree structure to identify a set of nodes (for example, elements, attributes, text, and so on).

XPath defines a tree model against which all expressions are evaluated. Most XPath expressions identify a set of nodes in the tree. For example, the following XPath expression identifies the two price elements: "/invoice/item/price".
XML Schema is an XML based alternative to DTD. It describes a model for a whole class of XML documents. Most applications of XML schema are used to validate an XML document.

You could find some tutorials here.

Short Instruction

Open the XML schema file.
When you have found the XML element or attribute for which you want to construct an XPath expression, just click and drag this node into the expression text box to get the Location path expression.
Do so if you want to use the core functions and operators.

Since the prefix of namespace has been declared in an XML schema may be different with prefix of an XML Document instance. So before trying to evaluate an XPath expression with XML document, please resolve the XML Schema namespace prefix with the XML Document namespace prefix.


  • 29th July, 2005: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Thanh Dao
Software Developer
Vietnam Vietnam
I'm still alive...but temporarily moved to work on mobile & web stuffs(j2me/brew/php/flash...something not M$). things have just been very busy, and probably will don't have chance to maintain & respond. Hope will have time to try to write again, because many ideas with WPF &silver light are waiting. wish me luck Smile | :)

- MESHSimPack project(c# library for measuring similarity among concepts of the MESH ontology):

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
manoj kumar choubey15-Feb-12 23:35
membermanoj kumar choubey15-Feb-12 23:35 
GeneralNice Idea Pin
Xmen W.K.13-Sep-09 20:07
memberXmen W.K.13-Sep-09 20:07 
GeneralGood ! Better if it worked on XML Pin
robvon25-Sep-07 21:44
memberrobvon25-Sep-07 21:44 
GeneralPlease provide example XSD! Pin
sebstein19-Jan-06 3:43
membersebstein19-Jan-06 3:43 
GeneralRe: Please provide example XSD! Pin
Thanh Dao19-Jan-06 4:59
memberThanh Dao19-Jan-06 4:59 
GeneralRe: Please provide example XSD! Pin
sebstein20-Jan-06 2:21
membersebstein20-Jan-06 2:21 
GeneralRe: Please provide example XSD! Pin
Thanh Dao21-Jan-06 21:20
memberThanh Dao21-Jan-06 21:20 
GeneralRe: Please provide example XSD! Pin
sebstein23-Jan-06 2:55
membersebstein23-Jan-06 2:55 
GeneralRe: Please provide example XSD! Pin
sebstein25-Jan-06 3:03
membersebstein25-Jan-06 3:03 
GeneralRe: Please provide example XSD! Pin
Thanh Dao25-Jan-06 4:15
memberThanh Dao25-Jan-06 4:15 
GeneralRe: Please provide example XSD! Pin
sebstein25-Jan-06 4:55
membersebstein25-Jan-06 4:55 
GeneralAnother interesting tool: Visual XPath- Leghari Pin
Thanh Dao23-Aug-05 4:27
memberThanh Dao23-Aug-05 4:27 
GeneralNice Effort... Pin
pbromberg31-Jul-05 8:26
memberpbromberg31-Jul-05 8:26 
GeneralRe: Nice Effort... Pin
Thanh Dao31-Jul-05 16:08
memberThanh Dao31-Jul-05 16:08 
GeneralSome things Pin
Stephan Pilz28-Jul-05 20:31
memberStephan Pilz28-Jul-05 20:31 
GeneralRe: Some things Pin
Thanh Dao28-Jul-05 21:17
memberThanh Dao28-Jul-05 21:17 
GeneralRe: Some things Pin
Stephan Pilz28-Jul-05 23:06
memberStephan Pilz28-Jul-05 23:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171017.2 | Last Updated 29 Jul 2005
Article Copyright 2005 by Thanh Dao
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid