public static string GetSchemaName(this XmlSchemaObject obj) { var localPath = obj.GetLocalPath(); return((localPath == null) ? null : Path.GetFileName(localPath)); }
private void AddEmbeddedDocumenation(XmlNamespaceManager namespaceManager, XmlSchemaObject documentatbleObject) { var sourceCode = Context.SourceCodeManager.GetSourceCode(documentatbleObject); if (String.IsNullOrEmpty(sourceCode)) { return; } using (var stringReader = new StringReader(sourceCode)) using (var xmlReader = new XmlTextReader(stringReader)) using (var stringWriter = new StringWriter()) using (var xmlTextWriter = new XmlTextWriter(stringWriter)) { var argumentList = GetXsltArgumentList(documentatbleObject); try { _compiledTransform.Transform(xmlReader, argumentList, xmlTextWriter); } catch (Exception ex) { var fileName = documentatbleObject.GetLocalPath(); throw ExceptionBuilder.ErrorTransformingInlineDocumentation(fileName, ex); } var doc = new XmlDocument(); try { doc.LoadXml(stringWriter.ToString()); } catch (Exception) { return; } var documentationInfo = GetOrCreateDocumentationInfo(documentatbleObject); var schemaDocElement = doc.SelectSingleNode("xsd:schemaDoc", namespaceManager); InitializeDocumentationInfo(documentatbleObject, documentationInfo, schemaDocElement, namespaceManager); } }