Results 1 to 3 of 3

Thread: Extensible XML - Nesting Custom tags within custom tags

  1. #1
    Join Date
    Jun 2007
    Posts
    2

    Question Extensible XML - Nesting Custom tags within custom tags

    I am having trouble with the example in Appendix B: http://static.springframework.org/sp...sible-xml-meat

    I have created my own namespace with custom elements, but i am not able to nest the elements within each other. My goal is for my xml to look like this:

    Code:
    <itp:dateCell ....>
        <itp:dateCell  ..../>
        <itp:dateCell  ..../>
    </itp:dateCell>
    The error I am getting is:
    org.xml.sax.SAXParseException: src-resolve.4: Components from namespace 'http://www.springframework.org/schema/itp' are not referenceable from schema document 'http://www.itpcorporation.com/schema/itp/itp.xsd'.

    and its being referenced to the bold line in the schema below.


    This is my Schema:
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <xsd:schema xmlns="http://www.springframework.org/schema/itp"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:beans="http://www.springframework.org/schema/beans"
        targetNamespace="http://www.itpcorporation.com/schema/itp"
        elementFormDefault="qualified"
        attributeFormDefault="unqualified">
        <xsd:import namespace="http://www.springframework.org/schema/beans"/>
    
        <xsd:element name="dateCell">
            <xsd:complexType>
                <xsd:complexContent>
                    <xsd:extension base="beans:identifiedType">
                        <xsd:choice minOccurs="0" maxOccurs="unbounded">
                            <xsd:element ref="dateCell"/>
                        </xsd:choice>
                        <xsd:attribute .../>
                        <xsd:attribute .../>
                        <xsd:attribute .../>
                        <xsd:attribute .../>
                    </xsd:extension>
                </xsd:complexContent>
            </xsd:complexType>
        </xsd:element>
    I also have other elements in this schema and when i take dateCell out, i do not get any errors, but i am not able to nest.

    The only difference between my code and the code in the example from the spring documentation is that the class I am trying to nest has a setter method for the List type. Because of this, i modified the code in the factory bean for method getObject() to look like this:

    Code:
        public Object getObject() throws Exception
        {
            this.parent.setAuxiliaryList(children);
            return this.parent;
        }
    I really need help understanding whats wrong with my code and/or approach. Thanks.

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    You seem to be a little schizophrenic about http://www.itpcorporation.com/schema and http://www.springframework.org/schema. If you choose one and stick to it your example should work - the xsd has references to both.

  3. #3
    Join Date
    Jun 2007
    Posts
    2

    Default

    Thanks Dave. I am not getting that error anymore.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •