I have the following xml <foods xmlns="http://example.com/agt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <food id="1" name="celery"> <price>50.2</price> </food> <food id="2" name="beets"> <price>23.3</price> </food> <food id="3" name="goat cheese"> <price>0.5</price> </food> </foods>
With the following xsd: <xs:schema targetNamespace="http://example.com/agt" attributeFormDefault="unqualified" elementFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:element name="price" type="xs:decimal"/> <xs:element name="food"> <xs:complexType> <xs:sequence> <xs:element ref="price"/> </xs:sequence> <xs:attribute name="id" type="xs:integer"/> <xs:attribute name="name" type="xs:string"/> </xs:complexType> </xs:element> <xs:element name="foods"> <xs:complexType> <xs:sequence> <xs:element ref="food" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> When I execute the following query in the console: xquery version "1.0-ml"; import module namespace json = "http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy"; declare namespace agt = "http://example.com/agt"; let $c := json:config("custom") , $_ := map:put($c,"array-element-names", "food") return json:transform-to-json( doc("foods.xml") , $c ) ... I get: {"foods":{"food":{"id":3, "name":"goat cheese", "price":0.5}}} Something isn't clicking for me. What happened to the food elements? No array, and only the last one made it into the output. Note that taking out the array-element-names does *not* solve the missing food elements. Is this a bug or am I doing it wrong? I just started with MarkLogic Server, so I could very well be doing it wrong. Any advice appreciated. Regards, Stu
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
