[MOBY] [MOBY-l] parsing superset objects?

Mark Wilkinson markw at illuminae.com
Sun Oct 19 09:00:06 EDT 2003


On Sat, 2003-10-18 at 23:10, Ken Steube wrote:
> Question:
> 
>   My service is receiving a GenericSequence, but somebody sends it a
>   DNASequence which is acceptable for my service.  How do I parse the
>   XML because I don't really know what is the main tag? The tag
>   surrounding the sequence could be GenericSequence or DNASequence
>   or any other inheriting object so I don't know what to look for.

You can parse it structurally (in both DNASequence and GenericSequence
the Length and SequenceString are child-elements of the main element.

You can also use the getNodeContentWithArticle() method of
MOBY::CommonSubs (as we were doing in our conversation last week)

>   I'm thinking in this case we have to use a named argument so that
>   you can get the <Simple articleName='mySequence'> object and then
>   its child to locate the sequence object.


There is no discussion to be had v.v. the naming of the Length (Integer)
and Sequence (String) elements since these are stated in the Class
definition; they *must* be there, and they *must* have those names (i.e.
your "mySequence" articleName is invalid).

>   Once you have it you have to find within the correct string and integer
>   for the data. You can only do this reliably if they are named with
>   their own articleName attributes.

this is part of their Class definition, so they always will be.

M


-- 
Mark Wilkinson <markw at illuminae.com>
Illuminae



More information about the moby-l mailing list