Jump to content
We've recently updated our Privacy Statement, available here ×

Xml format


wordpressego
Go to solution Solved by Raphaël Peguet,

Recommended Posts

Hi,

I am trying to get Jaspersoft Studio to convert an xml file to a pdf file.

If I take a very simple xml with a few tags in it, I have no problems.

But with the below format, I run into issues.
I would like to take the fields and value and be able to work with it in the designer, but I am not able to get
Jaspersoft Studio  to read the fields and values through the xml data adapter. It is as if the file is simply too complex for the Jaspersoft Studio?
Would really appreciate comments or any tips/advice. 
The xml shown below is a standard when doing business with governments and the like in Scandinavia.
The below is more complex then just standard xml tags, so is this task at all doable ? 

Thx in advance. 

Best Regards

Thomas.

<Invoice xmlns="http://rep.oio.dk/ubl/xml/schemas/0p71/pie/" xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/" xmlns:main="http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://www.w3.org/1999/xhtml">
    <com:ID>12345678</com:ID>
    <com:IssueDate>2018-04-11</com:IssueDate>
    <com:TypeCode>PIE</com:TypeCode>
    <main:InvoiceCurrencyCode>DKK</main:InvoiceCurrencyCode>
    <com:Note></com:Note>
    <com:BuyersReferenceID schemeID="EAN"></com:BuyersReferenceID>
    <com:ReferencedOrder>
        <com:BuyersOrderID>Fiat somecompany</com:BuyersOrderID>
        <com:SellersOrderID>12233232</com:SellersOrderID>
        <com:IssueDate>2016-04-11</com:IssueDate>
    </com:ReferencedOrder>
    <com:BuyerParty>
        <com:ID schemeID="EAN">12345678</com:ID>
        <com:AccountCode></com:AccountCode>
        <com:PartyName>
            <com:Name>Somesupplier</com:Name>
        </com:PartyName>
        <com:Address>
            <com:ID>Fakturering</com:ID>
            <com:Street>Ålborg</com:Street>
            <com:AdditionalStreet>Some street 89</com:AdditionalStreet>
            <com:HouseNumber></com:HouseNumber>
            <com:CityName>Ålborg</com:CityName>
            <com:PostalZone>7000</com:PostalZone>
            <com:Country>
                <com:Code listID="ISO 3166-1">DK</com:Code>
            </com:Country>
        </com:Address>
        <com:BuyerContact>
            <com:ID></com:ID>
            <com:Name></com:Name>
            <com:Phone></com:Phone>
            <com:Fax></com:Fax>
            <com:E-Mail></com:E-Mail>
            <com:Role>Rekvirent</com:Role>
        </com:BuyerContact>
    </com:BuyerParty>
    <com:SellerParty>
        <com:ID schemeID="CVR">32232332</com:ID>
        <com:PartyName>
            <com:Name>The parts company</com:Name>
        </com:PartyName>
        <com:Address>
            <com:ID>Goodsdelivery</com:ID>
            <com:Street>Somestreet 21</com:Street>
            <com:HouseNumber></com:HouseNumber>
            <com:CityName>Copenhagen</com:CityName>
            <com:PostalZone>2300</com:PostalZone>
            <com:Country>
                <com:Code listID="ISO 3166-1">DK</com:Code>
            </com:Country>
        </com:Address>
        <com:PartyTaxScheme>
            <com:CompanyTaxID schemeID="CVR">12345678</com:CompanyTaxID>
        </com:PartyTaxScheme>
        <com:OrderContact>
            <com:ID>6000</com:ID>
            <com:Name>Webordre (53)</com:Name>
            <com:Phone>43434343</com:Phone>
            <com:Fax>34434334</com:Fax>
            <com:E-Mail>some@email.com</com:E-Mail>
        </com:OrderContact>
    </com:SellerParty>

 

 

 

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution

Hi,

Your XML data source contains namespaces.
Using Jaspersoft Studio 6.4.X or 7.X you need to:

  • enable namespace support in the data adapter

screen_shot_2018-05-11_at_12_42.13_0.png.aa5ae7b50352a8c46a434ebc2bb11380.png

  • In the query use the following syntax to manage namespaces as described in https://stackoverflow.com/questions/4440451/how-to-ignore-namespaces-with-xpath for example.
    /*[local-name()=Invoice]/*

     

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...