attributes

xquery function to convert tag elements to attributes

Hello, I need to write a function that takes a sequence of "tag" elements of the form: <tag type="markupType" value="topic"/> <tag type="concept" value="death"/> ... and turns them into attributes of the form data-markupType="topic" data-concept="death" So far I have the following function: declare function local:tagsToAttrs($ta...

JQuery going through a set of UL and dynamically set ids incremently on each one

I have an unordered list which contains serveral items called 'oListItems' the UL has a class but no id. The class OuteroListItems contains many of oListitems oList.AppendFormat("<ul class='OuteroListItems'>"); oList.AppendFormat("<li>"); oList.AppendFormat("<ul class='oListItems'>"); oList.Appen...

Why can one null return be tested but another throws an exception?

I want to test if an xml attribute is present. Given this: XmlAttributeCollection PG_attrColl = SomeNodeorAnother.Attributes; This first test works: if (null != PG_attrColl["SomeAttribute"]) "GetNamedItem" is supposed to return null, but the following test throws an exception complaining about the null it returns. if (null != P...

Get the Description Attributes At Class Level

I have such a class [Description("This is a wahala class")] public class Wahala { } Is there anyway to get the content of the Description attribute for the Wahala class? ...

Why doesn't jquery validation plugin's remote attribute work for me?

I use jquery validation plugin and the remote attribute works with emailId but not with mobileNo? var validator = $("#addform").validate({ rules: { Name: "required", MobileNo: { required: true, minlength: 10, remote: '<%=Url.Action("getClientMobNo", "Clients") %>' }, A...

In XSLT, how can you sort using an indirect key?

I am having trouble getting xsl:sort to understand the scope of the attributes I am referencing. Here is an XML sample document to illustrate: <Root> <DrinkSelections> <Drink id=1000 name="Coffee"/> <Drink id=1001 name="Water"/> <Drink id=1002 name="Tea"/> <Drink id=1003 name="Almost But Not Quite Entirely Unlike Tea"/...

Set context property in jaxws request

Hey, I would like to set context attribute for every webservice made by my application. I tried this went I create the port: ((BindingProvider) port).getRequestContext().put("SomeInfo", someInfo); And to retrieve on webservice: HttpServletRequest request = (HttpServletRequest) getMessageContext().get(MessageContext.SERVLET_REQUEST);...

Is restricting attributes to class or properties doable?

I have two custom attributes defined like so: internal class SchemaAttribute : Attribute { internal SchemaAttribute(string schema) { Schema = schema; } internal string Schema { get; private set; } } internal class AttributeAttribute : Attribute { internal AttributeAttribute(string attribute) { Attribute...

Replace an element name while retaining the attributes with jquery

I'm trying to create a jquery setup where all instances of <i> are changed to <em>. It's easy enough to do with: $("i").each(function(){ $(this).replaceWith($('<em>' + this.innerHTML + '</em>')); }); But what I am having trouble figuring out is how to change all the <i> tags but retain each ones individual attributes. So if I have...

Scala xhtml attribute breaks because of a question mark

I had a problem with: <iframe id="iframe1" src='http://stockcharts.com/h-sc/ui?s=MT&amp;p=D&amp;yr=2&amp;mn=0&amp;dy=0&amp;id=p43321191731' width="300px" height="300px"></iframe> in Lift web framework (Scala) version. I get: Message: java.util.NoSuchElementException scala.RandomAccessSeq$$anon$13.next(RandomAccessSeq.scala:165) sca...

c# xml function to check whether a string is equal to a xml attribute, to add selected combobox item to textbox

i want to check the combobox.selecteditem.tostring() on combobox select in a given xml with several nodes, where each one has an attribute called "name" private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { textBox1.AppendText(nameAttributeCheck(comboBox1.SelectedItem.ToString())); } cat...

How to conditionally execute a jquery validation?

I am validating form using jquery validation plugin...... rules: { Name: "required", MobileNo: { required: true, minlength: 10, remote: '<%=Url.Action("getClientMobNo", "Clients") %>' }, Address: "required" }, messages: { Name: "please provide a client name", ...

Formatting the parent and child nodes of a Treeview that is populated by a XML file

Hello Everyone, I'm very new to xml so I hope I'm not asking any silly question here. I'm currently working on populating a treeview from an XML file that is not hierarchically structured. In the xml file that I was given the child and parent nodes are defined within the attributes of the item element. How would I be able to utilize the...

How can I require an attribute on a class definition?

Is there a way to enforce a compile requirement for certain attributes on a class or interface implementation? For example, let's say my application uses a series of static classes that contain const int resource values. I'd like to decorate the class in a Description attribute to describe its contents. In concept, I'd like to apply t...

Change <body id="grid"> to <body class="list"> with jQuery..

I know how to change an id: $("body").attr('id', 'list'); But now I want to change the attribute itself; instead of id='grid' I want to have class='list' For example, this: <body id="grid"> Should turn to: <body class="list"> ...

Django models & Python class attributes

The tutorial on the django website shows this code for the models: from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class Choice(models.Model): poll = models.ForeignKey(Poll) choice = models.CharField(max_length=200) ...

How can I internationalize strings representing C# enum values?

I've seen many questions and answers about mapping strings to enums and vice-versa, but how can I map a series of localized strings to enums? Should I just create an extension method like this that returns the proper string from a resource file? Is there a way to localize attributes (like "Description") that are used in solutions like ...

get an id of child element and store in a variable using jquery?

I'm basically trying to do exactly what the subject suggests, but I'm getting "undefined" in my alert, and I'm not entirely sure why. I am fairly new to jquery, so, I probably have the syntax wrong, but not sure where to go from here. I'll post both of my attempts, which both yield "undefined" in the alert... //In my first attempt, I...

Can you step into specific properties in VS 2010?

I know that you can either step into every property or not step into every property, but I would really like to be able to step into a specific property, and not the rest. Is this possible? (I also know I can use keyboard commands, but I'm asking if there's a more permanent solution.) I have a lot of properties and my setters do importan...

how to assign to the names() attribute of the value of a variable in R

In R, "assign('x',v)" sets the object whose name is 'x' to v. Replace 'x' by the result of applying a text function to a variable x. Then "assign" shows its worth. Unfortunately, "assign(paste('names(','x',')',sep=''),v)" fails. So if 'x' is a variable x, I can set its value, but I can't give it names for its elements. Can one work ...