Getting attribute using XPath

How could I get the value of lang (where lang=eng in book title), for the first element? Use: /*/book[1]/title/@lang This means: Select the lang attribute of the title element that is a child of the first book child of the top element of the XML document. To get just the string value of this attribute … Read more

XSLT not working in web browser

Running XSLT in a Web Browser Running XSLT in the browser is subject to some limitations: XSLT 2.0 is not supported by any of the major web browsers. Browser security models differ regarding XSLT processing. Cross-domain restrictions will often require that the XSLT load from the same origin as the the XML. (This appears to … Read more

Must an XML namespace name URI be retrievable?

Namespaces are URIs that need not be retrievable From @jww question: The question is whether the namespace end-point(=”http://xxxxx/ws”) needs to be a valid url? No, an XML namespace takes the lexical form of a URI but does not have to be retrievable according to W3C Recommendation: Namespaces in XML 1.0 (Third Edition): The attribute’s normalized … Read more

xmllint failing to properly query with xpath

I don’t use xmllint, but I think the reason your XPath isn’t working is because your doc.xml file is using a default namespace (http://purl.org/net/ulf/ns/0.4-02). From what I can see, you have 2 options. A. Use xmllint in shell mode and declare the namespace with a prefix. You can then use that prefix in your XPath. … Read more

JSON and XML comparison [closed]

Faster is not an attribute of JSON or XML or a result that a comparison between those would yield. If any, then it is an attribute of the parsers or the bandwidth with which you transmit the data. Here is (the beginning of) a list of advantages and disadvantages of JSON and XML: JSON Pro: … Read more

frequent issues arising in android view, Error parsing XML: unbound prefix

A couple of reasons that this can happen: 1) You see this error with an incorrect namespace, or a typo in the attribute. Like ‘xmlns’ is wrong, it should be xmlns:android 2) First node needs to contain: xmlns:android=”http://schemas.android.com/apk/res/android” 3) If you are integrating AdMob, check custom parameters like ads:adSize, you need xmlns:ads=”http://schemas.android.com/apk/lib/com.google.ads” 4) If you … Read more

Current node vs. Context node in XSLT/XPath?

The current node is whatever the template is currently operating on. Normally this happens to also be the context node, but the context node has special meaning within a nested XPath expression (the part in square brackets). There, it refers to whatever node is currently being tested for a match. Hence, the context node changes … Read more