Generating XML using ViewModelAsXML - mdriven

How do I render a XMLdocument containing these xsi adm xmlns tags with corresponding URI, I have tried the NodeName tagged value but without luck... Replace would do it but is there a more robust way?

I myself would use the opendocumentreport logic with a static template that holds xml documents with all namespaces and details:
vCurrent_GoogleFeed2.FeedResult:=vCurrent_GoogleFeed2.opendocumentreportasblob( GoogleFeed.Viewmodels.GoogleFeedReport ).asstring
And my template looks like this:

Related

Partial helper doesn't render partials in .hbs file

I feel like I'm missing something obvious. In working with v0.6.0, the Readme indicates you can use:
{%= partial("partial-name") %}
However, these are just getting printed as plain text. Do I need to use a different engine if I want to have those tags parsed?
Assemble allows using different engines and the example that you have is using lodash with custom delimiters.
To use the default partials helper in handlebars do {{partial "partial-name"}}

jade "include" doesn't work as expected

Referencing another Jade file from within one:
include ../widget
Renders HTML like this:
<include>../widget</include>
Using Scalatra, specifically. What am I doing wrong?
Scalate Jade is different than JavaScript Jade, so the tag isn't the same. You have to reference the filename in full, like so:
- include("../widget.jade")

Django Tag object

Django Tag object has a default function add_tag(), it seems it only allow one word for the tag name, is there anyway to save a tag contains more than one words?
If you are using django-tagging, you can add tags with spaces by either putting quotes around the tag or using commas to separate the tags. It makes sense in the context of adding multiple tags, but I think it works the same for individual tags too.
Note: The following code is untested
Tag.objects.add_tag(obj, '"banana split"')
Tag.objects.add_tag(obj, 'banana split,')

Need to find the tags under a tag in an XML using jQuery

I have this xml as part of the responseXml of an Ajax call:
<banner-ad>
<title><span style="color:#ffff00;"><strong>Title</strong></span></title>
</banner-ad>
When I used this jQuery(responseXml).find("title").text(); the result is "Title".
I also tried jQuery(responseXml).find("title:first-child") but the result is [object Object].
I want to get the result:
<span style="color:#ffff00;"><strong>Title</strong></span>
Please let me know how to do this in jQuery.
Thanks in advance for any help.
Regards,
Racs
Your problem is that you cannot simply append nodes from one document (the XML response) to another (your HTML page). The issue is two-fold:
You can use jQuery to append nodes from the XML document to the HTML page. This works; the nodes appear in the HTML DOM, but they stay XML nodes and therefore the browser ignores the style attribute, for example. Consequently the text will not be yellow (#ffff00).
As far as I can see, jQuery offers no built-in way to get the XML string (i.e. a serialized node) from an XML node. jQuery can handle XML documents quite well, but there is no equivalent to what .html() does in HTML documents.
So to make this work we need to extract the XML string from the XML document. Some browsers support the .xml property on XML nodes (namely, IE), the others come with an XMLSerializer object:
// find the proper XML node
var $title = $(doc).find("title");
// either use .xml or, when unavailable, an XMLSerializer
var html = $title[0].xml || (new XMLSerializer()).serializeToString($title[0]);
// result:
// '<title><span style="color:#ffff00;"><strong>Title</strong></span></title>'
Then we have to feed this HTML string to jQuery so new, real HTML elements can be created from it:
$("#target").append(html);
There is a fiddle to show this in action: http://jsfiddle.net/Tomalak/QWHj8/. This example also gets rid of the superfluous <title> element.
Anyway. If you have a chance to influence the XML itself, it would make sense to change it:
<banner-ad>
<title><span style="color:#ffff00;"><strong>Title</strong></span></title>
</banner-ad>
Just XML-encode the payload of <title> and you can do this in jQuery:
$("#target").append( $(doc).find("title").text() );
This would probably work:
$(responseXml).find("title").html();

Remove HTML entities

I am developing an application for iPhone.I need to remove html entities like ["<p>"] in a parsed xml response.Is there any direct way to remove all such entities.??
How is the data formatted? Are the HTML entities esacaped in the original XML, something like this:
<xml><content type="html"><p>A paragraph.</p></content></xml>
In this case you could just strip the tags with a regular expression.
Otherwise, I would suggest following the DTD of the XML file, and stripping all other tags under the assumption that they don't constitute part of the XML markup.