Discussion:
[XOM-interest] Validating after parsing?
org.ibiblio.lists.xom-interest
2011-04-07 12:10:18 UTC
Permalink
Hello.

Currently, I'm doing the following:

xv = BuilderPool.GLOBAL_POOL.getMSVBuilder(new File(schema_path).toURI());

... where schema_path points to the RELAX-NG file I'm validating XML against.

And then:

doc = xv.build (data);

... where data is an input stream containing XML data.

The problem: I'd like to read and parse an XML tree BEFORE validating. There
doesn't really seem to be a way to do this beyond re-serializing the tree to
a stream and then calling the above (which seems a pretty roundabout way of
doing things).

Any ideas?
denis queffeulou
2011-04-07 13:56:18 UTC
Permalink
Hi,

I'm wondering why the Serializer setLineSeparator method doesn't accept
an empty String.

Is is mandatory in XML to have line end returns ?

I found this rather rigid as I'm using XOM to generate content for
mobile phone, I'd like to strip end of line characters to save bytes.

--
Denis Queffeulou
Elliotte Rusty Harold
2011-04-09 11:56:33 UTC
Permalink
On Thu, Apr 7, 2011 at 9:56 AM, denis queffeulou
Post by denis queffeulou
Hi,
I'm wondering why the Serializer setLineSeparator method doesn't accept
an empty String.
Is is mandatory in XML to have line end returns ?
No but there is a difference between white space and no white space,
and sometimes between a space and a line separator. If you don't want
line breaks in your XML, then you need to not add them in the model
and don't use pretty printing from the serializer.
--
Elliotte Rusty Harold
elharo at ibiblio.org
Loading...