Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

on-line

Haupt Quellenprogramme E-Bücher Downloads Mit uns in Verbindung treten Über uns

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
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
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


XML DOM Parsing
Previous Next





Um zu lesen und Update, ein XML Dokument zu manipulieren und zu erstellen, benötigst du eine XML grammatische Definition.



Satzgliederung des XML DOM

Um XML Dokument zu manipulieren, benötigst du XML grammatische Definition. Die grammatische Definition Last das Dokument in deinen Computerspeicher. Sobald das Dokument geladen wird, können seine Daten mit DOM manipuliert werden. Das DOM behandelt das XML Dokument als Baum.

Es gibt irgendeinen Unterschied zwischen grammatischer Definition XML Microsofts und der XML grammatischen Definition, die in den Mozilla Datenbanksuchroutinen verwendet wird. In diesem Tutorial zeigen wir dir, wie man Kreuzdatenbanksuchroutineindex verursacht, der in den Internet Explorer- und Mozilladatenbanksuchroutinen arbeitet.



Grammatische Definition XML Microsofts

Grammatische Definition XML Microsofts ist ein COM Bestandteil, das mit Internet Explorer 5 und höheres kommen. Sobald du Internet Explorer angebracht hast, ist die grammatische Definition für die Indexe vorhanden.

Unterstützung grammatische Definition XML Microsofts alle notwendigen Funktionen, zum des Nodebaums zu überqueren, der Nodes und ihrer Attributwerte zugänglich zu machen, von Nodesn einzusetzen und Löschen und des Nodebaums zurück zu XML umzuwandeln.

Um einen Fall der grammatischer Definition XML Microsofts zu verursachen, kannst du den folgenden Code verwenden:

Javascript:

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

VBScript:

set xmlDoc=CreateObject("Microsoft.XMLDOM")


ASP:
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
The following code fragment load an existing XML document ("note.xml") into Microsoft's XML parser:
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("note.xml");

Die erste Linie der Indexe oben verursachen einen Fall der XML grammatischen Definition. Die zweite Linie dreht sich asynchronized weg Laden, um zu überprüfen ob die grammatische Definition nicht Durchführung der Indexe fortsetzt, bevor das Dokument völlig geladen wird. Die dritte Linie erklärt die grammatische Definition, XML Dokument benanntes „note.xml“ zu laden.



XML grammatische Definition in Mozilla, Oper und in Firefox

Unterstützung grammatische Definition XML Mozillas alle notwendigen Funktionen, zum des Nodebaums zu überqueren, der Nodes und ihrer Attributwerte zugänglich zu machen, von Nodesn einzusetzen und Löschen und des Nodebaums zurück zu XML umzuwandeln.

Um einen Fall der XML grammatischen Definition in den Mozilla Datenbanksuchroutinen zu verursachen, kannst du den folgenden Code verwenden:

Javascript:

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

The first parameter, ns, define the namespace used for the XML document. The second parameter, root, is the XML root element in XML file. The third parameter, null, is always null because it is not at all implemented yet. The following code fragment load an existing XML document ("note.xml") into Mozillas' XML parser:

var xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.load("note.xml");

Die erste Linie des Indexes oben verursachen einen Fall der XML grammatischen Definition. Die zweite Linie erklärt die grammatische Definition, XML Dokument benanntes „note.xml“ zu laden.



Analysierend ordnen ein XML - ein Kreuzdatenbanksuchroutine Beispiel ein

Das folgende Beispiel ist ein Kreuzdatenbanksuchroutinebeispiel, die ein vorhandenes XML Dokument („note.xml“) in die XML grammatische Definition laden:

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

Output:

Academictutorials Internal Note To: Tove From: Jani Message: Don't forget me this weekend!


Important Note

To extract the text (Jani) from the XML element like: <from>Jani</from>, the correct syntax is:

getElementsByTagName("from")[0].childNodes[0].nodeValue

WICHTIG: getElementsByTagName bringt immer eine Reihe Nodes zurück. Die Reihe enthält alle Elemente mit dem spezifizierten Namen innerhalb der XML Dokumente. In diesem Fall gibt es nur eins „“ vom Element, aber du mußt ruhig den Reihe Index spezifizieren ([0]).

Satzgliederung eine XML Zeichenkette - ein Kreuzdatenbanksuchroutine Beispiel

Der folgende Code ist ein Kreuzdatenbanksuchroutine Beispiel auf, wie man eine XML Zeichenkette analysiert und lädt:

<html>
<body>
<script type="text/javascript">
var text="<note>";
text=text+"<to>Tove</to>"
; text=text+"<from>Jani</from>";
text=text+"<heading>Reminder</heading>";
text=text+"<body>Don't forget me this weekend!</body>";
text=text+"</note>";
// code for IE
if (window.ActiveXObject)
{
var doc=new ActiveXObject("Microsoft.XMLDOM");
doc.async="false";
doc.loadXML(text);
}
// code for Mozilla, Firefox, Opera, etc.
else
{
var parser=new DOMParser();
var doc=parser.parseFromString(text,"text/xml");
}
// documentElement always represents the root node
var x=doc.documentElement;
document.write("Text of first child element: ");
document.write(x.childNodes[0].childNodes[0].nodeValue);
document.write("<br />");
document.write("Text of second child element: ");
document.write(x.childNodes[1].childNodes[0].nodeValue);
</script>
</body>
</html>

Output:

Text of first child element: Tove
Text of second child element: Jani




Previous Next

Keywords: xml document, xml file, xml parser, xmldom microsoft.xmldom, text node, xml dom attribute, document object model


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
XML Quizes
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 Quizes
JavaScript Quiz
VBScript Quiz
AJAX Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PHP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
XML Web Services Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz

Privacy Policy
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.