Academic Tutorials



English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting
Chats

XML Tutorial
XML Introduction
XML How to use
XML Syntax
XML Elements
XML Attributes
XML Validation
XML Validator
XML Browsers
XML Viewing
XML CSS
XML XSL
XML Data Island
XML Parser
XML in Real Life
XML Namespaces
XML CDATA
XML Encoding
XML Server
XML Application
XML HTTP Request
XML Save Data
XML Behaviors
XML Technologies
XML Editors
XML Summary
XML as Data Source

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Network Sites


XML Parser

Previoushome Next



XML Parser


A program that interprets the contents of an XML file and determines what to do with its input.
A D V E R T I S E M E N T

An XML parser is a software that reads XML files and makes the information from those files available to applications and programming languages, usually through a known interface like the DOM. The XML parser is responsible for testing whether a document is well-formed and it will also check for validity (ie, it determines if the document follows the rules of the DTD or XML schema). ...




Microsoft's XML Parser


Microsoft's XML parser is a COM component that comes with Internet Explorer 5 and higher. After installing Internet Explorer, the parser is available to scripts.

Microsoft's XML parser supports all the necessary functions of the node tree.To traverse access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML.

The most commonly used node types supported by Microsoft's XML parser is described below:


Type of Node Example
Processing instruction <?xml version="1.0"?>
Element <drink type="beer">Carlsberg</drink>
Attribute type="beer"
Text Carlsberg

MSXML Parser 2.5 is the XML parser that is included with Windows 2000 and IE 5.5.

MSXML Parser 3.0 is the XML parser that is included with IE 6.0 and Windows XP.

Features MSXML 3.0 parser:

  • JavaScript, VBScript, Perl, VB, Java, C++, etc. support
  • Complete XML support
  • Full DOM and Namespace support
  • DTD and validation
  • Complete XSLT and XPath support
  • SAX2 support
  • Server-safe HTTP

To create an instance of Microsoft's XML parser with JavaScript, use the following code:


var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")

Use the following code, to create an instance of Microsoft's XML parser with VBScript.

set xmlDoc=CreateObject("Microsoft.XMLDOM")

Use the following code,to create an instance of Microsoft's XML parser in an ASP page (using VBScript), use the following code:


set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")

Code written below loads an existing XML document ("employee.xml") into Microsoft's XML parser:


<script type="text/javascript">
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("employee.xml")
... ... ...
</script>

The first line of the script above creates an instance of the Microsoft XML parser. The third line tells the parser to load an XML document called "employee.xml". The second line turns off asynchronized loading, to make sure that the parser will not continue execution of the script before the document is fully loaded.




XML Parser in Mozilla Browsers

In Mozilla Plain XML documents are displayed in a tree-like structure (just like IE).


Mozilla browsers also supports parsing of XML data by using JavaScript. The parsed data can be presented by HTML.

Use the following code, for creating an instance of the XML parser with JavaScript in Mozilla browsers.


var xmlDoc=document.implementation.createDocument("ns","root",null)


The first parameter, ns, defines the namespace used for the XML document. The second parameter is the XML root element in the XML file. The third parameter, null, is always null because it is not implemented yet.

The code below loads an existing XML document ("employee.xml") into Mozillas' XML parser:

<script type="text/javascript">
var xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.load("employee.xml");
...
...
</script>

The first line of the script above creates an instance of the XML parser. The second line tells the parser to load an XML document called "employee.xml".

The next line describes the root element of the document (like it was saying: "this
document is a employee details"):




To Load an XML File - A Cross browser Example


The example given below is a cross browser example that loads an existing XML document ("employee.xml") into the XML parser:


<html>
<head>
<script type="text/javascript"> function loadXML()
{
//load xml file
// code for IE
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("employee.xml");
getmessage()
}
// code for Mozilla, etc.
else if (document.implementation &&
document.implementation.createDocument)
{
xmlDoc= document.implementation.createDocument("","",null);
xmlDoc.load("employee.xml");
xmlDoc.onload=getmessage
}
else
{
alert('Your browser cannot handle this script'); }
function getmessage()
{
document.getElementById("to").innerHTML=
xmlDoc.getElementsByTagName("to")[0].firstChild.nodeValue
document.getElementById("from").innerHTML=
xmlDoc.getElementsByTagName("from")[0].firstChild.nodeValue
document.getElementById("message").innerHTML=
xmlDoc.getElementsByTagName("body")[0].firstChild.nodeValue
}
</script>
</head>
<body onload="loadXML()" bgcolor="yellow">
<h1>VYOMS Details</h1>
<p><b>To:</b> <span id="to"></span><br />
<b>From:</b> <span id="from"></span>
<hr />
<b>Message:</b> <span id="message"></span>
</p>
</body>
</html>



Loading XML Text Into the Parser

Internet Explorer supports two ways of loading XML into a document object: the load() method and the loadXML() method. The load() method loads an XML file and the loadXML() method loads a text string that contains XML code.

The following code loads a text string into Microsoft's XML parser:


<script type="text/javascript">
var txt="<company>"
txt=txt+"<to>VYOM</to><from>TCS</from>"
txt=txt+"<heading>Reminder</heading>"
txt=txt+"<body>Employee Details</body>"
txt=txt+"</company>"
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.loadXML(txt)
...
...
...
</script>

Be the first one to comment on this page.




  XML Tutorial eBooks
More Links » »
 
 XML Tutorial FAQs
More Links » »
 
 XML Tutorial Interview Questions
More Links » »
 
 XML Tutorial Articles
More Links » »
 
 XML Tutorial News
More Links » »
 
 XML Tutorial Jobs
More Links » »

Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords: microsoft xml parser, c xml parser, free xml parser, xml document, sax xml parser expat xml parser, dom xml parser, microsoft xml parser, apache xml parser, xml parser tutorial, xml file parser, simple xml parser, xml parser example, xsl parser, xml parser 4.0, xml parser examples, msxml parser, c# xml parser, xslt parser, python xml parser, dtd parser, asp xml parser, xsd parser, xml parser sample, validating xml parser, xml parser library, xml parser api, xml parser 4, xml parser 3.0, using xml parser, xml parser pm, msxml 4.0 parser, oracle xml parser,

HTML Quizzes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizzes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright ? 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
Copyright ? 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.