I'm attempting to adapt this particular example to utilize xml as json data. However, I am encountering some issues with the code.
courses = x2js.xml_str2json(data);
console.log(courses.books.course);
$scope.todos = courses.books.course;
In the XML of the example, there are 'books' and 'course' tags. But I am unsure where 'courses' is coming from.
I am trying to replicate this example using the following XML:
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<DocumentElement xmlns="">
<semt_kodlari diffgr:id="semt_kodlari1" msdata:rowOrder="0">
<semt_adi>ALTIKAT</semt_adi>
</semt_kodlari>
</DocumentElement>
</diffgr:diffgram>
Here is my HTML snippet:
X = x2js.xml_str2json(data);
console.log(X.DocumentElement.semt_kodlari);
$scope.todos = X.DocumentElement.semt_kodlari;
Upon running this code, I encounter a "Cannot read property 'semt_kodlari' of undefined" error. Could someone please point out what may be wrong in my code and clarify the distinction between 'course' and 'course's'?