Jump to content
Sign in to follow this  
immo_we

any way to prevent use of default namespace..?

Recommended Posts

Hi is there any way to prevent via schema that the default namespace will be used vor a certain schema? currently I've defined this root element in the xml file: <rootEle name="Test4" schemaVersion="2.0" xmlns="http://www.example.org/testSchema"'>http://www.example.org/testSchema" xmlns:sch="http://www.example.org/testSchema"'>http://www.example.org/testSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/testSchema testSchema.xsd ">now I can use<sch:ele1> together with <ele1>both have the same meaning and this looks quite terrible for forming useful xpath queries.I would like to expect only elements in the form <sch:ele1> ... Immo

Share this post


Link to post
Share on other sites

If they both have the same namespace then there's no way to distinguish them. You need another namespace if you want the elements to be different.

Share this post


Link to post
Share on other sites
both have the same meaning and this looks quite terrible for forming useful xpath queries.
Regardless of whether they're in the default namespace or not, you need to register the namespace URI in XPath, and assign a prefix for it (which doesn't have to be the one used in the document). After that, both will be matched against the same expressions.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...