I have to (seemingly) simple questions:
1) I'd like to enfore a child node to take the value of it's parent in a given situation using an XML Schema. For example:
Assume the following ridiculous logic is true:
If my parent likes pizza, I MUST like pizza. Otherwise, I may like pizza.
So:
Would NOT be valid. All of the other possibilities {Yes,Yes},{No, Yes},{No, No} would be valid.
Any ideas on how to specify this in a Schema? In my "programming" sense I would want to do:
If (parent.likespizza = 'Yes') then
likespizza = 'Yes'
Else
likespizza = whatever it is in the XML doc
2) I know this has probably been asked and fixed a thousand times, but I can't get XPath to work with a schema. I know it has something to do with namespaces, but I can't get it to work. Frankly, I don't give a crap about them b/c I only use one, and only use that one so that it can find my Schema.
I have read around and saw that you need to add a namespace that XPath can use. But it also said that if you do this you need to reference the correct namespace everytime you use it, which just isn't feasible (especially since i'm only using one!)
Any ideas on a simple way to make this work?
I have this at the top of my XSD:
This at the top of my XML doc:
And I'm using .Compile and .Select in XPath.
Everything works fine if I use my XML file without the schema info. Once I add the schema info, XPath stops working.
Any help would be greatly appreciated
1) I'd like to enfore a child node to take the value of it's parent in a given situation using an XML Schema. For example:
Assume the following ridiculous logic is true:
If my parent likes pizza, I MUST like pizza. Otherwise, I may like pizza.
So:
Code:
<parent>
<name>Bob</name>
<LikesPizza>Yes</LikesPizza>
<child>
<name>Lily></name>
<LikesPizza>No</LikesPizza>
</child>
</parent>
Would NOT be valid. All of the other possibilities {Yes,Yes},{No, Yes},{No, No} would be valid.
Any ideas on how to specify this in a Schema? In my "programming" sense I would want to do:
If (parent.likespizza = 'Yes') then
likespizza = 'Yes'
Else
likespizza = whatever it is in the XML doc
2) I know this has probably been asked and fixed a thousand times, but I can't get XPath to work with a schema. I know it has something to do with namespaces, but I can't get it to work. Frankly, I don't give a crap about them b/c I only use one, and only use that one so that it can find my Schema.
I have read around and saw that you need to add a namespace that XPath can use. But it also said that if you do this you need to reference the correct namespace everytime you use it, which just isn't feasible (especially since i'm only using one!)
Any ideas on a simple way to make this work?
I have this at the top of my XSD:
Code:
<xs:schema id="otms" targetNamespace="[URL unfurl="true"]http://tempuri.org"[/URL] elementFormDefault="qualified" xmlns="[URL unfurl="true"]http://tempuri.org"[/URL]
xmlns:mstns="[URL unfurl="true"]http://tempuri.org"[/URL] xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema">[/URL]
This at the top of my XML doc:
Code:
<OTM xmlns="[URL unfurl="true"]http://tempuri.org"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL]
xsi:schemaLocation="[URL unfurl="true"]http://tempuri.org[/URL] OTMS.xsd">
And I'm using .Compile and .Select in XPath.
Everything works fine if I use my XML file without the schema info. Once I add the schema info, XPath stops working.
Any help would be greatly appreciated