• melmoussaoui
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hello, I'm searching for a way to execute a string as a query

i have a method who return the string which contains the query and i want to execute it and return the values and the fields names?


thanks in advance!!

Hello, I'm new to apex and salesforce world and I'm trying to create an XML file using Xmlstreamwriter which should look like this :

 

<?XML version="1.0" encoding="utf-8"?>
<SERVICE version="1.0">
	<CLIENT email="xx.xx@xx.xx">
		<BASIC_FIELDS id="1">
			<ADDRESS_LINE_1 id="2" >24 rue de rocher</ADDRESS_LINE_1>
			<CITY id="3" >Paris</CITY>
                 </BASIC_FIELDS>
        </CLIENT>
</SERVICE>

 

 

but when I try this code :

 

 public String getxmlRes()
        {
        Xmlstreamwriter xmlW = new Xmlstreamwriter();
        xmlW.writeStartDocument('utf-8','1.0');
        xmlW.writeStartElement('SERVICE', 'version', '"1.0"');    
        xmlW.writeStartElement(null,'CLIENT email= xxx@xx.com',null);
        xmlW.writeStartElement(null,'BASIC_FIELDS id="1"',null);
        xmlW.writeAttribute(null, null, 'ADRESS_LINE id="2"', '24 rue de rocher');
        xmlW.writeAttribute(null, null,'CITY id="3"', 'Paris');
        xmlW.writeEndElement();
        xmlW.writeEndElement(); 
        xmlW.writeEndElement();
        xmlW.writeEndDocument();
        String xmlStringxmlRes = xmlW.getXmlString();
        System.debug('The XML :'+xmlW.getXmlString());     
        xmlW.close();
        return xmlStringxmlRes;
}

 

instead I get this :

 

<?xml version="1.0" encoding="utf-8"?>
<SERVICE:version>
<CLIENT email= xxx@xx.com>
<BASIC_FIELDS id="1" ADRESS_LINE id="2"="24 rue de rocher" CITY id="3"="Paris">
</BASIC_FIELDS id="1">
</CLIENT email= xxx@xx.com>
</SERVICE:version>

i hope someone could help me!

thanks

 

Hello, I'm searching for a way to execute a string as a query

i have a method who return the string which contains the query and i want to execute it and return the values and the fields names?


thanks in advance!!

Hello, I'm new to apex and salesforce world and I'm trying to create an XML file using Xmlstreamwriter which should look like this :

 

<?XML version="1.0" encoding="utf-8"?>
<SERVICE version="1.0">
	<CLIENT email="xx.xx@xx.xx">
		<BASIC_FIELDS id="1">
			<ADDRESS_LINE_1 id="2" >24 rue de rocher</ADDRESS_LINE_1>
			<CITY id="3" >Paris</CITY>
                 </BASIC_FIELDS>
        </CLIENT>
</SERVICE>

 

 

but when I try this code :

 

 public String getxmlRes()
        {
        Xmlstreamwriter xmlW = new Xmlstreamwriter();
        xmlW.writeStartDocument('utf-8','1.0');
        xmlW.writeStartElement('SERVICE', 'version', '"1.0"');    
        xmlW.writeStartElement(null,'CLIENT email= xxx@xx.com',null);
        xmlW.writeStartElement(null,'BASIC_FIELDS id="1"',null);
        xmlW.writeAttribute(null, null, 'ADRESS_LINE id="2"', '24 rue de rocher');
        xmlW.writeAttribute(null, null,'CITY id="3"', 'Paris');
        xmlW.writeEndElement();
        xmlW.writeEndElement(); 
        xmlW.writeEndElement();
        xmlW.writeEndDocument();
        String xmlStringxmlRes = xmlW.getXmlString();
        System.debug('The XML :'+xmlW.getXmlString());     
        xmlW.close();
        return xmlStringxmlRes;
}

 

instead I get this :

 

<?xml version="1.0" encoding="utf-8"?>
<SERVICE:version>
<CLIENT email= xxx@xx.com>
<BASIC_FIELDS id="1" ADRESS_LINE id="2"="24 rue de rocher" CITY id="3"="Paris">
</BASIC_FIELDS id="1">
</CLIENT email= xxx@xx.com>
</SERVICE:version>

i hope someone could help me!

thanks