koch.henning
Usenet Archive
- Joined
- Jun 15, 2006
- Messages
- 1
- Reaction score
- 0
Hello,
I have some sort of problem with verifying the contents of my xml-document. I have a xml-scheme like this...
<xs:complexType name="abcType">
<xs:sequence>
<xs:element name="elementA" type="elementAType"/>
<xs:element name="elementB" type="elementBType"/>
<xs:element name="elementC" type="elementCType"/>
</xs:sequence>
<xs:attribute name="ID" type="xs:string"/>
</xs:complexType>
This abcType has an Attribute ID. And each of these elementA,B,C-Types has Subelements. Now I want to verify some things in the xml-document with the key-, keyref-Elements. I want to get only the some special sub-elements of elementBType.
I tried something like this:
<xs:element name="abc" type="abcType">
<xs:key name="IDKey">
<xs:selector xpath=".//elementB/specialSubElementB"/>
<xs:field xpath="@ID"/>
</xs:key>
This way I get the sub-elements of TypeB, but the Problem is, that the ID is in TypeB not in its sub-Elements. The problem is, that I can't refer the parent-element to the ID Normally you could write something like this:
xpath=".//elementB/[specialSubElementB]"/ so only the elements are taken, who have the subElementB. But this doesn't seem to work. I tried it in Avolta XML-Spy with the "Evaluate Path" and gave him the command with the brackets (xpath=".//elementB/[specialSubElementB]"/) and the correct elements were selected but in the selector-element this doesn't seem to work.
I could move the ID-Attribute to each subElement-Type, but it would be much better for my scheme if I would leave it at the parent-element abcType. Are the any work-arounds or does anybody know a solution for this problem?
Any help would be appreciated,
thanks...
Henning.
I have some sort of problem with verifying the contents of my xml-document. I have a xml-scheme like this...
<xs:complexType name="abcType">
<xs:sequence>
<xs:element name="elementA" type="elementAType"/>
<xs:element name="elementB" type="elementBType"/>
<xs:element name="elementC" type="elementCType"/>
</xs:sequence>
<xs:attribute name="ID" type="xs:string"/>
</xs:complexType>
This abcType has an Attribute ID. And each of these elementA,B,C-Types has Subelements. Now I want to verify some things in the xml-document with the key-, keyref-Elements. I want to get only the some special sub-elements of elementBType.
I tried something like this:
<xs:element name="abc" type="abcType">
<xs:key name="IDKey">
<xs:selector xpath=".//elementB/specialSubElementB"/>
<xs:field xpath="@ID"/>
</xs:key>
This way I get the sub-elements of TypeB, but the Problem is, that the ID is in TypeB not in its sub-Elements. The problem is, that I can't refer the parent-element to the ID Normally you could write something like this:
xpath=".//elementB/[specialSubElementB]"/ so only the elements are taken, who have the subElementB. But this doesn't seem to work. I tried it in Avolta XML-Spy with the "Evaluate Path" and gave him the command with the brackets (xpath=".//elementB/[specialSubElementB]"/) and the correct elements were selected but in the selector-element this doesn't seem to work.
I could move the ID-Attribute to each subElement-Type, but it would be much better for my scheme if I would leave it at the parent-element abcType. Are the any work-arounds or does anybody know a solution for this problem?
Any help would be appreciated,
thanks...
Henning.