Click here to Skip to main content
16,010,416 members
Home / Discussions / XML / XSL
   

XML / XSL

 
AnswerRe: Convert xml dataset to string Pin
ironstrike125-Feb-06 12:49
ironstrike125-Feb-06 12:49 
QuestionXSD Validation Pin
Al Ortega25-Feb-06 5:21
Al Ortega25-Feb-06 5:21 
QuestionConversion of Excel Worksheet Data in to XML file Format Pin
winpoorni23-Feb-06 17:58
winpoorni23-Feb-06 17:58 
QuestionWatermark Pin
sreejith ss nair23-Feb-06 2:38
sreejith ss nair23-Feb-06 2:38 
AnswerRe: Watermark Pin
George L. Jackson24-Feb-06 1:07
George L. Jackson24-Feb-06 1:07 
QuestionXSD information in resx file Pin
sumit malik23-Feb-06 0:24
sumit malik23-Feb-06 0:24 
QuestionXmlDocument.NameTable vs namespaces Pin
chricla23-Feb-06 0:14
chricla23-Feb-06 0:14 
AnswerRe: XmlDocument.NameTable vs namespaces Pin
Douglas Troy3-Mar-06 6:47
Douglas Troy3-Mar-06 6:47 
Once you reload the XML file, you have to iterate through the Namespace table, loading up the contained namespaces into the namespace manager (this doesn't happen for you). In order for selectSingleNode & selectNode to work, if the XML contains namespaces, those must be added to the Namespace manager.

So, you'll want to do something like (C# code):

<code>private void UpdateNamespaces(XmlNamespaceManager nsm)
		{			
			this.lbNamespaces.Items.Clear();
			xmlNodeList = xmlDocument.SelectNodes("//namespace::*");
			if (xmlNodeList != null)
			{
				for (int i=0; i<xmlNodeList.Count; i++)
				{
					xmlNode = xmlNodeList.Item(i);	
					if (xmlNode != null)
					{						
						string strPreFix = xmlNode.Name.ToString();
						int iPos = strPreFix.IndexOf(":", 0, strPreFix.Length - 1);
						strPreFix = strPreFix.Substring(iPos + 1);

						if (strPreFix == "xmlns") 
							strPreFix = "BogusName";							

						// -- get the URI for the prefix 
						string strNameSpaceURI = xmlNode.InnerText.ToString();

						// -- check to make sure there's not a duplicate
						if (this.lbNamespaces.FindString(strPreFix + "=" + strNameSpaceURI) < 0) 
						{
							// -- add that to the listbox and the NS mgr. collection
							this.lbNamespaces.Items.Add(strPreFix + "=" + strNameSpaceURI);
							nsm.AddNamespace(strPreFix, strNameSpaceURI);
						}				
					}
				}
			}
		}

</code>


Note: the list of namespaces will contain duplicates, so those must be removed ...




:..::. Douglas H. Troy ::..

Bad Astronomy |Development Blogging|Viksoe.dk's Site

QuestionPlease help - a question on XPath... Pin
Tigger9922-Feb-06 3:04
Tigger9922-Feb-06 3:04 
AnswerRe: Please help - a question on XPath... Pin
George L. Jackson22-Feb-06 12:58
George L. Jackson22-Feb-06 12:58 
QuestionXML file corrupted and filled with spaces..Any Idea!!! Pin
FiDz20-Feb-06 0:34
FiDz20-Feb-06 0:34 
AnswerRe: XML file corrupted and filled with spaces..Any Idea!!! Pin
George L. Jackson21-Feb-06 13:47
George L. Jackson21-Feb-06 13:47 
GeneralRe: XML file corrupted and filled with spaces..Any Idea!!! Pin
FiDz21-Feb-06 22:24
FiDz21-Feb-06 22:24 
GeneralRe: XML file corrupted and filled with spaces..Any Idea!!! Pin
George L. Jackson22-Feb-06 18:02
George L. Jackson22-Feb-06 18:02 
GeneralRe: XML file corrupted and filled with spaces..Any Idea!!! Pin
FiDz26-Feb-06 1:51
FiDz26-Feb-06 1:51 
QuestionHelp on MS Word 2003 XML Pin
ted_92119-Feb-06 15:27
ted_92119-Feb-06 15:27 
AnswerRe: Help on MS Word 2003 XML Pin
Douglas Troy3-Mar-06 6:32
Douglas Troy3-Mar-06 6:32 
Questionxml in smart device application Pin
bhavz6917-Feb-06 1:56
bhavz6917-Feb-06 1:56 
AnswerRe: xml in smart device application Pin
George L. Jackson18-Feb-06 1:53
George L. Jackson18-Feb-06 1:53 
QuestionXML display problem Pin
smadan16-Feb-06 19:41
smadan16-Feb-06 19:41 
AnswerRe: XML display problem Pin
George L. Jackson18-Feb-06 2:00
George L. Jackson18-Feb-06 2:00 
GeneralRe: XML display problem Pin
smadan19-Feb-06 18:13
smadan19-Feb-06 18:13 
GeneralRe: XML display problem Pin
George L. Jackson20-Feb-06 13:20
George L. Jackson20-Feb-06 13:20 
GeneralRe: XML display problem Pin
smadan20-Feb-06 18:38
smadan20-Feb-06 18:38 
Questionset values for nested XML nodes Pin
smadan16-Feb-06 18:38
smadan16-Feb-06 18:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.