Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Playing with the underlying storage

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Trimmer, Todd" <todd.trimmer AT trizetto.com>
  • To: "XOM list (E-mail)" <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] Playing with the underlying storage
  • Date: Thu, 10 Apr 2003 11:51:31 -0600

Let's say three different systems use XML in wildly different ways:


System 1 often concentrates on a large group of sibling elements at one
time. It does sequential reads and random access reads by position.
ArrayLists behoove it.

System 2 does a lot of adds of new Elements and removes of old Elements
under the same parent. LinkedLists behoove it.

System 3 does a lot or random access by tag name and/or attribute value (key
lookup). Maps behoove it.


What if there was an OM that let you at parse time request what type of
storage the Nodes will be placed under? The same operations would exist
under each of them. You can still use solid classes; no need for interfaces.
What would the ramifications be? Would the Documents become interoperable?
Would they fall under the same serialization curses that DOM did?

I know playing with the underlying storage is not a goal of XOM. But I was
trying to construct a reason why a vendor would not want to stick to
consistently using the same XML API everywhere. The vendor might need some
more optimization in critical areas. This puts a huge strain on the
programmers working for said vendor.

I was wondering if it was even possible for an OM to try to accomodate the
three cited needs above and yet still provide one clear public API all the
time -- transparently.



Todd Trimmer
>From CustomPrintGoods AT netscape.net Thu Apr 10 14:31:50 2003
Return-Path: <CustomPrintGoods AT netscape.net>
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from sbs2000.ywt.com.tw (61-221-176-153.HINET-IP.hinet.net
[61.221.176.153])
by happyhouse.metalab.unc.edu (Postfix) with ESMTP id 833922001D
for <xom-interest AT lists.ibiblio.org>;
Thu, 10 Apr 2003 14:31:48 -0400 (EDT)
Received: from smtp0211.mail.yahoo.com ([66.170.166.245]) by
sbs2000.ywt.com.tw with Microsoft SMTPSVC(5.0.2195.5329);
Fri, 11 Apr 2003 02:30:28 +0800
Date: Thu, 10 Apr 2003 18:31:29 GMT
From: CustomPrintGoods AT netscape.net
X-Priority: 3
To: xom-interest AT lists.ibiblio.org
Mime-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: base64
Message-ID: <SBS2000pMgUUDig6opN0000b642 AT sbs2000.ywt.com.tw>
X-OriginalArrivalTime: 10 Apr 2003 18:30:29.0437 (UTC)
FILETIME=[434DBED0:01C2FF8F]
Subject: [XOM-interest]
Custom Printed T-Shirts $2.10 - Embroidered Golf Shirts $11.95
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Apr 2003 18:31:50 -0000

PGh0bWw+DQoNCjxib2R5IGJnY29sb3I9IiNGRkZGRkYiPg0KDQo8cCBhbGlnbj0iY2VudGVyIj48
Zm9udCBzaXplPSIzIiBmYWNlPSJWZXJkYW5hIj48c3Ryb25nPllPVVIgTE9HTzwvc3Ryb25nPg0K
YWZmb3JkYWJseSBwcmludGVkIG9uIHF1YWxpdHkgSGFuZXMgR29sZiBTaGlydHMgJmFtcDsgVGVl
IFNoaXJ0czwvZm9udD48L3A+DQoNCjxkaXYgYWxpZ249ImNlbnRlciI+PGNlbnRlcj4NCg0KPHRh
YmxlIGJvcmRlcj0iMCIgY2VsbHBhZGRpbmc9IjQiIGNlbGxzcGFjaW5nPSIwIj4NCiAgICA8dHI+
DQogICAgICAgIDx0ZCBhbGlnbj0iY2VudGVyIiB2YWxpZ249InRvcCIgYmdjb2xvcj0iI0ZGRkYw
MCI+PGZvbnQNCiAgICAgICAgY29sb3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j4NCjwvZm9udD48Zm9udCBmYWNlPSJBcmlhbCxIZWx2ZXRpY2EiPjU1OSBTLiBI
aWdobGFuZCBTdHJlZXQgKg0KTWVtcGhpcywgVE4gMzgxMTE8L2ZvbnQ+IDxicj4NCjxmb250IGZh
Y2U9IkFyaWFsLEhlbHZldGljYSI+OTAxLTMyNy01NDU2PC9mb250PjwvcD4NCg0KPHAgYWxpZ249
ImNlbnRlciI+Jm5ic3A7PC9wPg0KDQo8cCBhbGlnbj0iY2VudGVyIj4mbmJzcDs8L3A+DQoNCjxw
Pjxmb250IHNpemU9IjIiIGZhY2U9IlZlcmRhbmEiPldlIGhvbm9yIHRoZSByZW1vdmFsIHJlcXVl
c3RzDQp0aGF0IHdlIHJlY2VpdmUuPGJyPg0KVG8gYmUgcmVtb3ZlZCBmcm9tIGZ1dHVyZSBtYWls
aW5ncywgcGxlYXNlIGVtYWlsIHVzIGF0IDwvZm9udD48YQ0KaHJlZj0ibWFpbHRvOkRvTm90Q29u
dGFjdFVzQGV4Y2l0ZS5jb20iPjxmb250IHNpemU9IjIiDQpmYWNlPSJWZXJkYW5hIj48c3Ryb25n
PkRvTm90Q29udGFjdFVzQGV4Y2l0ZS5jb208L3N0cm9uZz48L2ZvbnQ+PC9hPjxmb250DQpzaXpl
PSIyIiBmYWNlPSJWZXJkYW5hIj48c3Ryb25nPjxicj4NCg0Kd2l0aCB0aGUgYWRkcmVzcyB5b3Ug
d2FudCByZW1vdmVkIDwvc3Ryb25nPjxlbT48c3Ryb25nPnR5cGVkIGludG8NCnRoZSBTdWJqZWN0
IExpbmUgb2YgeW91ciBlbWFpbDwvc3Ryb25nPjwvZW0+PC9mb250PjwvcD4NCjwvYm9keT4NCjwv
aHRtbD4=
>From elharo AT metalab.unc.edu Thu Apr 10 15:09:25 2003
Return-Path: <elharo AT metalab.unc.edu>
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from mail.speakeasy.net (mail11.speakeasy.net [216.254.0.211])
by happyhouse.metalab.unc.edu (Postfix) with ESMTP id A68BF2007F
for <xom-interest AT lists.ibiblio.org>;
Thu, 10 Apr 2003 15:09:24 -0400 (EDT)
Received: (qmail 32404 invoked from network); 10 Apr 2003 19:09:31 -0000
Received: from unknown (HELO [192.168.254.4]) ([216.254.85.72])
(envelope-sender <elharo AT metalab.unc.edu>)
by mail11.speakeasy.net (qmail-ldap-1.03) with SMTP
for <todd.trimmer AT trizetto.com>; 10 Apr 2003 19:09:31 -0000
Mime-Version: 1.0
X-Sender: elharo AT mail.ibiblio.org
Message-Id: <p04330101babb713b9f34@[192.168.254.4]>
In-Reply-To: <89297B2626BD5541B479C42E9599B6245D6952@s-coengl-e05>
References: <89297B2626BD5541B479C42E9599B6245D6952@s-coengl-e05>
Date: Thu, 10 Apr 2003 15:06:57 -0400
To: "Trimmer, Todd" <todd.trimmer AT trizetto.com>,
"XOM list (E-mail)" <xom-interest AT lists.ibiblio.org>
From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
Subject: Re: [XOM-interest] Sugar syntax
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Apr 2003 19:09:25 -0000

At 11:33 AM -0600 4/10/03, Trimmer, Todd wrote:
>If most of the methods of the Node and its ancestors are final, then why
>does sugar syntax hurt so much? It doesn't make a subclasser's job easier or
>harder.
>

Could you be more explicit? I'm not sure what you want to do.
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| Processing XML with Java (Addison-Wesley, 2002) |
| http://www.cafeconleche.org/books/xmljava |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
>From todd.trimmer AT trizetto.com Thu Apr 10 16:38:40 2003
Return-Path: <todd.trimmer AT trizetto.com>
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from sdc01-x08.trizetto.net (unknown [208.229.189.32])
by happyhouse.metalab.unc.edu (Postfix) with SMTP id 7EE3F20031
for <xom-interest AT lists.ibiblio.org>;
Thu, 10 Apr 2003 16:38:40 -0400 (EDT)
Received: by s-coengl-eb1.tzg.com with Internet Mail Service (5.5.2656.59)
id <23ASCXTW>; Thu, 10 Apr 2003 14:38:31 -0600
Message-ID: <89297B2626BD5541B479C42E9599B6245D6954@s-coengl-e05>
From: "Trimmer, Todd" <todd.trimmer AT trizetto.com>
To: 'Elliotte Rusty Harold' <elharo AT metalab.unc.edu>,
"XOM list (E-mail)" <xom-interest AT lists.ibiblio.org>
Subject: RE: [XOM-interest] Sugar syntax
Date: Thu, 10 Apr 2003 14:38:15 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2656.59)
Content-Type: text/plain;
charset="iso-8859-1"
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Apr 2003 20:38:41 -0000

> -----Original Message-----
> From: Elliotte Rusty Harold [mailto:elharo AT metalab.unc.edu]
> Sent: Thursday, April 10, 2003 2:07 PM
> To: Trimmer, Todd; XOM list (E-mail)
> Subject: Re: [XOM-interest] Sugar syntax
>
>
> At 11:33 AM -0600 4/10/03, Trimmer, Todd wrote:
> >If most of the methods of the Node and its ancestors are
> final, then why
> >does sugar syntax hurt so much? It doesn't make a
> subclasser's job easier or
> >harder.
> >
>
> Could you be more explicit? I'm not sure what you want to do.
>


Let's say I propose an absolutely ridiculous and facetious method to be
added to Element. Like getThirdComment(). I can implement this in two ways:
high-level and low-level.

The high-level way will simply build off of other public API:

public Comment getThirdComment()
{
Node child;
int nComment = 0;
for (int i = 0; i < getChildCount(); ++i)
{
child = getChild(i);
if (child instanceof Comment)
{
++nComment;
if (nComment == 3)
return (Comment)child;
}
}

return null;
}

The low-level way attacks the underlying storage directly:

public Comment getThirdComment()
{
Node child;
int nComment = 0;

ListIterator liter = children.listIterator();
while (liter.hasNext())
{
child = liter.next();
if (child instanceof Comment)
{
++nComment;
if (nComment == 3)
return (Comment)child;
}
}

return null;
}

Now a subclass comes along. He sees getThirdComment(),
getLastProcessingInstruction(), and all kinds of funky stuff. He thinks,
"Great Scott! I have to potentially override all that??!?"

This was a problem in JDOM. If you wanted to subclass Element to represent
every tag in your ML, it took a good while to override all the sugar syntax
methods. If you neglected to, the code might compile anyway, but the
ancestor version of those convenience methods might wind up doing something
nonsensical for your derivative. You had to very diligent.

A low-level written base method might make the subclasses write the WHOLE
METHOD from scratch if the underlying storage was different. The
optimizations in the low-level method in the base class are wiped out in the
override.

A high-level written base method would often warrant the subclasses to do:

public Comment getThirdComment()
{
// pre-processing
...

Comment result = super.getThirdComment();

// post-processing
...

return result;
}

Since the high-level way builds off of public API, any changes done to
getChild(int), getChildCount() would propogate to getThirdComment() for
free. This might make the subclasser think he can get away with no having to
override the convenience methods AT ALL.

But what if they way the public API is being used is highly inefficient for
that subclass? What if every call to getChildCount() inside the for loop in
getChildCount() caused a dB query? Or to pull result from a source over a
network?

The point I am trying to make is that cases like these are minimized in XOM,
because most of the methods are final anyway. And the underlying storage is
private. So it would very difficult for a subclasser to make an inherited
convenience method become very non-performant without his knowledge. If the
convenience method is optimized in the base, the chances are very good
indeed it will still be optimized in the derivative. The final/private use
lets us say this with confidence.

This is what I mean when I say it doesn't hurt to add sugar syntax /
convenience methods to XOM as nearly as much as it does in JDOM.

I do realize this is a rather pointless exercise. There are other
philosophical reasons for not wanting a plethora of convenience methods. I
don't think any programmer will satisfied with an OM he didn't roll his own.
At least in Java. I do believe I will be forever doomed to functionally
program XML with library functions passing in the Nodes I want to modify.
Digesting the markup into model-specific JavaBeans as early on as possible
should minimize the pain.

Having said that, I am seeing the wisdom of the micro-kernel approach more
and more. Except for the danged nulls ;-)

Simply because I don't have the oportunity to create a contextual message
saying WHY the sought after item was not present. A diagnostic trace if you
will. Even if all I wanted to do was a DEBUG level commons logging message
before the null return, I can't. The methods are final. Maybe if there were
were protected preX() and postX() hooks inside these methods. A subclass
still can't tamper with the storage or make the document non-well formed.
The base class would no nothing inside these hooks.

public class nu.xom.ParentNode
{
...
public final Node getChild(int pos)
{
preGetChild(pos);
final Node child = children.get(pos);
postGetChild(pos, child);

return child;
}

protected void preGetChild(final int pos) {}

protected void postGetChild(final int pos, final Node child) {}
...
}

---

public class foo.FooElement extends nu.xom.Element
{
...
private static final org.apache.log4j.Category log =
Category.getLogger(FooElement.class);

protected void preGetChild(final int pos)
{
if (pos < 0)
{
log.warn("Position " + pos + " is less than zero.");
return;
}

if (pos >= getChildCount())
{
StringBuffer buf = new StringBuffer("Position ").
append(pos).
append(" is greater than or equal to the children size
(").
append( getChildCount() ).
append(") of Element ");

StringBuffer bufPath = new StringBuffer(getQualifiedName());

Node node = this;
while (node.getParent() != null)
{
node = node.getParent();
if (node instanceof Element)
{
bufPath.insert(0, '/');
bufPath.insert(0, ((Element)node).getQualifiedName()
);
}
}

String msg = buf.append(bufPath).append('.').toString();
log.warn(msg);
}
}
...
}


Todd Trimmer
>From elharo AT metalab.unc.edu Thu Apr 10 16:52:12 2003
Return-Path: <elharo AT metalab.unc.edu>
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from mail.speakeasy.net (mail13.speakeasy.net [216.254.0.213])
by happyhouse.metalab.unc.edu (Postfix) with ESMTP id 071612002C
for <xom-interest AT lists.ibiblio.org>;
Thu, 10 Apr 2003 16:52:12 -0400 (EDT)
Received: (qmail 3683 invoked from network); 10 Apr 2003 20:52:19 -0000
Received: from unknown (HELO [192.168.254.4]) ([216.254.85.72])
(envelope-sender <elharo AT metalab.unc.edu>)
by mail13.speakeasy.net (qmail-ldap-1.03) with SMTP
for <todd.trimmer AT trizetto.com>; 10 Apr 2003 20:52:19 -0000
Mime-Version: 1.0
X-Sender: elharo AT mail.ibiblio.org
Message-Id: <p04330100babb89684d78@[192.168.254.4]>
In-Reply-To: <89297B2626BD5541B479C42E9599B6245D6954@s-coengl-e05>
References: <89297B2626BD5541B479C42E9599B6245D6954@s-coengl-e05>
Date: Thu, 10 Apr 2003 16:51:13 -0400
To: "Trimmer, Todd" <todd.trimmer AT trizetto.com>,
"XOM list (E-mail)" <xom-interest AT lists.ibiblio.org>
From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
Subject: RE: [XOM-interest] Sugar syntax
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Apr 2003 20:52:12 -0000

At 2:38 PM -0600 4/10/03, Trimmer, Todd wrote:

>Simply because I don't have the oportunity to create a contextual message
>saying WHY the sought after item was not present. A diagnostic trace if you
>will. Even if all I wanted to do was a DEBUG level commons logging message
>before the null return, I can't. The methods are final. Maybe if there were
>were protected preX() and postX() hooks inside these methods. A subclass
>still can't tamper with the storage or make the document non-well formed.
>The base class would no nothing inside these hooks.


I don't have preX and postX, but I do have checkX methods that will
be called by any constructor and any method that can mutate a node.
But I guess you want these in getter methods as well, huh?
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| Processing XML with Java (Addison-Wesley, 2002) |
| http://www.cafeconleche.org/books/xmljava |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
>From todd.trimmer AT trizetto.com Thu Apr 10 17:11:17 2003
Return-Path: <todd.trimmer AT trizetto.com>
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from sdc01-x08.trizetto.net (unknown [208.229.189.32])
by happyhouse.metalab.unc.edu (Postfix) with SMTP id 6C80F20012
for <xom-interest AT lists.ibiblio.org>;
Thu, 10 Apr 2003 17:11:16 -0400 (EDT)
Received: by s-coengl-eb1.tzg.com with Internet Mail Service (5.5.2656.59)
id <23ASCZA5>; Thu, 10 Apr 2003 15:11:05 -0600
Message-ID: <89297B2626BD5541B479C42E9599B6245D6955@s-coengl-e05>
From: "Trimmer, Todd" <todd.trimmer AT trizetto.com>
To: 'Elliotte Rusty Harold' <elharo AT metalab.unc.edu>,
"XOM list (E-mail)" <xom-interest AT lists.ibiblio.org>
Subject: RE: [XOM-interest] Sugar syntax
Date: Thu, 10 Apr 2003 15:10:49 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2656.59)
Content-Type: text/plain;
charset="iso-8859-1"
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Thu, 10 Apr 2003 21:11:17 -0000

> -----Original Message-----
> From: Elliotte Rusty Harold [mailto:elharo AT metalab.unc.edu]
>
> I don't have preX and postX, but I do have checkX methods that will
> be called by any constructor and any method that can mutate a node.
> But I guess you want these in getter methods as well, huh?


Upon deeper reflection, I realized these contextual messages can be built
more appropriately in the application-specific model reflecting the
underlying XML, rather than be built inside the XOM itself. A lower-level
message about the XML won't tell the application user much. Again, your
micro-kernel approach stands strong. I obviously need to think more about
what is appropriate for that which is using XOM and that which is extending
XOM. Limiting XOM extensions to MLs is hopefully the key.


Todd Trimmer
>From g_a_l_l_a AT mail333.com Wed Apr 16 13:02:40 2003
Return-Path: <g_a_l_l_a AT mail333.com>
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from relay2.hotbox.ru (unknown [62.152.82.179])
by happyhouse.metalab.unc.edu (Postfix) with ESMTP id 1AB152009E
for <xom-interest AT lists.ibiblio.org>;
Wed, 16 Apr 2003 13:02:39 -0400 (EDT)
To: xom-interest AT lists.ibiblio.org
Date: 16 Apr 2003 21:06:23 +0400
Message-ID: <2003.04.16.50A162D8431939DC AT mail333.com>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
From: g_a_l_l_a AT mail333.com
Subject: [XOM-interest]
1067938978-ID: We are glad to inform you about the changes in our
website
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Wed, 16 Apr 2003 17:02:40 -0000

Dear Sir or Madam,
We are glad to inform you about the changes in our website
http://www.gallery-a.ru. Now you can get to know the price for the
paintings
in our gallery without filling the order form.
Also, we have new works of Utkin Alexandr, Belonog Anatoly and other
painters.
Soon there will be pages of new painters and new section of free wallpapers
and screensavers.
Welcome to our website!
Gallery-a curator.

Sorry if that information not interesting for You and we disturb You with
our message!
For removing yor address from this mailing list just replay this message
with word 'unsubscribe' in subject field
or simple click this link:

http://www.gallery-a.ru/unsubscribe.php?e=eG9tLWludGVyZXN0QGxpc3RzLmliaWJsaW8ub3JnOjE2NzgxMTk5






  • [XOM-interest] Playing with the underlying storage, Trimmer, Todd, 04/10/2003

Archive powered by MHonArc 2.6.24.

Top of Page