CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    May 2009
    Posts
    1

    Question How to retrieve an element which has no xml:lang attribute .

    HI,
    My xml file some thing like this.
    <?xml version="1.0" encoding="utf-8" ?>
    <parent id="http://abc.co.in">
    <name xml:lang="en">code Guru</name>
    <name>My name</name>
    </parent>

    Now in the above xml file i tried to retrieve the name element having xml lang attribute using the xpath expression as
    "(//*[starts-with(name(),name)])[lang( 'en' )]".Then it is working fine iam getting the result as "code Guru"

    But if i try to retrieve the element name which is not having xml:lang attribute using the following xpath expression's
    (//*[starts-with(name(),name)])[not(//@*[local-name()='lang' ])]
    (//*[starts-with(name(),name)])[(@*[local-name()='lang' ])=' ' ]
    //*[starts-with(name(),name)])[not(@xml:lang)]
    (//*[starts-with(name(),name)])[@xml:lang=' ' ].

    i failed to get the value of that element.
    Could any body please suggest me how to achieve this? Please let me know if you want any pre-data regarding this?

    Regards,
    Venkat.
    Last edited by cnu.kaigala; May 28th, 2009 at 11:42 AM. Reason: corrected the parameter in the lang() function as $hi to 'en'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured