On May 8, 2006, at 8:04 PM, Matthew Soffen wrote:

Andrew,

What parts should fail ?

well is has two "nodes" sections despite maxOccurs="1" :-)


Matt

On Mon, 2006-05-08 at 18:58 +0200, Andrew Beekhof wrote:
so as far as i can tell, the attached files _should_ fail.
but they dont :-(


any thoughts?






On May 8, 2006, at 6:19 PM, Andrew Beekhof wrote:


On May 8, 2006, at 6:09 PM, Matthew Soffen wrote:

Andrew,

Mine starts:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

Not sure of the elementFormDefault is needed but (It cant hurt).

I also don't think you can do the typing like you did.

Could you try this ( Lose the extra typing ).    I don't think you can define the top level elements in terms of types. OK ?



doh, it was a typo!  s/_/-/



<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">    

    <xsd:element name="cib" >
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="configuration" type="ClusterConfig"/>
            </xsd:sequence>
            <xsd:attribute name="cib-last_written" type="xsd:string" use="required"/>
            <xsd:attribute name="admin_epoch"    type="xsd:string" use="required"/>  



Matt


On Mon, 2006-05-08 at 17:43 +0200, Andrew Beekhof wrote:

On May 8, 2006, at 4:53 PM, Matthew Soffen wrote:

The other nice feature of XSD is that it is written in XML as well.

You can cleanly create new types within your XSD (I have one called YNType just to ensure a field is Y or N. 

If you need another pair of eyes to look at it when you are done.  Let me know.


going ok, but I hit this


invalid.xml:1: element cib: Schemas validity error : Element 'cib': The attribute 'cib-last-written' is not allowed.
invalid.xml:1: element cib: Schemas validity error : Element 'cib': The attribute {'cib-last_written'} is required but missing.


any ideas?


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">


  <xsd:element name="cib" type="ReplicatedConfig"/>


  <xsd:complexType name="ReplicatedConfig">
    <xsd:sequence>
      <xsd:element name="configuration" type="ClusterConfig"/>
      <!--xsd:element name="status" type="ClusterStatus"/-->
    </xsd:sequence>
    <xsd:attribute name="cib-last_written" type="xsd:string//" use="required"/>
    <xsd:attribute name="admin_epoch"      type="xsd:string" use="required"/>
 
  ...


On Mon, 2006-05-08 at 16:50 +0200, Andrew Beekhof wrote:

On May 8, 2006, at 4:46 PM, Matthew Soffen wrote:

OK. My Bad. Yes. It does work to validate properly  ( Had a typo in my xsd ).

> xmllint  --schema LRPMeteringData.xsd event_summary_20050629025529.xml
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<LRPSummaryData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LRPMeteringData.xsd" CreateTime="2005-06-29T02:55:31">
    <Event EventID="10876" LoadZoneID="4004" Program="PRICE" StartTimeStamp="2005-06-29T16:00:00" EndTimeStamp="2005-06-29T22:00:00" NoticeType="Notice"/>
    <Event EventID="10877" LoadZoneID="4008" Program="PRICE" StartTimeStamp="2005-06-29T16:00:00" EndTimeStamp="2005-06-29T22:00:00" NoticeType="Notice"/>
</LRPSummaryData>
event_summary_20050629025529.xml validates

So XSD could be an option.


looks a lot more flexible, writing one now :)
thanks for the tip!


Matt

On Mon, 2006-05-08 at 15:52 +0200, Andrew Beekhof wrote:
do you know what can we use to validate xml against it?
i dont see xsd in xmllint

On May 8, 2006, at 3:45 PM, Matthew Soffen wrote:


Correction:

My Bad. I meant XSD ( XML Schema Definition).  This is an example of one I wrote for something at ISO.  It allows you to define how many of a field may exist, if it is required or not.  Its pretty flexible ( at least I think).

Matt

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

    <xsd:element name="LRPMeteringData">
        <xsd:complexType>
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="Event" type="EventType"/>
            </xsd:sequence>
            <xsd:attribute name="Component"  type="ComponentType" use="required"/>
            <xsd:attribute name="FileType"   type="FileTypeType"  use="required"/>
            <xsd:attribute name="CreateTime" type="xsd:dateTime"  use="required"/>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="LRPSummaryData">
        <xsd:complexType>
                <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="Event" type="EventSummaryType" />
            </xsd:sequence>
            <xsd:attribute name="CreateTime" type="xsd:dateTime"  use="required"/>
        </xsd:complexType>
    </xsd:element>

    <xsd:element name="MeterReaders">
        <xsd:complexType>
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="MeterReader" type="MeterReaderType"/>
            </xsd:sequence>
            <xsd:attribute name="EffectiveDate"  type="xsd:date" use="required"/>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="ContactType">
        <xsd:sequence>
            <xsd:element name="FirstName"   type="xsd:string"/>
            <xsd:element name="LastName"    type="xsd:string"/>
            <xsd:element name="Phone"       type="xsd:positiveInteger"  minOccurs="0"/>
            <xsd:element name="PhoneExt"    type="xsd:positiveInteger"  minOccurs="0"/>
            <xsd:element name="Fax"         type="xsd:positiveInteger"  minOccurs="0"/>
            <xsd:element name="Email"       type="xsd:string"           minOccurs="0"/>
            <xsd:element name="Pager"       type="xsd:string"           minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>
   
    <xsd:complexType name="MeterReaderType">
        <xsd:sequence>
            <xsd:element name="CustomerID"      type="xsd:positiveInteger"/>
            <xsd:element name="Name"            type="xsd:string"/>
            <xsd:element name="IbcsProvider"    type="YNType"/>
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="Contact" type="ContactType"/>
            </xsd:sequence>
        </xsd:sequence>
    </xsd:complexType>


On Mon, 2006-05-08 at 15:42 +0200, Andrew Beekhof wrote:
On 5/8/06, Matthew Soffen <[EMAIL PROTECTED]> wrote:
>  Has using an XSL been considered instead of a DTD ?
>
>  Matt

my understanding is that XSL will let you transform XML from one
"format" to another.
but that doesn't do validation as far as i can tell.

btw. were the extra changes to bootstrap ok for you?
I tried to email you directly but it bounced.

>  On Mon, 2006-05-08 at 15:00 +0200, Andrew Beekhof wrote:
>  On May 8, 2006, at 2:44 PM, Lars Marowsky-Bree wrote:
>
> > On 2006-05-08T14:16:15, Andrew Beekhof <[EMAIL PROTECTED]> wrote:
> >
> >>> Good point.
> >> we also need to find a way to have it ignore the order things appear
> >> in... thats going to be a major PITA
> >
> > You mean within the CIB? Well, the order is defined, doesn't matter
> > too
> > much, or does it?
>
> the problem is when you replace things (normally by removing the old
> and adding the new) you can affect the order things in the CIB occur in.
>
> the CIB doesn't care, but the DTD will and if you have dtd validation
> turned on...
>
> So instead of:
>
> <!ELEMENT configuration (nodes, resources, constraints, metadata,
> crm_config)>
>
> You need:
>
> <!ELEMENT configuration
> (nodes|resources|constraints|metadata|
> crm_config)+>
>
> Which no longer ensures you have exactly one of each.
>
> I just finished reading a thread from 2000 where this problem was
> discussed and the response was "tough luck".
> It appears nothing has changed in the last 6 years.
>
> --
> Andrew Beekhof
>
> "Too much knowledge leads to confusion; Too many guitar lessons lead
> to jazz-fusion!" - TISM
>
>
>
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
>
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
>
>
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

--
Andrew Beekhof


“The greatest trick the devil ever pulled was convincing the world he didn’t exist.” - The Usual Suspects






_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

--
Andrew Beekhof


"I like your old stuff better than your new stuff" - Regurgitator







_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

--

Andrew Beekhof


"Too much knowledge leads to confusion; Too many guitar lessons lead to jazz-fusion!" - TISM






_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

--
Andrew Beekhof


"If it weren't for my horse, I wouldn't have spent that year in college" - Unknown, courtesy of Lewis Black

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

--

Andrew Beekhof


"Eating fruit is mean and vicious... keep your hands off Golden Delicious" - TISM




_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________

--

Andrew Beekhof


"Ooo Ahhh, Glenn McRath" - TISM



_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to