I have <form data-v-4db188a6=""> tag.
I need find only form tag contains 'data' in the attribute name not attribute value!
.//form[contains(#prop, 'data')] not work.
Is it even possible?
Yes, this is possible:
//form[attribute::*[contains(local-name(), 'data')]]
Short xpath expression:
//form/#*[contains(name(), 'data')]
Related
I have in my JSP page code like this:
<spring:url value="" var="url"/>
EN
And issue is that parameter url in link is always set to empty String.I would expect that if I type url like localhost:8080/test the url variable will hold this value and it will be replaced in link so it would look like /change_locale?locale=EN¤t=test. However it is always generated like /change_locale?locale=EN¤t=.What I am doing wrong? Best regards
In
<spring:url value="" var="url"/>
Your value value is the empty String. Because of this, the URL is relative.
Spring uses UrlTag to construct the value from a <url> tag. You'll want to take a look at its createUrl method in the source code if you're curious.
In this case, it will generate a value that is the empty String and store it in a page scope attribute named url. That's what you get when rendering
${url}
I want get a url form html page with xpath .
i used the //*[#id="main"]/table/tr[2]/td[3]/a/#href
its return url like this /nevesta/yulia
i want add Base URI to url like this http//mydomain.ru/nevesta/yulia
after searching i found out , resolve-uri do that , but Unfortunately i can't find any example for this.
concat(base-uri(.), data(//*[#id="main"]/table/tr[2]/td[3]/a/#href))
It returns the Base URI of the document/node as defined in XML Base. There are some examples for using it on XQueryFunctions.com. Quoting from the linked page above:
If $arg is an element, the function returns the value of its xml:base attribute, if any, or the xml:base attribute of its nearest ancestor. If no xml:base attributes appear among its ancestors, it defaults to the base URI of the document node.
In other words: this function returns a sequence of base URIs of the nearest ancestor; if there isn't defined any, the one of the document (which you seem to be after).
But please be aware that this is an XPath 2.0 only function (and thus also XQuery, if course) and not available in XPath 1.0!
At this link:
http://www.mkyong.com/struts/struts-logic-iterate-example/
example #2:
they show usage of struts tag to iterate over a List listUsers . But the example shows the List set as an attribute in the request directly. Is it possible to use this tag if the List is an attribute in the corresponding form bean? using the syntax at the link, I get (expectedly):
Cannot find bean: "listUsers" in any scope
If the list is set to the form you need to have following syntax in the iterate tag
<logic:iterate id="myid" name="<nameofform>" property="<listname>">
<bean:write name="myid" />
</logic:iterate>
Form name is the name defines in struts-config.xml.
I'm using DomDocument to query for html elements.
when i use $obj->textContent or $obj->nodeValue it returns only the texts that include in the element, it does not return the html representation of the object.
which means..
if the object contains
<div>test</div>
the return value for both tries will be test.
how do i fetch the html elements as well?
I know that there are other solutions for this besides domDocument like DomHTMlDocument and others but i'd prefer to work a solution with DomDocument.
thanks!
Have you tried a solution such as http://refactormycode.com/codes/708-innerhtml-of-a-domelement ?
I'm trying to add the jQuery Validation plugin to some websites and I'm running into a bit of an issue in that the fields that it's supposed to validate have a prefix on the name property, such as "Customer.FirstName".
Since you have to pass a JSON object to the validate function for the rules, it doesn't work because it never finds the elements.
Is there a way to do per field basis, or can I still pass in a variant of the JSON object that specifies the field id as a string, such as "#Customer\.FirstName"?
Thanks in advance!
EDIT:
Per Greg's suggestions, I got it to work. So for anyone who has issues like these, you have to do it like this:
$("form").validate({
rules: {
"Prefix.FieldName": "validationKeyword"
}
});
DO NOT add the "#" to the selector, and DO NOT add the "\\" escape chars to the selector. So, "#Prefix\\.FieldName" will not match anything, so just leave those chars out.
JSON supports keys with "." in them - just quote them:
var obj = {"#Customer.FirstName": "value"};
In fact to be proper JSON they should always be double-quoted.
Edit: if this is a selector then you can escape the . like this: "#Customer\\.FirstName"
Edit2: The docs say the key needs to be a name so I it should either be "Customer.Firstname" or "Customer\.Firstname" depending on how well-coded the plugin is. You'll need <input name="Customer.Firstname" ...>.