ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pythoncard
pythoncard
Re: [Pythoncard-users] flatfileDatabase and XML
by Donnal Walter other posts by this author
Jan 11 2003 11:20PM messages near this date
[Pythoncard-users] flatfileDatabase and XML | [Pythoncard-users] PythonCard Questionnaire reminder
Yes, as far as I can see, the following is indeed valid XML:

>  <?xml version="1.0" encoding="UTF-8"?>
>  <records>
>      <rec Profile='http://biz.yahoo.com/p/a/a.html'
>           Phone='(650) 752-5000'
>           NumberOfEmployees='41,000'
>           Web='http://www.agilent.com'
>           Exchange='NYSE'
>           Company='Agilent Technologies Inc.'
>           Address='395 Page Mill
>                    Road\nPalo Alto,
>                    CA 94306'
>           Symbol='A' >
>      </rec>
>      <rec> ...
>      </rec>
>  </records>

However, it is only one of two strategies for serializing data in
XML. Here the data are stored as ATTRIBUTES of an XML tag. The
alternative is to store the data as the CONTENT of tags:

<recordlist> 
    <rec> 
        <Profile> http://biz.yahoo.com/p/a/a.html</Profile>
        <Phone> (650) 752-5000</Phone>
        <NumberOfEmployees> 41,000</NumberOfEmployees>
        <Web> http://www.agilent.com</Web>
        <Exchange> NYSE</Exchange>
        <Company> Agilent Technologies Inc.</Company>
        <Address> 
            <line> 395 Page Mill</line>
            <line> Road\nPalo Alto</line>
            <line> CA 94306</line>
        <Symbol> A</Symbol>
    </rec> 
</recordlist> 

There are pros and cons to each approach, and it is possible to mix
strategies, where attributes are used for, well, attributes of the
data such as language or time zone and the true data are contained
in the content.

For a long time I was quite enamoured with XML as a possible data
serialization format for a project on which I am working, but the
first problem I encountered was dealing with user defined classes.
After finding a way to overcome this problem, I ran into problems
with how to serialize a list of objects where the objects can be of
different classes. Finally, I quit when I realized that some of my
lists referenced objects that also need to be referenced in a
separate list for some reason.

When I gave up on XML I went back to pickling, but since then I
have been following YAML (yaml.org) as a possible alternative that
is both human and machine readable and better designed for data
serialization than XML.

YMMV 




=====
Donnal Walter
Arkansas Children's Hospital

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Pythoncard-users mailing list
Pythoncard-users@[...].net
https://lists.sourceforge.net/lists/listinfo/pythoncard-users
Thread:
Kevin Altis
Donnal Walter

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved