INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

Novice XSD namespace question

Novice XSD namespace question

(OP)
I have an xsd I am trying to link up to an xml so the xml content will be validated (see below).  I am having trouble with namespaces.   If you attempt to validate as is, it fails stating on the brushes element and the only way I can get it to work is to undeclare the default namespace on the xml root element.  So I think I have a namespace conflict between the brushes element in the xsd and the brushes element in the xml.  Can't figure out why that is.  Any explanation is much appreciated.

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="mynamespace">
  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="brushes">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="brush" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="id" type="xs:string" use="required"></xs:attribute>
                  <xs:attribute name="type" use="required">
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:pattern value="image|video"></xs:pattern>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="uri" type="xs:string"></xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
         </xs:element>
         <xs:element name="theme_references">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="theme_reference" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="id" type="xs:string" use="required"></xs:attribute>
                  <xs:attribute name="icon_brush" type="xs:string" use="required"></xs:attribute>
                  <xs:attribute name="theme_uri" type="xs:string" use="required"></xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


<?xml version="1.0" encoding="utf-8"?>
<root xmlns="mynamespace"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="mynamespace theme_references.xsd">
  <brushes>
    <brush id="alphabet_icon" type="image" uri="content\themes\alphabet\images\A.png"></brush>
  </brushes>
  <theme_references>
    <theme_reference id="alphabet" icon_brush="alphabet_icon" theme_uri="content\themes\alphabet\alphabet.xml"></theme_reference>
  </theme_references>
</root>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close