Results 1 to 4 of 4

Thread: How to implement xmlns selectsinglenode in dom4j

  1. #1
    Join Date
    May 2008
    Posts
    255

    How to implement xmlns selectsinglenode in dom4j

    I have an XML file i needed to load and read the contents. How to get the value of the xmlns attribute, I think that programmatically this could be a valid implementation to retrieve xmlns selectsinglenode and by providing the default namespace problem and might be a solution that could be implemented for dom4j. This all information i got from the blog. Is there a way around this?

  2. #2
    Join Date
    Dec 2008
    Posts
    161

    Re: How to implement xmlns selectsinglenode in dom4j

    Selects the first XmlNode that matches the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied XmlNamespaceManager.

    To implement XmlNode you need to specify the Namespace and Assembly and that required details are mentioned as below:

    Namespace: System.Xml
    Assembly: System.Xml (in System.Xml.dll)

    I will also provide you the Visual basic declaration

    Code:
    Public Function SelectSingleNode ( _
        xpath As String, _
        nsmgr As XmlNamespaceManager _
    ) As XmlNode
    for more information check here

  3. #3
    Join Date
    Jan 2009
    Posts
    143

    Re: How to implement xmlns selectsinglenode in dom4j

    If the element has a namespace you need to pass that to the XML
    processor with setProperty e.g.

    var xmlDocument = new ActiveXObject('Msxml2.DOMDocument.4.0');
    xmlDocument.async = false;

    I was able to delete xmlns attribute without any visible side effects to make SelectSingleNode("/configuration/system.web") working.

  4. #4
    Join Date
    Dec 2008
    Posts
    161

    Re: How to implement xmlns selectsinglenode in dom4j

    I actually believe that there should be no need to expose the prefix programmatically, but if i am not mistaken the solution you provided is javascript. I am looking for the solution in C#.NET. the only time that a user should want to know about or define a prefix for a namespace would be when serialising the NodeSet to a XML Document. I want to get the value of the xmlns attribute, so I tried to use objSource.selectSingleNode("rdf:RDF/@xmlns")

Similar Threads

  1. How to implement sum() faster in c#?
    By Luis-Fernando in forum Software Development
    Replies: 4
    Last Post: 27-02-2010, 09:25 PM
  2. Implement the copy_backward() in C++
    By Agustíne in forum Software Development
    Replies: 5
    Last Post: 16-02-2010, 09:46 PM
  3. Implement the equal_range() in C++
    By Garrick in forum Software Development
    Replies: 5
    Last Post: 15-02-2010, 07:09 PM
  4. How to implement IP Sec
    By Enriquee in forum Technology & Internet
    Replies: 5
    Last Post: 12-01-2010, 06:28 AM
  5. Want to implement differentiation in C++
    By ADEN in forum Software Development
    Replies: 1
    Last Post: 25-10-2008, 06:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,493,786.89877 seconds with 16 queries