Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

looking for tdom help in merging two schemas into one


I've got two xml schemas which look something like:

    <xs:schema xmlns:xs1="http://www.w3.org/2001/XMLSchema"  ...>
       ...
    </xs:schema>
    <xs:schema xmlns:xs2="http://www.example.com" ...>
       ...
    </xs:schema>

I'm wanting to take these two separate schemas and merge them into one,
so the result would be:

    <xs:schema xmlns:xs1="..." xmlns:xs2="..." ...>
       ...
       ...
    </xs:schema>

So my question is, how can I pull out the namespace definitions from
each of the separate schemas? I can do "$root attributes" but what it
returns doesn't have all the information I want.

Do I even need to do this step or is there a tdom command I'm missing
that can merge these two schemas into one in one fell swoop?

I'm tempted just to use string commands to pull that stuff out, but
surely there must be a way to take advantage of tdom to do the work.

--
Bryan Oakley
http://www.tclscripting.com

I think maybe I just answered my own question. Funny how airing a
question out in public is sometimes all that is needed to jog a solution
loose.

The following seems to provide me with exactly the data I need:

   set doc [dom parse $schema]
   set root [$doc documentElement]
   array set attrs [lindex [$root asList] 1]

I get something that looks like this:

   attrs(xmlns:xs1)  = http://www.w3.org/2001/XMLSchema
   attrs(xmlns:xs2)  = http://www.example.com

So I think I can solve my problem with that (that, and a modicum of
bulletproofing...). Still, I'm interested to know if there are other
ways to do this.

--
Bryan Oakley
http://www.tclscripting.com

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc