S
Ste
I have the following problem..XmlDocumentFragment puts a blank namespace in
the output XML
I am trying to insert some text "<number of pagses>199</number of pagses>"
into the <bookdetails> type. However using the XmlDocumentFragment class i
get a blank namespace in the output XML ..see below for an example .
Using this code ::
// import the BookDetails <BookDetails> from the Soap exception
XmlNode BookDetails = doc.ImportNode(SoapException.Detail["BookDetails"],
true);
// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
// Create a document fragment.
XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
// Set the contents of the document fragment.
docFrag.InnerXml ="<number of pagses>199</number of pagses";
BookDetails.InsertAfter(docFrag, BookDetails.LastChild);
docFrag.InnerXml = <BookDetails xmlns=\"mynamespace\">
<title>a book title</title>
<isbn>12234567</isbn>
<number of pages xmlns="">199</number
of pagses>
</BookDetails>
/////////////// argggggggggggggg xmlns=""
... input xml..
<soapfault>
<detail>
<BookDetails xmlns=\"mynamespace\">
<title>a book title</title>
<isbn>12234567</isbn>
</BookDetails>
</detail>
</soapfault>
... expected (** wanted **) output xml...
<soapfault>
<detail>
<BookDetails xmlns=\"mynamespace\">
<title>a book title</title>
<isbn>12234567</isbn>
<number of pagses>199</number of pagses>
</BookDetails>
</detail>
</soapfault>
the output XML
I am trying to insert some text "<number of pagses>199</number of pagses>"
into the <bookdetails> type. However using the XmlDocumentFragment class i
get a blank namespace in the output XML ..see below for an example .
Using this code ::
// import the BookDetails <BookDetails> from the Soap exception
XmlNode BookDetails = doc.ImportNode(SoapException.Detail["BookDetails"],
true);
// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
// Create a document fragment.
XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
// Set the contents of the document fragment.
docFrag.InnerXml ="<number of pagses>199</number of pagses";
BookDetails.InsertAfter(docFrag, BookDetails.LastChild);
docFrag.InnerXml = <BookDetails xmlns=\"mynamespace\">
<title>a book title</title>
<isbn>12234567</isbn>
<number of pages xmlns="">199</number
of pagses>
</BookDetails>
/////////////// argggggggggggggg xmlns=""
... input xml..
<soapfault>
<detail>
<BookDetails xmlns=\"mynamespace\">
<title>a book title</title>
<isbn>12234567</isbn>
</BookDetails>
</detail>
</soapfault>
... expected (** wanted **) output xml...
<soapfault>
<detail>
<BookDetails xmlns=\"mynamespace\">
<title>a book title</title>
<isbn>12234567</isbn>
<number of pagses>199</number of pagses>
</BookDetails>
</detail>
</soapfault>