![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: importing a node and resolving namespace prefixes >Thread Next - Re: importing a node and resolving namespace prefixes Re: importing a node and resolving namespace prefixesTo: NULL Date: 9/5/2006 7:45:00 AM Thanks for the info. It's really helpful. Now I just have to study XSLT. :) One more question, performance-wise is it faster with XSLT than recreating the nodes? "Joe Fawcett" wrote: > You can't directly. You will have to recreate the nodes in the new document > based on the local name of the elements, the new namespace and any text node > values etc. > This sort of problem is usually solved more easily by XSLT, especially if > you can use version 2.0 which has better namespace handling options. > > -- > > Joe Fawcett - XML MVP > > > http://joe.fawcett.name > "K Lao" <KLao@d...> wrote in message > news:32F1DD6C-C37C-4C81-BEED-5C7004D3D032@m...... > >I am using IXMLDOMDocument3's importNode() and appendchild() to copy a node > > from one XML document to another. However, the node being copied (deep > > copy) > > still uses the namespace prefixes of the source doc. How do I make the > > node > > copied to the dest doc use the dest doc's namespace prefixes? > > > > Example: > > > > Source XML: > > <?xml version="1.0" encoding="UTF-8"?> > > <psf:PrintTicket > > xmlns:psf="http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1" > > xmlns:ns0000="http://schemas.something.com" > > xmlns:psk="http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"> > > <psf:Feature name="psk:JobOutputBin"> > > <psf:Option name="ns0000:DestPrinterDefault"/> > > </psf:Feature> > > </psf:PrintTicket> > > > > Destination: > > <?xml version="1.0" encoding="UTF-8"?> > > <psf:PrintTicket > > xmlns:psf="http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1" > > xmlns:ns0000="http://schemas.something.com" > > xmlns:kxd000="http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"> > > </psf:PrintTicket> > > > > Note that the namespace prefix psk in Source XML is now kxd000 in the Dest > > XML > > > > Result I am getting: > > <?xml version="1.0" encoding="UTF-8"?> > > <psf:PrintTicket > > xmlns:psf="http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1" > > xmlns:ns0000="http://schemas.something.com" > > xmlns:kxd000="http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"> > > <psf:Feature name="psk:JobOutputBin"> > > <psf:Option name="ns0000:DestPrinterDefault"/> > > </psf:Feature> > > </psf:PrintTicket> > > > > The namespace prefixes are not resolved. > > > > What can I do to fix this? > > > | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
