Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Generate XML .A person will have dependents and the dependents can be spouse and children or only spouse. A person can have more than 1 child.

What I have tried:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE person SYSTEM "person.dtd">
<person>
<name>priya
<age>22
punjab

<dependents>
<spouse>
<sname>sam
<sage>22

<children>
<child>
<cname>rtrtt
<cgender>f
<cage>16
Posted
Updated 3-Oct-17 18:41pm
Comments
Dave Kreskowiak 3-Oct-17 14:14pm    
You say you're getting an error but you never said what that error was. It's only the MOST IMPORTANT PIECE OF INFORMATION you can have when troubleshooting a problem, that's all.

You are not closing your entries. See XML Tutorial[^].
 
Share this answer
 
XML tags must have opening and closing tags
<person>
    <name>priya</name>
    <age>22</age>
    .
    .
    .
</person>

Here person is the root tag that has to be unique.
All other tags can be repeated.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900