public XmlDocument GetXmlDocument() { WXMLModelWriterSettings settings = new WXMLModelWriterSettings(); WXMLDocumentSet set = GetWXMLDocumentSet(settings); return(set[0].Document); }
internal WXMLModelWriter(WXMLModel model, WXMLModelWriterSettings settings) { _model = model; _nametable = new NameTable(); _nsMgr = new XmlNamespaceManager(_nametable); _nsMgr.AddNamespace(WXMLModel.NS_PREFIX, WXMLModel.NS_URI); _wxmlDocumentSet = new WXMLDocumentSet(); _settings = settings; }
public void TestLinqContext() { using (Stream stream = Resources.GetXmlDocumentStream("linq-context")) { WXMLModel model = WXMLModel.LoadFromXml(new XmlTextReader(stream)); Assert.IsNotNull(model); WXMLDocumentSet wxmlDocumentSet = model.GetWXMLDocumentSet(new WXMLModelWriterSettings()); Assert.IsNotNull(wxmlDocumentSet); } }
private void FillImports() { if (_model.Includes.Count == 0) { return; } XmlNode importsNode = CreateElement("Includes"); _ormXmlDocumentMain.DocumentElement.AppendChild(importsNode); foreach (WXMLModel objectsDef in _model.Includes) { WXMLModelWriterSettings settings = (WXMLModelWriterSettings)_settings.Clone(); //settings.DefaultMainFileName = _settings.DefaultIncludeFileName + _ormObjectsDef.Includes.IndexOf(objectsDef); WXMLDocumentSet set = Generate(objectsDef, _settings); _wxmlDocumentSet.AddRange(set); foreach (WXMLDocument ormXmlDocument in set) { if ((_settings.IncludeBehaviour & IncludeGenerationBehaviour.Inline) == IncludeGenerationBehaviour.Inline) { XmlNode importedSchemaNode = _ormXmlDocumentMain.ImportNode(ormXmlDocument.Document.DocumentElement, true); importsNode.AppendChild(importedSchemaNode); } else { XmlElement includeElement = _ormXmlDocumentMain.CreateElement("xi", "include", "http://www.w3.org/2001/XInclude"); includeElement.SetAttribute("parse", "xml"); string fileName = GetIncludeFileName(_model, objectsDef, settings); includeElement.SetAttribute("href", fileName); importsNode.AppendChild(includeElement); } } } }