<xs:groupname="music-data"><xs:annotation><xs:documentation>The music-data group contains the basic musical data that is either associated with a part or a measure, depending on whether the partwise or timewise hierarchy is used.</xs:documentation></xs:annotation><xs:sequence><xs:choiceminOccurs="0"maxOccurs="unbounded"><xs:elementname="note"type="note"/><xs:elementname="backup"type="backup"/><xs:elementname="forward"type="forward"/><xs:elementname="direction"type="direction"/><xs:elementname="attributes"type="attributes"/><xs:elementname="harmony"type="harmony"/><xs:elementname="figured-bass"type="figured-bass"/><xs:elementname="print"type="print"/><xs:elementname="sound"type="sound"/><xs:elementname="barline"type="barline"/><xs:elementname="grouping"type="grouping"/><xs:elementname="link"type="link"/><xs:elementname="bookmark"type="bookmark"/></xs:choice></xs:sequence></xs:group>
I read the section "Influencing Element and Mixed Content Order", but I don't understand how to keep the sequence order when I generate xml document "element.append(item)" don't keep the order.
Other question, these elements are unamed despite "name"
<xs:elementname="score-timewise"block="extension substitution"final="#all"><xs:annotation><xs:documentation>The score-timewise element is the root element for a timewise MusicXML score. It includes a score-header group followed by a series of measures with parts inside. The document-attributes attribute group includes the version attribute.</xs:documentation></xs:annotation><xs:complexType><xs:sequence><xs:groupref="score-header"/><xs:elementname="measure"maxOccurs="unbounded"><xs:complexType><xs:sequence><xs:elementname="part"maxOccurs="unbounded"><xs:complexType><xs:groupref="music-data"/><xs:attributeGroupref="part-attributes"/></xs:complexType></xs:element></xs:sequence><xs:attributeGroupref="measure-attributes"/></xs:complexType></xs:element></xs:sequence><xs:attributeGroupref="document-attributes"/></xs:complexType></xs:element>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PyXB is concerned with validation, and the schema does not enforce an order. What support is provided was intended primarily for preserving order when processing existing documents, and your need to build them up manually may not be supported. For example, using this schema:
c 1
a 2
b 3
a 11
c 12
b 13
<?xml version="1.0" ?><SCn><a>2</a><a>11</a><b>3</b><b>13</b><c>1</c><c>12</c></SCn><?xml version="1.0" ?><SCn><c>1</c><a>2</a><b>3</b><a>11</a><c>12</c><b>13</b></SCn>
This may not help in your case because you're building the document manually, and several ways of adding content are not detected and preserved in the built-up orderedContent() value. For example, if scn was constructed like this:
the orderedContent() array would be empty and there would be no way to influence the generated order.
For the other question those elements do have names, but they're visible only within the scope of the anonymous type that defines them. If you want to manipulate them as attributes you need to get an instance of the corresponding type first, which is tedious but necessary unless you can refactor the schema. See this section.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
MusicXML defines
I read the section "Influencing Element and Mixed Content Order", but I don't understand how to keep the sequence order when I generate xml document "element.append(item)" don't keep the order.
Other question, these elements are unamed despite "name"
PyXB is concerned with validation, and the schema does not enforce an order. What support is provided was intended primarily for preserving order when processing existing documents, and your need to build them up manually may not be supported. For example, using this schema:
with this test program:
the result is:
This shows the content provided by orderedContent() and the impact of setting the instance-specific validation configuration.
This may not help in your case because you're building the document manually, and several ways of adding content are not detected and preserved in the built-up
orderedContent()
value. For example, ifscn
was constructed like this:the
orderedContent()
array would be empty and there would be no way to influence the generated order.For the other question those elements do have names, but they're visible only within the scope of the anonymous type that defines them. If you want to manipulate them as attributes you need to get an instance of the corresponding type first, which is tedious but necessary unless you can refactor the schema. See this section.