Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Robert Chanphakeo
8
Views
6
Comments
XML Extension: Serialization_XmlToRecordList
Question
XML Extension - received the following error when using
Serialization_XmlToRecordList to convert xml to a recordlist.
Object reference not set to an instance of an object
OML attached
(here)
Eric Oud Ammerveld
Robert, have you put the ToObject() function around your XML variable when passing it to the serialisation function?
That is a tiny and often overlooked "
must have
"
Eric Oud Ammerveld
Good comment and structure, by the way.
I don't see that very often :)
Robert Chanphakeo
@Eric
thanks
"Robert, have you put the ToObject() function around your XML variable when passing it to the serialisation function?
That is a tiny and often overlooked "
must have
""
Yes, it is using ToObject(),.....(the oml is attached above)
......the Serialization_XmlToRecordList method keeps on complaining "
Object reference not set to an instance of an object".
Eric Oud Ammerveld
Sorry, I can't open it, it's a 5.1 version OML and we're using 5.0.
Daniel Lourenço
Staff
Hi Robert,
The
XMLToRecordList
and
RecordToXML
are a pure serialization / desserialization solution. You can only use in the
XMLToRecordList
with an XML that resulted from the execution of the
RecordToXML
action. The goal is for you to be able to store the status of a list or record (in a file, string, database, etc.) and then to be able to restore it back to your runtime list. The XML used in the XML extension is an internal XML representation defined in the extension.
This means that you should never have an XML coming from an external App and then use it directly as the input for the
XMLToRecordList
action - this would represent a direct dependency from your external app to the internal XML representation of the XML extension.
In order to have a robust API, a solution would be to strictly define the XML structure, parse it with the XML manipulation actions in the XML extension and populate the resulting record with the parsing logic.
I see that the XML that you are inserting is
"
<xmlRegisterRequest><FirstName>testvalue</FirstName></xmlRegisterRequest>
".
This probably is not compatible with the XML To Record list reprsentation and that is why you are getting that error.
I made a test in which I exported two records to XML. One have FirstName="Daniel", the second has FirstName="Robert". The resulting XML was the one below:
<?xml version="1.0" encoding="utf-8"?>
<DBExport>
<Entity name="xmlRegisterRequest">
<Attribute>
<Name>FirstName</Name>
<Value>Daniel</Value>
</Attribute>
</Entity>
<Entity name="xmlRegisterRequest">
<Attribute>
<Name>FirstName</Name>
<Value>Robert</Value>
</Attribute>
</Entity>
</DBExport>
You can see the eSpace that does the export attached. To see it, just open the entry point
Export
.
Regards,
Daniel Lourenço
OutSystems
TestAPI.oml
Robert Chanphakeo
Hi Daniel
Thanks for the response, that makes sense.
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...