Click here to Skip to main content
Click here to Skip to main content

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

, 28 Jul 2005 CPOL
Rate this:
Please Sign up or sign in to vote.
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)

Share

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 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 Pinmembermanoj kumar choubey16-Feb-12 0:35 
GeneralNice Idea PinmemberXmen W.K.13-Sep-09 21:07 
GeneralGood ! Better if it worked on XML Pinmemberrobvon25-Sep-07 22:44 
GeneralPlease provide example XSD! Pinmembersebstein19-Jan-06 4:43 
GeneralRe: Please provide example XSD! PinmemberThanh Dao19-Jan-06 5:59 
GeneralRe: Please provide example XSD! Pinmembersebstein20-Jan-06 3:21 
GeneralRe: Please provide example XSD! PinmemberThanh Dao21-Jan-06 22:20 
GeneralRe: Please provide example XSD! Pinmembersebstein23-Jan-06 3:55 
GeneralRe: Please provide example XSD! Pinmembersebstein25-Jan-06 4:03 
GeneralRe: Please provide example XSD! PinmemberThanh Dao25-Jan-06 5:15 
GeneralRe: Please provide example XSD! Pinmembersebstein25-Jan-06 5:55 
GeneralAnother interesting tool: Visual XPath- Leghari PinmemberThanh Dao23-Aug-05 5:27 
GeneralNice Effort... Pinmemberpbromberg31-Jul-05 9:26 
GeneralRe: Nice Effort... PinmemberThanh Dao31-Jul-05 17:08 
GeneralSome things PinmemberStephan Pilz28-Jul-05 21:31 
GeneralRe: Some things PinmemberThanh Dao28-Jul-05 22:17 
GeneralRe: Some things PinmemberStephan Pilz29-Jul-05 0:06 

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

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

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