473,395 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XmlValidatingReader 2nd try

Hello!

I still have the problem with the XmlValidatingReader in combination with
key/keyref constraints and namespaces.

My schema is quite simple.
I have following key/keyref defined:
<xsd:key name="LangKey">
<xsd:selector xpath="transNS:Language"/>
<xsd:field xpath="@ID"/>
</xsd:key>
<xsd:keyref name="LangKeyRef" refer="transNS:LangKey">
<xsd:selector xpath="transNS:Item/Translation"/>
<xsd:field xpath="@Language"/>
</xsd:keyref>

This describes a translation table. I have a set of languages, each language
has an id (ID-Attribute is the key).
And I have a set of translation items. Each translation item has a link to a
language via the language ID (Langugae attribute -> ID attribute in the
language table). That´s not really complicated, I think.

But the XmlValidatingReader does not recognize if a translation item
references a language which is not defined in language table! And I don´t
know why.

As I mentioned in my last posting, other external XML validators (like
XmlSpy or the Sun XmlValidator) detect the error correctly

And further: If I omit the namespace definition in the schema then the
XmlValidatingReader also works fine! Maybe there´s something wrong with the
namespace definition.

This is really a strange behavior and I don´t know where´s the mistake.

Regards,
Bernhard
Nov 12 '05 #1
1 1118
I found the solution!

The prolem was the selector in the keyref
Instead of : '<xsd:selector xpath="transNS:Item/Translation"/>'
you have to write '<xsd:selector xpath="transNS:Item/transNS:Translation"/>

Each element gets the namespace qualifier.

Regards,
Bernhard

"Bernhard Felkel" wrote:
Hello!

I still have the problem with the XmlValidatingReader in combination with
key/keyref constraints and namespaces.

My schema is quite simple.
I have following key/keyref defined:
<xsd:key name="LangKey">
<xsd:selector xpath="transNS:Language"/>
<xsd:field xpath="@ID"/>
</xsd:key>
<xsd:keyref name="LangKeyRef" refer="transNS:LangKey">
<xsd:selector xpath="transNS:Item/Translation"/>
<xsd:field xpath="@Language"/>
</xsd:keyref>

This describes a translation table. I have a set of languages, each language
has an id (ID-Attribute is the key).
And I have a set of translation items. Each translation item has a link to a
language via the language ID (Langugae attribute -> ID attribute in the
language table). That´s not really complicated, I think.

But the XmlValidatingReader does not recognize if a translation item
references a language which is not defined in language table! And I don´t
know why.

As I mentioned in my last posting, other external XML validators (like
XmlSpy or the Sun XmlValidator) detect the error correctly

And further: If I omit the namespace definition in the schema then the
XmlValidatingReader also works fine! Maybe there´s something wrong with the
namespace definition.

This is really a strange behavior and I don´t know where´s the mistake.

Regards,
Bernhard

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: jason | last post by:
how do you use the XmlValidatingReader to validate an XML document that is passed into the XmlValidatingReader constructor? it looks like the normal process is to use an underlying reader, as...
5
by: Geoff | last post by:
I am using an XMLValidatingReader to validate an XML file received via a web service. I want to verify that the incoming file matches the XML schema. When testing the validation routine, the...
1
by: Bernhard Felkel | last post by:
I have troubles validating XML files with key/keyref constraints. Here´s my schema: <?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"...
1
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST> xml file 2
12
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.