Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

xml - how to put templates/inheritance in config files? -


i'm working on model variety of categories of objects, each variety of versions. i'd have these available defaults in config file, allow users customize defaults.

this general case like:

<containers>   <container1>     <object1>       <param1>42</param1>       <param2>3.14159</param2>     </object1>     <object2>       <param3>2.71828</param3>       <param4>auto</param4>     </object2>   </container1> </containers> 

i process next block , have resulting object structure identical created previous block.

<templates>   <object1 id="object1_1.0">     <param1>42</param1>     <param2>1</param2>   </object1>   <object2 id="object2_1.0">     <param3>2</param3>     <param4>auto</param4>   </object2> </templates> <containers>   <container1>     <object1 ref="object1_1.0">       <!--param1 "inherited" "42"-->       <param2>3.14159</param2>     </object1>     <object2 ref="object2_1.0">       <param3>2.71828</param3>       <!--param4 "inherited" "auto"-->     </object2>   </container1> </containers> 

that is, able same tree reading in these 2 different input files. expect read in xml , process resulting tree before being able generate object tree.

i've been unable find references being done in other projects--i'm not sure how search it. if you've done this, how did approach it? otherwise, how think would? or have tried , found more complicated it's worth?

you can use xslt like:

<?xml version="1.0" encoding="utf-8"?> 

<xsl:template match="/">     <xsl:apply-templates select="@*|node()"/> </xsl:template>  <!-- process containers --> <xsl:template match="containers">     <xsl:for-each select="child::node()">         <!--copy container node  -->         <xsl:copy>             <xsl:for-each select="child::node()">                 <xsl:copy>                     <!-- first copy template node -->                     <xsl:for-each select="//node()[@id=current()/attribute::ref]/child::node()">                         <xsl:copy>                             <xsl:apply-templates select="@*|node()"/>                         </xsl:copy>                     </xsl:for-each>                     <!--then object nodes -->                     <xsl:apply-templates select="@*|node()"/>                 </xsl:copy>             </xsl:for-each>         </xsl:copy>     </xsl:for-each> </xsl:template>  <!-- =====================================================  recursive copy,  skip templates nodes , ref attributes --> <xsl:template match="@ref"/> <xsl:template match="templates"/> <!-- skip ref attributes --> <xsl:template match="@*|node()">     <xsl:copy>         <xsl:apply-templates select="@*|node()"/>     </xsl:copy> </xsl:template> 

it not perfect, because doesn't remove duplicate params, should doable (or use xslt step).


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -