I have a xsd file. For every xs:element inside xs:sequence, I want to convert them to <Class></Class>
. So for this file below, the output should contain 3 times of <Class></Class>
.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="contacts">
<xs:complexType>
<xs:sequence>
<xs:element ref="contact"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:NCName"/>
<xs:element name="lastname" type="xs:NCName"/>
</xs:sequence>
<xs:attribute name="citizen" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
But instead I got this:
$ zorba -i -f -q test.xqy
<?xml version="1.0" encoding="UTF-8"?>
<Class/>
<Class/>
This output looks so strange. I dont have <Class/>
in the xqy file.
xqy file:
for $x in doc("test.xsd")/xs:schema/xs:element/xs:complexType/xs:sequence
return <Class>
</Class>
You could improve the XPath part with
/*
because you are searching for children of thexs:sequence
:XQuery 3.0
With this I have: