471,605 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

XmlDocumentFragment and namespaces

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>
Nov 30 '05 #1
0 3359

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

24 posts views Thread by Marcin Vorbrodt | last post: by
2 posts views Thread by Mike Morse | last post: by
1 post views Thread by apple | last post: by
11 posts views Thread by Random | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.