none
standalone="yes" in out xml document

    Question

  • I have used below line in my XSLT  to produce  <?xml version="1.0" encoding="UTF-8" standalone="yes"?> in my output xml

    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" version="1.0" standalone="yes"/>

    But I am not able to see standalone="yes" in my output  ??

    What am I missing ?


    MBH

    Thursday, December 03, 2015 10:19 PM

Answers

  • The "correct" way to do this is to write a pipeline component that will properly set the xml declaration and add the attribute you want.

    Another, but more or less equally good way, is to utilize the built-in functions in the xml pipeline. In your xml transmit pipeline for this send port, simply set AddXmlDeclaration to false, and then in the XmlAsmProcessingInstructions set the value to "<?xml version="1.0" encoding="utf-8" standalone="yes"?>" (i.e. your full xml declaration).

    This will disable the pipeline from writing its own xml declaration, and instead use the processing instructions functionality to write out your own "custom" xml declaration instead. Then you won't need to do any special code or components.

    • Marked as answer by JaguarsJag Tuesday, December 08, 2015 7:36 PM
    Monday, December 07, 2015 8:18 AM

All replies

  • So, you need to triple, then quadruple check this.

    The standalone attribute is relevant to DTD only.  If your contract is based on xsd, then standalone is irrelevant.

    Friday, December 04, 2015 2:50 AM
    Moderator
  • Hi John, can you explain more in detail ? My destination schema is regular schema, but the vendor required format output is in Java. So used XSLT to achieve this. Everything is been achieved, only in the output xml file standalone="yes" is missing. How can I achieve this ?

    MBH

    Friday, December 04, 2015 8:45 AM
  • if I test the Map, I am able to get standalone="yes"  attribute in the file. So, somewhere in send Pipeline XML assembler is disabling the property.

    Does anyone suggest how can this be enabled to appear in the output xml file ?

    <?xml version="1.0" encoding="utf-8" standalone="yes" ?> 
     <GPIntraDayPayments xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb" xsi:noNamespaceSchemaLocation="GPIntraDay.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <intraDayPayment>
      <custNo>31000000805</custNo> 
      <invNo>BSDM22699</invNo> 
      <amount>1930.74000000000000000000</amount> 
      <depositID>REFERENCE</depositID> 
      <depositDate>2015-09-21</depositDate> 
      </intraDayPayment>
      </GPIntraDayPayments>


    MBH

    Friday, December 04, 2015 9:27 AM
  • The standalone attribute is a hint to the parser about how it might have to handle the xml instance (document) because of constructs defined in a DTD.  DTD is the precursor to Xsd.

    If the owner of the Xml is using Xsd (the schema we're all familiar with and what is used by BizTalk Server), and not DTD since there practically exclusive, then the standalone attribute on the instance is irrelevant since there is no DTD to consider.  In other words, standalone cannot affect how an xsd is treated so it's presence and value don't matter.

    Simply, the standalone attribute is irrelevant to XSD Schema based documents.

    Have you even tried it?  Send the instance without it and see what happens.

    You have to contact the source and ask them directly if they need it.  If they do but are using Xsd, then they are requiring non-standard xml any you have to tell you management you need to spend extra time to accommodate their unique requirement.

    Friday, December 04, 2015 11:47 AM
    Moderator
  • what is that I need to do to achieve this unique requirement ?

    MBH

    Friday, December 04, 2015 12:02 PM
  • Do you have it in writing that the standalone attribute is required?  You also need to ask them what they're using it for since the correct usage affects how they interpret the instance.

    There is nothing wrong with pushing back on this if it saves you unnecessary work.  If they require it, they should be able to add it, especially if the value is always yes.

    Friday, December 04, 2015 12:15 PM
    Moderator
  • I understand, when I explain to my manager the next question he will ask what you have to do to achieve this ? what is the effort ?

    MBH

    Friday, December 04, 2015 12:17 PM
  • If the attribute is generated by the Xlst but is missing from the eventual output, then some component, XmlAssembler maybe, is seeing that there is no DTD and dropping it.

    You can either:

    1. Not use that component.  For example, use a Pipeline without the XmlAssembler.

    2. Create a custom Pipeline Component for the Encode State that re-adds standalone to the declaration.

    Have you tried just sending the message without it?  Again, you need to try some things first before worrying about solving it.

    Friday, December 04, 2015 12:45 PM
    Moderator
  • Yes I tried using Pass Through, it doesnt output UTF-8 and standalone :(

    MBH

    Friday, December 04, 2015 12:55 PM
  • The "correct" way to do this is to write a pipeline component that will properly set the xml declaration and add the attribute you want.

    Another, but more or less equally good way, is to utilize the built-in functions in the xml pipeline. In your xml transmit pipeline for this send port, simply set AddXmlDeclaration to false, and then in the XmlAsmProcessingInstructions set the value to "<?xml version="1.0" encoding="utf-8" standalone="yes"?>" (i.e. your full xml declaration).

    This will disable the pipeline from writing its own xml declaration, and instead use the processing instructions functionality to write out your own "custom" xml declaration instead. Then you won't need to do any special code or components.

    • Marked as answer by JaguarsJag Tuesday, December 08, 2015 7:36 PM
    Monday, December 07, 2015 8:18 AM
  • As suggested by Marcus try to change below properties in XML Transmit pipeline while sending the message-

    Open the file in notepad and check if you are getting the desired result. Also, I agree to John you should check with the destination system if they really want it, if Yes then what's the purpose and try to push this over.


    Thanks,
    Prashant

    My BizTalk Blog
    -------------------------------------------------------------------------
    Please mark this post accordingly if it answers your query or is helpful.

    Monday, December 07, 2015 9:06 AM