Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8869049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:23:34+00:00 2026-06-14T17:23:34+00:00

how do you register namespace on context with vala so that you can query

  • 0

how do you register namespace on context with vala so that you can query “//someNamespace:tag” (and not only “//tag”)

My starting point is : https://live.gnome.org/Vala/XmlSample

            Xml.Doc* doc = Parser.parse_file (path);
            if(doc==null) print("failed to read the .xml file\n");

            Context ctx = new Context(doc);
            if(ctx==null) print("failed to create the xpath context\n");

            Xml.XPath.Object* obj = ctx.eval_expression("/Example/Objects/Pet");
            if(obj==null) print("failed to evaluate xpath\n");

I guessed[*] how to “create” some namespace

Xml.Ns* ns = new Xml.Ns(null,"","svg");

now how do I pass this namespace to the context ?
something like xpathRegisterNs that exists in .py (AFAIK)
Python XPath / libxml2 namespace query

If someone got some sample code to get the list of existing namespace in the doc it would be great too.

PS: [*] I say I guessed because I hoped I’d found a good Linux IDE with vala completion. Right now I’m stuck with Monodevelop 2.8.6.3 which has syntax highlighting for vala but no code completion (It keeps saying “fetching information for the class” but I don’t get any result). So if someone knows of a good ide, I’ll be glad to hear you…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:23:35+00:00Added an answer on June 14, 2026 at 5:23 pm

    You don’t need to create the namespace as an object; that’s only needed for registering it with a document. On the Context do:

    ctx.register_ns("svg", "http://www.w3.org/2000/svg");
    ctx.eval_expression("//svg:g");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to dynamically register entities and configurations with a context (ef4 code-only) I
Code @register.inclusion_tag('template.html', takes_context=True) def include_client_side_bar(context): return { 'STATIC_URL': settings.STATIC_URL, } My code is will
containerBuilder .Register<IGraphClient>(context => { var graphClient = new GraphClient(new Uri(http://localhost:9999/db/data)); graphClient.Connect(); // Particularly this
<%@ Master Language=C# AutoEventWireup=true CodeBehind=AssociateMaster.master.cs Inherits=EQ.AssociateMaster %> <%@ Register Assembly=AjaxControlToolkit Namespace=AjaxControlToolkit TagPrefix=ajaxToolkit %> <!DOCTYPE
I encountered a weird error that I could not understand... When I run my
I register a UPnP device with: var o: IUPnPRegistrar; W: string; R: HRESULT; begin
int* Register = 0x00FF0000; // Address of micro-seconds timer while(*Register != 0); Should I
I register the following function //EDIT: updated $("#id").on("change", function() { alert('xxx'); }); In my
I register a NSNotification in viewDidLoad method. Should I unregister it both in viewDidUnload
i am developing register form using php where i need to upload the file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.