Click here to Skip to main content
15,885,101 members
Articles / Programming Languages / XML

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

Rate me:
Please Sign up or sign in to vote.
4.57/5 (10 votes)
28 Jul 2005CPOL2 min read 113.5K   3.1K   51   17
A tool for building XPath expression base on XML Schema
Sample screenshot

Introduction

(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.

History

  • 29th July, 2005: Initial post

License

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


Written By
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 continue...so 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 | :)

FYI:
- MESHSimPack project(c# library for measuring similarity among concepts of the MESH ontology):
http://sourceforge.net/projects/meshsimpack.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Manoj Kumar Choubey15-Feb-12 23:35
professionalManoj Kumar Choubey15-Feb-12 23:35 
GeneralNice Idea Pin
Xmen Real 13-Sep-09 20:07
professional Xmen Real 13-Sep-09 20:07 
GeneralGood ! Better if it worked on XML Pin
robvon25-Sep-07 21:44
robvon25-Sep-07 21:44 
GeneralPlease provide example XSD! Pin
User 263075119-Jan-06 3:43
User 263075119-Jan-06 3:43 
GeneralRe: Please provide example XSD! Pin
Thanh Dao19-Jan-06 4:59
Thanh Dao19-Jan-06 4:59 
GeneralRe: Please provide example XSD! Pin
User 263075120-Jan-06 2:21
User 263075120-Jan-06 2:21 
GeneralRe: Please provide example XSD! Pin
Thanh Dao21-Jan-06 21:20
Thanh Dao21-Jan-06 21:20 
GeneralRe: Please provide example XSD! Pin
User 263075123-Jan-06 2:55
User 263075123-Jan-06 2:55 
GeneralRe: Please provide example XSD! Pin
User 263075125-Jan-06 3:03
User 263075125-Jan-06 3:03 
GeneralRe: Please provide example XSD! Pin
Thanh Dao25-Jan-06 4:15
Thanh Dao25-Jan-06 4:15 
GeneralRe: Please provide example XSD! Pin
User 263075125-Jan-06 4:55
User 263075125-Jan-06 4:55 
GeneralAnother interesting tool: Visual XPath- Leghari Pin
Thanh Dao23-Aug-05 4:27
Thanh Dao23-Aug-05 4:27 
GeneralNice Effort... Pin
pbromberg31-Jul-05 8:26
pbromberg31-Jul-05 8:26 
GeneralRe: Nice Effort... Pin
Thanh Dao31-Jul-05 16:08
Thanh Dao31-Jul-05 16:08 
GeneralSome things Pin
Stephan Pilz28-Jul-05 20:31
Stephan Pilz28-Jul-05 20:31 
GeneralRe: Some things Pin
Thanh Dao28-Jul-05 21:17
Thanh Dao28-Jul-05 21:17 
GeneralRe: Some things Pin
Stephan Pilz28-Jul-05 23:06
Stephan 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.