adding getXMLDoc method that allows creating XML documents with non-HTML compliant nodes (e.g. createCDATASection). r=bartvde (closes #3366)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12108 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -848,6 +848,29 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
|
||||
return uri;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getXMLDoc
|
||||
* Get an XML document for nodes that are not supported in HTML (e.g.
|
||||
* createCDATASection). On IE, this will either return an existing or
|
||||
* create a new <xmldom> on the instance. On other browsers, this will
|
||||
* either return an existing or create a new shared document (see
|
||||
* <OpenLayers.Format.XML.document>).
|
||||
*
|
||||
* Returns:
|
||||
* {XMLDocument}
|
||||
*/
|
||||
getXMLDoc: function() {
|
||||
if (!OpenLayers.Format.XML.document && !this.xmldom) {
|
||||
if (document.implementation && document.implementation.createDocument) {
|
||||
OpenLayers.Format.XML.document =
|
||||
document.implementation.createDocument("", "", null);
|
||||
} else if (!this.xmldom && window.ActiveXObject) {
|
||||
this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
|
||||
}
|
||||
}
|
||||
return OpenLayers.Format.XML.document || this.xmldom;
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.XML"
|
||||
|
||||
});
|
||||
@@ -879,3 +902,10 @@ OpenLayers.Format.XML.lookupNamespaceURI = OpenLayers.Function.bind(
|
||||
OpenLayers.Format.XML.prototype.lookupNamespaceURI,
|
||||
OpenLayers.Format.XML.prototype
|
||||
);
|
||||
|
||||
/**
|
||||
* Property: OpenLayers.Format.XML.document
|
||||
* {XMLDocument} XML document to reuse for creating non-HTML compliant nodes,
|
||||
* like document.createCDATASection.
|
||||
*/
|
||||
OpenLayers.Format.XML.document = null;
|
||||
|
||||
Reference in New Issue
Block a user