XML Schema Question

Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: May 2007
Posts: 45
Reputation: mike.mclennan is an unknown quantity at this point 
Solved Threads: 0
mike.mclennan's Avatar
mike.mclennan mike.mclennan is offline Offline
Light Poster

XML Schema Question

 
0
  #1
Sep 26th, 2007
I have created a new XML file and schema that is used to run sql scripts but I am having a problem doing a few things. below is an example of what I am hoping to create.

XML file.
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. <root>
  2.  
  3. <script>
  4. <name> Script for Upgrading </name>
  5. <file> C:\Files\Scripts\Upgrade.sql </file>
  6. <SCHEMA> Schema Owner </SCHEMA>
  7. </script>
  8. <script>
  9. <name> Script for Removing Geometeries </name>
  10. <file> C:\Files\Scripts\replaceGeoms.sql </file>
  11. <SCHEMA> Schema Owner </SCHEMA>
  12. <USERNAME> Username </USERNAME>
  13. <PASSWORD> Password </PASSWORD>
  14. </script>
  15.  
  16. <parameter_type>USERNAME</parameter_type>
  17. <parameter_type>SCHEMA</parameter_type>
  18. <parameter_type>PASSWORD</parameter_type>
  19. <parameter_type>NUMBER</parameter_type>
  20. <parameter_type>STRING</parameter_type>
  21.  
  22. </root>
XML schema
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="sqlscripts"
            xmlns="sqlscripts" elementFormDefault="qualified">

    <xsd:element name="root">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="script" type="script_type" maxOccurs="unbounded" />
          <xsd:element name="parameter_type" type="xsd:string" 
                                                                                maxOccurs="unbounded" />    
        </xsd:sequence>
      </xsd:complexType>
     </xsd:element>

    <xsd:complexType name="script_type">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string" />
            <xsd:element name="file" type="xsd:string" />                    
            <xsd:element type="parameter_type" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>  

</xsd:schema>

The main problem I am having is I want the element that surrounds the parameter to
be parameter type name. So if the element is USERNAME and the value is pparker then I know that ppparker is a username and not a PAssword or string or whatever. But I have not been able to find how to do this with the xml schema.

I also would like to create the name field as a key or a unique, I have found a few examples of that but nothing that has worked for me. (I am validating the XML with C# validationReader)

Any help would be greatly appreciated.
- mike mclennan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the RSS, Web Services and SOAP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC