"Vicente GarcÃ*a" wrote:
hi,
I have a xml file as shown:
<?xml version="1.0" encoding="utf-8"?>
<PIM>
<fragments>
</fragments>
</PIM>
</xml>
I must add children in the fragments node such as:
<fragments>
<element name="name1">hello</element>
<element name="name2">hello 2</element>
<element name="name3">hello 3</element>
....
<fragments>
The problem is that I am not be able to add children using XmlDocument,
XmlElement nor XmlNode...May anyone help me with this issue?
Thanks in advance
regards
Vicente,
What technicial limitation prohibits you from using the XmlDocument object
to manipulate your doucment (other than the fact that this document is not
valid xml)?
Unless you can provide sound logical reasons and technical limitations there
isn't a solution for you here - only a hack.
The XmlDocument object conforms to the xml standards, unless you know
exactly what you are doing you should avoid the "I'm smarter than the
framework developers" approach to xml manipulation. Don't take offence to
this either. I've seen way to many solvable problems that people just don't
take the time to fix correctly. Some just apply a hack to get it working and
never go back. This will cause more problems in the long run.
<?xml version="1.0" encoding="utf-8"?>
<PIM>
<fragments>
</fragments>
</PIM>
</xml>
<!-- </xmlis not valid -
The <?xml version="1.0" ?is a processing instruction and is required for
all xml documents, it doesn't required any ending tag, let alone one that was
never defined.