Regexp_substr unexpected behaviour

While trying to come up with a constraint to check for correct RGB color codes
(RvalueGvalueBvalue) where the value is between 0 and 255
I saw the following:
database used: Oracle Database 10g Express Edition Release 10.2.0.1.0
CREATE TABLE test
(color varchar2(12)
,status varchar2(1)
insert into test
values ('R2G2B2','G')
insert into test
values ('R22G22B22','G')
insert into test
values ('R222G222B222','G')
insert into test
values ('R300G2B2','F')
insert into test
values ('R300G256B2','F')
insert into test
values ('R300G256B256','F')
select t.status
     , t.color
     , REGEXP_SUBSTR(t.color,'^R(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])') red
     , REGEXP_SUBSTR(t.color,'G(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])') green
     , REGEXP_SUBSTR(t.color,'B(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])$') blue
     , REGEXP_SUBSTR(t.color,'^R(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])G(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])B(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])$','1','1','i') total
from test t
order by redoutput
status   color        red    green    blue  total
  G      R2G2B2       R2      G2       B2    R2G2B2
  G      R22G22B22    R22     G22      B22   R22G22B22
  G      R222G222B222 R22     G22      B222  R222G222B222
  F      R300G2B2     R30     G2       B2   
  F      R300G300B2   R30     G30      B2
  F      R300G300B300 R30     G30Expected output
status   color        red    green    blue  total
  G      R2G2B2       R2      G2       B2    R2G2B2
  G      R22G22B22    R22     G22      B22   R22G22B22
  G      R222G222B222 R222    G222     B222  R222G222B222
  F      R300G2B2             G2       B2   
  F      R300G300B2                    B2
  F      R300G300B300 Both the total and blue colums have the output as expected
but the red and the green give a output with a maximum of 2 digits instead of 3
even when the string should not match (300 > 255).
I have read the information about regular expressions in the Application Developer's Guide - Fundamentals and SQL Reference but neither explain above behaviour
Can someone explain why this is happening?
Or give a hint of how to correct the select statement in such a way that results are like the expected output?

First thanks everybody for their response.
I was wrong in assuming that R300G0B0 with above mentioned regular expression for red should return null instate of R30 because 30 is on the range 0-255 I didn't say that the expression should take all the digits into account.
Akeeti Jyuuzou's solutions is doing just that with anchoring the red to the green and the green to the blue and the blue to the end of the line. In the blow example I have anchored the red to any non digit character.
SQL> select t.kleur color
  2       , REGEXP_SUBSTR(t.kleur,'^R(25[0-5]|2[0-4]\d{1}|1\d{2}|\d{1,2})\D') red
  3       , REGEXP_SUBSTR(t.kleur,'G(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])') green
  4       , REGEXP_SUBSTR(t.kleur,'B(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])$') blue
  5       , REGEXP_SUBSTR(t.kleur,'^R(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])G(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])B(\d{1,2}|1\d{2}|2[0-4]\d{1}|25[0-5])$','1','1','i') total
  6  from test t
  7  /
COLOR                 RED   GREEN   BLUE    TOTAL
R300G0B300                   G0                                                                                                                                                               
R0G0B20X            R0G    G0                                                                                                                                                               
SQL Slow moe is indeed right that the alterations are read form left to right and is stopped by the first correct pattern as is shown below.
In below example I have turned around the alterations for the red but left the green to see the difference
SQL> select t.kleur color
  2       , REGEXP_SUBSTR(t.kleur,'^R(25[012345]|2[01234]\d{1}|1\d{2}|\d{1,2})') red
  3       , REGEXP_SUBSTR(t.kleur,'G(\d{1,2}|1\d{2}|2[01234]\d{1}|25[012345])') green
  4       , REGEXP_SUBSTR(t.kleur,'B(\d{1,2}|1\d{2}|2[01234]\d{1}|25[012345])$') blue
  5       , REGEXP_SUBSTR(t.kleur,'^R(\d{1,2}|1\d{2}|2[01234]\d{1}|25[012345])G(\d{1,2}|1\d{2}|2[01234]\d{1}|25[012345])B(\d{1,2}|1\d{2}|2[01234]\d{1}|25[012345])$','1','1','i') total
  6  from test t
  7  order by id
  8  /
COLOR                   RED     GREEN     BLUE     TOTAL
R222G222B222        R222     G22         B222       R222G222B222
                                                                                                                                                             

Similar Messages

  • Unexpected behaviour upon pressing the 'Enter' key on dialog screen

    Hi.
    I have two dialog screens that exhibit unexpected behaviour when i pressed the 'Enter' key.
    Screen 1: When I pressed the 'Enter' key, the focus shifted to another input field and the content of the previous input field is cleared. The thing is, I did not have any codes in PAI for 'Enter'. Why is this happening?
    Screen 2: On load, some of the fields on this screen will be disabled. However, when I pressed the 'Enter' key, all the disabled fields become enabled. Again, I did not have any codes that handle the 'Enter' key in PAI. Why is this happening?
    Any help is appreciated.

    Hi Atish.
    Yes, I have used CHAIN... END CHAIN.
    I thought that CHAIN... END CHAIN allows my input fields to be re-activated after an error message is displayed.
    How would CHAIN... END CHAIN cause the unexpected behaviour?
    Thanks.

  • SAP Personas: An unexpected behaviour has been detected and you have been disconnected – please log in again.

    Hallo everyone,
    We are installing Personas and facing several challenges.
    Personas 2 SP02 was installed according to instructions of Note '1848339 - Installation and Upgrade note for Personas' and configured according to the Config Guide v1.3 (rel. May 2014). The referenced notes were also applied as well as the 'How to config - FAQ' blog by Sushant.
    We are able to log on and execute transactions and perform activities successfully (e.g. SE80, SPRO, KB15, etc.).
    When trying to copy a screen the following error appears: 'An unexpected behaviour has been detected and you have been disconnected - please log in again.'
    Thereafter one can simply continue executing transactions without having to log in again.
    Please see the download of the error attached as per blog: SAP Screen Personas Support Tips – client side logging
    The HAR is unfortunately too large to attach. Are there any alternatives?
    Thank you in advance for you assistance!
    Kind regards,
    Daniel
    Message was edited by: Daniel K

    Hi,
    I have never worked on SAP PERSONA but you can try below things
    1)try to use different user or J2ee_admin since it might be same user multiple session case
    2) Try with different browser since plugins can behave unexpectedly
    3)Make entry in host file also
    4) check dev_icm logs
    5) check on ABAP side for dumps in ST22
    Warm Regards,
    Sumit

  • Unexpected behaviour of Composer with adf-config

    This is a part of my adf-config.xml file:
    <cust:customizableComponentsSecurity xmlns="http://xmlns.oracle.com/adf/faces/customizable/config">
    <cust:enableSecurity value="true"/>
    <cust:actionsCategory>
    <cust:actionCategory name="personalizeActionsCategory" value="#{securityContext.userName eq 'weblogic' ? 'true' : 'false'}"/>
    <cust:actionCategory name="customizeActionsCategory" value="#{securityContext.userName eq 'weblogic' ? 'true' : 'false'}"/>
    </cust:actionsCategory>
    </cust:customizableComponentsSecurity>
    Section upon sets a simple EL to provide security restrictions for user in Composer. When I deploy an application and login at first time everything works fine. But when I log in with user other than 'weblogic' unexpected behaviour appears. After that even 'weblogic' user can not access to personalization and customization options anymore.
    So, the question is - is it a really unexpected behaviour, bug or I missed something? Here is a pretty clear and simple manual that I followed to try to make it work: http://docs.oracle.com/cd/E29597_01/webcenter.1111/e25595/jpsdg_page_editor_security.htm#autoId18
    Edited by: Igor_Petrov on 22.02.2013 5:56
    Edited by: Igor_Petrov on 22.02.2013 5:57

    More information: I tried rebuild again. The Messages folder now has 20418 entries and takes 7.54 Gb of disk space.
    I searched using Spotlight for a unique term which appears in one of the messages and found 8 instances of it. All are the same message, but are separate .emlx files.
    This is getting crazy ...

  • SimpleDateFormat unexpected behaviour

    Hi everybody,
    i'm facing an issue which is mainly due to my incomprehension of the inner mechanisms of date parsing in Java. I would like to parse a date from an input string with a specific pattern, but some inputs match this pattern when i expect them not to. Let me explain it through an example:
    public class DateIssue {
         public static void main(String[] args) {
              SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
              sdf.setLenient(false);
              try {
                   System.out.println(sdf.parse("10/02/20001"));
              } catch (ParseException pe) {
                   pe.printStackTrace();
    }Here i'm expecting a 4 digit year, but when i give "20001" as a year, the simpledateformat parses it just fine, and no exception is thrown. I checked the API where i found:
    Year:  If the formatter's Calendar is the Gregorian calendar, the following rules are applied.
    * For formatting, if the number of pattern letters is 2, the year is truncated to 2 digits; otherwise it is interpreted as a number.
    * For parsing, if the number of pattern letters is more than 2, the year is interpreted literally, regardless of the number of digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D.
    * For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the time the SimpleDateFormat instance is created. For example, using a pattern of "MM/dd/yy" and a SimpleDateFormat instance created on Jan 1, 1997, the string "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" would be interpreted as May 4, 1964. During parsing, only strings consisting of exactly two digits, as defined by Character.isDigit(char), will be parsed into the default century. Any other numeric string, such as a one digit string, a three or more digit string, or a two digit string that isn't all digits (for example, "-1"), is interpreted literally. So "01/02/3" or "01/02/003" are parsed, using the same pattern, as Jan 2, 3 AD. Likewise, "01/02/-3" is parsed as Jan 2, 4 BC.
    Otherwise, calendar system specific forms are applied. For both formatting and parsing, if the number of pattern letters is 4 or more, a calendar specific long form is used. Otherwise, a calendar specific short or abbreviated form is used.
    I suspect the following excerpt:
    For parsing, if the number of pattern letters is more than 2, the year is interpreted literally,
    to be responsible for this behaviour, but i thought parsing with lenient would avoid such a "mistake", and throw an exception because of the wrong number of digits. What is the best way to check that the year is exactly four digit long? Do I have to use string.matches() or a Pattern object just for this?
    Thanks a lot
    Edited by: calvino_ind on Aug 30, 2009 1:51 PM

    See this recent, and related thread: [Unexpected SimpleDateFormat behavior|http://forums.sun.com/thread.jspa?threadID=5404776&messageID=10802339]
    The behavior is unexpected intuitively but seems to follow the API contract. The number of digits apparently is only used to break up consecutive fields.

  • Extending class gives unexpected behaviour

    Hello forumusers
    I am making my own table model by extending DefaultTableModel. When calling insertRow(int, Object[]) in my own code, super.insertRow calls insertRow(int, Vector) in my code instead of in the superclass. I didn't think that the superclass would hold any reference to my class and when the superclass calls insertRow(int, Vector) it would be a method in the DefaultTableModel class.
    Please see the code below. Can anyone explain this behaviour to me?
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    class TableModelTest {
      public TableModelTest() {
        BundleTableModel m = new BundleTableModel(
            new String[][]{{"aaa", "aab", "aba"}, {"ccc", "cca", "cac"}},
            new String [] {"header0", "header1", "header2"});
        m.insertRow(1, new String[]{"BBB", "BBA", "BAB"});
      public static void main(String[] args) {
        TableModelTest dut = new TableModelTest();
      public class BundleTableModel extends DefaultTableModel {
        public BundleTableModel(String[][] dataIds, String[] columnNameIds) {
          super();
          setColumnCount(columnNameIds.length);
          setRowCount(dataIds.length);
          // My own code comes here
        public void insertRow(int row, Object[] rowData) {
          System.out.println("insertRow(int, Object[] called");
          super.insertRow(row, rowData);
          // My own code comes here
        public void insertRow(int row, Vector rowData) {
          System.out.println("insertRow(int, Vector) called");
          super.insertRow(row, rowData);
          // My own code comes here
    }

    Lesson learned.
    ejp was correct from the beginning.
    JLS section 8.4.10.6 'Large Example of Overriding' explains:
    "The critical point about overriding in this example is that the method putstr, which is declared in class BufferOutput, invokes the putchar method defined by the *current object this*, which is not necessarily the putchar method declared in class BufferOutput.
    This allows a subclass of BufferOutput to change the behavior of the putstr method without redefining it."
    Thanks for all comments.

  • Unexpected behaviour with my navigation buttons

    Hi Guys,
    I've just noticed some strange behaviour for my nav buttons in a project I've recently created. My project uses click boxes to naviage and has a Home Button which jumps from any slide (aside from Question Slides) to the first slide in the project. A next and back click box which are all set to go to the next slide / go to previous slide...
    All works fine and as expected (i.e as soon as I click on the next button it goes to the next slide regardless if audio is still playing of the if the slide has finished playing) until say I get two or three pages in to the project and click the home button. It goes to the first page as expected where I click a go to next slide click box (this one takes a few seconds to appear on this slide) which immediatly goes to the next slide. Here is where my problems start... I click on next and I hear the click sound but it refuses to skip to the next slide - It plays the whole slide (50 seconds worth of audio) before it will go to the next slide...
    For the life of me I cannot see why it would do this.
    The click box is set to infinite attempts.
    Anyone ever had a similar issue???
    Thanks
    JT

    Try fiddling with your Quiz: Settings > Required options to see if they make a difference.

  • MERGE: unexpected behaviour, oracle 11g

    Hi all,
    I'm facing a strange behaviour with Merge statement.
    In particular in doc Oracle we read:
    "MERGE is a deterministic statement. That is, you +*cannot update*+ the same row of the target table multiple times in the same MERGE statement."
    My source table has two equal key rows and the "merge statement" merge the row with the last value in the source table.
    How Is this possible ?
    thank you.

    VERSION:
    SQL> select * from v$version
      2  ;
    BANNER
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>MERGE, in a dynamic context:
    v_sql :=
    'MERGE INTO dwh_cdl.dim_cost_hierarchy dim
             USING (SELECT DISTINCT TRIM (item_code) id_item,
                                    NVL (TRIM (CATEGORY), ''ND'') CATEGORY,
                                    r1.r1_code r_1,
                                    r2.r2_code r_2,
                                    r3.r3_code r_3,
                                    r4.r4_code r_4,
                                    w.item_description desc_item
                                            FROM '
                                            || v_wrk
                                            || ' w INNER JOIN dwh_cdl.lu_r1 r1
                                                 ON (w.r_1 = r1.r1_code)
                                                 INNER JOIN dwh_cdl.lu_r2 r2
                                                 ON (w.r_2 = r2.r2_code)
                                                 INNER JOIN dwh_cdl.lu_r3 r3
                                                 ON (w.r_3 = r3.r3_code)
                                                 INNER JOIN dwh_cdl.lu_r4 r4
                                                 ON (w.r_4 = r4.r4_code)
                                    ) wrk
             ON (    dim.id_item = wrk.id_item
                 AND dim.category = wrk.category
                 AND dim.r1_code = wrk.r_1
                 AND dim.r2_code = wrk.r_2
                 AND dim.r3_code = wrk.r_3
                 AND dim.r4_code = wrk.r_4
                 AND dim.wid_country = '
                || pkg_global.v_country
                || ')
             WHEN MATCHED THEN
                UPDATE
                   SET dim.desc_item = wrk.desc_item
             WHEN NOT MATCHED THEN
                INSERT (wid_item, id_item, CATEGORY, desc_item, type_item,
                        flag_valid, r1_code, r2_code, r3_code, r4_code,
                        wid_country, date_in)
                VALUES (pkg_util.get_next_val (''DIM_COST_HIERARCHY''), wrk.id_item,
                        wrk.CATEGORY, wrk.desc_item, NULL, 1, r_1, r_2, r_3, r_4,
                || pkg_global.v_country
                || ', SYSDATE)';
    EXECUTE IMMEDIATE v_sql;The USING table has duplicate key rows. So when join with "dim_cost_hierarchy" Oracle should issue error ! But, it doesn't !
    It gets the last one row value.

  • Unexpected behaviour when working with multiple browser tabs

    Hi
    I have an Apex 3.0 app here where the users can click on a country and get a report for that country.
    What one of my creative users was doing was right-clicking on the country links and opening them in a new tab. So he ended with 10 tabs, one for each country, in the same browser window.
    Then he went to the first tab and tried to save the report as CSV (clicking on that default link that is automatically generated by apex) and he got the wrong data... The data he got was for the country he opened last; I guess this is because that export link uses the current session variables values, not the values corresponding to the page where the link is displayed on (am I correct?)
    Any workarounds for this (except for not using tabs)?
    Thanks
    Luis

    Hi Luis,
    I've seen this too, yes... I've also warned for this in my APEX presentation at Collab. (using Application Items to store specific session variables)
    I suppose it's the browsers behaviour. I also wonder if there's something you can do and works at all times. Maybe SSP (Session State Protection) will help you? (as the url will be different)
    Dimitri

  • Unexpected behaviour dataTable

    Hi all!
    I'm currently creating a JSF application, using Mojarra 2.0.2, Spring DPI, ... .
    On a certain page, I notice that the value attribute of an h:dataTable tag gets evaluated although the rendered attribute of it's parent is set to false:
              <h:panelGroup rendered="false">
                   <h:dataTable var="row" value="#{myBean.myList}" />
              </h:panelGroup>     I really do not expect this behaviour and I should think the getMyList() method of the myBean instance should not get evaluated.
    Is this a bug? And is there something I can do to make sure the value attribute will not be evaluated?
    Thanks in advance,
    Koen Verhulst

    Components still get created and properties can be evaluated even when they or their parents are not rendered.

  • Forte C++ 6 Preprocessor unexpected behaviour

    Hi,
    I'm using Forte C++ 6 (C++ 5.1) under Solaris 7.
    While compiling code containing #error - directives,
    the preprocessor issues only a warning message and
    continues the compilation process. The compiler
    should abort the compilation if an "#error foo"
    occurs, like the C-compiler does.
    Are there other people detected this behaviour and/or
    is there a workaround ?
    regards
    Falko

    Ordinarily, the same source files and makefiles that work with C++ 5.0 on Solaris 2.6 should work with C++ 5.3 on Solaris 8.
    You didn't say what you did to "adapt the makefile" when changing compilers and OS versions. If the compiler was installed in the default /opt location on each system, we don't think any makefile change would be required. (You might want to make changes for performance or program organization reasons, but we don't think any changes are required just to repeat a working program build.)
    What happens if you use the original files that worked with C++ 5.0 on Solaris 2.6?
    Are C++ 5.0 and C++ 5.3 are both installed in the same /opt directory? That isn't allowed, and will lead to strange behavior.
    Are you continuing a build using the new compiler and OS in a directory containing old binary files or template cache? When changing OS and compilers, it is safest, but not strictly necessary, to rebuild all your binary files. At a minimum, you must delete the old template cache.
    Are you still using C++ 5.0 in the build process? If so, you must isolate the use of C++ 5.0 and 5.3. The compilers cannot share a template cache, so you must run compiles in different locations.
    Anything beyond these hints will require more support and analysis than we could provide in the Forum. You will probably need to generate a .i file from the compilation and have a support engineer look at it. If you have contract with Sun, please follow the service channel.
    - Rose

  • Unexpected behaviour running AppleScript on Universal G5

    I am puzzled about some strange behaviour when I attempt to run a script that was working Ok on my G5 (Mac OS only) on a friend's new G5 (dual core).
    First, when I ran it the first time I found a whole bunch of code added which referred to opening multiple windows (my script was duplicating folders). Definitely this code was not in the code I had developed.
    Then it began failing in rather strange ways, so I looked into the console log and saw that around the same time that the system was not able to load QXPScriptingAdditions. My friend does have Quark Express on her machine but my script does not reference it in anyway. Why is the system attempting to load this file?
    I admit that I haven't given a very detailed description of what happened but perhaps someone has an idea what is happening.

    This is my fourth attempt ... due to network timeouts when I attempt to post
    First things first, try disabling notorious
    QXPScriptingAdditions and recompile the script on the
    machine in question and run it to see how it goes.
    To disable the OSAX, remove
    QXPScriptingAdditions.osax from either of the
    followings:
    /Library/ScriptingAdditions/
    ~/Library/ScriptingAdditions/
    and re-login or perhaps re-start the computer.
    I did rename it ... but I probably should have removed it.
    Also make sure you copy the original source code
    (text version) of the script to the problem machine
    and compile it there. (If something odd is to happen
    it should be at this compile stage, I think.)
    That is what I did
    Should the script be OK without QXPScriptingAdditions
    the culprit is obvious. Or else currently I have no
    idea about what's going on.
    I did have another application error which I have since fixed but it should not have caused the conditions that I experienced.
    Tomorrow I hope to test the new, hopefully bug free, version of the program and will report back then.

  • Unexpected behaviour from LSSerializer.writeToString

    I was trying to use LSSerializer to serialize a fragment of a larger XML document when I ran into some odd behaviour from Oracle's implementation.
    This sample code shows LSSerializer being used to write a org.w3c.dom.Element XML fragment in both Oracle and Xerces:
    <pre>
    import java.io.ByteArrayInputStream;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.ls.DOMImplementationLS;
    import org.w3c.dom.ls.LSSerializer;
    public class Test
    public static final String xml = "&lt;foo>&lt;bar>abc&lt;/bar>&lt;baz>xyz&lt;/baz>&lt;/foo>";
    public static void main(String[] args) throws Exception
    // Oracle
    System.out.println("Oracle LSSerializer:");
    test(new oracle.xml.jaxp.JXDocumentBuilderFactory());
    System.out.println();
    // Xerces
    System.out.println("Xerces LSSerializer:");
    test(new com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl());
    private static void test(DocumentBuilderFactory fac) throws Exception
    DocumentBuilder b = fac.newDocumentBuilder();
    Document d = b.parse(new ByteArrayInputStream(xml.getBytes()));
    Element e = d.getDocumentElement();
    System.out.println("Document root element: " + e.getNodeName());
    DOMImplementationLS di = (DOMImplementationLS) d.getImplementation();
    LSSerializer ser = di.createLSSerializer();
    System.out.println(ser.writeToString(e));
    </pre>
    Here's the output:
    <pre>
    Oracle LSSerializer:
    Document root element: foo
    &lt;bar>abc&lt;/bar>&lt;baz>xyz&lt;/baz>
    Xerces LSSerializer:
    Document root element: foo
    &lt;?xml version="1.0" encoding="UTF-16"?>
    &lt;foo>&lt;bar>abc&lt;/bar>&lt;baz>xyz&lt;/baz>&lt;/foo>
    </pre>
    As you can see, Oracle's LSSerializer implementation serializes the children of the org.w3c.dom.Element, but not the element itself.
    It's not hard to work around, but it really doesn't seem like the correct behaviour. It's certainly doesn't behave the way a reasonable developer would expect it to.

    The XDK 10g implementation is slightly different from the Xerces implementation.
    In XDK 10g, the node previous to the node to be output should be specified in the
    writeToString() method.
    Also in XDK 10g, SHOW_ELEMENT does not output the element text, in Xerces the element text is output.
    Refer
    http://www.oracle.com/technology/pub/notes/technote_dom.html

  • [Moxy] json marshalling, mixed element unexpected behaviour

    Hi there,
    Moxy generated wrong output when there is XML mixed element type and one of the nested elements is a string type.
    Then in generated json, text is put into nested element instead of "value" element.
    Example:
    Schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" >
    <xs:element name="root" type="rootType"/>
    <xs:complexType name="rootType">
    <xs:sequence>
    <xs:element type="elementType" name="element" maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="elementType" mixed="true">
    <xs:sequence>
    <xs:element type="xs:string" name="nested" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    sample xml:
    <root>
    <element>should be into value element, not in nested<nested>nested content</nested></element>
    </root>
    Gives unexpected json output:
    {"root":{"element":[{"nested":["should be into value element, not in nested","nested content"]}]}}

  • [PROBLEM] Keyboard layout unexpected behaviour problem Xfce

    Dear Everyone,
    I am rather new to arch linux. I have recently (about a week ago) installed archlinux with xorg and xfce (booted by slim), and reading the wiki I managed to set up a fully working computer. But there is a slight problem that continues bugging me about keyboard layouts, and although I have found a way to make the keyboard layout switching with alt+shift work I think that I did it in a nonstandard way and some programs still exhibit unusual (and I think unintended) behaviour.
    Here goes:
    I use a notebook
    My xorg uses hotplugging that seems to be working (hal and dbus installed and running at bootup, detects external usb mouse, I have no xorg.conf file). When I setup my keyboard I put the 10-keymap.fdi from the /usr/share/... dir into /etc/hal/fdi/policy/10-keymap.fdi and it contains (as instructed by the wiki):
    <merge key="input.xkb.layout" type="string">us,ru</merge>
    <merge key="input.xkb.variant" type="string" />
    <merge key="input.xkb.options" type="string">grp:alt_shift</merge>
    And here is the problem:
    After editig this file I restarted hal using
    #/etc/rc.d/hal stop
    #/etc/rc.d/hal start
    and keyboard switching with alt+shift started working.
    Then I went to the xfce keyboard settings to the layout tab and my setup was:
    keyboard model -> evdev-managed keyboard
    keyboard layout -> us   
    so the russian layout did not appear (also adding the russian layout through this menu before editing the .fdi file was useless (it was the first thing I tried before reading the wiki and writing config files for hal))
    I started the keyboard layout switcher applet for xfce and it also displayed only the us flag and had only us as the available layout, and even switching to russian layout using alt+shift had no effect on the displayed flag.
    What I decided to do then was to restart my system.
    Everything restarted without error (hal and stuff started etc..) but it was no longer possible to switch keyboard layouts using alt+shift.
    The xfce keyboard settings now displayed us and ru as available layouts but switch between them using the mouse in the settings menu had no effect whatsoever. Also the layout switcher displayed that both layouts were available but for the russian keyboard the variant field displayed a lot of garbage (I will post screenshot soon). Switching to the russian layout through any key sequence defined in the applet was useless. Trying to switch it with the mouse by selecting the flag didn't do anything either.
    The only way I discovered to make the alt+shift keys work is by manually restarting hal through
    #/etc/rc.d/hal stop
    #/etc/rc.d/hal start
    which is very strange since I have not changed any settings file.
    Then again every time I restarted my comuter the ability to switch layouts was lost until manually restarting hal.
    The only  solution I found was going to the xfce keyboard settings and clicking the  "Use system defaults []"
    After restarting the system alt+shift switching began to work fine but the keyboard applet didn't  work anyway.
    As a consequence I think that all this is a big mess since I suppose that what I described is not the expected behaviour. The other effect of this is that only user with root priviledges could possibly add a new layout to the system (editing the /etc/hal/policy/10-keymap.fdi file) while the idea was that the gui tools of the DM (xfce in my case) permitted the user to change layouts on his/her own. Then again the keyboard layour applet never worked so it is impossible to have an indicator of the current layout. Where do you think should I write about this. I think this qualifies as a bug although I do not know whose fault is it: is it xfce, Xorg, hal or others?  And having to restart hal maunally without having changed any config files is rather strange. The garbage displayed by the applet is also suspicious.
    Any advice to where to report this and how to fix everything would be great.
    P.S. Throughout all these tries to make things work the setxkbmap command from the cli never had any effect.
    Last edited by cavesnow (2009-03-14 10:41:51)

    hmm... i have a similar problem:
    i want two layouts: GB(english) and ES(spanish). I have them defined in /etc/hal/fdi/policy/10-keymap.fdi :
    <merge key="input.xkb.layout" type="string">gb,es</merge>
    and i can actually switch between them. the issue is that i have an extra, unwanted layout. i have to press once in order to change from GB to ES, then if i want to switch back to GB, i have to switch twice. There is a third layout i did not configured.
    Example of the layouts:
    GB: abcdefghijklmnopqrstuvwxyz
    ES: abcdefghijklmnopqrstuvwxyz    and i can write accents and everything for spanish:  ñÑáéíóú, etc.
    unkown third layout: æ"¢ðeđŋħ→jĸłµnøþ@¶ßŧ↓"ł»←«
    łħæŧ →ß ŧħ→ß???
    sorry, i mean:
    what is this???
    any help would be appreciated.

Maybe you are looking for

  • HT2311 How do I install a previous version of iTunes for MacBook Pro?

    i'm trying to help out my friend who has recently purchased an old MacBook Pro ... he has a 2007 MacBook pro and everything works - done all updates etc ... BUT! (theres always a but isnt there ... ) I cant update the latest iTunes because the softwa

  • Can not install Adobe Air 3.1.0.4880

    Hope I am in the right place. Tried to install Air does not install. Here is the log: [2012-01-31:15:39:13] Bootstrapper begin with version 3.1.0.4880 on Win x86 [2012-01-31:15:39:13] Installed runtime (2.0.2.12610) located at c:\Program Files\Common

  • How to charge my iPod?

    I use my iPod with my Mac. However when I travel I travel with a Windows laptop. I don't have any music on my laptop. My question is that I want to keep my iPod charged. Can I charge it only with my laptop? Or is there another way to charge it?

  • My Iphone5 is going back for repairs, Can I put my Iphone5 Sim into my old Iphone 4?

    As the title says Thank you

  • Can't import own classes...

    I'm very new to java. I rented a book called Java 2 Grand Cru to learn it on my own. It is based on Java 1.3 but I have 1.4 installed. Now I wanted to write a simple program with a class in an other directory. I added that directory to CLASSPATH so m