• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Adding attributes to an XML schema

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am building a schema for a properties file. I want to add a name attribute, but I am not sure how.

It's defined like this in the .xsd...

<xsd:complexType name="coldef" id="coldef">
<xsd:sequence>
<xsd:element name="iosource" id="iosource" type="xsd:string"/>
<xsd:element name="iotarget" id="iotarget" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

I want it to appear like this in the XML...
<coldef>
<iosource tablename="">1</iosource>
<iotarget tablename="Customer">ssn</iotarget>
</coldef>
 
Ranch Hand
Posts: 8953
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have defined iosource and iotarget of type xsd:string so they cannot have attributes. Either define a new type with attributes or extend the string type with tha attribute. Haven't tried the 2nd option so not sure if it works.

http://www.w3schools.com/schema/schema_simple_attributes.asp
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic