I have the following XML that I need to be able to pull specific fields from:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<id>Cases</id>
<title type="text">CaseList</title>
<updated>2013-04-04T15:32:56Z</updated>
<author>
<name/>
</author>
<link href="CaseList" rel="self" title="CaseList"/>
<entry>
<id>291</id>
<title type="text">CaseList('291')</title>
<updated>2013-04-04T15:32:56Z</updated>
<category term="S.Cases" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<content type="application/xml">
<m:properties>
<d:case_id>291</d:case_id>
<d:case_title>Global Case</d:case_title>
<d:case_type>Meso</d:case_type>
</m:properties>
</content>
</entry>
<entry>
<id>291</id>
<title type="text">CaseList('292')</title>
<updated>2013-04-04T15:38:56Z</updated>
<category term="S.Cases" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<content type="application/xml">
<m:properties>
<d:case_id>292</d:case_id>
<d:case_title>Global Case 2</d:case_title>
<d:case_type>Meso 2</d:case_type>
</m:properties>
</content>
</entry>
</feed>
I've tried almost everything, but I feel that there is a core XML concept I'm missing that would help me extract nodes such as d:case_id. Is there a simple way of pulling out one or more nodes using Javascript? The other namespace questions don't include a namespace within another namespace... here, the values I'm interested in are behind m:properties.
I have used this
parentNode.getElementsByTagNameNS("*", "name");
and it worked fine for me in chrome and IE10 browser.
Please follow the below link for details:
jQuery XML parsing with namespaces
Related
I'm getting what appears to me to be a strange error when I load my JSP. Spring is a Java framework, so why would I need a mapping for a JavaScript file? The JavaScript in my page is not working.
org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/ghs1986/js/javascript.js] in DispatcherServlet with name 'ghs1986'
For what it's worth, here is my applicationContext.xml.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
<mvc:annotation-driven />
<mvc:resources location="WEB-INF/pages/images/" mapping="/images/**" />
<mvc:view-controller path="/" view-name="home" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".jsp" />
</bean>
This is how I'm trying to access the JavaScript in my JSPs.
<script type="text/javascript" src="js/javascript.js"></script>
And here is my web.xml.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<web-app version="4.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_4_0.xsd">
<display-name>Granada High School Class of 1986</display-name>
<servlet>
<servlet-name>ghs1986</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ghs1986</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>home.jsp</welcome-file>
</welcome-file-list>
</web-app>
In much the same way as you have a mapping to allow the spring controller to know about images with
<mvc:resources location="WEB-INF/pages/images/" mapping="/images/**" />
you need to add a similar mapping to let it know about your javascript files. Something like,
<mvc:resources location="WEB-INF/pages/js/" mapping="/js/**" />
The issue is the same in both cases, the front end controller of Spring doesn't know how to find your js files without that.
So, I have an ASP.NET project, and in Debug mode, I get the following line in my HTML source:
<script src="/Scripts/jquery-2.2.4.js"></script>
However, when I deploy the project, my site has the following line in the source:
<script src="/bundles/jquery?v=Ww-VxqepLI91N7FDR1JXgRvM347mWv5Bv_0D4LsyGEk1"></script>
I assume this has to do with the bundling/minification. This is normal. What is not normal is that even though I'm trying to use jQuery 2.2.4, the bundled/minified jQuery source seems to contain both jQuery 2.2.4 and 3.0.0 (I verified this by opening the page and noticing multiple copies of the same functions, including the version number). As such, my site's JavaScript is failing, saying that Bootstrap requires jQuery >= 1.9.1 and < 3.0.0.
For the life of me, I can't figure out where this additional jQuery file is coming from.
References.js:
/// <autosync enabled="true" />
/// <reference path="bootstrap.min.js" />
/// <reference path="jquery.validate.min.js" />
/// <reference path="jquery.validate.unobtrusive.min.js" />
/// <reference path="jquery-2.2.4.min.js" />
/// <reference path="modernizr-2.8.3.js" />
/// <reference path="respond.matchmedia.addlistener.min.js" />
/// <reference path="respond.min.js" />
NuGet (limited to jQuery results):
jQuery v2.2.4
No dependencies.
jQuery.Validation v1.15.0
jQuery (>= 1.4.4)
Microsoft.jQuery.Unobtrusive.Validation v3.2.3
jQuery (>= 1.8.0)
jQuery.Validation (>= 1.8.0)
packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net46" />
<package id="bootstrap" version="3.3.6.1" targetFramework="net46" />
<package id="EntityFramework" version="6.1.3" targetFramework="net46" />
<package id="jQuery" version="2.2.4" targetFramework="net46" />
<package id="jQuery.Validation" version="1.15.0" targetFramework="net46" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net46" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net46" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net46" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net46" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.1" targetFramework="net46" />
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net46" />
<package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net46" developmentDependency="true" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
<package id="Modernizr" version="2.8.3" targetFramework="net46" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
<package id="Respond" version="1.4.2" targetFramework="net46" />
<package id="WebGrease" version="1.6.0" targetFramework="net46" />
</packages>
As far as I can tell, all of the dependencies are satisfied. I guess it's possible that one of these packages is trying to include jQuery 3.
Any help would be appreciated. I've tried uninstalling and reinstalling jQuery and related libraries a few times. If any other information is necessary, just let me know!
Edit:
The result of disabling bundling is as follows. The HTML page now has:
<script src="/Scripts/modernizr-2.6.2.js"></script>
<script src="/Scripts/modernizr-2.8.3.js"></script>
... and ...
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/jquery-2.2.4.js"></script>
<script src="/Scripts/jquery-3.0.0.js"></script>
Any ideas what is causing this?
I solved the issue by changing my publish settings to:
Remove additional files at destination (probably the real solution)
Precompile during publishing
It's annoying that other files would be included even though the project settings don't really reference them. I guess bundles.Add was including all jquery/modernizr files matching the wildcard/"version" pattern.
I am trying to call firebreath functions from my javascript file.Everything works fine if I call the firebreath functions using an html document with javascript functions and also for firefox version upto 28. For higher versions of firefox on calling the functions through plugin I get an error "TypeError:plugin.echo is not a function" (echo is an inbuilt firebreath function). Find the below code for reference.
overlay.xul
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/"?>
<overlay id="mypluginOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/x-javascript" src="chrome://myplugin/content/ngContent.js"/>
<vbox style="height:0;">
<html:object type="application/x-myplugin" id="myplugin" style="height:0;"></html:object>
</vbox>
</overlay>
ngContent.js
try
{
var plugin = document.getElementById('myplugin');
alert(plugin); // Output for firefox version upto 28 : <JSAPI-Auto Javascript Object>
//Output for firefox higher versions : [object HTMLObjectElement]
plugin.echo("qwerty");
}
catch(ErrorMessage)
{
alert(ErrorMessage);
}
Can anyone help me in this??? Thanks in advance....
EDIT:
Tried html:embed tag instead of html:object in overlay.xul.
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/"?>
<overlay id="mypluginOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/x-javascript" src="chrome://myplugin/content/ngContent.js"/>
<vbox style="height:0;">
<html:embed type="application/x-myplugin" id="myplugin" style="height:0;"></html:embed>
</vbox>
</overlay>
It doesn't work either.
I have embeded other's videos, but how do I do it and bring in all of its likes,comments and views to my page. I want to allow visitors to also make comments and like it from my page without having to go to youtube.
from my experience i don't think you can embed a video with the comments, but you can pull them using youtube api:
//Retrieving comments for a video
//Each video entry contains a <gd:comments> tag, which encapsulates the URL to which you will send API requests to retrieve or append to the list of comments for the video. The sample XML below shows how this URL appears in an API response:
<feed>
<entry>
...
<media:group>
...
</media:group>
<gd:comments>
<gd:feedLink
href='https://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments'/>
</gd:comments>
</entry>
</feed>
//Each comment has an author, a title and content. The following XML shows a sample API //response containing a comments feed:
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
xmlns:batch='http://schemas.google.com/gdata/batch'
xmlns:yt='http://gdata.youtube.com/schemas/2007'
xmlns:gd='http://schemas.google.com/g/2005'
gd:etag='W/"DE8HQXo-eip7ImA9WxRQGU4."'>
<id>tag:youtube,2008:video:ZTUVgYoeN_b:comments</id>
<updated>2008-07-18T22:10:57.065Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://gdata.youtube.com/schemas/2007#comment'/>
<title>Comments on 'My Walk with Mr. Darcy'</title>
<logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>
<link rel='related' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b?v=2'/>
<link rel='alternate' type='text/html'
href='https://www.youtube.com/watch?v=ZTUVgYoeN_b'/>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?v=2'/>
<link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?v=2'/>
<link rel='http://schemas.google.com/g/2005#batch'
type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments/batch?v=2'/>
<link rel='self' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?...'/>
<link rel='service' type='application/atomsvc+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?alt=atom-service&v=2'/>
<link rel='next' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments?...'/>
<author>
<name>YouTube</name>
<uri>http://www.youtube.com/</uri>
</author>
<generator version='2.0'
uri='http://gdata.youtube.com/'>YouTube data API</generator>
<openSearch:totalResults>9051</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>
<entry gd:etag='W/"D0YASX47eCp7ImA9WxRQGU8."'>
<id>tag:youtube,2008:video:xpI6VNvRTII:comment:F53EAC190E4EA5C9</id>
<published>2008-07-18T14:57:59.000-07:00</published>
<updated>2008-07-18T14:57:59.000-07:00</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://gdata.youtube.com/schemas/2007#comment'/>
<title>Walking is fun</title>
<content>I like it a lot.</content>
<link rel='related' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b?v=2'/>
<link rel='alternate' type='text/html'
href='https://www.youtube.com/watch?v=ZTUVgYoeN_b'/>
<link rel='self' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/comments/F53EAC190E4EA5C9?v=2'/>
<author>
<name>GoogleDevelopers</name>
<uri>https://gdata.youtube.com/feeds/api/users/GoogleDevelopers</uri>
</author>
</entry>
<entry>
...
</entry>
...
</feed>
source: https://developers.google.com/youtube/2.0/developers_guide_protocol_comments
I'm trying to develop a simple script that reads the words of a string, and compare with a dictionary .txt, .dic... or an Array Collection of correct words.
The format of my string is like this:
<data>
<value>Exmple</value>
</data>
<data>
<value>Boxx</value>
</data>
<data>
<value>Softvare</value>
</data>
<data>
<value>Adres</value>
</data>
He can only apply the fix on the words that you have within the <value> tag.
What he would have me return should be the same structure with the words corrected. This Form.
<data>
<value>Example</value>
</data>
<data>
<value>Box</value>
</data>
<data>
<value>Software</value>
</data>
<data>
<value>Adress</value>
</data>
I'm trying to get at first this result using some combinations .replace()
My application will run on a system without internet access. So I need to do something that does not require access to any web service, which requires consultation or at some other file linguaguem. So precisso be developing this checker in jquery / javascript PURE!
Is it possible to do this? If yes how can I be doing in my code? Example?
DEMO CODE
$('button').click(function () {
var code = $('textarea[name=message]').val();
if ($('#output').length < 1) {
$("body").append('<h2>Output</h2><textarea id="output" rows="10" cols="100"></textarea>');
}
$('#output').val(code);
});
My English is bad I hope my question has been clear and can be understood by you.