mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 00:26:10 +03:00
use getElementsByTagNameNS for namespaced DZI xml when getElementsByTagName fails
This commit is contained in:
parent
e93578fa54
commit
df90308b0e
@ -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,
|
||||||
@ -234,6 +235,11 @@ function configureFromXML( tileSource, xmlDoc ){
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
sizeNode = root.getElementsByTagName( "Size" )[ 0 ];
|
sizeNode = root.getElementsByTagName( "Size" )[ 0 ];
|
||||||
|
// if finding by tag name failed, attempt to find with namespace
|
||||||
|
if (sizeNode === undefined) {
|
||||||
|
sizeNode = root.getElementsByTagNameNS(ns, "Size" )[ 0 ];
|
||||||
|
}
|
||||||
|
|
||||||
configuration = {
|
configuration = {
|
||||||
Image: {
|
Image: {
|
||||||
xmlns: "http://schemas.microsoft.com/deepzoom/2008",
|
xmlns: "http://schemas.microsoft.com/deepzoom/2008",
|
||||||
@ -256,9 +262,15 @@ function configureFromXML( tileSource, xmlDoc ){
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispRectNodes = root.getElementsByTagName( "DisplayRect" );
|
dispRectNodes = root.getElementsByTagName( "DisplayRect" );
|
||||||
|
if (dispRectNodes === undefined) {
|
||||||
|
dispRectNodes = root.getElementsByTagNameNS(ns, "DisplayRect" )[ 0 ];
|
||||||
|
}
|
||||||
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.getElementsByTagName( "Rect" )[ 0 ];
|
||||||
|
if (rectNode === undefined) {
|
||||||
|
rectNode = dispRectNode.getElementsByTagNameNS(ns, "Rect" )[ 0 ];
|
||||||
|
}
|
||||||
|
|
||||||
displayRects.push({
|
displayRects.push({
|
||||||
Rect: {
|
Rect: {
|
||||||
|
Loading…
Reference in New Issue
Block a user