Click here to Skip to main content
15,903,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have set of class and in every class it's filed ... each filed in tag (TemplateField name=””) and it's type in tag (TemplateFieldType pureName="") like this :
XML
<pre lang="xml">-<class>
      -<TemplateDef  title="false" alias="Employee">
          -<fields relType="0">
               -<TemplateField  name="perso"  inherited="false" description="" >
                      -<fieldType   number="2">
                           <TemplateFieldType  pureName="String" dis="" />
                     </fieldType>
                </TemplateField>
          </fields>
-</class>


I need when I read this file to get for each class it's fildes and for every fileds it's type like this :

Employee

String perso

I have a lot of class and a lot of own fileds ... But I here put an example ... I knew I can get the name of class by code :
JavaScript
function myFunction(xml) {
    var x, i, xmlDoc, txt;
    xmlDoc = xml.responseXML;
    txt = "";
    x = xmlDoc.getElementsByTagName('TemplateDef');
    for (i = 0; i < x.length; i++) { 
        txt += x[i].getAttribute('alias') + "<br>";
    }


in my code I get the name of my class ... But How I can to get it's fileds ... I did not knew How to get the fileds and it's type from the xml file above ?

there are any method to get them by name of class (for example "perso") any help?

What I have tried:

My code above ... But I need to help ...any help ?
Posted
Updated 27-Sep-16 15:39pm
v3

1 solution

x.childNodes[...]

Example XML DOM getElementsByTagName() Method[^]
 
Share this answer
 
Comments
Member 12702368 28-Sep-16 3:47am    
Thank you so much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900