Copying an existing XML file to a new XML file

Danomanic

New Member
I have an existing XML file that has the following start element:\[code\]<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mynms SYSTEM 'mynms20.dtd'><mynms version="2.0" xmlns="mynms20.xsd"> <!-- This is the troublesome line--><cmData type="actual"> <header> <log dateTime="2011-10-17T06:07:07" action="created" appInfo="ActualExporter">InternalValues are used</log> </header> ..... </cmData>\[/code\]I'm reading this file using c#'s XMLReader and then altering certain elements of the file as above and outputing the new xml in another file using c#'s XMLWriter.So when the XMLReader reads in an element, I have the following:\[code\]writer.WriteStartElement(xmlReader.Prefix, xmlReader.Name, null);writer.WriteAttributes(xmlReader, true); <!-- This causes the assertion. Take this out then everything is OK -->\[/code\]But I get an exception stating The prefix ' ' cannot be redefined from ' ' to 'mynms20.xsd' within the same start element tag. <--- What does this mean and how can I just copy the namespace and attributes over to another file?Many thanks.
 
Back
Top