Merge pull request #465 from rlskoeser/ns-aware

Support dzi xml with namespaces in Firefox
This commit is contained in:
iangilman 2014-08-21 09:33:07 -07:00
commit 8459750cf1

View File

@ -222,6 +222,7 @@ function configureFromXML( tileSource, xmlDoc ){
var root = xmlDoc.documentElement, var root = xmlDoc.documentElement,
rootName = root.localName, rootName = root.localName,
ns = xmlDoc.documentElement.namespaceURI,
configuration = null, configuration = null,
displayRects = [], displayRects = [],
dispRectNodes, dispRectNodes,
@ -233,7 +234,8 @@ function configureFromXML( tileSource, xmlDoc ){
if ( rootName == "Image" ) { if ( rootName == "Image" ) {
try { try {
sizeNode = root.getElementsByTagName( "Size" )[ 0 ]; sizeNode = root.getElementsByTagNameNS(ns, "Size" )[ 0 ];
configuration = { configuration = {
Image: { Image: {
xmlns: "http://schemas.microsoft.com/deepzoom/2008", xmlns: "http://schemas.microsoft.com/deepzoom/2008",
@ -255,10 +257,11 @@ function configureFromXML( tileSource, xmlDoc ){
); );
} }
dispRectNodes = root.getElementsByTagName( "DisplayRect" ); dispRectNodes = root.getElementsByTagNameNS(ns, "DisplayRect" );
for ( i = 0; i < dispRectNodes.length; i++ ) { for ( i = 0; i < dispRectNodes.length; i++ ) {
dispRectNode = dispRectNodes[ i ]; dispRectNode = dispRectNodes[ i ];
rectNode = dispRectNode.getElementsByTagName( "Rect" )[ 0 ]; rectNode = dispRectNode.getElementsByTagNameNS(ns, "Rect" )[ 0 ];
displayRects.push({ displayRects.push({
Rect: { Rect: {