Advertisement
Guest User

_getObjectsByNameElement

a guest
Sep 16th, 2015
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // returns xml Elements of corresponded label object with name objectName
  2.         function _getObjectsByNameElement(objectName)
  3.         {
  4.             var objects = _getObjectElements();
  5.             var return_objects = [];
  6.  
  7.             // find object with name
  8.             for (var i = 0; i < objects.length; i++)
  9.             {
  10.                 var elem = objects[i];
  11.                 var name = Xml.getElementText(Xml.getNode(elem, "Name"));
  12.                 if (name == objectName)
  13.                     return_objects.push(elem);
  14.             }
  15.  
  16.             if (return_objects.length > 0)
  17.                 return return_objects;
  18.  
  19.             throw new Error("getObjectByNameElement(): no object with name '" + objectName + "' was found");
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement