I have probably found the solution but it may give some weird results that needs parsing.
For the soql query:
SELECT Account_Description__c, Account_Type__c, CreatedById, CreatedDate, IsDeleted, Email_Notifications_BCC__c, Email_Notifications_CC__c, LastModifiedById, LastModifiedDate, OwnerId, Password__c, Id, Name, Security_Token__c, SystemModstamp, sfdc_Token__c, (SELECT Access_Database__c, Access_Database__r.Name, Access_Database__r.ID, Salesforce_User_Instance__c, Salesforce_User_Instance__r.Name FROM Salesforce_Instance_With_DataBases__r) FROM sfdcInformation__c
Executing the following:
sfdc.getChild("Salesforce_Instance_With_DataBases__r");
where sfdc is the SObject reference.
will result into something like:
XmlObject{name={urn:sobject.partner.soap.sforce.com}Salesforce_Instance_With_DataBases__r, value=null,
children=[
XmlObject{name={urn:partner.soap.sforce.com}done, value=true, children=[]},
XmlObject{name={urn:partner.soap.sforce.com}queryLocator, value=null, children=[]},
XmlObject{name={urn:partner.soap.sforce.com}records, value=null,
children=[
XmlObject{name={urn:sobject.partner.soap.sforce.com}type, value=Salesforce_Instance_With_DataBase__c, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Id, value=null,children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Access_Database__c, value=a05G00010092CvK, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Access_Database__r, value=null,
children=[
XmlObject{name={urn:sobject.partner.soap.sforce.com}type, value=AccessDBs__c, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Id, value=a05G00021092CvK, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Name, value=D:\DATA\DPPI\DATA\DPPI\DPPIPR01, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Id, value=a05G00020092DvK, children=[]}
]
},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Salesforce_User_Instance__c, value=a00G020002MEnauIAD, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Salesforce_User_Instance__r, value=null,
children=[
XmlObject{name={urn:sobject.partner.soap.sforce.com}type, value=sfdcInformation__c, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Id, value=null, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Name, [email protected], children=[]}
]
}
]
},
XmlObject{name={urn:partner.soap.sforce.com}records, value=null,
children=[
XmlObject{name={urn:sobject.partner.soap.sforce.com}type, value=Salesforce_Instance_With_DataBase__c, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Id, value=null, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Access_Database__c, value=a05G0100009283sIAA, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Access_Database__r, value=null,
children=[
XmlObject{name={urn:sobject.partner.soap.sforce.com}type, value=AccessDBs__c, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Id, value=a05G0000003283sIAA, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Name, value=D:\DATA\6011\DATA\6011\6011PR01, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Id, value=a05G0000019283sIAA, children=[]}
]
},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Salesforce_User_Instance__c, value=a00G000030MEnauIAD, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Salesforce_User_Instance__r, value=null,
children=[
XmlObject{name={urn:sobject.partner.soap.sforce.com}type, value=sfdcInformation__c, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Id, value=null, children=[]},
XmlObject{name={urn:sobject.partner.soap.sforce.com}Name, [email protected], children=[]}
]
}
]
},
XmlObject{name={urn:partner.soap.sforce.com}size, value=2, children=[]}
]
}
We need to parse this to get the child records accordingly with the help of XmlObject reference returned having the methods like:
- getChildren():
Iterator<XmlObject> SObject
- getName():
QName XmlObject
And I think we need to parse these token based response using next()
and hasNext()
.
Please let me know if I'm proceeding in the right way or there is any other solution?
EDIT
If it is the only way around. How can we make sure for different object structures some general scenario is possible.
PS: In this case the records of the Junction Object with relationship name Salesforce_Instance_With_DataBases__r
is queried.
'
?