86
Views
7
Comments
Solved
[XML Records] I can't set the output structure
xml-records
Service icon
Forge asset by Afonso Carvalho
Application Type
Service

I've tried several different structures, but it always gives me this error: The current node (xml) does not match the record definition (PagSeguroTransaction). 

Why does it complain about node "xml" if it doesn't exist in my input xml?

I'll send an example of the XML (attached) and how my structure is defined.

I've changed this structure several times, without success.

If you can help me by assembling the structure by the xml that I sent as an example, I would appreciate it.

Thanks


    

pagseguro.txt
2021-06-21 12-37-59
Wei Zhu
Solution

Hi You have two problems.

1. Attribute name not match XML tag name because of Case-Sensitive.
   So you need define  structure and attribute with same name of XML tag.
2. Unnecessary Record (PagSeguroTransaction) used.
   XML Root element is transactionSearchResult, so you just need define a record list of transactionSearchResult.
   And you data will be loaded at first row of that record list.

After that, your data can be loaded successfully as following.


Regards
Wei

2023-02-27 16-15-36
CLAYTON ANDERSON SEVERINO

Perfect! The problem was the case sensitive.

I'll explain why it gave an error before. I took the XML return from the API and converted it to JSON, then I created the structure with this JSON, thinking that it was created following what I sent, but the outsystems ignored the case sensitive and created the structure in its default, so the structure created did not was the same as the API return structure.

I hit the structure exactly the same as the input and it worked, so be careful with the case sensitive.

Thanks everyone for the replies!

UserImage.jpg
Clayton Anderson

Sorry, the xml tag is missing from the file, first line:

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

UserImage.jpg
Clayton Anderson

I used XmlToRecordList(ToObject(TransacoesList))


2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Hello Clayton,

Reading the error you're getting, the XML declaration might be considered as a node by the component. Have you tried placing an element named "xml" at the top hierarchy of your Structure?

Do you mind sharing a module with your Structure? If you can't share your entire module that's okay, but if you can isolate the Structure in an .oml file it will make it easier to test and help.

2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Just remembered you can also give the IgnoreXMLDeclarationAndNS input a try - I believe setting it to True will cause the component to ignore the xml tag.

2021-06-21 12-37-59
Wei Zhu
Solution

Hi You have two problems.

1. Attribute name not match XML tag name because of Case-Sensitive.
   So you need define  structure and attribute with same name of XML tag.
2. Unnecessary Record (PagSeguroTransaction) used.
   XML Root element is transactionSearchResult, so you just need define a record list of transactionSearchResult.
   And you data will be loaded at first row of that record list.

After that, your data can be loaded successfully as following.


Regards
Wei

2023-02-27 16-15-36
CLAYTON ANDERSON SEVERINO

Perfect! The problem was the case sensitive.

I'll explain why it gave an error before. I took the XML return from the API and converted it to JSON, then I created the structure with this JSON, thinking that it was created following what I sent, but the outsystems ignored the case sensitive and created the structure in its default, so the structure created did not was the same as the API return structure.

I hit the structure exactly the same as the input and it worked, so be careful with the case sensitive.

Thanks everyone for the replies!

2023-02-27 16-15-36
CLAYTON ANDERSON SEVERINO

I hit the structure exactly the same as the input and it worked.

So be careful with the case sensitive.

Thanks everyone for the replies!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.