views:

126

answers:

2

I have the following xml file

<Layout xmlns="http://tempuri.org/Layout/"&gt;
  <Numeric Id="temperature" Caption="Temperature">
    <validation:IsValidWhen xmlns:validation="http://tempuri.org/Validation/"&gt;

    </validation:IsValidWhen>
  </Numeric>
</Layout>

The http://tempuri.org/Layout/ XSD does not have a reference to http://tempuri.org/Validation/ and I cannot change it.

I am getting the error

The element 'Numeric' in namespace 'http://tempuri.org/Layout/' has invalid child element 'IsValidWhen' in namespace 'http://tempuri.org/Validation/'. List of possible elements expected: 'ContextMenu, OnChanged, OnLeave' in namespace 'http://tempuri.org/Layout/'

How can I make this XML be valid when the parent element is from a schema that is not aware of my validation schema?

+1  A: 

If you do not control the http://tempuri.org/Layout/ schema, then there may not be anything you can do to make this "valid." However, it's still perfectly reasonable and well-formed XML that can be used by any party that knows what to expect. If the other parties you're interacting with understand the format, there really isn't any problem.

qid
Hmmm, I guess I could try to make the Actipro SyntaxEditor to ignore those errors if that still make it a valid Xml.
Pierre-Alain Vigeant
A: 

Perhaps you can use XML catalogs to instruct your tools (or code, which has strict validation) where to locate multiple unrelated schemas.

Bozho