xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arvind Bassi <arvind_ba...@yahoo.co.uk>
Subject Embedding XML within XML Problem
Date Wed, 04 Apr 2001 17:22:00 GMT
There are two questions located at the base of this email.

The project that l am working on at present, has the following flow:

1. Obtain external XML
2. Transform external XML to internal XML format, with external XML
embedded inside internal XML
3. Process transaction inside internal XML document (as part of this
store the external XML document embedded inside)
4. Obtain query results from database and produce an internal XML
5. Transform this internal XML document to an external XML format
6. Send external XML

I am using Xalan-J, and my parser is Xerces-J which ships with it.

I have handled (or tried to handle) the embedding and extraction of the
external XML as so:

1. I have embedded the external XML inside a tag called <Message_type>.
The external XML is wrapped inside a CDATA Section.
2. I have tried to extract the CDATA section using Xerces-J.

However, when Xerces-J encounters the CDATA Section it treats the
opening CDATA clause as a Node.PROCESSING_INSTRUCTION_NODE, aswell as
the closing CDATA clause. The embedded XML document is treated like a
document fragment, and thus l would need to iterate through it and use
code to generate a String from it.

Therefore, this has come to an impasse.

Is there a better way to handle this situation of embedding an XML
document, and later retrieving it?

Moreover, what is the most efficient way of converting a whole
Document() into a String? I do not know how to do this, e.g.

    public String getStringFromDocument(Document doc){

        String s = null;

        ???????????? s = doc ?????????????

        return s;

I was wondering if l can transform the whole Document() into a String,
then l could use String manipulation methods to isolate the CDATA
Section and extract the original XML document as a String.

Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message