Пример #1
0
 def __init__(self, element, parent):
     self.element = element
     self.parent = parent
     did_element = XmlUtils.selectSingleNode(element, 'did')
     if not did_element:
         raise Exception, "did not found"
     self.did = EadDID(did_element)
     self.title = self.did.unittitle or self.title
     self.level = element.getAttribute('level')
Пример #2
0
def utilsSingleNodeTester ():
	root = rec.selectSingleNode (rec.dom, 'record/contributors')
	path = 'person/@order'
	node = XmlUtils.selectSingleNode (root, path)
	if node:
		if node.nodeType == node.ATTRIBUTE_NODE:
			print "Attribute value: " + node.nodeValue
		else:
			print node.toxml()
	else:
		print 'node not found at', path
Пример #3
0
	def getEnumerationTypes (self):
		"""
		get the Enumeration Type defs defined in this XSD
		"""
		
		# print "getEnumerationTypes: enumTypes is %s" % type(self._enumTypes)
		
		if self._enumTypes is None:
			self._enumTypes = []
			for typeDef in self._get_typeDefs():
				# print "typeDef (%s) %s" % (type(typeDef), typeDef.getAttribute("name"))
				
				# we don't require any enums to be present
				if XmlUtils.selectSingleNode (typeDef, qp("restriction")):
					self._enumTypes.append (self.enumType_constructor (typeDef))
	
			if len(self._enumTypes) == 0:
				print "WARNING: getEnumerationTypes did not find any"
		return self._enumTypes
Пример #4
0
	def __init__ (self, element):
		self.element = element
		self.name = element.getAttribute ("name")
		self.restriction = XmlUtils.selectSingleNode (element, qp("restriction"))
		self.terms = XmlUtils.selectNodes (self.restriction, qp("enumeration"))
Пример #5
0
 def _get_dao(self):
     daoElement = XmlUtils.selectSingleNode(self.element, "dao")
     if daoElement:
         return DigitalObject(daoElement)