protected virtual XPathProcessor XPathProcessor(string xml) { var processor = new XPathProcessor(); processor.Initialize(xml); return(processor); }
public override void Map(XPathProcessor source, Dog destination) { this.RegisterNamespace(source, XmlNamespaces.PetNamespacePrefix, XmlNamespaces.PetNamespace); this.Engine.Map(source, destination as Animal); destination.Tricks = source.ToString("Tricks"); }
public override void Map(XPathProcessor source, Parent destination) { destination.Id = source.ToInt("Id"); destination.Name = source.ToString("Name"); destination.Cost = source.ToDecimal("Cost"); destination.Children = this.engine.MapList <XPathProcessor, Child>(source, "Children"); }
public override void Map(XPathProcessor source, Cat destination) { RegisterNamespace(source, XmlNamespaces.PetNamespacePrefix, XmlNamespaces.PetNamespace); Engine.Map(source, destination as Animal); destination.Spayed = source.ToBool("Spayed"); }
public override void Map(XPathProcessor source, Animal destination) { this.RegisterNamespace(source, XmlNamespaces.AppNamespacePrefix, XmlNamespaces.AppNamespace); // NB Due to children potentially being in different namespace, properties must specify prefix here destination.Id = source.ToInt("Id", XmlNamespaces.AppNamespacePrefix); destination.Name = source.ToString("Name", XmlNamespaces.AppNamespacePrefix); }
public override void Map(XPathProcessor source, Child destination) { this.RegisterNamespace(source, XmlNamespaces.SalesNamespacePrefix, XmlNamespaces.SalesNamespace); destination.Id = source.ToInt("Id"); destination.Value = source.ToFloat("Value", XmlNamespaces.SalesNamespacePrefix); destination.Start = source.ToDateTime("Start"); }
/// <summary> /// Convert XML into an entity using the <see cref="Schema"/> engine. /// </summary> /// <param name="xml">XML to use</param> /// <returns>A converted entity.</returns> protected virtual T GetEntity(string xml) { var sourceEngine = Container.Resolve <IXmlMappingEngine>(Version.ToAsmVersion(Schema)); // NOTE: Should be LinqXPathProcessor but getting weird serialization errors var processor = new XPathProcessor(); processor.Initialize(xml); return(sourceEngine.Map <XPathProcessor, T>(processor)); }
public override void Map(XPathProcessor source, Entity destination) { destination.Id = source.ToString("Id"); destination.Id2 = source.ToString("Id2"); destination.Name = source.ToString("Name"); destination.Name2 = source.ToString("Name2"); destination.Value = source.ToInt("Value", isAttribute: true); destination.Total = source.ToInt("Total"); destination.NullProperties["Total"] = source.IsNull("Total"); }
public override void Map(XPathProcessor source, ScratchEntity destination) { destination.Id = source.ToString("Id"); destination.Id2 = source.ToString("Id2"); destination.Name = source.ToString("Name"); destination.Name2 = source.ToString("Name2"); destination.Value = source.ToInt("Value", isAttribute: true); destination.Date = source.ToDateTime("Date"); destination.DateTime = source.ToDateTime("DateTime"); destination.DateTimeOffset = source.ToDateTimeOffset("DateTimeOffset"); destination.Total = source.ToInt("Total"); }
public virtual void Initialize() { this.ExpectedXml = this.CreateExpectedXml(); this.ExpectedDto = this.CreateExpectedDto(); var locator = new Mock <IServiceLocator>(); var factory = new LocatorXmlMapperFactory(locator.Object); var cache = new CachingXmlMapperFactory(factory); this.MappingEngine = new XmlMappingEngine(cache); this.RegisterChildMappers(this.MappingEngine); this.XPathProcessor = new XPathProcessor(); this.XPathProcessor.Initialize(this.ExpectedXml); this.Mapper = this.CreateMapper(this.MappingEngine); this.MappingEngine.RegisterMapper(this.Mapper); }
public override void Map(XPathProcessor source, Id destination) { destination.System = source.ToString("system", isAttribute: true); destination.Value = source.ToString(CurrentXPath); }
public override void Map(XPathProcessor source, Owner destination) { destination.Name = source.ToString("Name"); destination.Pets = this.Engine.MapList <XPathProcessor, Animal>(source, "Pets", string.Empty, collectionItemNodeNamespacePrefix: this.NamespacePrefix); }
protected virtual XPathProcessor CreateProcessor() { var processor = new XPathProcessor(); return processor; }
public static TDestination Map <TDestination>(this IXmlMappingEngine engine, XPathProcessor xpathProcessor) { return(engine.Map <XPathProcessor, TDestination>(xpathProcessor)); }
/// <summary> /// Uses a <see cref="XPathProcessor" /> to populate an object based on the mapping. /// </summary> /// <param name="processor">XPathProcessor to use</param> /// <param name="value">Object to populate</param> public void FromXml(XPathProcessor processor, object value) { throw new NotImplementedException("Not Implemented"); }
protected virtual XPathProcessor CreateProcessor() { var processor = new XPathProcessor(); return(processor); }
protected virtual XPathProcessor XPathProcessor(string xml) { var processor = new XPathProcessor(); processor.Initialize(xml); return processor; }
public override void Map(XPathProcessor source, Owner destination) { }
public void ProcessXML(object param) { XPathProcessorResult result = XPathProcessor.Process(XMLPathFile, XMLPath); Result = result.Result; }
public override void Map(XPathProcessor source, Owner destination) { destination.Id = this.Engine.Map <Identifier>(source, "Identifier"); destination.Name = source.ToString("Name"); destination.Pets = this.Engine.MapList <XPathProcessor, Animal>(source, "Pets"); }
public override void Map(XPathProcessor source, Animal destination) { destination.Id = source.ToInt("Id2"); destination.Name = source.ToString("Name2"); }
public override void Map(XPathProcessor source, Order destination) { destination.Ids = this.Engine.MapList <Id>(source, "ids"); }
public static TDestination Map <TDestination>(this IXmlMappingEngine engine, XPathProcessor xpathProcessor, string nodeName, string xmlPrefix = "") { return(engine.Map <XPathProcessor, TDestination>(xpathProcessor, nodeName, xmlPrefix: xmlPrefix)); }
public override void Map(XPathProcessor source, Identifier destination) { destination.Scheme = source.ToString("scheme", isAttribute: true); destination.Value = source.ToString(CurrentXPath); }
public static List <TDestination> MapList <TDestination>(this IXmlMappingEngine engine, XPathProcessor xpathProcessor, string collectionNode, string xmlPrefix = "", bool outputDefault = false) { return(engine.MapList <XPathProcessor, TDestination>(xpathProcessor, collectionNode, string.Empty, xmlPrefix, outputDefault: outputDefault)); }