Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] BNUX Question

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: Galip Aydin <gaydin AT grids.ucs.indiana.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] BNUX Question
  • Date: Tue, 11 Apr 2006 22:29:09 -0700

That's not a wellformed XML document, hence can't be constructed with XOM, hence can't be serialized (whether using bnux or not).
A namespaced element has a qualified name and a namespace URI; the latter is missing in your example. Thus, XOM raises an exception even before bnux even comes comes into play, probably on

new Element("gml:featureMember")

Rather, you'd have to construct namespace'd elements like this:

new Element("gml:featureMember", "http://www.opengis.net/gml";)

Although it's not really necessary you can also add a namespace declaration via

element.addNamespaceDeclaration("gml", "http://www.opengis.net/gml";)

Wolfgang.


On Apr 11, 2006, at 8:37 PM, Galip Aydin wrote:

Wolfgang,
Thanks for the reply. I am trying to serialize individual GML fragments
which do not contain namespace declarations, as following;
<gml:featureMember>
<Entity>
<Bus>
<location>
<gml:Point srsName="null">
<gml:coord>
<gml:X>-82.3773</gml:X>
<gml:Y>28.0804</gml:Y>
<gml:Z>1.0</gml:Z>
</gml:coord>
</gml:Point>
</location>
</Bus>
</Entity>
</gml:featureMember>

When I use the method described in the samples it gives an error about the
namespace gml. So what is the best way to convert this XML fragment to bnux?
Thanks again,
Galip.


----- Original Message -----
From: "Wolfgang Hoschek" <wolfgang.hoschek AT mac.com>
To: "Galip Aydin" <gaydin AT grids.ucs.indiana.edu>
Cc: <xom-interest AT lists.ibiblio.org>
Sent: Tuesday, April 11, 2006 11:03 PM
Subject: Re: [XOM-interest] BNUX Question


On Apr 11, 2006, at 7:49 PM, Galip Aydin wrote:

Hi All
I I am trying to use bnux in a GIS project to compress very large GML
documents. GML documents are XML files with geographic information
encoded according to OpenGIS standards. However because of the current
architecture I am having trouble using bnux, and I was wondering if
anybody has a suggestion. Here is the problem:
I am creating GML documents from MySQL ResultSets. There are several
namespace declaration at the top of the GML documents and several
hundred <gml:featureMember> elements. Each featureMember element is
created using an individual database results. The system works as
follows: I am retrieving the results from the MySQL database in a
streaming fashion, for each result creating a featureMember element and
publishing this to a publish/subscribe messaging system topic. The
client accumulates the results to construct the whole GML document.
However since each featureMember element does not contain the namespace
declarations I can't use bnux.
Now, is there a way to create a Streaming Serializer Factory by
providing the namespaces once and use it to compress elements of that
document as they become available?

Thanks in advance for any suggestions.
Galip.


I'm not sure I understand the problem. On deserialization, bnux recreates
whatever has been given to it before on serialization, including
namespaces. There's no loss of information.

It works by feeding normal XOM nodes such as elements into bnux. Each XOM
element can have namespaces, but it need not. Such namespaces can be
given in the Element constructor and via
Element.addNamespaceDeclaration(). In streaming fashion, you'll use a
StreamingSerializer obtained from
StreamingSerializerFactory.createBinaryXMLSerializer() to write bnux
format. There's an example in the javadoc for StreamingSerializer.

BTW, you might want to get started with the bin/fire-bnux command line
test tool, converting bnux to and from XML. You might also want to run
the testsuite via "ant download-testdata test-bnux".

Wolfgang.


_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest





Archive powered by MHonArc 2.6.24.

Top of Page