I'm using C # (actually .NET 2.0) - I'm actually trying to use Mono on Mac OS X (I don
N100 & lt; / subcategoryCode> gt; subcategoryName xmlns =" uuid : 7E1158D2-DA42-4048-8513-66B4D48FA992 "> DJ Headphones & lt; / subcategoryName & gt; Products xlink: href =" tcm: 5-33 975 "xlink: title =" teston compression "xlink: Type = "simple" xmlns: xlink = "http://www.w3.org/1999/xlink" xmlns = "UUID: 7E1158D2-DA42-4048-8513-66B4D48FA 992" / & Gt; & lt; products xlink: href = "tcm: 5-54295" xlink: title = "HPX 2000 Composition" xlink: type = "simple" xmlns: xlink = "http://www.w3.org/1999/xlink" xmlns = "UUID: 7E1158D2-DA42-4048-8513-66b 4D 48FA 992 "/> & lt; products xlink: href =" tcm: 5-54296 "xlink: title =" HPX4000 composition "xlink: type =" simple "xmlns: xlink =" http: // www .w3.org / 1999 / xlink "xmlns =" UUID: 7E1158D2-DA42-4048-8513-66B 4D48FA 992 "/> I'm trying to recover the SelectSingleNode by using subcategoryName but I just can not. This is my code:
XmlNamespaceManager nsm = New XmlNamespaceManager (doc.NameTable); Nsm.AddNamespace (string.opt, "UUID: 7E1158D2-DA42-4048-8513-66B 4D48FA2 992"); XmlNodeList SubjectList = Doctor. Getilments biatagnam ("subcategories"); Foreach (XMLNode subtitle in subcomponent) {html + = "& lt; div id = \" "html + = subcat.SelectSingleNode (" subcategoryName ", nsm) .intertext; // <- here is my problem !! ! Html + = "\" class = \ "product_ thumb bs_holder \" style = \ "display: block; \ "& Gt;"; Html + = "& lt; / div & gt;"; Html = = "& lt; div style =" clear: both \ "& gt; & lt; / div & gt;"; } I believe this issue is probably related to the name on which I am managing the namespace, but for hours, I got stuck on it. I have made a bunch of adenemspace announcements like no luck.
Will any person adequately adequately provide any indication on that issue?
XPath does not work with default namespace. You must create a prefix for the namespace. Should:
XmlNamespaceManager nsm = New XmlNamespaceManager (doc.NameTable); Nsm.AddNamespace ("x", "uuid: 7E1158D2-DA42-4048-8513-66B4D48FA992"); XmlNodeList SubjectList = Doctor. Getilments biatagnam ("subcategories"); (XMLNote Subnet in Subacat List) {html = = "& lt; div id = \" "; html + = subcat.SelectSingleNode (" x: subcategoryName ", Nsm) .Intertext; // <- here is my problem ! !! html + = "\" class = \ "product_thumbs_holder \" style = \ "display: block; \ "& Gt;"; Html + = "& lt; / div & gt;"; Html + = "& lt; div style =" clear: both \ "& gt; & lt; / div & gt;"; } Note: You do not need to add a prefix to the XML document. There is no need to match prefix and code in the prefix and code in the XML document, as long as it matches the associated namespaces.
Comments
Post a Comment