Create structure xml in vb

0

I'm making the electronic signature of an xml and I need to get the following xml structure.

<ext:UBLExtensions>
    <ext:UBLExtension>
        <ext:ExtensionContent></ext:ExtensionContent>
    </ext:UBLExtension>
</ext:UBLExtensions>

This is the code I have made but I can not print the label "ExtensionContent"

    Dim a As New InvoiceType
    Dim b As New UBLVersionIDType
    Dim c As New CustomizationIDType
    Dim d As New ProfileIDType
    Dim f As New IDType
    Dim g As New IssueDateType


    Dim extensions As New UBLExtensionsType
    Dim arrayExtesion(2) As UBLExtensionType
    Dim extension As New UBLExtensionType
    Dim docFactura As New XmlDocument()

    b.Value = "3"
    c.Value = "2.0"
    d.schemeName = "AAA:Identificador de Tipo de Operación"
    d.schemeAgencyName = "AA:AAA"
    d.schemeURI = "rn:pe:gob:A:catalogo17"
    d.Value = "0101"
    f.Value = "F002-10"
    g.Value = "2017-04-28"

    a.UBLVersionID = b
    a.CustomizationID = c
    a.ProfileID = d
    a.ID = f
    a.IssueDate = g
    extensions.UBLExtension = arrayExtesion
    a.UBLExtensions = extensions.UBLExtension
    a.UBLExtensions(0) = extension
    a.UBLExtensions(1) = extension

    Dim path As String = "C:\Facturas-XML\a.xml"

    Dim serialization As XmlSerializer = New XmlSerializer(GetType(InvoiceType))

    Dim ns As XmlSerializerNamespaces = New XmlSerializerNamespaces()
    ns.Add("cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
    ns.Add("ds", "http://www.w3.org/2000/09/xmldsig#")
    ns.Add("ext", "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2")
    ns.Add("cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")


    Dim sXml As String = ""
    Dim sww As New StringWriterUtf8
    Dim writter As XmlWriter = XmlWriter.Create(sww)
    serialization.Serialize(writter, a, ns)        
    sXml = sww.ToString()

    docFactura.LoadXml(sXml)
    System.IO.File.WriteAllText(path, sXml)

This generates the following xml and as it is observed there is no ExtensionContent tag:

I enclose the class that generates from some .xsd files see the class click here

    
asked by mcastro1992 12.11.2018 в 05:37
source

0 answers