+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
XML
1.
2. Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
4. XML
• XML stands for eXtensible Markup Language
• XML was designed to carry data, not to
displayData
• XML tags are not predefined. You must define
your own tags
5. Main Components of an XML
Document
Elements: <hello>
Attributes: <item id=“33905”>
Entities: < (<)
6. The Basic Rules
• XML is case sensitive
• All start tags must have end tags
• Elements must be properly nested
• XML declaration is the first statement
• Every document must contain a root element
• Attribute values must have quotation marks
• Certain characters are reserved for parsing
7. Common Errors for Element
Naming
• Do not use white space when creating names
for elements
• Element names cannot begin with a digit,
although names can contain digits
• Only certain punctuation allowed – periods,
colons, and hyphens
8. XML Schema Basics
• XML Schema is an XML application
• Provides simple types (string, integer, dateTime, duration,
language, …)
• Allows defining possible values for elements
• Allows defining types derived from existing types
• Allows defining complex types
• Allows posing constraints on the occurrence of elements
• Allows forcing uniqueness and foreign keys
• Way too complex to cover in an introductory talk
10. XML Parser
• An XML parser converts an XML document into an XML DOM object -
which can then be manipulated with JavaScript
• A DOM (Document Object Model) defines a standard way for accessing
and manipulating documents
The XML DOM
• The XML DOM defines a standard way for accessing and manipulating
XML documents
• The XML DOM views an XML document as a tree-structure
• All elements can be accessed through the DOM tree. Their content (text
and attributes) can be modified or deleted, and new elements can be
created. The elements, their text, and their attributes are all known as
nodes
11. Parse an XML Document
The following code fragment parses an XML document into an XML DOM
object:
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","books.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
12. Parse an XML Document
Note:
Internet Explorer uses the loadXML() method to parse an XML
string, while other browsers use the DOMParser object.
13. GladeXML
Allows dynamic loading of user interfaces from XML descriptions.
This object represents an `instantiation' of an XML interface description.
When one of these objects is created, the XML file is read, and the
interface is created. The GladeXML object then provides an interface for
accessing the widgets in the interface by the names assigned to them
inside the XML description.
The GladeXML object can also be used to connect handlers to the named
signals in the description. Libglade also provides an interface by which it
can look up the signal handler names in the program's symbol table and
automatically connect as many handlers up as it can that way.
14. Usage
Class: <glade-xml>
Derives from <gobject>.
This class defines no direct slots.
— Function: glade-xml-new (fname mchars) (root mchars) (domain mchars)
⇒ (ret <glade-xml>)
Creates a new GladeXML object (and the corresponding widgets) from the
XML file fname. Optionally it will only build the interface from the widget
node root (if it is not ‘#f’). This feature is useful if you only want to build
say a toolbar or menu from the XML file, but not the window it is
embedded in. Note also that the XML parse tree is cached to speed up
creating another GladeXML object for the same file
fnamethe XML file name.
rootthe widget node in fname to start building from (or ‘#f’)
domainthe translation domain for the XML file (or ‘#f’ for default)
retthe newly created GladeXML object, or NULL on failure.
15. Usage
Method: get-widget
This function is used to get a pointer to the
GtkWidget corresponding to name in the interface
description. You would use this if you have to do
anything to the widget after loading.
selfthe GladeXML object.
namethe name of the widget.
retthe widget matching name, or ‘#f’ if none exists.
16. If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com