-
Nov 8th, 2011, 09:42 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] blank namespace attribute appears merging Docs
Hi All,
I have a XML document that I load and this has namespaces on it.
I then create a series of document fragments and place these into another XmlDocument. In my main docuement, I then navigate to the place where I want to insert my second document.
This all appears to work fine, my document fragments placed in an XmlDocument of their own all look fine. I add them into the correct place of the master document, but then it adds an attribute of xmlns="" to my newly inserted section. I do not want this to appear, it also blows out when validating against my xsd because of this unexpected attribute. Is there any way I can stop this from being generated?
Code:
XmlNode totalDoc = xmlInput.ImportNode(xmlRisks.DocumentElement, true);
XmlPath itemsInsertPoint = _xmlPathRepository.Queryable<XmlPath>().Where(r => r.SectionName == "All" && r.Type == "I" && r.Level == "S").Single();
xmlInput.SelectSingleNode(itemsInsertPoint.XPath, ns).AppendChild(totalDoc);
interogatting xmlRisks (line 1) looks ok, my element does not contain the xmlns attribute by the time the 3rd line is run and I check the main document(xmlInput), my newly inserted section has the empty namespace added to first element.
e.g.
expecting: <Items><Item>.........but received <Items><Item xmlns="">......
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|