2009-10-28 16 views
5

Özniteliği xmlns="http://webdev2003.test.com" özniteliğini xsl/xslt kullanarak SSIS'deki XML Görevi'ni kullanarak aşağıdaki xml'den kaldırmaya çalışıyorum. Büyük bir dosya boyutunu göz önünde bulunduran uygun bir metodoloji. ~ 40mbRmove xmlns özniteliği

<?xml version="1.0" encoding="utf-16"?> 
<ArrayOfAccount xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">  
<Account> 
    <FirstName xmlns="http://webdev2003.test.com/">John</FirstName> 
    <LastName xmlns="http://webdev2003.test.com/">Smith</LastName> 
</Account> 
</ArrayOfAccount> 
+0

SSIS'de uygun ad alanı kullanımı yok mu? – Tomalak

cevap

0

Ne

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <xsl:template match="*"> 
    <xsl:element name="{name()}"> 
     <xsl:apply-templates select="attribute::*"/> 
     <xsl:if test="namespace-uri()!='http://webdev2003.test.com/' and 
       namespace-uri()!=''"> 
     <xsl:attribute name="xmlns"> 
      <xsl:value-of select="namespace-uri()"/> 
     </xsl:attribute> 
     </xsl:if> 
     <xsl:apply-templates/> 
    </xsl:element> 
    </xsl:template> 

    <xsl:template match="@*"> 
    <xsl:attribute name="{name()}"> 
     <xsl:value-of select="."/> 
    </xsl:attribute> 
    </xsl:template> 
</xsl:stylesheet> 

hakkında? Ben kendi sorulara cevap zaman

+0

XML Not Defteri'nden bir hata alıyorum - Yerel adı 'xmlns' olan bir öznitelik ve bir boş ad alanı URI'si oluşturulamıyor. MSVS hatası içinde sırasıyla: Yerel adı 'xmlns' olan ve boş bir ad alanı URI'si oluşturulamadı. – decompiled

1

this article'da açıklandığı gibi ad alanı bildirimlerini kaldırabilirsiniz. Stil sayfanızda, hariç tutma sonucu önekleri özniteliğine eklemeden önce ad alanı için bir önek bildirmeniz gerekebilir.

You can prevent this from happening with the xsl:stylesheet element's exclude-result-prefixes attribute. This attribute's name can be confusing, because the namespace prefixes will still show up in the result tree. It doesn't mean "exclude the prefixes in the result"; it means "exclude the namespaces with these prefixes".