schema

XML Schema (XSD) validation tool?

At the office we are currently writing an application that will generate XML files against a schema that we were given. We have the schema in an .XSD file. Are there tool or libraries that we can use for automated testing to check that the generated XML matches the schema? We would prefer free tools that are appropriate for commercial...

ORM: Handwritten schema or auto-generated?

Should I use a hand-written schema for my projected developed in a high-level language (such as Python, Ruby) or should I let my ORM solution auto-generate it? Eventually I will need to migrate without destroying all the data. It's okay to be tied to a specific RDBMS but it would be nice if features such as constraints and procedures cou...

What are XML namespaces for?

This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML schemas? Should XSD schemas always be associated with a namespace? ...

Expressing an is-a relationship in a relational database

I was wondering if there is a clean way to represent an is-a relationship as illustrated by this example: This DB stores recording times for three types of programs: movies, game shows, drama. In an object oriented sense each of these is-a program. Each of these subclasses have different properties. Here are the tables (fk prefix indica...

What is the best way to generate XML Binding Code from a DTD?

Most Java-XML binding frameworks and code generators need XML Schema Defintions. Can you suggest the best way to generate binding code from DTD. I know that the XJC in JAXB 2 supports DTD but it is considered experimental. In the spirit of Stack Overflow, one suggestion per answer please - to be voted up or down instead of duplicated ...

mysql "drop database" takes time -- why?

mysql5.0 with a pair of databases "A" and "B", both with large innodb tables. "drop database A;" freezes database "B" for a couple minutes. Nothing is using "A" at that point, so why is this such an intensive operation? Bonus points: Given that we use "A", upload data into "B", and then switch to using "B", how can we do this faster? Dr...

XML Attributes vs Elements

When should you use XML attributes and when should you use XML elements? e.g. <customData> <records> <record name="foo" description="bar" /> </records> </customData> or <customData> <records> <record> <name>foo</name> <description>bar</description> </record> </records> </customData> ...

how to see the schema of a db2 table (file)

As in subject... is there a way of looking at an empty table schema without inserting any rows and issuing a SELECT? ...

What is the Best Way to Represent Summer Time Rules?

I need to store the summer time (daylight saving time) change-over rules for different world regions in a database. I already have a way of storing regions and sub-regions (so the whole "half of Australia"/Arizona/Navaho problem is taken care of), but I'm wondering what the most efficient schema would be to accomplish this. The two opt...

Database schema to track random settings in website for marketing

I have Flex based consumer website where I would like to change various look and feel type settings based on random and other criteria, and then track these through to what results in the most sales. For instance I might completely switch out the homepage, show different things depending upon where people come from. I might show or hid...

How to throw a XmlSchemaException on XML Schema validation errors?

Calling Validate() on an XmlDocument requires passing in a ValidationEventHandler delegate. That event function gets a ValidationEventArgs parameter which in turn has an Exception property of the type XmlSchemaException. Whew! My current code looks like this: ValidationEventHandler onValidationError = delegate(object sender, Vali...

XML add <a> hyperlink

Hi, I have a xml blob that's checked against a schema in sql 2005. My website uses xsl to transform and display the blob. How do I add a hyperlink to the xml (in any node) without the sql 2005 schema complaining a node was found in the wrong place? Or the xsl thinking that the hyperlink is a valid xml node? thank you ...

Is there an agreed ideal schema for tagging

I have a photo website and i want to support tags as my original category bucketing is starting to fail (some pictures are family and vacations, or school and friends). Is there an agreed tagging db schema? I still want to support having photos as part of an album. Right now i have a few tables: Photos PhotoID PhotoAlbumID Captio...

Ado.net Getting the schema for a table

Given an SQLConnection object how can you get a schema for a single table? I was trying this the other day and I seemed to be able to get the schema from a DataSet which I'd gotten from running a query, but all the schema info I could get from the connection seemed to be related to what tables were available and not the actual details o...

Log4Net "Could not find schema information" messages

I decided to use log4net as a logger for a new webservice project. Everything is working fine, but I get a lot of messages like the one below, for every log4net tag I am using in my web.config: Could not find schema information for the element 'log4net'... Below are the relevant parts of my web.config: <configSections> <se...

How do you version your database schema?

How do you prepare your SQL deltas? do you manually save each schema-changing SQL to a delta folder, or do you have some kind of an automated diffing process? I am interested in conventions for versioning database schema along with the source code. Perhaps a pre-commit hook that diffs the schema? Also, what options for diffing deltas e...

Tool for validating SQL Server database schema

Are there any tools available for validating a database schema against a set of design rules, naming conventions, etc. I'm not talking about comparing one database to another (as covered by this question). I want to be able to say "What in this database doesn't meet this set of rules". Some examples of the type of rules I'm talking a...

How can you validate Elements based on an attribute Value using a Schema?

The XML I'm trying to validate is as follows: <root> <element attribute="foo"> <bar/> </element> <element attribute="hello"> <world/> </element> </root> How can this be validated using a Schema? Note: element can only contain bar when attribute="foo". element can only contain world when attribute="he...

How to set "xml:lang" attribute?

Hi, I need to add a "xml:lang" attribute on the root xml node in the outbound doument from Biztalk. This is a fixed value, so it may be set in the schema or something. This is what I want to get out: <Catalog xml:lang="NB-NO"> ... </Catalog> I've tried to define the attribute "xml:lang", but it doesn't allow me to use ":" in the sch...

Tool to compare sql server tables

Looking for a free tool to compare two sql server tables (both data and schema). Sorry, cannot afford any solutions from Red Gate. No Sql queries please. It would be great if the tool can script the differences found. I also went through some older posts. The closest I have seen is SQLDBDiff but I would love to try more options. ...