XML Kunwar Singh.

Slides:



Advertisements
Similar presentations
EIONET Training Zope Page Templates Miruna Bădescu Finsiel Romania Copenhagen, 28 October 2003.
Advertisements

The eXtensible Markup Language (XML) An Applied Tutorial Kevin Thomas.
What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
XML: Extensible Markup Language
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Feature requests for Case Manager By Spar Nord Bank A/S IBM Insight 2014 Spar Nord Bank A/S1.
XML and XSL Transforming your XML documents with eXtensible Stylesheet Language Transformations [Optional Lecture]
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
1 Extensible Markup Language: XML HTML: portable, widely supported protocol for describing how to format data XML: portable, widely supported protocol.
1 Extensible Markup Language: XML HTML: portable, widely supported protocol for describing how to format data XML: portable, widely supported protocol.
XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Exploring Microsoft® Office Grauer and Barber 1 Committed to Shaping the Next Generation of IT Experts. Robert Grauer and Maryann Barber Using.
Overview of XPath Author: Dan McCreary Date: October, 2008 Version: 0.2 with TEI Examples M D.
TIBCO Designer TIBCO BusinessWorks is a scalable, extensible, and easy to use integration platform that allows you to develop, deploy, and run integration.
® IBM Software Group © 2006 IBM Corporation How to read/write XML using EGL This Learning Module shows how to utilize an EGL Library to read/write an XML.
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
XML files (with LINQ). Introduction to LINQ ( Language Integrated Query ) C#’s new LINQ capabilities allow you to write query expressions that retrieve.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Cataloging for Electronic Commerce: Tool and Resource Development for Creating Standardized Catalogs for U.S. Defense Logistics Information Service Barry.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
XP New Perspectives on XML, 2 nd Edition Tutorial 10 1 WORKING WITH THE DOCUMENT OBJECT MODEL TUTORIAL 10.
An Introduction to XML Presented by Scott Nemec at the UniForum Chicago meeting on 7/25/2006.
Extensible Markup and Beyond
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Session 1 SESSION 1 Working with Dreamweaver 8.0.
XML DOM Functionality in.NET DSK Chakravarthy
1 XSLT An Introduction. 2 XSLT XSLT (extensible Stylesheet Language:Transformations) is a language primarily designed for transforming the structure of.
Extensible Stylesheet Language Chao-Hsien Chu, Ph.D. School of Information Sciences and Technology The Pennsylvania State University XSL-FO XSLT.
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
[ Part III of The XML seminar ] Presenter: Xiaogeng Zhao A Introduction of XQL.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
An Introduction to XML Paul Donohue May 8th 2002 Hotel Senator Zürich.
XML Alyssa Roberts. What is XML? Extensible Markup Language Specification to creating custom mark-up languages Simplified version of SGML, originally.
Geneva, 2nd Tutorial for Health e-Child Project, Service creation in Genius Web Portal Nicola Venuti NICE srl Geneva, , 2nd.
Windows XP Lab 2 Organizing Your Work Competencies.
Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML.
1.NET Web Forms Applications: Main Form © 2002 by Jerry Post.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
XML DOM Week 11 Web site:
XML Schema – XSLT Week 8 Web site:
XSLT, XML Schema, and XPath Matt McClelland. Introduction XML Schema ▫Defines the content and structure of XML data. XSLT ▫Used to transform XML documents.
Getting data out of XML These exercises provide an overview of how to use the native Taverna XPath services to get data out of XML.
1 XSLT XSLT (extensible stylesheet language – transforms ) is another language to process XML documents. Originally intended as a presentation language:
XML Databases Presented By: Pardeep MT15042 Anurag Goel MT15006.
Visual Basic Fundamental Concepts
What is New with the Website?
Project 1 Introduction to HTML.
This is the cover slide..
Displaying XML Data with XSLT
CARA 3.10 Major New Features
IBM Rational Rhapsody Advanced Systems Training v7.5
Data Virtualization Tutorial: XSLT and Streaming Transformations
XML in Web Technologies
PowerApps Getting Started Series
TreeView Control.
Week 11 Web site: XML DOM Week 11 Web site:
Visual Basic..
Built in Fairfield County: Front End Developers Meetup
What is XML?.
HTML 5 SEMANTIC ELEMENTS.
Tutorial 7 – Integrating Access With the Web and With Other Programs
Chapter 10 Accessing Database Files
XML and its applications: 4. Processing XML using PHP
DataXfer Utility Version 3 by Stephen Johnson
Using Veera with R and Shiny to Build Complex Visualizations
Presentation transcript:

XML Kunwar Singh

Overview of Presentation What is XML? Why do we need it? Importance of XML XML Applications XML Market XML Sample Applications Sample Output References

What is XML? XML is the Extensible Markup Language Not a fixed format like HTML XML is actually a `metalanguage' —a language for describing other languages

Why do we need it ? To define document types Easy to author and manage SGML-defined documents Easy to transmit and share them across the Web XML has been designed for ease of implementation, and for interoperability with both SGML and HTML

Importance of XML It removes two constraints which were holding back Web developments: dependence on a single, inflexible document type the complexity of full SGML, whose syntax allows many powerful but hard-to-program options

What does an XML document look like inside? <?xml version="1.0" standalone="yes"?><conversation> <greeting>Hello, world!</greeting> <response>Stop the planet, I want to get off!</response></conversation>

Applications Data interchange format in B2B Web applications such as e-commerce, supply-chain management, workflow, and application integration Media-independent publishing XML can be used to create customized views into data

Why XML in Pharmaceutical companies? XML is open Human-readable Self-explaining Highly-structured Extensible

Sample Application Code <?xml version="1.0" encoding="utf-8"?> <addressbook> <contacts id="Contacts"> <contact id="Alex"> <email id="popmail"> someone@some_pop_mail.net</email> <city>Edinburgh</city> <country>United Kingdom</country> </contact> <contact id="Rebekah"> <email id="webmail"> someone@some_web_mail.net</email> <city>Papakura</city> <country>New Zealand</country> </contact> <contact id="Justin"> <email id="webmail"> someone_else@some_web_mail.com</email> <city>Muriwai</city> <country>New Zealand</country> </contact> </contacts> </addressbook>

Iterate Recursively [C#] private void populateTreeControl( System.Xml.XmlNode document, System.Windows.Forms.TreeNodeCollection nodes) { foreach (System.Xml.XmlNode node in document.ChildNodes) { // If the element has a value, display it; // otherwise display the first attribute // (if there is one) or the element name // (if there isn't) string text = (node.Value != null ? node.Value : (node.Attributes != null && node.Attributes.Count > 0) ? node.Attributes[0].Value : node.Name); TreeNode new_child = new TreeNode(text); nodes.Add(new_child); populateTreeControl(node, new_child.Nodes); } }

Iterate Recursively cont… [VB] Private Sub populateTreeControl( _ ByVal document As System.Xml.XmlNode, _ ByVal nodes As _ System.Windows.Forms.TreeNodeCollection) Dim node As System.Xml.XmlNode For Each node In document.ChildNodes ' If the element has a value, display it; ' otherwise display the first attribute ' (if there is one) or the element name ' (if there isn't) Dim [text] As String If node.Value <> Nothing Then [text] = node.Value Else If Not node.Attributes Is Nothing And _ node.Attributes.Count > 0 Then [text] = node.Attributes(0).Value Else [text] = node.Name End If End If Dim new_child As New TreeNode([text]) nodes.Add(new_child) populateTreeControl(node, new_child.Nodes) Next node End Sub

Create a new Windows Forms application, drop a TreeView control onto the form [C#] System.Xml.XmlDocument document = new System.Xml.XmlDataDocument(); document.Load("../../contacts.xml"); populateTreeControl(document.DocumentElement, treeView1.Nodes); [VB] Dim document As New System.Xml.XmlDataDocument() document.Load("../contacts.xml") populateTreeControl(document.DocumentElement, _ TreeView1.Nodes)

Define what structures the hierarchical view can or cannot manipulate within a given document [C#] private void populateTreeControl(System.Xml.XmlNode document, System.Windows.Forms.TreeNodeCollection nodes) { foreach (System.Xml.XmlNode node in document.ChildNodes) { System.Xml.XmlNode expr = node.SelectSingleNode(xpath_filter); if (expr != null) { TreeNode new_child = new TreeNode(expr.Value); nodes.Add(new_child); populateTreeControl(node, new_child.Nodes); } } }

Define what structures the hierarchical view can or cannot manipulate within a given document [VB] Private Sub populateTreeControl( _ ByVal document As System.Xml.XmlNode, _ ByVal nodes As System.Windows.Forms.TreeNodeCollection) Dim node As System.Xml.XmlNode For Each node In document.ChildNodes Dim expr As System.Xml.XmlNode = _ node.SelectSingleNode(xpath_filter) If Not (expr Is Nothing) Then Dim new_child As New TreeNode(expr.Value) nodes.Add(new_child) populateTreeControl(node, new_child.Nodes) End If Next End Sub

Implementing drag and drop operations [C] private void XmlTreeView_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) { // Allow the user to drag tree nodes within a // tree if (e.Data.GetDataPresent( "System.Windows.Forms.TreeNode", true )) { e.Effect = DragDropEffects.Move; drag_drop_active = true; } else e.Effect = DragDropEffects.None; }

Implementing drag and drop operations cont… [VB] Private Sub XmlTreeView_DragEnter( _ ByVal sender As Object, _ ByVal e As System.Windows.Forms.DragEventArgs) _ Handles MyBase.DragEnter ' Allow the user to drag tree nodes within a tree If e.Data.GetDataPresent( _ "System.Windows.Forms.TreeNode", True) Then e.Effect = DragDropEffects.Move drag_drop_active = True Else e.Effect = DragDropEffects.None End If End Sub

Implementing Delete, Rename, and Insert Operations [Delete] [C]string xpath_query = buildXPathQuery(this.SelectedNode); System.Xml.XmlNode node = xml_document.DocumentElement.SelectSingleNode( xpath_query); node.ParentNode.RemoveChild(node); SelectedNode.Remove(); [VB] Dim xpath_query As String = _ buildXPathQuery(Me.SelectedNode) Dim node As System.Xml.XmlNode = _ xml_document.DocumentElement.SelectSingleNode( _ xpath_query) node.ParentNode.RemoveChild(node) SelectedNode.Remove()

Renaming a folder with XPath filter private void XmlTreeView_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e) { string xpath_query = buildXPathQuery(e.Node); System.Xml.XmlNode node = xml_document.DocumentElement.SelectSingleNode( xpath_query); System.Xml.XmlNode label = node.SelectSingleNode(xpath_filter); label.Value = e.Label; } [VB] Private Sub XmlTreeView_AfterLabelEdit( _ ByVal sender As Object, _ ByVal e As System.Windows.Forms.NodeLabelEditEventArgs) _ Handles MyBase.AfterLabelEdit Dim xpath_query As String = buildXPathQuery(e.Node) Dim node As System.Xml.XmlNode = _ xml_document.DocumentElement.SelectSingleNode( _ xpath_query) Dim label As System.Xml.XmlNode = node.SelectSingleNode(xpath_filter) label.Value = e.Label End Sub

Insert a Folder System.Xml.XmlDocument insert_fragment = new System.Xml.XmlDocument(); insert_fragment.LoadXml( "<product id='New Item'>" + "<description/><ordercode/><price/>" + "<image/></product>"); // The TreeView uses XmlInsertionNode to add // a new folder to the tree's underlying XML // document on request xmlTreeView1.XmlInsertionNode = insert_fragment.DocumentElement; [VB] Dim insert_fragment As New System.Xml.XmlDocument() insert_fragment.LoadXml(" & _ "<product id='New Item'>" & _ "<description/><ordercode/>"<price/>" & _ "<image/></product>") xmlTreeView1.XmlInsertionNode = _ insert_fragment.DocumentElement

Ensure the folder is defined in such a way that the filter query identifies it as a folder… [C#] // First you need to clone the node template, and // import it, because it originates from a different // document System.Xml.XmlNode copy_node = new_node.Clone(); System.Xml.XmlNode insert_node = xml_document.ImportNode(copy_node, true); // Next locate which node should be its parent, and // insert it string xpath_query = buildXPathQuery(this.SelectedNode); System.Xml.XmlNode node = xml_document.DocumentElement.SelectSingleNode( xpath_query); node.AppendChild(insert_node); // Finally, apply the xpath filter to determine what // to display System.Xml.XmlNode expr = insert_node.SelectSingleNode(xpath_filter); System.Windows.Forms.TreeNode new_child = SelectedNode.Nodes.Add(expr.Value); populateTreeControl(insert_node, new_child.Nodes); // Select the node, to force the tree to expand SelectedNode = new_child; // And start editing the new folder name suppress_label_edit = false; new_child.BeginEdit();

Ensure the folder is defined in such a way that the filter query identifies it as a folder… [VB] ' First you need to clone the node template, and ' import it, because it originates from a different ' document. Dim copy_node As System.Xml.XmlNode = new_node.Clone() Dim insert_node As System.Xml.XmlNode = _ xml_document.ImportNode(copy_node, True) ' Next locate which node should be its parent, ' and insert it Dim xpath_query As String = _ buildXPathQuery(Me.SelectedNode) Dim node As System.Xml.XmlNode = xml_document.DocumentElement.SelectSingleNode( _ xpath_query) node.AppendChild(insert_node) ' Finally, apply the xpath filter to determine what ' should be ' displayed Dim expr As System.Xml.XmlNode = _ insert_node.SelectSingleNode(xpath_filter) Dim new_child As System.Windows.Forms.TreeNode = _ SelectedNode.Nodes.Add(expr.Value) populateTreeControl(insert_node, new_child.Nodes) ' Select the node, to force the tree to expand SelectedNode = new_child ' And start editing the new folder name suppress_label_edit = False new_child.BeginEdit()

Load the XML document from a file xmlDocument = new System.Xml.XmlDataDocument(); xmlDocument.Load(strXmlDocument); // After setting the path filter, load the // document into the TreeView xmlTreeView1.XPathFilter = "attribute::id"; xmlTreeView1.Load(xmlDocument); // Defining XmlInsertionNode allows creation of new // nodes within the TreeView System.Xml.XmlDocument insert_fragment = new System.Xml.XmlDocument(); insert_fragment.LoadXml("<product id='New Item'><description/><ordercode/><price/> <image/></product>"); xmlTreeView1.XmlInsertionNode = insert_fragment.DocumentElement;

Load the XML document from a file [VB] ' Load the XML document from a file xmlDocument = New System.Xml.XmlDataDocument() xmlDocument.Load(strXmlDocument) ' After setting the path filter, load the ' document into the TreeView xmlTreeView1.XPathFilter = "attribute::id" xmlTreeView1.Load(xmlDocument) ' Defining XmlInsertionNode allows creation of new ' nodes within the TreeView Dim insert_fragment As New System.Xml.XmlDocument() insert_fragment.LoadXml("<product id='New " & _ "Item'><description/><ordercode/><price/>" & _ "<image/></product>") xmlTreeView1.XmlInsertionNode = insert_fragment.DocumentElement

Final Catalog- OutPut- Hierarchial Tree View

Final catalog- Detailed view

Some More XML Examples http://www.w3schools.com/xml/tryit.asp?filename=cd_list http://www.w3schools.com/xml/tryit.asp?filename=cd_navigate http://www.w3schools.com/xml/tryit.asp?filename=cd_application

References and Sources http://www.projectcool.com/developer/xmlz www.Msdn.microsoft.com/workshop/xml/default www.Developer.netscape.com/tech/metadata/index.html www.oasis-open.org www.ucc.ie/xml/ www.w3schools.com

Questions/ Comments ???????????????????? ?