web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to add two root nodes in XML using x++

(0) ShareShare
ReportReport
Posted on by 154

I need to create the following

<Document>

<Cstr>

<Book>

<name>test</name>

</Book>

<Book>

<name>test</name>

</Book>

</cstr>

</Document>

How do I get </cstr>??

Can you help me with the code for the same??

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    XML documents can have only one root node, that's defined in the XML standard.

    If your XML file has many <Document> elements, you can add <Documents> root node and put all <Document> elements as child nodes of <Documents>.

    You also asked "How do I get </cstr>?" What do you mean by that?

  • Verified answer
    Martin Dráb Profile Picture
    239,499 Most Valuable Professional on at

    Cstr isn't a root node - it's embedded in the Document node. Or it would if the opening tag matched the closing one. It doesn't because the closing tag doesn't start with the capital 'C'.

    By the way, the structure will be obvious if you use indentation (see below). You can achieve that by using Insert > Insert Code (in the rich formatting view), therefore please use that for pasting code snippets.

    	
    		
    			test
    		
    		
    			test
    		
    	
    

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 664

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 615 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 550

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans