|
|
|
date: Sun, 29 Jun 2008 10:10:52 +0100,
group: microsoft.public.xml
back
XML Design
Hi All,
Bit of a newbie when it comes to designing XML layouts so I'm after some
advice.
I have a record Risk, which has elements of severity (low, medium, high),
description (string), effective date (date). Related to that I have another
record, Response, which has the elements of severity (none, low, medium,
high), and description (string).
What would be the "ideal" way of laying these out in XML? Currently I have:
<riskRecords>
<riskRecord>
<riskRecordSeverity></riskRecordSeverity>
<riskRecordDescription></riskRecordDescription>
<riskRecordEffectiveDate></riskRecordEffectiveDate>
<riskRecordResponse>
<riskRecordReponseSeverity></riskRecordResponseSeverity>
<riskRecordResponseDescription></riskRecordResponseDescription>
</riskRecordResponse>
<riskRecord>
<riskRecord>
<riskRecordSeverity></riskRecordSeverity>
<riskRecordDescription></riskRecordDescription>
<riskRecordEffectiveDate></riskRecordEffectiveDate>
<riskRecordResponse>
<riskRecordReponseSeverity></riskRecordResponseSeverity>
<riskRecordResponseDescription></riskRecordResponseDescription>
</riskRecordResponse>
<riskRecord>
</riskRecords>
Also what would be the XSD for this?
All advice most appreciated.
Regards,
Adam M.
date: Sun, 29 Jun 2008 10:10:52 +0100
author: Adam David Moss ess
Re: XML Design
"Adam David Moss" <no@email.address> wrote in message
news:Omc6Agc2IHA.5664@TK2MSFTNGP02.phx.gbl...
> Hi All,
>
> Bit of a newbie when it comes to designing XML layouts so I'm after some
> advice.
>
> I have a record Risk, which has elements of severity (low, medium, high),
> description (string), effective date (date). Related to that I have
> another record, Response, which has the elements of severity (none, low,
> medium, high), and description (string).
>
> What would be the "ideal" way of laying these out in XML? Currently I
> have:
>
> <riskRecords>
> <riskRecord>
> <riskRecordSeverity></riskRecordSeverity>
> <riskRecordDescription></riskRecordDescription>
> <riskRecordEffectiveDate></riskRecordEffectiveDate>
>
> <riskRecordResponse>
> <riskRecordReponseSeverity></riskRecordResponseSeverity>
> <riskRecordResponseDescription></riskRecordResponseDescription>
> </riskRecordResponse>
> <riskRecord>
>
> <riskRecord>
> <riskRecordSeverity></riskRecordSeverity>
> <riskRecordDescription></riskRecordDescription>
> <riskRecordEffectiveDate></riskRecordEffectiveDate>
>
> <riskRecordResponse>
> <riskRecordReponseSeverity></riskRecordResponseSeverity>
> <riskRecordResponseDescription></riskRecordResponseDescription>
> </riskRecordResponse>
> <riskRecord>
> </riskRecords>
>
> Also what would be the XSD for this?
>
> All advice most appreciated.
>
> Regards,
>
>
> Adam M.
Well I'd probably have the severity and date as attributes but that seems a
reasonable layout., use XML date formats (ISO 8601) if at all possible
(yyyy-MM-ddThh:mm:ss) rather than a local one such as MM/dd/yyyy.
To get a schema start with XSD.EXE. You run it against the xml and it will
generate a schema. You will need to tweak it, mainly by altering the
minOccurs and maxOccurs values and picking better data types in some cases.
Then you might possible make the severity an enumeration.
--
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
date: Sun, 29 Jun 2008 11:04:22 +0100
author: Joe Fawcett am
Re: XML Design
Hi,
Thanks for that.
So you would recommend something like:
<riskRecords>
<riskRecord severity="" effectivedate="">
<description></description>
<riskRecordResponse severity="">
<riskRecordResponseDescription></riskRecordResponseDescription>
</riskRecordResponse>
</riskRecord>
Could you tell me why?
Also where do I find this xsd tool? Can't seem to locate it in my vs2008
installation?
Thanks.
"Joe Fawcett" <joefawcett@newsgroup.nospam> wrote in message
news:875EB967-5F5D-4F1D-80DD-6BD19EFD010A@microsoft.com...
>
>
> "Adam David Moss" <no@email.address> wrote in message
> news:Omc6Agc2IHA.5664@TK2MSFTNGP02.phx.gbl...
>> Hi All,
>>
>> Bit of a newbie when it comes to designing XML layouts so I'm after some
>> advice.
>>
>> I have a record Risk, which has elements of severity (low, medium, high),
>> description (string), effective date (date). Related to that I have
>> another record, Response, which has the elements of severity (none, low,
>> medium, high), and description (string).
>>
>> What would be the "ideal" way of laying these out in XML? Currently I
>> have:
>>
>> <riskRecords>
>> <riskRecord>
>> <riskRecordSeverity></riskRecordSeverity>
>> <riskRecordDescription></riskRecordDescription>
>> <riskRecordEffectiveDate></riskRecordEffectiveDate>
>>
>> <riskRecordResponse>
>> <riskRecordReponseSeverity></riskRecordResponseSeverity>
>> <riskRecordResponseDescription></riskRecordResponseDescription>
>> </riskRecordResponse>
>> <riskRecord>
>>
>> <riskRecord>
>> <riskRecordSeverity></riskRecordSeverity>
>> <riskRecordDescription></riskRecordDescription>
>> <riskRecordEffectiveDate></riskRecordEffectiveDate>
>>
>> <riskRecordResponse>
>> <riskRecordReponseSeverity></riskRecordResponseSeverity>
>> <riskRecordResponseDescription></riskRecordResponseDescription>
>> </riskRecordResponse>
>> <riskRecord>
>> </riskRecords>
>>
>> Also what would be the XSD for this?
>>
>> All advice most appreciated.
>>
>> Regards,
>>
>>
>> Adam M.
> Well I'd probably have the severity and date as attributes but that seems
> a reasonable layout., use XML date formats (ISO 8601) if at all possible
> (yyyy-MM-ddThh:mm:ss) rather than a local one such as MM/dd/yyyy.
> To get a schema start with XSD.EXE. You run it against the xml and it will
> generate a schema. You will need to tweak it, mainly by altering the
> minOccurs and maxOccurs values and picking better data types in some
> cases.
> Then you might possible make the severity an enumeration.
>
> --
>
> Joe Fawcett (MVP - XML)
> http://joe.fawcett.name
date: Sun, 29 Jun 2008 13:35:14 +0100
author: Adam David Moss ess
Re: XML Design
"Adam David Moss" <no@email.address> wrote in message
news:#IyIOSe2IHA.2188@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> Thanks for that.
>
> So you would recommend something like:
>
> <riskRecords>
> <riskRecord severity="" effectivedate="">
> <description></description>
>
> <riskRecordResponse severity="">
> <riskRecordResponseDescription></riskRecordResponseDescription>
> </riskRecordResponse>
> </riskRecord>
>
> Could you tell me why?
>
> Also where do I find this xsd tool? Can't seem to locate it in my vs2008
> installation?
>
> Thanks.
>
> "Joe Fawcett" <joefawcett@newsgroup.nospam> wrote in message
> news:875EB967-5F5D-4F1D-80DD-6BD19EFD010A@microsoft.com...
>>
>>
>> "Adam David Moss" <no@email.address> wrote in message
>> news:Omc6Agc2IHA.5664@TK2MSFTNGP02.phx.gbl...
>>> Hi All,
>>>
>>> Bit of a newbie when it comes to designing XML layouts so I'm after some
>>> advice.
>>>
>>> I have a record Risk, which has elements of severity (low, medium,
>>> high), description (string), effective date (date). Related to that I
>>> have another record, Response, which has the elements of severity (none,
>>> low, medium, high), and description (string).
>>>
>>> What would be the "ideal" way of laying these out in XML? Currently I
>>> have:
>>>
>>> <riskRecords>
>>> <riskRecord>
>>> <riskRecordSeverity></riskRecordSeverity>
>>> <riskRecordDescription></riskRecordDescription>
>>> <riskRecordEffectiveDate></riskRecordEffectiveDate>
>>>
>>> <riskRecordResponse>
>>> <riskRecordReponseSeverity></riskRecordResponseSeverity>
>>> <riskRecordResponseDescription></riskRecordResponseDescription>
>>> </riskRecordResponse>
>>> <riskRecord>
>>>
>>> <riskRecord>
>>> <riskRecordSeverity></riskRecordSeverity>
>>> <riskRecordDescription></riskRecordDescription>
>>> <riskRecordEffectiveDate></riskRecordEffectiveDate>
>>>
>>> <riskRecordResponse>
>>> <riskRecordReponseSeverity></riskRecordResponseSeverity>
>>> <riskRecordResponseDescription></riskRecordResponseDescription>
>>> </riskRecordResponse>
>>> <riskRecord>
>>> </riskRecords>
>>>
>>> Also what would be the XSD for this?
>>>
>>> All advice most appreciated.
>>>
>>> Regards,
>>>
>>>
>>> Adam M.
>> Well I'd probably have the severity and date as attributes but that seems
>> a reasonable layout., use XML date formats (ISO 8601) if at all possible
>> (yyyy-MM-ddThh:mm:ss) rather than a local one such as MM/dd/yyyy.
>> To get a schema start with XSD.EXE. You run it against the xml and it
>> will generate a schema. You will need to tweak it, mainly by altering the
>> minOccurs and maxOccurs values and picking better data types in some
>> cases.
>> Then you might possible make the severity an enumeration.
>>
>> --
>>
>> Joe Fawcett (MVP - XML)
>> http://joe.fawcett.name
>
I just think attributes are better for meta-data and single values. The only
reason that I'd put description as a text node is that long text values are
unwieldy in attribute values.
It's not something I'd get into a fight over though :)
--
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
date: Sun, 29 Jun 2008 16:12:11 +0100
author: Joe Fawcett am
|
|