JAXB XML doesn't build default/fixed values?

Hi people.
I need to build a status XML that must look like this:
<rule name="TeamPayment" result="Auditing">
   <code>968</code>
   <code>571</code>
</rule>I'm using JAXB 2, there is a attribute named 'result' with a fixed value that the marshaller doesn't adds to the XML.
I'm not setting the value of attribute 'result' in my code, because it has a fixed value and I think the marshaller must obey the Schema definition.
Also, I set the Schema to the marshaller. marsh.setSchema(ruleSchema); This is the Schema:
<xsd:complexType name="RuleInstance" abstract="true">
   <xsd:sequence>
      <xsd:element name="errorCode" type="xsd:string" minOccurs="0"
            maxOccurs="unbounded"/>
      <xsd:element name="scriptText" type="xsd:string" minOccurs="0"
            maxOccurs="1"/>
   </xsd:sequence>
   <xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="AuditingRuleInstance">
   <xsd:complexContent>
      <xsd:extension base="tns:RuleInstance">
         <xsd:attribute name="result" type="xsd:string" fixed="Auditing"/>
      </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ApprovedRuleInstance">
   <xsd:complexContent>
      <xsd:extension base="tns:RuleInstance">
         <xsd:attribute name="result" type="xsd:string" fixed="Approved"/>
      </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="DeniedRuleInstance">
   <xsd:complexContent>
      <xsd:extension base="tns:RuleInstance">
         <xsd:attribute name="result" type="xsd:string" fixed="Denied"/>
      </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="IgnoredRuleInstance">
   <xsd:complexContent>
      <xsd:extension base="tns:RuleInstance">
         <xsd:attribute name="result" type="xsd:string" fixed="Ignored"/>
      </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="DeferredRuleInstance">
   <xsd:complexContent>
      <xsd:extension base="tns:RuleInstance">
         <xsd:attribute name="result" type="xsd:string" fixed="Deferred"/>
      </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>
<xsd:element name="rule" type="tns:RuleInstance"/>Am I doing something wrong?
Att,
TJ.

I'm not so good at cmake, but I believe that you'll need to explicitely set OpenCV_ROOT_DIR in the PKGBUILD. /usr is defined in cmake/modules/FindOpenCV.cmake, but cmake seems to be missing it.

Similar Messages

  • Autofilling required attributes with default/fixed value when marshalling

    I'm wondering if there is a way to configure JAXB to set default or fixed values on undefined element attributes when marshalling. For example, if an element is derived from the following schema snippet
    <xs:complexType name="CentimetersLength">
          <xs:simpleContent>
             <xs:extension base="xs:double">
                <xs:attribute name="units" fixed="cm" use="required"/>
             </xs:extension>
          </xs:simpleContent>
       </xs:complexType>then when marshalling, I would think it would be acceptable to do the following
    CentimetersLength length = new CentimetersLength();
    length.setValue(3.0);
    marshaller.marshall(length);If the marshaller is set with the schema, it fails because the "units" attribute is required, even though it has a fixed value. If one looks at the JAXB-generated code produced by xjc, CentimetersLength has a method, getUnits(), that returns "cm" by default, but this doesn't carry over to the marshalled XML document.
    Thanks for the help,
    Josh

    Check this if it helps you?

  • Fk01 - Defaulting Fixed values in Authorisation field

    Hi
    While creating a vendor master via the t code Fk01 , we want to defualt fixed value in the authorisation field (LFA1-BEGRU)for each of the company code.
    I tried through the SHD0 transaction, but it populates only that particular value all the time in the authorisation field.
    can we do it thorugh variant groups.
    Thanks in advance
    kind regards
    sap student

    Hi partha,
    check the domain is active.
    regards
    shibu

  • Applicatio​n builder default control value

    I have a VI the reads a data file.  When I build an application and transfer the application to another computer the default directory is no longer valid.  Is there anyway to allow the user to establish a default directory for the file read on his computer or does he always have to go through multiple levels to find the file every time he restarts the application?

    There is an initialization file (projectname.ini) that is created with your application (build for the application). You can define your default locations there. Note, you will need to configure the builder to use your file.

  • Exported build.xml doesn't build Service Control correctly

    We created a few components that build properly in Workshop...but not in the build.xml that Workshop generates. We are using Workshop 9.2.
    Here is what we did...
    1) Coded a Web Service that uses the ALDSP 3.0 dynamic mediator API (to access a data service)
    2) Generated a WSDL from that service
    3) Created a Service Control (that uses the WSDL from #2)
    When we do a build via Project -> Clean (with Build Automatically enabled), this gets built just fine.
    When we run the Ant task with the targets "clean, build", it fails when it tries to compile the SEI file (the file that gets generated for #3 above).
    During the build process (from the Workshop-exported build.xml file), the com.bea.control.servicecontrol.impl.ServiceControlAssembler appears to generate the MyServiceControlSEI.java file that does not compile.
    Although the compile error probably has to do with the naming conventions in our XML schema, we at least want to get the build.xml build process to act the same way as the regular Project -> Clean process (in which case our project builds just fine...even with our XML schema issues).
    My question is...does the Project -> Clean process use a different set of APTs or tasks to generate the SEI file than the build.xml process? If so, how can we configure the exported build.xml file to use the same tasks/tools as the Project -> Clean process?
    Thank you,
    Michael

    Hi Michael,
    Can you confirm if you are running the ant script from the command line and have run the setenv.cmd/sh script prior to running the ant tasks
    more info on executing ant script from the command line is available at
    [url http://e-docs.bea.com/wlw/docs102/guide/ideuserguide/build/conUseCustomAntBuild.html]http://e-docs.bea.com/wlw/docs102/guide/ideuserguide/build/conUseCustomAntBuild.html
    cheers
    Raj

  • Advantage and disadvantage of xml publisher, report builder and discoverer

    Hi,
    anyone can explain advantage and disadvantage of xml publisher, report builder and discoverer?
    thanks in advance!

    The best way i found was to put a equals and then double quotes... this only works for excel however it will allow you to cut and paste (ie to use the value to search in Oracle) and also to do vlookups.
    In a bit more detail:
    - I used word to generate my default table
    - this created a field INVOICE_NUM
    - in the cell in the table i put = " before the INVOICE_NUM field and then put the closing " afterwards.
    The theory is that excel will concatenate the values together... because it has quotes around it, it will treat it as a string rather than simply a value.
    For any other formats this will not work.
    I'm guessing most people have moved on and resolved this some other way, but just thought I'd share the wealth!

  • How to export string in CDATA with the jaxb xml writer?

    How to export string in CDATA with the jaxb xml writer?
    It read CDATA no problem but it is lost on write.

    Found it:
    ### THIS WORKS WITH SUN JAXB REFERENCE IMPLEMENTATION. ###
    (Not tested with any other)
    In the xsd, you must create a type for your string-like element.
    Then associate a data type converter class to this new type, which will produce CDATA tags.
    Then you must set a custom characterEscapeHandler to avoid the default xml escaping in order to preserve the previously produced CDATA tag.
    Good luck.
    -----type converter-----
    import javax.xml.bind.DatatypeConverter;
    public class ExpressionConverter {
         * Convert an expression from an XML file into an internal representation. JAXB will
         * probably have already stripped off the CDATA encapsulation. As a result, this method
         * simply invokes the JAXB type conversion for strings but does not take any other action.
         * @param text an XML-compliant expression
         * @return a pure string expression
         public static String parse(String text) {
              String result = DatatypeConverter.parseString(text);
              return result;
         * Convert an expression from its internal representation to an XML-compliant version.
         * This method will simply surround the string in a CDATA block and return the result.
         * @param text a pure string expression
         * @return the expression encapsulated within a CDATA block
         public static String print(String text) {
              StringBuffer sb = new StringBuffer(text.length() + 20); //should add the length of the CDATA tags + 8 EOLs to be safe
              sb.append("<![CDATA[");
              sb.append(wrapLines(text, 80));
              sb.append("]]>");
              return DatatypeConverter.printString(sb.toString());
         * Provides line-wrapping for long text strings. EOL indicators are inserted at
         * word boundaries once a specified line-length has been exceeded.
         * @param text the string to be wrapped
         * @param lineLength the maximum number of characters that should be included in a single line
         * @return the new string with appropriate EOL insertions
         private static String wrapLines(String text, int lineLength) {
              //wrap logic, watchout for quoted strings!!!!
              return text;
    ------in caller----
    Marshaller writer = ......
    writer.setProperty("com.sun.xml.bind.characterEscapeHandler", new NoCharacterEscapeHandler());
    -----escaper-----
    import java.io.IOException;
    import java.io.Writer;
    import com.sun.xml.bind.marshaller.CharacterEscapeHandler;
    public class NoCharacterEscapeHandler implements CharacterEscapeHandler {
         * Escape characters inside the buffer and send the output to the writer.
         * @param buf buffer of characters to be encoded
         * @param start the index position of the first character that should be encoded
         * @param len the number of characters that should be encoded
         * @param isAttValue true, if the buffer represents an XML tag attribute
         * @param out the output stream
         * @throws IOException if the writing process fails
         public void escape(char[] buf, int start, int len, boolean isAttValue, Writer out) throws IOException {
              for (int i = start; i < start + len; i++) {
                   char ch = buf;
                   if (isAttValue) {
                        // isAttValue is set to true when the marshaller is processing
                        // attribute values. Inside attribute values, there are more
                        // things you need to escape, usually.
                        if (ch == '&') {
                             out.write("&");
                        } else if (ch == '>') {
                             out.write(">");
                        } else if (ch == '<') {
                             out.write("<");
                        } else if (ch == '"') {
                             out.write(""");
                        } else if (ch == '\'') {
                             out.write("&apos;");
                        } else if (ch > 0x7F) {
                             // escape everything above ASCII to &#xXXXX;
                             out.write("&#x");
                             out.write(Integer.toHexString(ch));
                             out.write(";");
                        } else {
                             out.write(ch);
                   } else {
                        out.write(ch);
              return;

  • Default fixed attributes

    Hello,
    Is there a way to tell the JAXB ObjectFactory that it should generated an element with a mandatory attribute that has a fixed value? For example, I have the following XSD fragment: <xsd:attribute name="version" use="required" fixed="2.0" type="xsd:string"/>The code generated by the XJC requires a 'setVersion("2.0")' method call. Now I am wondering is there way to keep the required fixed XML attribute without the need to call the setVersion( ... ) method?
    Have a nice day,
    Marcel

    Check this if it helps you?

  • XML Publisher Template Builder for Adobe Acrobat

    Need a XML Publisher Template Builder for adobe acrobat as is available for word.

    I did so.. however, publisher is not able to substitute xsl syntax by the actual value..
    eg.
    i had a <?X_PO_NUM?> in word (either using text field or manually writing this..) and i converted the word doc into pdf using third party s/w..
    when i uploaded this template pdf with sample data file using xmlp admin repsonsibility, and tried to preview the output,
    substitution is not happening..
    the requirement here is, to have some input fields in final PDF output for which report-users should be able to type values in.
    for which I assume initial template has to be in PDF itself..
    any ideas or pointers will be much appreciated..

  • UDF of type "Lookup" - doesn't accept "space/Empty" value in lookup defn

    Hello there,
    I have created a Combo Box UDF field - but I don't want to put any value in it. If I give only "space" in Encode and Decode - it gives error of providing some value to it. I want to give a default blank value over there along with other values so that the user is free to declare an empty value if he/she doesn't wants to provide one otherwise the user has to mandatorily provide some value to this like "NULL/zzz/NOTHING" as a string.
    Is there anyway we can achieve this - giving blank value in a lookup/combo field ?
    TIA,
    - oidm.

    I don't think you can enter nulll/space in decode.
    For Lookup Field Code as well as Decode can't be null.
    If you want to give blank so it is not possible APMK, in decode you can give ---. You can treat it as Blank.
    Code Key > NULL
    Decode > ---

  • How can batch field in Purchase Order(PO) be a fixed value????

    Hi Experts,
    In SAP, when create a purchase order, there is a field "Batch" for every item,
    which means "Assigns a material that is manufactured in batches or production lots to a specific
    batch ".
    For some special reasons, we want for some certain materials,when create purchase orders every
    time,the "Batch" field will be a fixed values.
    For example,for material "AB1" ,"CD2",when create purchase orders every time,the "Batch" field will
    be "2345" automatically,do not need input manually.But for all the other materials, the "Batch" field would be null ,no value.
    How can I do this? How can assign fixed batch number values to some certain materials in Purchase
    Order?
    If there needs some ABAP development,which user exit do I need??
    Thanks for any reply!

    Hi there,
    You may need to establish, whether you wish to use batch managent or split valuation.
    Spilt valuation does allow you to default values into purchasing documents via information records, but I guess it depends on what else you want to do with this tracking
    Split valuation can be controlled independently at the material and plant level
    Regards
    Steve

  • Default cell values for column not properly saved in uir file in labwindows 2009 (9.1.0 427)?

    I've run into a strange problem with the table control.  Basically, even though I set default cell values for a particular column as numeric, when I try to add items to the list it tries to add them as strings, and returns an error message that it is expecting *char instead of int.  Furthermore, when I open the uir file that contains the table in question in 2010, it appears as if the default cell values for that column are still set as strings, even though in 2009 when I open the uir file it shows as numbers.  I tried converting the uir to C code, and sure enough the C code indicated that the column still is a string type.
    I've gone ahead and made a small project to show the issue.  If you open this project in labwindows 2009 and click on the table in the table_bug.uir, and edit default cell values for column 1, you will see that the cell settings have type as numeric and data type as int.  When you run the project, however, it will fail with an error message saying that it is looking for a *char.  When this same project is loaded into labwindows 2010, clicking on the table in table_bug.uir and edit default cell values (column 1) shows the type as string.  When I change this to numeric (and change numeric attribute to int), this runs fine in 2010.  I tried simply changing the uir in 2010, and then using it in 2009, but 2009 complains that the uir is from a newer version (understandable).  If there is any workaround that would let me continue to use 2009 for the time that would be great.
    Any help would be greatly appreciated.
    thanks,
    Alex Corwin
    Solved!
    Go to Solution.
    Attachments:
    table_bug.zip ‏324 KB

    I opened the UIR in 2009 (but I have 2009 SP1) and it still showed that the default value for the first column was a string. I didn't have any problems changing it to a numeric int, and then building and running the project without error.
    Here are a few things you can try:
    1) Change the default value to a string. OK out of the dialog, re-enter the dialog, and change it back to Numeric int. Resave and see if the problem has gone away.
    2) You said you get a ".UIR is from a newer version" error when opening the 2010 UIR in 2009. Does the UIR still open if you click okay? Often times this will work just fine. Assuming you don't have any problems with this, make a minor change to the UIR in 2009, such as moving the table to the left, and then back to the right and then re-save. See if your program works now.
    Kevin B.
    National Instruments

  • How to set to-mode to Fixed Value and give a date in RSDV transaction

    Hi
             I am working in BI7.0 environment. I am deploying HR Reporting Project. I need to load data to HR Info Cube 0PAPA_C02, to do this I need to maintain validity slice (RSDV transaction) for the Info Cube. After first load I need to set "to-mode-'Fixed Value'" and give a date such as 31.12.9999.
            Can anyone please let me know the steps on how to set- to mode to Fixed Value in RSDV.
    Thanks

    Here's the basic steps to follow:
    1) Go to tcode RSDV, enter the InfoCube name (0PAPA_C02) and Execute.
    2) If there is data already in the InfoCube you will get a validity table with default validty dates from 0CALDAY.
    3) Click on the Display/Change button so that you're in change mode and edit the validity date to be 31.12.9999.
    4) In the To-Mode column, set the value to 'F' for fixed.
    5) Put the fixed date value (31.12.9999 in your example) in Fixed to time.
    6) Click on Save.

  • A better way of building the fixed-length String

    I created the following code to build a fixed length string. I checked other posts for the same topic, but I found mine is better. The code below converts a double numeric value to a fixed length string with padding of white spaces (or other types):
    Line 15 initializes the char array to while space; line 13 creates a character array; lines 17, 18 copy the array created in line 13 to the one initialized in line 15.
    Any comment is welcomed.
    1. import java.text.*;
    2.
    3. public class jformat {
    4.
    5. public static void main(String[] args) {
    6.
    7. char[] fb=new char[14];
    8. char[] tb;
    9. int c, f;
    10. DecimalFormat fmt=new DecimalFormat("########0.00");
    11. double dbl=12345.66;
    12.
    13. tb=fmt.format(dbl).toCharArray();
    14.
    15. for(c=0; c<fb.length; c++) fb[c]=' ';// this line is not required in JDK 1.5
    16.
    17. for(c=tb.length-1, f=fb.length-1; c>=0; c--, f--){
    18.     fb[f]=tb[c];
    19. }
    20. System.out.println(new String(fb));
    21.
    22. }
    23.
    24. }

    Here's a couple of alternatives. One uses a StringBuffer and the second, for Java 5 only, uses the Formatter capabilities.
    import java.text.DecimalFormat;
    public class jformat
        public static void main(String[] args)
            int fieldSize = 14;
            double dbl = 12345.66;
            String dblString = new DecimalFormat("0.00").format(dbl);
            StringBuffer sb = new StringBuffer();
            for (int j = 0; j < fieldSize - dblString.length(); j++)
                sb = sb.append(' ');
            System.out.println(sb.append(dblString).toString());
             *  The above code works in Java versions 1.3, 1.4, and 1.5.
             *  However, 1.5 provides the Formatter class, and the single
             *  line below can replace the preceeding code.
            System.out.printf("%14.2f%n", dbl);
    }

  • Table lookup instead of fixed value mapping

    Hi Folks,
    My current scenario is that I have used fixed value mapping to map a single target field.  These details are actually maintained in the TP_Code table in R3 (a sample table).
    TradingPartner:SAP:Short Text
    PA:PA:Package
    PL:PAL:Pallet
    The table contains 20 entries.
    I am thinking that fixed value mapping is not a good option since there might have future changes in the TP_Code table.
    Is rfc lookup a good option?  But I am not sure which rfc to use and if there is any udf availble to be used in parsing the xml payload.
    Please advise.
    Thanks a ton!

    Thanks so much for the links!
    I managed to use and run the RFC lookup to an R3 table using JCo.  However, I am not getting the right result.
    I am getting the result in this format -> 800,PA,PAC,Package
    The correct output is PAC which is the third node.  Could this only be achieved by using java tokenizer?
    The code that I have used is as follows:
    Import com.sap.mw.jco.*;
    //write your code here
    String DBTABLE = a;
    String WHERE_CLAUSE = b" = ""'"c"'" ;
    String sapClient = "xxx";
    String hostName = "nnnxxx";
    String systemNumber = "xx";
    String userName = "nnnnn";
    String password = "******";
    String language = "EN";
    JCO.Repository mRepository;
    JCO.Client mConnection = JCO.createClient(
                   sapClient,
                   userName,
                   password,
                   language,
                   hostName,
                   systemNumber );
    // connect to SAP
    mConnection.connect();
    // create repository
    mRepository = new JCO.Repository( "SAPLookup", mConnection );
    // Create function
    JCO.Function function = null;
    IFunctionTemplate ft = mRepository.getFunctionTemplate("RFC_READ_TABLE");
    function = ft.getFunction();
    // Obtain parameter list for function
    JCO.ParameterList input = function.getImportParameterList();
    // Pass function parameters
    input.setValue( DBTABLE, "QUERY_TABLE");
    input.setValue( "," , "DELIMITER");
    //Fill the where clause of the table
    JCO.ParameterList tabInput = function.getTableParameterList();
    JCO.Table inputTable = tabInput.getTable("OPTIONS");
    inputTable.appendRow();
    inputTable.setValue(WHERE_CLAUSE,"TEXT");
    mConnection.execute( function );
    JCO.Table valueSet = function.getTableParameterList().getTable("DATA");
    String resultSet = valueSet.getString("WA");
    mConnection.disconnect();
    return resultSet;

Maybe you are looking for

  • Is there a way to compleatly remove my iphone 4 device info from my computer

    Not sure how to word this , for the past 2 days i have been trying to sync my iphone 4 to my itunes ( sorry if this question should be in the iphone section )  but it didn't appear in my itunes  until today , but now in the device manager it is liste

  • External Monitor Not Supported Issue (Sony Bravia)

     Lenovo Community I have been tryign to connect my Lenovo T400 to a Sony Bravia (KDL-32S300 LCD Digital Color Flat Screen) and unable to use the "Projector Only" (to watch recorded movie) video output setting.  I am given a non-supported error.  Yet

  • Why does my brand new 16GB iPad Air have about 13GB?

    I got an iPad Air with 16GB. I have 21 apps and the only music on here is a little over 800 songs thanks to iCloud. In my settings in the "About" section, it says I have 12.9 GB capacity and 9.0 available. Why is that? Also, if this helps, it also sa

  • Extracted Audio Not Rendering?

    I use Premiere Pro in conjunction with Audition for making videos on my YouTube channel. Recently, I have tried to render videos and all the audio that I have right-clicked and hit "Edit in Adobe Audition", then edited, is rendering as silence. It al

  • Bind Variables...Urgent

    Thanks! I build a SQL statement, PARSE and Execute... Begin :l_result := Test(pa01=>':pa01',pa02=>':pa02'); End; I am binding ':pa01', ':pa02' When I try to Bind variables, it throws error "ORA-01036 illegal variable name/number". Do I need to instal