Re: [xml] suggestion with libxml

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Mon Jun 28 1999 - 08:01:18 EDT


  Hi Hilaire,

> I may use libxml to parse xml file format for an interactive geometry
> application.
> I've a couple of question.
> Here are examples - valid ? - to define points :
>
> <freepoint label="A" x="1.3" y="10" />

  ok

> <freepoint label="B" x="13" y="10" />

  ok
  
> <middle label="I" point="A" point="B"/>

  Wrong.

> The 1st things I don't like is I need to define different tags for each
> kind of point (and there is a lot) althought this is always point I
> define. Do I have the choice ?

  You can either express your semantic:
    - in the tag name
    - using an extra attribute defining the type, i.e.the kind of point
    - use the structure to express the semantic

> The 2nd things. Is it valid, in the middle definition, to have twice the
> point attribut ? Or should I write somethings like :
>
> <middle label="I" point1="A" point2="B"/>

   Yes you will have to change a given attribute can occur only once
   other (suggested) way:
   <middle label="I">
       <point value="A"/>
       <point value="B"/>
   </middle>
   Basically it uses the structure to express the relationship, that's
IMHO the best method to use, it scale and can be extended to other
relationships.

> This appear to be more easy to parse this with libxml but may be less
> readble/conistant for users
>
> The situation is even worst with intersection point:
> Here the intersection of line & cercle ; segment & half-line :
>
> <intersection label="A" line="(MN)" circle="(C1)" k="1" />
> <intersection label="B" segment="[MN]" halfline="[OP)" />

  Same
    <intersection label="A" k="1">
       <line value="(MN)"/>
       <circle value="(C1)"/>
    </intersection>

> This really look like a nightmare to parse with libxml as there is 10th
> kind of intersection point.
>
> Alternatively I could make a horrible things like this :
>
> <intersection_line_circle label="A" line="(MN)" circle="(C1)" k="1" />
> <intersection_segment_halfline label="B" segment="[MN]" halfline="[OP)" />
>
> Horrible for the users but easy to parse.
>
> Any ideas, suggestion ?

  use the structure to express the logical concepts. It won't be harder to parse
is expendable, and basically makes sense ...

Daniel

-- 
	    [Yes, I have moved back to France !]
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux, WWW, rpmfind,
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | rpm2html, XML,
http://www.w3.org/People/W3Cpeople.html#Veillard | badminton, and Kaffe.
----
Message from the list xml@rufus.w3.org
Archived at : http://rufus.w3.org/veillard/XML/messages
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rufus.w3.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:39 EDT