Project

General

Profile

1 3 wheeler
<?php
2
require_once('objects/types.php');
3
4
function isIgnoreType($nodeName) {
5
  global $ignoreTypes;
6
  return $ignoreTypes[$nodeName];
7
}
8
9
function isPrimitiveType($nodeName) {
10
  global $primitiveTypes;
11
  return $primitiveTypes[$nodeName];
12
}
13
14
function isKnownAttribute($attrName) {
15
  global $knownAttributes;
16
  return $knownAttributes[$attrName];
17
}
18
19 6 wheeler
function needsIndex($colName) {
20
  global $indexableCols;
21
  return $indexableCols[$colName];
22
}
23
24
function isNativePointer($colName) {
25
  global $nativeVegXPointers;
26
  return $nativeVegXPointers[$colName];
27
}
28
29 3 wheeler
function hasImportantNodes($node) {
30
  $nodes = $node->getElementsbyTagName("*");
31
  foreach($nodes as $node) {
32
    $nodeName = preg_replace("/.*:/","",$node->nodeName);
33
    if(!isIgnoreType($nodeName)) {
34
      return true;
35
    }
36
  }
37
  return false;
38
}
39
40
function stringXMLNode($node) {
41
  return $node->ownerDocument->saveXML($node);
42
}
43
44
function findFirstAncestorName($node) {
45
  $xpath = new DOMXPath($node->ownerDocument);
46
  $parentNodes = $xpath->query("parent::*",$node);
47
  $parentNode = $parentNodes->item(0);
48
  $name = $parentNode->getAttribute('name');
49
  if($name != '') {
50
    return $name;
51
  } else {
52
    return findFirstAncestorName($parentNode);
53
  }
54
}
55
56
?>