Pages: 1
Print
Author Topic: Unknown Element Error When Creating Element  (Read 220 times)
scotth
Member

Posts: 35


« on: June 29, 2011, 07:48:10 AM »

I am getting an "Unknown element, unable to create." error when I attempt to create a particular element programmatically in XMetaL 6.0. Some elements I can create without difficulty, but this element I could not. I used a command similar to the one below to do the creation:

var fooNode = doc.createElement("foo");

After some research, I found that I had to move the in-line definition for the element in the schema to a referenced definition. Doing this would allow me to add the element without difficulty. I was curious if this is a known issue and/or why this occurs. Below are examples from the working and non-working schemas. Perhaps there is an issue with the non-working schema, but it appears to be valid according to my research.

Please let me know if there are any additional details that I can provide that would be helpful.

Works:

<xs:element name="docInfo" type="docInfoElemType"/>
    <xs:complexType name="docInfoElemType">
        <xs:sequence>
            <xs:element ref="foo" minOccurs="0"/>
            <xs:element ref="bar"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="foo" type="fooElemType"/>
    <xs:complexType name="fooElemType">
        <xs:sequence>
            <xs:element ref="para"/>
        </xs:sequence>
        <xs:attributeGroup ref="dateAttGroup"/>
    </xs:complexType>


Doesn't Work:

<xs:element name="docInfo" type="docInfoElemType"/>
    <xs:complexType name="docInfoElemType">
        <xs:sequence>
            <xs:element name="foo" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="para"/>
                    </xs:sequence>
                    <xs:attributeGroup ref="dateAttGroup"/>
                </xs:complexType>
            </xs:element>
            <xs:element ref="bar"/>
        </xs:sequence>
    </xs:complexType>
Logged
Pages: 1
Print
Jump to:  

email us