Restricting Namespace! Help-me plz!

This should cover W3C XML Schema, Relax NG and DTD related problems.
sulley
Posts: 4
Joined: Thu May 11, 2006 3:07 pm

Restricting Namespace! Help-me plz!

Post by sulley » Thu May 11, 2006 3:21 pm

Hi people!

I'm with a big problem. I have to restrict the namespaces of my schema xsd.

-------
For Example:

In xsd schema there is:
<TestXML xmlns:ds="http://www.w3.org/2000/09/xmldsig#" ...>

I need validate this value with this list:
http://www.test.com/xmldsig#
http://www.aol.com/xmldsig#
--------

This is necessary because when user change the value of xmlns:ds tag, the signature value of my xml is changed. To solve this, I define a list of namespaces and the value informed needs to belong in the list.

Sorry my english, I'm studying.

Thanks!

Luiz - Procergs - Porto Alegre - RS - Brazil

sulley
Posts: 4
Joined: Thu May 11, 2006 3:07 pm

OOOppppssss....

Post by sulley » Thu May 11, 2006 4:15 pm

People,

One correction...

I spoke with my partner and We find a error in this post.

I have a tag xmlns:xsi, xmlns:nfe and xmlns:xsi. We don't permit other tag.

If user put xmlns:BR the shema need report a error.

Please, need help!

Thanks.

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Thu May 11, 2006 4:24 pm

XML Schema does not put any constraints on the namespace declarations you may have in an XML document. So for instance if you have a schema that validates:

<test/>

then it will equally validate

<test xmlns:whatever="something"/>

Best Regards,
George

sulley
Posts: 4
Joined: Thu May 11, 2006 3:07 pm

More one question...

Post by sulley » Thu May 11, 2006 4:50 pm

Thanks George but I dont understood very well.

Not Is possible validate if user type the tag xmlsns:BR? I don't need validate the value of this tag. Only if it's exists or not.

Tks!

Luiz

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Thu May 11, 2006 4:58 pm

Hi Luiz,

That is not a tag, it is a namespace declaration. XML Schema does not constraint in any way the namespace declarations and what prefixes should be used to express an instance document. For XML Schema there is no difference between the following:

<test xmlns="http://www.example.com/test/">

<test:test xmlns:test="http://www.example.com/test/">

<x:test xmlns:x="http://www.example.com/test/">

Best Regards,
George

sulley
Posts: 4
Joined: Thu May 11, 2006 3:07 pm

Closing this question

Post by sulley » Thu May 11, 2006 5:10 pm

Thanks George. Have a nice day.

Post Reply