[XML Records] XML to RecordList to skip "comments" within "" tags

Forge Component
(42)
Published on 25 Nov (2 weeks ago) by Afonso Carvalho
42 votes
Published on 25 Nov (2 weeks ago) by Afonso Carvalho

Hi,

I am currently using the XML to RecordList, I added a replace command on the XML text to replace the whole comment to make it work.

Is there a way to skip comments inside "<!-- " and "-->" tags ? if I don't use the replace command, the XMLtoRecordList is taking the comment as  primary node to match the record definition tag, giving an error "The current node (%23comment) does not match the record definition (xxyy)".

Currently, Replace command is working but this may not work if they changed anything inside the comment tags.


Thank you.

-Edwin

Edwin Siruma wrote:

Hi,

I am currently using the XML to RecordList, I added a replace command on the XML text to replace the whole comment to make it work.

Is there a way to skip comments inside "<!-- " and "-->" tags ? if I don't use the replace command, the XMLtoRecordList is taking the comment as  primary node to match the record definition tag, giving an error "The current node (%23comment) does not match the record definition (xxyy)".

Currently, Replace command is working but this may not work if they changed anything inside the comment tags.


Thank you.

-Edwin

Or if there is a way to specify the primary node of the XML so we can easily skip everything before the primary or parent node.


Thanks again!

-Edwin


Hi Edwin,

My apologies for the late reply, but I'll have some time to look at this very soon. I'll see about adding an option to skip comments.

Afonso Carvalho wrote:

Hi Edwin,

My apologies for the late reply, but I'll have some time to look at this very soon. I'll see about adding an option to skip comments.


Thank you, Afonso!

Hi Edwin,


Me and Afonso fixed the problem, but we cannot attach a new version in forge (we are waiting that OutSystems fixs a forge issue).


In meantime please find in attach the XIF with the bypass of comments.


The Solution:


"

if (ssBypassComments)
                {
                    XmlNodeList allComments = doc.SelectNodes("//comment()");
                    foreach (XmlNode n in allComments)
                    {
                        n.ParentNode.RemoveChild(n);
                    }
                }

"


I hope it helps!


Kindest Regards,

Olga



Thank you Olga!

This option has been added to the latest version of the extension.