Customer Portal

How do I exclude xml elements without wildcards?

Comments 5

  • Avatar
    imriskal
    0
    Comment actions Permalink
    Hi, eneric,

    If you do not want to write some empty element, you can use "Write null element" property. This setting is available after clicking on some element in Mapping window.

    And regarding your first question, what exactly are you trying to do? Where are you specifying the attributes and how should the result look like? If your attribute does not have the same name as metadata field, you can map it specifically with the arrow.

    Best regards,
  • Avatar
    eneric
    0
    Comment actions Permalink
    Thanks for the quick reply!

    I tried setting that flag and it did not work as expected. I tried setting it to both false and true and I still get empty elements like:

    <wd:Address_Line wd:Type="ADDRESS_LINE_4" wd:Descriptor="Address Line 4"/>

    Is it because within the element there are static attributes? Do I need to add a binding or set some other property?

    I tried not outputting any data to that field and it still writes the empty element with the attributes.

    Have attached a new screenshot:
  • Avatar
    imriskal
    0
    Comment actions Permalink
    Hello, eneric,

    You are right, if binding is done on parent element, static attributes are saved even if element is empty. This behavior is correct. It is inconvinient in your case but there is an option how to prevent the empty element from appearing in output file.

    The easiest way is to set filter expression on binding to something like !isnull($in.0.address_line_1). See my example graph nr. 1 for more details. However, this solution has one flaw - there is a bug (https://bug.javlin.eu/browse/CLO-1042) preventing you from making such conditions on data from input ports other than 0. If you do not need such expression, you can use this procedure.

    The second option is more time-consuming but it does not require filter expression. You have to create one edge for each child element. See my example graph nr. 2 for more details.

    I hope you will find at least one of the examples useful.

    Best regards,
  • Avatar
    eneric
    0
    Comment actions Permalink
    Thanks Lubos!

    Creating a new port for each element I don't want written is going to be prohibitive, but I really appreciate knowing about the workaround.

    The port filter seems to be the solution, but I would need it on port 1, so the bug is a bummer. I hope it gets fixed.

    What I did in the short term was open the output file in a text editor and do a regex to remove .*?/> lines from the file.

    Is there an easy way to do this with the structured data component?
  • Avatar
    imriskal
    0
    Comment actions Permalink
    Hi, eneric,

    If everything goes well, this fix will be a part of our next 3.5.M1 release. But your regexp is a nice workaround for now.

    If you mean StructuredDataWriter, I can't see any easy way. Would not be easier if you switched input edges on XMLWriter? Is it possible in your graph?

    Best regards,

Please sign in to leave a comment.