/Docs/07-Implementacion/Source/trunk/EDUAR_Regular/EDUAR/EDUAR_UI/Private/Manuales/Docente/xmlengine.js
http://blpm.googlecode.com/ · JavaScript · 62 lines · 44 code · 6 blank · 12 comment · 12 complexity · 133107e8fb98ad6b4eb4dae8297f2eba MD5 · raw file
- //XML load routines
- XMLload = function(url) {
- if (saf)
- {
- var d = new XMLHttpRequest();
- d.open("GET", url, false);
- d.send(null);
- return d.responseXML;
- }
- var xmldoc = XMLnewDocument();
- xmldoc.async = false;
- xmldoc.load(url);
- return xmldoc;
- };
-
-
- XMLnewDocument = function(rootTagName, namespaceURL) {
- if (!rootTagName) rootTagName = "";
- if (!namespaceURL) namespaceURL = "";
-
- if (document.implementation && document.implementation.createDocument) {
- // This is the W3C standard way to do it
- return document.implementation.createDocument(namespaceURL,
- rootTagName, null);
- }
- else { // This is the IE way to do it
- // Create an empty document as an ActiveX object
- // If there is no root element, this is all we have to do
- var doc = new ActiveXObject("MSXML2.DOMDocument");
-
- // If there is a root tag, initialize the document
- if (rootTagName) {
- // Look for a namespace prefix
- var prefix = "";
- var tagname = rootTagName;
- var p = rootTagName.indexOf(':');
- if (p != -1) {
- prefix = rootTagName.substring(0, p);
- tagname = rootTagName.substring(p+1);
- }
-
- // If we have a namespace, we must have a namespace prefix
- // If we don't have a namespace, we discard any prefix
- if (namespaceURL) {
- if (!prefix) prefix = "a0"; // What Firefox uses
- }
- else prefix = "";
-
- // Create the root element (with optional namespace) as a
- // string of text
- var text = "<" + (prefix?(prefix+":"):"") + tagname +
- (namespaceURL
- ?(" xmlns:" + prefix + '="' + namespaceURL +'"')
- :"") +
- "/>";
- // And parse that text into the empty document
- doc.loadXML(text);
- }
- return doc;
- }
- };
- //END OF XML load routines