3

I am able to read xml name, description, details whether it is mandatory or multivalue using core service factory java.

I am not able to read xml type. There is no method called 'Gettype'.
Could anyone please tell me how to retrieve xml type?

Thanks in advance!

My code goes like this.

ICoreService oClient = CoreServiceFactory.getBasicHttpClient();
SchemaFieldsData schemaData = oClient.readSchemaFields(str, true, null); 
ArrayOfItemFieldDefinitionData design=schemaData.getFields(); 
List<ItemFieldDefinitionData> design_item = design.getItemFieldDefinitionData();
for(ItemFieldDefinitionData loopVariable : design_item)
    {         
     String xmlName=loopVariable.getName();               
     String description=loopVariable.getDescription();                
     String multiValue=(loopVariable.getMaxOccurs()==1) ? "No" : "Yes";               
     String mandatory=(loopVariable.getMinOccurs()==1) ? "Yes" : "No";     
    }
3

If you mean how to determine the field type: it is reflected in the type of your loopVariable (which is a pretty lousy name for a variable, BTW :-)

Note that ItemFieldDefinitionData Is an abstract base class. The actual instances will be of a concrete subtype which reflects the field type.

  • Thanks for an idea. Yeah, ItemFieldDefinitionData is a root class. String xmlClass=loopVariable.getClass().getSimpleName(); From this, I am able to get sub class names like EmbeddedSchemaFieldDefinitionData, MultimediaLinkFieldDefinitionData etc . which gives my answer. – Bhavya Feb 19 '16 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.