Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Novice XSD namespace question

rss181919 (Programmer) (OP)
27 Feb 11 2:46
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>

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!

Back To Forum

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