We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

xsd design

dbashley1
dbashley1 asked
on
Medium Priority
522 Views
Last Modified: 2012-05-11
I'm trying to build an xsd file to validate help xml files I am writing.

I have a node <p> that I want to have a single optional attribute (class) and allow any content under it....both text and html.  I'm getting the validation error stating that "parent element's content model is text only" when I try to add html. I don't know how to fix it.  I'm using VS 2010 to create the xsd and xml files.

Below is my xsd file

***********************
<?xml version="1.0" encoding="utf-8"?>
<schema id="helptopics"  elementFormDefault="qualified"  xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://myurl.com">
      <element name="topic">
            <complexType mixed="true">
                  <sequence>
                        <element name="title" type="string">
                        </element>
                        <element name="topicdescription" type="string" minOccurs="0">
                        </element>
                        <element name="content">
                              <complexType mixed="true">
                                    <choice minOccurs="0" maxOccurs="unbounded">
                                          <element name="p" minOccurs="0" maxOccurs="unbounded">
                                                <complexType mixed="true">
                                                      <attribute name="class" />
                                                </complexType>            
                                          </element>
                                          <element name="ul" minOccurs="0" maxOccurs="unbounded">
                                                <complexType>
                                                      <sequence minOccurs="1" maxOccurs="unbounded">
                                                            <element name="li" maxOccurs="unbounded">
                                                                  <complexType mixed="true"></complexType>
                                                            </element>
                                                      </sequence>
                                                </complexType>
                                          </element>
                                          <element name="ol" minOccurs="0" maxOccurs="unbounded">
                                                <complexType>
                                                      <choice minOccurs="1" maxOccurs="unbounded">
                                                            <element name="li" maxOccurs="unbounded">
                                                                  <complexType mixed="true">
                                                                  </complexType>
                                                            </element>
                                                      </choice>
                                                </complexType>
                                          </element>
                                          <element name="media" minOccurs="0" maxOccurs="unbounded">
                                                <complexType>
                                                      <attribute name="src">
                                                      </attribute>
                                                      <attribute name="alt" use="optional">
                                                            <simpleType>
                                                                  <restriction base="string" />
                                                            </simpleType>
                                                      </attribute>
                                                </complexType>
                                          </element>
                                    </choice>
                              </complexType>
                        </element>


                  </sequence>

            </complexType>
      </element>

</schema>
Comment
Watch Question

Senior Technical Architect, Salesforce Commerce Cloud
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.