how do i get my rss feed image to show in feedburner? - rss

How do I put image in rss feed to show up in feedburner newsletter..
<item>
<title><![CDATA[TEST ONE TITLE]]></title>
<link>www.example.com/test/title</link>
<source url="http://www.youtube.com/aaaaa"><![CDATA[TEST ONE TITLE]]></source>
<description><img src="http://www.example.com/img1.jpg" style="border: medium none ; display: block;" />TEST ONE DESCRIPTION.</description>
<content:encoded><![CDATA[<img src="http://www.example.com/img1.jpg" /> TEST ONE DESCRIPTION ]]></content:encoded>
<pubDate>Sun, 28 Oct 2010</pubDate>
<author>USER</author>
<category>CategoryOne</category>
<guid>http://www.example.com</guid>
</item>

<item>
<!-- ... -->
<enclosure url="http://www.example.com/img1.jpg" type="image/jpeg" length="[SIZE_IN_BYTES]" />
<!-- ... -->
</item>

Related

How to use XQuery to Update an Attribute in BaseX XML Database?

I am using BaseX to store XML data with multiple item nodes in the following format:
<root>
<item id="Root" parent_id="0" type="folder">
<content>
<name>Root</name>
</content>
</item>
<item id="One" parent_id="Root" type="file">
<content>
<name>First File in the Tree</name>
</content>
</item>
<item id="Two" parent_id="Root" type="file">
<content>
<name>Second File in the Tree</name>
</content>
</item>
</root>
I am trying to update the parent_id on one of the 'item' nodes to another item node's id attribute.
The tree before running the XQuery expression:
Root
∟ First File in the Tree
∟ Second File in the Tree
I am trying to figure out the correct XQuery expression to change the parent of one of the items from root to "one" item, so that my tree now looks like this:
Expected result tree:
Root
∟ First File in the Tree
    ∟ Second File in the Tree
Since the attribute parent_id controls this, I am looking to update exactly that.
If all you want to do is to update the #parent_id attribute, use a simple updating query like
replace value of node //item[#id='Two']/#parent_id with 'One'
But: this wouldn't actually change the XML tree, but only the one you're representing in XML (although I believe that this is what your question was about). A more XML-like approach to store the tree would be directly mapping the tree you want to have to XML:
<root>
<item id="Root" type="folder">
<content>
<name>Root</name>
</content>
<item id="One" type="file">
<content>
<name>First File in the Tree</name>
</content>
<item id="Two" type="file">
<content>
<name>Second File in the Tree</name>
</content>
</item>
</item>
</item>
</root>
Or even more concise, holding the same information:
<folder id="Root" name="Root">
<file id="One" name="First File in the Tree">
<file id="Two" name="Second File in the Tree" />
</file>
</folder>

Mapping related repeating node to a repeating node on BizTalk Mapper

I'm trying to do a map on BizTalk 2013, and I'm blocked at this mapping problem (using mapper):
Input message:
<DetailsResponse>
<HeaderDetails>
<DocumentNumber>322</DocumentNumber>
</HeaderDetails>
<ItemDetails>
<item>
<DocumentNumber>322</DocumentNumber>
<ItemNumber>1</ItemNumber>
<MaterialNumber>40</MaterialNumber>
<Description>random description 1</Description>
</item>
<item>
<DocumentNumber>322</DocumentNumber>
<ItemNumber>2</ItemNumber>
<MaterialNumber>41</MaterialNumber>
<Description>random description 2</Description>
</item>
</ItemDetails>
<ScheduleDetails>
<item>
<DocumentNumber>322</DocumentNumber>
<ItemNumber>1</ItemNumber>
<ConfirmedQuantity>2.000</ConfirmedQuantity>
</item>
<item>
<DocumentNumber>322</DocumentNumber>
<ItemNumber>2</ItemNumber>
<ConfirmedQuantity>3.000</ConfirmedQuantity>
</item>
</ScheduleDetails>
</DetailsResponse>
Intended output message:
<Response>
<Data>
<Items>
<Item>
<LineNumber>
<Internal>1</Internal>
</LineNumber>
<ConfirmedQuantity>
<Value>2</Value>
</ConfirmedQuantity>
<Article>
<Number>40</Number>
<Description>random description 1</Description>
</Article>
</Item>
<Item>
<LineNumber>
<Internal>2</Internal>
</LineNumber>
<ConfirmedQuantity>
<Value>3</Value>
</ConfirmedQuantity>
<Article>
<Number>41</Number>
<Description>random description 2</Description>
</Article>
</Item>
</Items>
</Data>
</Response>
I want to map ItemsDetails and ScheduleDetails to Item, by "merging" their data based on ItemNumber. I already tried a lots of things but wasn't able to do it yet.
I couldn't find any example about this.Does this pattern have any particular name?
If anyone has any idea that they can share, it would be appreciated.
The only way I can think to maybe get this working with Functoids is to link ItemDetails and ScheduleDetails with one or more Looping Functoids and using an Equal Functoid to filter the ScheduleDetails based on the current ItemDetail ItemNumber.
It that doesn't work out, your only other option is custom Xslt. A Call Template would be pretty straight forward.
If you convert your map to vanilla XSLT, then the mapping becomes straightforward :
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="itemSchedules"
match="/DetailsResponse/ScheduleDetails/item"
use="concat(DocumentNumber,'-',ItemNumber)" />
<xsl:template match="/DetailsResponse">
<Response>
<Data>
<Items>
<xsl:apply-templates select="ItemDetails/item" />
</Items>
</Data>
</Response>
</xsl:template>
<xsl:template match="item">
<Item>
<LineNumber>
<Internal>
<xsl:value-of select="ItemNumber"/>
</Internal>
</LineNumber>
<ConfirmedQuantity>
<Value>
<xsl:value-of select="format-number(key('itemSchedules',
concat(DocumentNumber,'-',ItemNumber))/ConfirmedQuantity,0)" />
</Value>
</ConfirmedQuantity>
<Article>
<Number>
<xsl:value-of select="MaterialNumber"/>
</Number>
<Description>
<xsl:value-of select="Description"/>
</Description>
</Article>
</Item>
</xsl:template>
</xsl:stylesheet>
The xsl:key retains an index of references to the schedule details 'part' of the puzzle, and we create a catenated key of DocumentNumber and ItemNumber.

How to move a portlet into content's #content area?

I would like to modify the content on the fly so I can later feed the modified version into my theme's content slot. The usecase is positioning the calendar portlet inside a collective.cover row/column/cell.
Here's what I tried:
<replace css:content="#content .row:nth-child(2) .cell:nth-child(2) .tile.tile-edge">
<!-- These work (meaning levels above current selection CAN be copied) -->
<xsl:copy-of select="." />
<xsl:copy-of select="../.." />
<xsl:copy-of select="/" />
<!-- However, neither of these do -->
<xsl:copy-of css:select=".portletCalendar:first-child" />
<xsl:copy-of select="//div[contains(concat(' ', normalize-space(#class), ' '), ' portletCalendar ')]" />
<xsl:copy-of select="//div[#id='portal-personaltools']" />
</replace>
It may be that the only problem you were having was relying on Diazo's facility for translating css selectors in XSL commands. It only works if the target is the currently selected node or a child of it. So, replace it with an XPath selector:
<!-- replace one part of content with another -->
<replace css:content="#content .row:nth-child(2) .cell:nth-child(2) .tile.tile-edge">
<xsl:copy-of select="//dl[#class='portlet portletCalendar']" />
<xsl:apply-templates mode="raw" />
</replace>
<!-- make sure it doesn't show up in two places -->
<drop content="//dl[#class='portlet portletCalendar']" />

Create web form from xml in asp.net mvc

I am assigned to web part of some project.There are two parts in this project,
window and web.In window part,User can create their own customized template
like visual studio IDE,you can addform and other controls.And then,we save this template
with data in xml file.My duty isto read from this xml file and create webform.
For web part,just showing information that createdfrom window part.
our xml file format is like below.For web part,we developed in c#.net with asp.net mvc.
<Object type="System.Windows.Forms.Form">
<Object type="System.Windows.Forms.Label">
<Property name="Name">lblCity</Property>
<Property name="Text">City</Property>
</Object>
<Object type="System.Windows.Forms.TextBox">
<Property name="Name">txtCity</Property>
<Property name="Text">England</Property>
</Object>
<Object type="System.Windows.Forms.Label">
<Property name="Name">lblNRIC</Property>
<Property name="Text">NRIC</Property>
</Object>
<Object type="System.Windows.Forms.TextBox">
<Property name="Name">txtNRIC</Property>
<Property name="Text">ABC01234</Property>
</Object>
<Object type="System.Windows.Forms.RadioButton">
<Property name="Name">RadioButton1</Property>
<Property name="Text">OptionA</Property>
</Object>
<Object type="System.Windows.Forms.CheckBox">
<Property name="Name">CheckBox1</Property>
<Property name="Text">Yes</Property>
</Object>
<Object type="System.Windows.Forms.CheckBox">
<Property name="Name">CheckBox2</Property>
<Property name="Text">No</Property>
</Object>
<SampleDataSet>
<SampleTable>
<TableName>Sample1</TableName>
<ProductName>ABC</ProductName>
<Price>100</Price>
<Qty>10</Qty>
<Amount>1000</Amount>
</SampleTable>
<SampleTable>
<TableName>Sample2</TableName>
<ProductName>DEF</ProductName>
<Price>200</Price>
<Qty>20</Qty>
<Amount>4000</Amount>
</SampleTable>
<SampleTable>
<TableName>Sample3</TableName>
<ProductName>GHK</ProductName>
<Price>300</Price>
<Qty>30</Qty>
<Amount>9000</Amount>
</SampleTable>
</SampleDataSet>
</Object>
We know it should not be create web form like window part,but,we really need it.
So,how i solve my problem?can i use xml serilization?
please give me right ways with some examples.
Regards
Han
You could use XSLT to transform this XML to XHTML. Also, you could inherit your own XMLBasedFormResult from MVC ActionResult class and generate form HTML at ExecuteResult method using C# (e.g. with LinqToXML).
Well, don't you think you will really end up duplicating what visual studio does..?
I would suggest you use something like WPF, which can be shown in the browser as well as in the Windows app. I am telling from experience this idea of parsing xml and generating UI is not very good..it is almost like writing a jsp/asp engine.
Also i noticed that the xml you have there has no formatting information, location on screen, color, style, font etc..
How do you intend on populating text boxes, dropdown lists, menus etc..?
As mace said XSLT is a good solution.
This is the xls stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Template for <Object type="System.Windows.Forms.Form -->
<xsl:template match="*[#type = 'System.Windows.Forms.Form']">
<!-- Here's the html's form tag -->
<form>
<fieldset>
<xsl:apply-templates />
</fieldset>
</form>
</xsl:template>
<!-- Template for <Object type="System.Windows.Forms.Label -->
<xsl:template match="*[#type = 'System.Windows.Forms.Label']">
<!-- Here's the html's label tag -->
<label><xsl:value-of select="." /></label>
</xsl:template>
<!-- Template for <Object type="System.Windows.Forms.TextBox -->
<xsl:template match="*[#type = 'System.Windows.Forms.TextBox']">
<!-- Create the html's input tag -->
<xsl:element name="input">
<!-- And set the attributes -->
<xsl:attribute name="name">
<xsl:value-of select="./Property[#name ='Name']" />
</xsl:attribute>
<xsl:attribute name="type">text</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="./Property[#name ='Text']" />
</xsl:attribute>
</xsl:element>
</xsl:template>
<!-- Add here templates for RadioButton, Checkbox ... -->
</xsl:stylesheet>
You can read this Tutorial to get basic skills of xls.
You can run this xsl transformation now in C#:
//load the Xml doc
XPathDocument myXPathDoc = new XPathDocument(sXmlPath) ;
XslTransform myXslTrans = new XslTransform() ;
//load the Xsl
myXslTrans.Load(sXslPath) ;
//create the output stream
XmlTextWriter myWriter = new XmlTextWriter
("result.html", null);
//do the actual transform of Xml
myXslTrans.Transform(myXPathDoc,null, myWriter);
myWriter.Close() ;
You have to modify that for your scenario. Look at the MSDN for information about the XslTransform-class etc.

asp.net xpath: select only certain attributes

I have a GridView populated from an xml file, which has the following structure:
<menu>
<item id="1" name="home" page="default.aspx">
*{...some stuff...}*
<item>
<item id="2" name="content" page="content.aspx">
*{...some stuff...}*
<item>
<item id="3" name="user" page="user.aspx">
*{...some stuff...}*
<item>
<menu>
As you can reckon, it's the menu of my application.
If i just associate that file to an xmldatasource and then to a GridView, it shows (correctly) a grid like this:
id name page
1 home default.aspx
2 content content.aspx
3 user user.aspx3 user user.aspx
How do I set the xPath query to only show name attribute/field?
I've tried those:
menu/item#name
menu/#name
//#name
but didn't work
I have a GridView populated from an
xml file, which has the following
structure:
<menu>
<item id="1" name="home" page="default.aspx">
*{...some stuff...}*
<item>
<item id="2" name="content" page="content.aspx">
*{...some stuff...}*
<item>
<item id="3" name="user" page="user.aspx">
*{...some stuff...}*
<item>
<menu>
This is not a well-formed XML file -- an ending tag must have the sintax </tag> and there are no ending tags at all in the above text.
How do I set the xPath query to only
show name attribute/field?
I've tried those:
menu/item#name
menu/#name
//#name
is syntactically invalid: location steps must start with the / character and there is no / character between item and #name.
is syntactically valid but is asking to select all name attributes of all menu elements that are children of the current node. Unfortunately, menu has no name attributes.
should select nodes, but given the text above isn't at all a well-formed XML document, this explains the negative result. Also, this selects all name attributes in the whole document, regardles on which element they are -- this is not exactly what you want, regardless of the fact that on a wellformed document of this type this might select the nodes you want.
Solution:
Step1: Correct your XML document:
<menu>
<item id="1" name="home" page="default.aspx">
*{...some stuff...}*
</item>
<item id="2" name="content" page="content.aspx">
*{...some stuff...}*
</item>
<item id="3" name="user" page="user.aspx">
*{...some stuff...}*
</item>
</menu>
Step2: Use one of the following XPath expressions (there are even more that would select the wanted nodes):
/menu/item/#name
or
/*/item/#name
or
/*/*/#name
or
//#name

Resources