public Resource(XmlNode xmlNode) { XmlNode resourceIdNode = xmlNode.SelectSingleNode("resourceId"); if (resourceIdNode != null) { if (resourceIdNode.Attributes["href"] != null || resourceIdNode.Attributes["id"] != null) { if (resourceIdNode.Attributes["id"] != null) { resourceIdIDRef_ = resourceIdNode.Attributes["id"].Value; ResourceId ob = new ResourceId(resourceIdNode); IDManager.SetID(resourceIdIDRef_, ob); } else if (resourceIdNode.Attributes["href"] != null) { resourceIdIDRef_ = resourceIdNode.Attributes["href"].Value; } else { resourceId_ = new ResourceId(resourceIdNode); } } else { resourceId_ = new ResourceId(resourceIdNode); } } XmlNode resourceTypeNode = xmlNode.SelectSingleNode("resourceType"); if (resourceTypeNode != null) { if (resourceTypeNode.Attributes["href"] != null || resourceTypeNode.Attributes["id"] != null) { if (resourceTypeNode.Attributes["id"] != null) { resourceTypeIDRef_ = resourceTypeNode.Attributes["id"].Value; ResourceType ob = new ResourceType(resourceTypeNode); IDManager.SetID(resourceTypeIDRef_, ob); } else if (resourceTypeNode.Attributes["href"] != null) { resourceTypeIDRef_ = resourceTypeNode.Attributes["href"].Value; } else { resourceType_ = new ResourceType(resourceTypeNode); } } else { resourceType_ = new ResourceType(resourceTypeNode); } } XmlNode languageNode = xmlNode.SelectSingleNode("language"); if (languageNode != null) { if (languageNode.Attributes["href"] != null || languageNode.Attributes["id"] != null) { if (languageNode.Attributes["id"] != null) { languageIDRef_ = languageNode.Attributes["id"].Value; Language ob = new Language(languageNode); IDManager.SetID(languageIDRef_, ob); } else if (languageNode.Attributes["href"] != null) { languageIDRef_ = languageNode.Attributes["href"].Value; } else { language_ = new Language(languageNode); } } else { language_ = new Language(languageNode); } } XmlNode sizeInBytesNode = xmlNode.SelectSingleNode("sizeInBytes"); if (sizeInBytesNode != null) { if (sizeInBytesNode.Attributes["href"] != null || sizeInBytesNode.Attributes["id"] != null) { if (sizeInBytesNode.Attributes["id"] != null) { sizeInBytesIDRef_ = sizeInBytesNode.Attributes["id"].Value; XsdTypeDecimal ob = new XsdTypeDecimal(sizeInBytesNode); IDManager.SetID(sizeInBytesIDRef_, ob); } else if (sizeInBytesNode.Attributes["href"] != null) { sizeInBytesIDRef_ = sizeInBytesNode.Attributes["href"].Value; } else { sizeInBytes_ = new XsdTypeDecimal(sizeInBytesNode); } } else { sizeInBytes_ = new XsdTypeDecimal(sizeInBytesNode); } } XmlNode lengthNode = xmlNode.SelectSingleNode("length"); if (lengthNode != null) { if (lengthNode.Attributes["href"] != null || lengthNode.Attributes["id"] != null) { if (lengthNode.Attributes["id"] != null) { lengthIDRef_ = lengthNode.Attributes["id"].Value; ResourceLength ob = new ResourceLength(lengthNode); IDManager.SetID(lengthIDRef_, ob); } else if (lengthNode.Attributes["href"] != null) { lengthIDRef_ = lengthNode.Attributes["href"].Value; } else { length_ = new ResourceLength(lengthNode); } } else { length_ = new ResourceLength(lengthNode); } } XmlNode mimeTypeNode = xmlNode.SelectSingleNode("mimeType"); if (mimeTypeNode != null) { if (mimeTypeNode.Attributes["href"] != null || mimeTypeNode.Attributes["id"] != null) { if (mimeTypeNode.Attributes["id"] != null) { mimeTypeIDRef_ = mimeTypeNode.Attributes["id"].Value; MimeType ob = new MimeType(mimeTypeNode); IDManager.SetID(mimeTypeIDRef_, ob); } else if (mimeTypeNode.Attributes["href"] != null) { mimeTypeIDRef_ = mimeTypeNode.Attributes["href"].Value; } else { mimeType_ = new MimeType(mimeTypeNode); } } else { mimeType_ = new MimeType(mimeTypeNode); } } XmlNode nameNode = xmlNode.SelectSingleNode("name"); if (nameNode != null) { if (nameNode.Attributes["href"] != null || nameNode.Attributes["id"] != null) { if (nameNode.Attributes["id"] != null) { nameIDRef_ = nameNode.Attributes["id"].Value; XsdTypeNormalizedString ob = new XsdTypeNormalizedString(nameNode); IDManager.SetID(nameIDRef_, ob); } else if (nameNode.Attributes["href"] != null) { nameIDRef_ = nameNode.Attributes["href"].Value; } else { name_ = new XsdTypeNormalizedString(nameNode); } } else { name_ = new XsdTypeNormalizedString(nameNode); } } XmlNode commentsNode = xmlNode.SelectSingleNode("comments"); if (commentsNode != null) { if (commentsNode.Attributes["href"] != null || commentsNode.Attributes["id"] != null) { if (commentsNode.Attributes["id"] != null) { commentsIDRef_ = commentsNode.Attributes["id"].Value; XsdTypeString ob = new XsdTypeString(commentsNode); IDManager.SetID(commentsIDRef_, ob); } else if (commentsNode.Attributes["href"] != null) { commentsIDRef_ = commentsNode.Attributes["href"].Value; } else { comments_ = new XsdTypeString(commentsNode); } } else { comments_ = new XsdTypeString(commentsNode); } } XmlNode stringNode = xmlNode.SelectSingleNode("string"); if (stringNode != null) { if (stringNode.Attributes["href"] != null || stringNode.Attributes["id"] != null) { if (stringNode.Attributes["id"] != null) { stringIDRef_ = stringNode.Attributes["id"].Value; XsdTypeString ob = new XsdTypeString(stringNode); IDManager.SetID(stringIDRef_, ob); } else if (stringNode.Attributes["href"] != null) { stringIDRef_ = stringNode.Attributes["href"].Value; } else { string_ = new XsdTypeString(stringNode); } } else { string_ = new XsdTypeString(stringNode); } } XmlNode hexadecimalBinaryNode = xmlNode.SelectSingleNode("hexadecimalBinary"); if (hexadecimalBinaryNode != null) { if (hexadecimalBinaryNode.Attributes["href"] != null || hexadecimalBinaryNode.Attributes["id"] != null) { if (hexadecimalBinaryNode.Attributes["id"] != null) { hexadecimalBinaryIDRef_ = hexadecimalBinaryNode.Attributes["id"].Value; XsdTypeHexBinary ob = new XsdTypeHexBinary(hexadecimalBinaryNode); IDManager.SetID(hexadecimalBinaryIDRef_, ob); } else if (hexadecimalBinaryNode.Attributes["href"] != null) { hexadecimalBinaryIDRef_ = hexadecimalBinaryNode.Attributes["href"].Value; } else { hexadecimalBinary_ = new XsdTypeHexBinary(hexadecimalBinaryNode); } } else { hexadecimalBinary_ = new XsdTypeHexBinary(hexadecimalBinaryNode); } } XmlNode base64BinaryNode = xmlNode.SelectSingleNode("base64Binary"); if (base64BinaryNode != null) { if (base64BinaryNode.Attributes["href"] != null || base64BinaryNode.Attributes["id"] != null) { if (base64BinaryNode.Attributes["id"] != null) { base64BinaryIDRef_ = base64BinaryNode.Attributes["id"].Value; XsdTypeBase64Binary ob = new XsdTypeBase64Binary(base64BinaryNode); IDManager.SetID(base64BinaryIDRef_, ob); } else if (base64BinaryNode.Attributes["href"] != null) { base64BinaryIDRef_ = base64BinaryNode.Attributes["href"].Value; } else { base64Binary_ = new XsdTypeBase64Binary(base64BinaryNode); } } else { base64Binary_ = new XsdTypeBase64Binary(base64BinaryNode); } } XmlNode urlNode = xmlNode.SelectSingleNode("url"); if (urlNode != null) { if (urlNode.Attributes["href"] != null || urlNode.Attributes["id"] != null) { if (urlNode.Attributes["id"] != null) { urlIDRef_ = urlNode.Attributes["id"].Value; XsdTypeAnyURI ob = new XsdTypeAnyURI(urlNode); IDManager.SetID(urlIDRef_, ob); } else if (urlNode.Attributes["href"] != null) { urlIDRef_ = urlNode.Attributes["href"].Value; } else { url_ = new XsdTypeAnyURI(urlNode); } } else { url_ = new XsdTypeAnyURI(urlNode); } } }
public Resource(XmlNode xmlNode) { XmlNodeList resourceIdNodeList = xmlNode.SelectNodes("resourceId"); if (resourceIdNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in resourceIdNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { resourceIdIDRef = item.Attributes["id"].Name; ResourceId ob = ResourceId(); IDManager.SetID(resourceIdIDRef, ob); } else if (item.Attributes.ToString() == "href") { resourceIdIDRef = item.Attributes["href"].Name; } else { resourceId = new ResourceId(item); } } } XmlNodeList resourceTypeNodeList = xmlNode.SelectNodes("resourceType"); if (resourceTypeNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in resourceTypeNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { resourceTypeIDRef = item.Attributes["id"].Name; ResourceType ob = ResourceType(); IDManager.SetID(resourceTypeIDRef, ob); } else if (item.Attributes.ToString() == "href") { resourceTypeIDRef = item.Attributes["href"].Name; } else { resourceType = new ResourceType(item); } } } XmlNodeList languageNodeList = xmlNode.SelectNodes("language"); if (languageNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in languageNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { languageIDRef = item.Attributes["id"].Name; Language ob = Language(); IDManager.SetID(languageIDRef, ob); } else if (item.Attributes.ToString() == "href") { languageIDRef = item.Attributes["href"].Name; } else { language = new Language(item); } } } XmlNodeList sizeInBytesNodeList = xmlNode.SelectNodes("sizeInBytes"); if (sizeInBytesNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in sizeInBytesNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { sizeInBytesIDRef = item.Attributes["id"].Name; XsdTypeDecimal ob = XsdTypeDecimal(); IDManager.SetID(sizeInBytesIDRef, ob); } else if (item.Attributes.ToString() == "href") { sizeInBytesIDRef = item.Attributes["href"].Name; } else { sizeInBytes = new XsdTypeDecimal(item); } } } XmlNodeList lengthNodeList = xmlNode.SelectNodes("length"); if (lengthNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in lengthNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { lengthIDRef = item.Attributes["id"].Name; ResourceLength ob = ResourceLength(); IDManager.SetID(lengthIDRef, ob); } else if (item.Attributes.ToString() == "href") { lengthIDRef = item.Attributes["href"].Name; } else { length = new ResourceLength(item); } } } XmlNodeList mimeTypeNodeList = xmlNode.SelectNodes("mimeType"); if (mimeTypeNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in mimeTypeNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { mimeTypeIDRef = item.Attributes["id"].Name; MimeType ob = MimeType(); IDManager.SetID(mimeTypeIDRef, ob); } else if (item.Attributes.ToString() == "href") { mimeTypeIDRef = item.Attributes["href"].Name; } else { mimeType = new MimeType(item); } } } XmlNodeList nameNodeList = xmlNode.SelectNodes("name"); if (nameNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in nameNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { nameIDRef = item.Attributes["id"].Name; XsdTypeNormalizedString ob = XsdTypeNormalizedString(); IDManager.SetID(nameIDRef, ob); } else if (item.Attributes.ToString() == "href") { nameIDRef = item.Attributes["href"].Name; } else { name = new XsdTypeNormalizedString(item); } } } XmlNodeList commentsNodeList = xmlNode.SelectNodes("comments"); if (commentsNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in commentsNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { commentsIDRef = item.Attributes["id"].Name; XsdTypeString ob = XsdTypeString(); IDManager.SetID(commentsIDRef, ob); } else if (item.Attributes.ToString() == "href") { commentsIDRef = item.Attributes["href"].Name; } else { comments = new XsdTypeString(item); } } } XmlNodeList stringNodeList = xmlNode.SelectNodes("string"); if (stringNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in stringNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { stringIDRef = item.Attributes["id"].Name; XsdTypeString ob = XsdTypeString(); IDManager.SetID(stringIDRef, ob); } else if (item.Attributes.ToString() == "href") { stringIDRef = item.Attributes["href"].Name; } else { string = new XsdTypeString(item); } } } XmlNodeList hexadecimalBinaryNodeList = xmlNode.SelectNodes("hexadecimalBinary"); if (hexadecimalBinaryNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in hexadecimalBinaryNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { hexadecimalBinaryIDRef = item.Attributes["id"].Name; XsdTypeHexBinary ob = XsdTypeHexBinary(); IDManager.SetID(hexadecimalBinaryIDRef, ob); } else if (item.Attributes.ToString() == "href") { hexadecimalBinaryIDRef = item.Attributes["href"].Name; } else { hexadecimalBinary = new XsdTypeHexBinary(item); } } } XmlNodeList base64BinaryNodeList = xmlNode.SelectNodes("base64Binary"); if (base64BinaryNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in base64BinaryNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { base64BinaryIDRef = item.Attributes["id"].Name; XsdTypeBase64Binary ob = XsdTypeBase64Binary(); IDManager.SetID(base64BinaryIDRef, ob); } else if (item.Attributes.ToString() == "href") { base64BinaryIDRef = item.Attributes["href"].Name; } else { base64Binary = new XsdTypeBase64Binary(item); } } } XmlNodeList urlNodeList = xmlNode.SelectNodes("url"); if (urlNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in urlNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { urlIDRef = item.Attributes["id"].Name; XsdTypeAnyURI ob = XsdTypeAnyURI(); IDManager.SetID(urlIDRef, ob); } else if (item.Attributes.ToString() == "href") { urlIDRef = item.Attributes["href"].Name; } else { url = new XsdTypeAnyURI(item); } } } }