Created
December 10, 2012 17:05
-
-
Save emersoncortez/4251870 to your computer and use it in GitHub Desktop.
Ejemplo de jQuery.parseXML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// La cadena XML | |
var cadenaXML = '<libro><titulo>XML y jQuery</titulo><autor>Carlos Linares</autor><editorial>La Ceiba</editorial></libro>'; | |
// Transformando la cadena XML en un objeto jQuery. | |
var obj = $.parseXML(cadenaXML); | |
$xml = $(obj); | |
// Una vez creado el objeto, este puede ser manipulado | |
// Extrayendo el título del libro y el autor | |
alert($xml.find('titulo').text()); | |
alert($xml.find('autor').text()); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment