Jump to content

any way to prevent use of default namespace..?


immo_we

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

Link to comment
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.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...