I have the following schema in which i have to find each element name listed.
> <?xml version='1.0' encoding='UTF-8' ?> <xs:schema
> xmlns:xs='http://www.w3.org/2001/XMLSchema'>
>
>
> <xs:sequence> <xs:element name='name' type='xs:string'/> <xs:element
> name='address' type='xs:string'/> <xs:element name='city'
> type='xs:string'/> <xs:element name='country' type='xs:string'/>
> </xs:sequence>
>
> </xs:schema>
- Name
- Street
- city
- state
- country
I tried with this code:
var app = angular.module('httpApp', []);
app.controller('httpController', function ($scope, $http) {
var xmlm="<?xml version='1.0' encoding='UTF-8' ?><xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:sequence><xs:element name='name' type='xs:string'/><xs:element name='address' type='xs:string'/><xs:element name='city' type='xs:string'/><xs:element name='country' type='xs:string'/></xs:sequence></xs:schema>";
//var x2js = new X2JS();
$scope.data=xmlm;
//var aftCnv = x2js.xml_str2json(xmlm);
//$scope.jsonic=aftCnv;
xmlDoc = $.parseXML( xmlm ),
$xml = $( xmlDoc ),
$name = $xml.find( "xs:sequence" );
$scope.data=$name.text();
$( "#1" ).append( $name.text() );
I get neither errors on the console or the output. The Page is empty.