cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Exporting XML

carolynherlin
1-Newbie

Exporting XML



I have a need to pull selected information from my "master" XML file and write it to an XML file with a different DTD. I'll need a separate process to take information from that separate XML file and put it back in my "master." Does any one have suggestions about thebest way to go about this?



Thanks,

Carolyn Herlin


3 REPLIES 3

Hi Carolyn—



This sounds like a perfect job for XSLT. You can apply an XSLT tranformation in Arbortext pretty easily, and XSLT is designed for this sort of thing. You would need one transformation stylesheet for the export piece (“pull selected information from the ‘master’ XML file”), and another one for the import piece (“take information from the separate XML file and put it back in the ‘master’”).



You could also do it using ACL, or the Arbortext Object Model via Java, Javascript, or VBScript. Or, you could do it outside of Arbortext completely, using Perl or something like that.



It really depends on what kind of skills you have available, either yourself or in other staff you can assign to the task. If you don’t already know it, XSLT can have a bit of a learning curve to it. But then again, any other approach is going to involve some programming of one kind or another, so you’ll need someone with appropriate expertise to handle the implementation.



--Clay


Couple of routes to go with this.



If the "master" isn't terribly complex, I'd go with open(id,path) func
to create new doc fragment with doctype declaration pointing to
different DTD. Use while(getline(id,var)) {put(id,var)} with some
match/match_result funcs to just pull over what you're after.



If the structure is complex enough that a line-by-line pull might create
invalid structure, you'd probably be better off with doc_open(). I do
this a lot with larger documents, to keep from creating windows and
loading styles that bog down the machine with larger docs.



Some expanded definition on the structures you're working with and what
kind of information is being passed back and forth would help narrow
down some approaches.



HIH,



-Jason

I agree with Clay. XSL should be your first choice (barring, also as Clay
suggests, deep skills in any other technology that will work and little or
no skills in XSL).

I am always very wary of "round-tripping" where, I like to joke, the
operative term is "trip," as in it will trip you up. While this is sometimes
unavoidable, great care should be taken before committing to such a
workflow. Round-tripping is inherently fragile since the code supporting to-
and fro- is typically very, very tightly aimed at the narrowest successful
set of elements/attributes/features. Changes to either side of the trip can
cause problems, even seemingly unrelated changes. Applications (custom and
off-the-shelf) on both sides of the trip can become version bound when
scarce resources prevent the testing necessary to vet an upgrade. Etc. etc.
etc.

On Mon, Aug 16, 2010 at 12:20 PM, Carolyn Herlin
<->wrote:

> I have a need to pull selected information from my "master" XML file and
> write it to an XML file with a different DTD. I'll need a separate process
> to take information from that separate XML file and put it back in my
> "master." Does any one have suggestions about the best way to go about this?
>
>
>
> Thanks,
>
> Carolyn Herlin
>
>
>
>
Top Tags