+ Start a Discussion
The KnightThe Knight 

Dom.Document Constructor with String argument throws error

In Apex Language reference it is mentioned that there is a single argument constructor for Dom.Document object  accepting String, it throws error saying that constructor does not exist.

 

Code from the Apex Language Reference:

String xml = httpResponse.getBody();
Dom.Document domDoc = new Dom.Document(xml);

 

Error I am getting:

 

Error: Compile Error: Constructor not defined: [dom.Document].<Constructor>(String) at line 51 column 34

 

Did anyone see this constructor working?

 

Thanks,

Joseph

 

 

tukmoltukmol

i have not seen that in the documentation.

 

anyhow, can't you do this?

 

Document doc = new Document();

doc.load(xml):

The KnightThe Knight

Thanks tukmol :). I din't think about it .

 

BTW here is the link where I found this constructor. httpResponse getbodydocument