Non-wanted character in my XML

Hi,
(I'm sorry for my english expression ==> I'm french)
I've tried to create an XML Document with this source code :
Document doc = createDomDocument();
public static Document createDomDocument() {
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.newDocument();
return doc;
} catch (ParserConfigurationException e) {
     e.printStackTrace();
return null;
Element root = doc.createElement("root");
acl.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
acl.setAttribute("xmlns", "http://www.example.org/myProject");
acl.setAttribute("xsi:noNamespaceSchemaLocation", "http://www.example.org/myProject.xsd");
doc.appendChild(acl);But my result is that :
<?xml version="1.0" encoding="UTF-8"?>
<root     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="http://www.example.org/myProject"
                       xmlns:NS1=""
          NS1:xsi:noNamespaceSchemaLocation="http://www.example.org/myProject.xsd">
     <firstElement xmlns:NS1="" NS1:id="5646478946135" NS1:oper="CRA" NS1:mode="BAT" NS1:secret="YES">
          <PositionDate>20080822</PositionDate>
     </firstElement>
</root>And I don't understand why I've got this 'NS1' (I think it's for NameSpace...)
Have you have any solution for me ? I've search some solution on this forum but I've find nothing
Thank you.

This is probably what's confusing the DOM:
acl.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");Attribute names "xmlns:foo" are interpreted as a namespace prefix definition; they do not themselves need to be namespaced. So, you could rewrite like this:
acl.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");Or, an arguably better approach is this (because it doesn't assume that you've set the prefix namespace):
Element root = doc.createElement("root");
acl.setAttribute("xmlns", "http://www.example.org/myProject");
acl.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:noNamespaceSchemaLocation", "http://www.example.org/myProject.xsd");

Similar Messages

  • ORA-01858: a non-numeric character was found where a numeric was expected

    hi ,
    This was the code which shows the sales rep invoice amount and collected amount but while running report thru concurrent program its showing the following error:
    ORA-01858: a non-numeric character was found where a numeric was expected
    WHERE TO_CHAR ( TO_DATE ( PS.GL_DATE , 'DD/MON/YY' ) , 'MON-YYYY' ) BETWEEN TO_CHAR ( TO_DATE ( : ==> P_todate , 'YYYY/MM/DD' ) , 'MON-YYYY' ) AND TO_CHAR ( TO_DATE ( : P_todate , 'YYYY/MM/DD' ) , 'MON-YYYY' ) AND ps.customer_id = cust.custome
    The Actual Code was this
    SELECT SUBSTR(SALES.name,1,50) salesrep_name_inv,
    --ps.CLASS,
    SUM(ABS(ps.acctd_amount_due_remaining)) acctd_amt,
    SUM(ABS(ps.amount_due_remaining)) amt_due_remaining_inv,
    SUM(ABS(ps.amount_adjusted)) amount_adjusted_inv,
    SUM(ABS(ps.amount_applied)) amount_applied_inv,
    SUM(ABS(ps.amount_credited)) amount_credited_inv,
              SALES.salesrep_id,
    NULL "REMARKS"
    -- ps.gl_date gl_date_inv,
    FROM ra_cust_trx_types ctt,
    ra_customers cust,
    ar_payment_schedules ps,
    ra_salesreps SALES,
    ra_site_uses site,
    ra_addresses addr,
    ra_cust_trx_line_gl_dist gld,
    gl_code_combinations c,
    ra_customer_trx ct
    WHERE TO_CHAR(TO_DATE(PS.GL_DATE,'DD/MON/YY'),'MON-YYYY')
    BETWEEN TO_CHAR(TO_DATE(:P_todate,'YYYY/MM/DD'),'MON-YYYY') AND TO_CHAR(TO_DATE(:P_todate,'YYYY/MM/DD'),'MON-YYYY')
    AND ps.customer_id = cust.customer_id
    AND ps.customer_trx_id = ct.customer_trx_id
    AND ps.cust_trx_type_id = ctt.cust_trx_type_id
    AND NVL(ct.primary_salesrep_id, -3) = SALES.salesrep_id
    AND ps.customer_site_use_id+0 = site.site_use_id(+)
    AND site.address_id = addr.address_id(+)
    AND TO_CHAR(TO_DATE(PS.GL_DATE_CLOSED,'DD/MON/YY'),'MON-YYYY')
    BETWEEN TO_CHAR(TO_DATE(:P_todate,'YYYY/MM/DD'),'MON-YYYY') AND TO_CHAR(TO_DATE(:P_todate,'YYYY/MM/DD'),'MON-YYYY')
    --AND    ps.gl_date_closed > TO_DATE(:P_todate,'MON-YYYY')
    AND ct.customer_trx_id = gld.customer_trx_id
    AND gld.account_class = 'REC'
    AND gld.latest_rec_flag = 'Y'
    AND gld.code_combination_id = c.code_combination_id
    AND sales.salesrep_id is not null and sales.name is not null
    -- and ps.payment_schedule_id+0 < 9999
    -- AND SALES.salesrep_id ='1001'
    GROUP BY SALES.name,
    --ps.CLASS,
    SALES.salesrep_id

    So to_date function accepts a string as input and returns a date. When a date is input instead, it is implicity converted to the required type of the function paremeter, which is a string, so that to_date can convert it back to a date again.
    If you are lucky with the implicit conversion, you get the same date back, if you are not you might get a different date or an error.
    From your query it appears that this conversion from a date, to a string, to a date, and then back to a string using to_char this time, is being done to remove the time or day part of the date. The actual range comparison is being done on strings rather than dates, which is dangerous as strings sort differently than dates.
    In this example if I sort by date, Jan 01 comes between Dec 00 and Feb 01 as you would expect.
    SQL> select * from t order by d;
    D
    12-01-2000
    01-01-2001
    02-01-2001When converted to strings, Feb 01 comes between Dec 00 and Jan 01, which is probably not the desired result
    SQL> select * from t order by to_char(d,'DD-MON-YY');
    D
    12-01-2000
    02-01-2001
    01-01-2001If you want to remove time and day parts of dates you should use the trunc function
    trunc(d) removes the time, trunc(d,'mm') will remove the days to start of month.
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/functions201.htm#i79761

  • Non-ASCII character in Email field

    Hi Guys,
    I am trying to enter non-english characters in Email field of user form, but OIM throws an error that "A non-Ascii character has been entered". I have also tried to turn off the AppFirewall Filter in xlConfig.xml file but no help. Is there any way thay I can enter non-Ascii characters in Email field?
    Regards,
    Rahul

    .oO(surfinIan)
    >I have a script that converts a ms word document to text
    then uploads that to a
    >blob field on a mysql db.
    > During the conversion some characters my not be
    recognised. When i then call
    >up the blob for display on the browser...those characters
    show up as unknown
    >characters with a ? or box. Is there a way to
    preg_replace those unknown
    >characters before displaying them.
    What about fixing the encoding problem instead? If chars get
    lost during
    such a transfer
    document->script->database->script->browser it's always
    an encoding problem somewhere down the road.
    The recommendation these days is to use UTF-8, which avoids
    most of
    these old problems. You just have to make sure that your
    documents are
    properly stored as UTF-8 in the database and delivered as
    such to the
    script and the browser, then you don't have to worry about
    special chars
    anymore.
    That's just the general idea. I can't be more specific, since
    I don't
    know your conversion script or the database structure.
    Micha

  • How to validate for non-english character on a single line text field

    In a "Single Line Text" field we would like to allow the users to enter alpha numeric values only. We should show error when the user enter non-English values like
    carácter
    Vijayaragavan, MCTS

    Hi,
    According to your post, my understanding is that you wanted to validate for non-english character on a single line text field.
    I recommend to use jQuery to attach regular expression validation. Please refer to:
    Using #jQuery to attach regular expression validation to a #SharePoint list form field
    In addition, for custom validations you can create your own Types. Refer to
    this[^] for creating custom field type
    More information:
    SharePoint Custom Field - Regex Validator
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • Does querybuilder support non-english character?

    I want to make query using querybuilder with non-english character (Chinese)?
    I tried with http://localhost:4502/libs/cq/search/content/querydebug.html but it is not working.
    below is my query string:
    property=contenttext
    property.value=&#20320;&#22909;&#21966;
    I have converted the chinese character (你好嗎)to unicode.
    Can anyone help me?

    That's a bug in the debugger UI. But it's easy to fix:
    in crxde lite, overlay /libs/cq/search/components/querydebug/querydebug.jsp by copying it to /apps/cq/search/components/querydebug/querydebug.jsp
    open /apps/cq/search/components/querydebug/querydebug.jsp
    find the line "props.load(new ByteArrayInputStream(queryParam.getBytes("ISO-8859-1")));"
    and replace with "props.load(new StringReader(queryParam));"
    Will be fixed in 5.6.1.

  • Error when import file with non-english character

    Hi,<br /><br />I have images file with non-english character (unicode), for example ABC<X>.png where <X> is non-english character such as japanese, chinese, etc.<br /><br />Whenever I want to import the file to After Effects (right click -> import -> file), I always encounter error:<br /><br />Finding file/dir info for the file "C:\...\ABC?.png" -- file not found (-43) (3::30)<br />Can't import file "ABC?.png": unsupported filetype or extension. (0::1)<br /><br />My PC is Windows XP Professional 2002 SP2 English.<br /><br />How to solve this problem?<br /><br />Thanks

    Adjust your system language settings. Proper file name conventions require a consistent Unicode environment, so install the respective foreign language support files or switch the language system-wide. Mixing different zones/ code ranges is always a bad idea. If your system is not in Japanese, AE will always misinterpret the characters and refuse to import. If that's not feasible, simply rename the files.
    Mylenium

  • Non supported character set: oracle-character-set-171'  in java XSU

    I cannt update object type CHAR data in table cause Non
    supported character set: oracle-character-set-171'
    NLS lang UTF-8
    database language WIN-1251

    I think it is a bug at JDBC-OCI Driver.
    Now I am useing setPlsqlIndexTable to transfer
    a var to PLSQL procedure, and want to
    retrieve it from out parameter.
    When I transfer English characters, it can
    work correctly, but if I transfer Japnese or
    Chinese characters, the disorderly characters
    were returned. I have not resolved this problem
    yet. Who can tell me how to resolve it.

  • Returning Non-Numeric character

    Hi All,
    Im using Oracle 11gR2. Following is my sample data and i want to search the string having non-numeric characters in it.
    with t as
    select '123' val from dual
    union
    select ' 123' val from dual
    union
    select '1123' val from dual
    union
    select 'A123' val from dual
    union
    select 'x 123' val from dual
    union
    select '#123' val from dual
    select val from t
    where regexp_like (val, '[[:alpha:]|[:blank:]|#]')Query works perfectly for given result set but would break if another string, say '123@', with a special character comes. So is there any format specifier (as we have [:alpha:], [:digit:]) to directly identify non-numeric character including space from a string? If no what is the work round for it?
    Thanks,
    Vivek

    Vivek wrote:
    Query works perfectly for given result set but would break if another string, say '123@', with a special character comes. So is there any format specifier (as we have [:alpha:], [:digit:]) to directly identify non-numeric character including space from a string? If no what is the work round for it?What is your expected output?
    All the strings which contains anything other than digits? You could use TRANSALTE
    select val from t
    where translate(val,'a0123456789','a') is not null;
    --"Add space also if you want to exclude space
    select val from t
    where translate(val,'a 0123456789','a') is not null;
    {code}
    You could use REGEXP_LIKE or REGEXP_REPLACE, but regexp functions are more CPU consuming..
    {code}
    select val from t
    where not regexp_like(val,'^0-9+$');
    {code}
    Edited by: jeneesh on Apr 2, 2013 2:16 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQLException: Non supported character set: oracle-character-set-178

    Hello,
    I run a j2ee application on the Sun J2EE Application server.
    I migrated to 0racle 9.2.0.3.
    I have an ejb making a connexion with the oci driver
    and in it I manipulate XMLType:
    PreparedStatement pst = cnx.prepareStatement(sql);
    XMLType xt = XMLType.createXML(cnx, "<ENTETE></ENTETE>");
    pst.setObject(1, xt);
    I've got an exception on the setObject method :
    java.sql.SQLException: Non supported character set: oracle-character-set-178
    at oracle.gss.util.NLSError.throwSQLException(NLSError.java:46)
    at oracle.sql.CharacterSetUnknown.failCharsetUnknown(CharacterSetFactory
    Thin.java:171)
    at oracle.sql.CharacterSetUnknown.convert(CharacterSetFactoryThin.java:1
    35)
    at oracle.xdb.XMLType.getBytesString(XMLType.java:1687)
    at oracle.xdb.XMLType.getBytesValue(XMLType.java:1623)
    at oracle.xdb.XMLType.toDatum(XMLType.java:431)
    at oracle.jdbc.driver.OraclePreparedStatement.setORAData(OraclePreparedS
    tatement.java:2745)
    at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedSt
    atement.java:3208)
    I have the nsl_charset12.zip , ojdbc14.jar,xdb.jar,xmlparserv2.jar in the J2EE_CLASSPATH of my server.
    Does any one have an idea.
    Thanks , Edwige

    (*bump*)
    Almost the exact same problem here...
    "conn" is an object of type OracleConnection
    "cst" is an object of type "CallableStatement"
    "xml" is a String holding a well-formed XML document (say, "<foo><bar>value</bar></foo>")
    XMLType xt = XMLType.createXML(conn, xml);
    cst.setObject(1, xt); // BOOM! Non supported character set: oracle-character-set-178
    Other relevant details:
    Using the 9.2.0.3 JDBC thin client (ojdbc14.jar)
    Using the newest nls_charset12.zip (in the 9.2.0.3 download section under the "1.2/1.3" heading.
    JDK1.4.1_03 (04?)
    Oracle itself is 9.2.0.3
    database charset is 'WE8MSWIN1252' (yeah, I fought with the DBA and lobbied for UTF-8, but obviously he won that battle... sigh...)
    Also relevant... prior to a few days ago, it worked. Then, the DBA did an upgrade and the charset errors began. It's hard to get a straight answer from him because his English isn't very good, but my guess is that he updated it from 9.2.0.1 to 9.2.0.3.

  • Non supported character set with ojdbc14.jar

    Hi.
    I have an application that uses JMS/AQ and works great under JDK1.4 and with libraries:
    -classes12.jar
    -nls_charset12.jar
    I looked at the oracle web site that says you should use the new JDBC drivers(ojdbc14.jar) but I fail to get it working. I keep getting;
    oracle.jms.AQjmsException: Non supported character set: oracle-character-set-178
    at oracle.jms.AQjmsSession.addDurableSubscriber(AQjmsSession.java:2616)
    at oracle.jms.AQjmsSession.createDurableSubscriber(AQjmsSession.java:2124)
    at oracle.jms.AQjmsSession.createDurableSubscriber(AQjmsSession.java:1872)
    at prevision.socketserver.JMSThread.checkForNewAlarms(JMSThread.java:84)
    Any help would be greatly appreciated!
    Best regards,
    Christer Nordvik

    hi Christer,
    I have looked at the drivers download page at:http://otn.oracle.com/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html and there isn't any nls_charset12.jar for JDK1.4. I've tried using the one with JDK1.3
    There isn't any nls_charset12.jar for 1.4, its the one that comes with 1.3, just wanted to check it you are using the latest version of nls_charset12.jar
    BTW are you running this program from command-line or app server ? Incase of app server the latest jar's must be replaced in oc4j_home/jdbc/lib dir.
    Elango.

  • Using Non-destructive filter with Nested XML data

    Hi,
    How do you use Non-destructive filter with Nested XML data?
    I am using the non-destructive filter sample with my own xml which is setup to search for the <smc></smcs> in my xml below. But when i test it it only searches the last row of the "smc". How can i make it work so it can search for repeating nodes? or does it have something to with how my xml is setup?
        <ja>
            <url>www.sample.com</url>
            <jrole>Jobrole goes here</jrole>
            <prole>Process role goes here...</prole>
            <role>description...</role>
            <prole>Process role goes here...</prole>
            <role>description....</role>
            <prole>Process role goes here...</prole>
            <role>description...</role>
            <sjc>6K8C</sjc>
            <sjc>6B1B</sjc>
            <sjc>6B1F</sjc>
            <sjc>6B1D</sjc>
            <smc>6C9</smc>
            <smc>675</smc>
            <smc>62R</smc>
            <smc>62P</smc>
            <smc>602</smc>
            <smc>622</smc>
            <smc>642</smc>
            <smc>65F</smc>
            <smc>65J</smc>
            <smc>65L</smc>
            <smc>623</smc>
            <smc>625</smc>
            <smc>624</smc>
            <smc>622</smc>
            <audience>Target audience goes here....</audience>
        </ja>
    here is the javascript that runs it.
    function FilterData()
        var tf = document.getElementById("filterTF");
        if (!tf.value)
            // If the text field is empty, remove any filter
            // that is set on the data set.
            ds1.filter(null);
            return;
        // Set a filter on the data set that matches any row
        // that begins with the string in the text field.
        var regExpStr = tf.value;
    if (!document.getElementById("containsCB").checked)
            regExpStr = "^" + regExpStr;
        var regExp = new RegExp(regExpStr, "i");
        var filterFunc = function(ds, row, rowNumber)
            var str = row["smc"];
            if (str && str.search(regExp) != -1)
            return row;
            return null;
        ds1.filter(filterFunc);
    function StartFilterTimer()
        if (StartFilterTimer.timerID)
            clearTimeout(StartFilterTimer.timerID);
        StartFilterTimer.timerID = setTimeout(function() { StartFilterTimer.timerID = null; FilterData(); }, 100);
    I really need help on this, or are there any other suggestions or samples that might work?
    thank you!

    I apologize, im using Spry XML Data Set. i guess the best way to describe what im trying to do is, i want to use the Non-desctructive filter sample with the Spry Nested XML Data sample. So with my sample xml on my first post and with the same code non-destructive filter is using, im having trouble trying to search repeating nodes, for some reason it only searches the last node of the repeating nodes. Does that make sense? let me know.
    thank you Arnout!

  • Check whether the selected character is an xml open/close tag character...

    Hi Everyone,
    I am using InDesign CS4 and i need some help from you.
    Is there any better way to check the selected character is an XML open/close tag character in the text instead of using the unicode.
    Thanks in advance
    Thiyagu

    I'm having trouble understanding your requirements. I think you're trying to remove the zero-width non-breaking spaces that don't hold tags. Is that right?
    If that's the case, you don't really have to worry about the tags. You can do a normal find and replace:
    app.findTextPreferences.findWhat = "<feff>";
    app.changeTextPreferences.changeTo = "";
    app.activeDocument.changeText();
    It will match the characters that hold the tags, but won't remove them. Actually, it will say it removed them, but won't actually do it—or will replace them immediately? I don't know.
    (As far as I know, there is no way to match the 0xfeffs with a grep find, which is what it looks like you were trying. It would be super awesome if there weren't as many different  notations for unicode characters as there are means of finding them.)
    If you're trying to remove the characters that hold the tags, I think your only option is to untag the elements. You can't remove the 0xfeffs but keep the tags.

  • Reading a non-english character

    Hi, I have a trouble with reading a non-english character from a html page.
    I'm taking the word from the html page, and compare it with itself,
    like this
    string.equals("B&#304;TT&#304;")
    but it returns false.
    is it possible to correct this?

    specify an encoding for your inputstream reader:
    BufferedReader in = new BufferedReader(
                new InputStreamReader(new FileInputStream("infilename"), "8859_1")); for example

  • Error while pulling data from an Oracle database. ORA-01858: a non-numeric character was found where a numeric was expected

    I'm trying to pull data from an Oracle database using SSIS. When I try to select a few fields from the source table, it returns the following error message:
        [OLE DB Source [47]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.
        An OLE DB record is available.  Source: "OraOLEDB"  Hresult: 0x80040E14  Description: "ORA-01858: a non-numeric character was found where a numeric was expected".
        An OLE DB record is available.  Source: "OraOLEDB"  Hresult: 0x80004005  Description: "ORA-01858: a non-numeric character was found where a numeric was expected".
    The source columns are a combination of numeric and texts, and I've also tried selecting one of them, which didn't work. I'm using the Oracle client 11.2.0.1, and it works fine with any other data sources I have connected to so far. How can I resolve this
    error?

    Hi H.James,
    According to your description, the issue is a non-numeric character was found where a numeric was expected while pulling data from an Oracle database in SSIS.
    Based on the error message, the issue should be you are comparing a number column to a non-number column in a query. Such as the query below (ConfID is a number, Sdate is a date):
     where C.ConfID in (select C.Sdate
                       from Conference_C C
                       where C.Sdate < '1-July-12')
    Besides, a default behavior for the Oracle OleDb Provider that change the NLS Date Format of the session to 'YYYY-MM-DD HH24:MI:SS can also cause the issue. For more details about this issue, please refer to the following blog:
    http://blogs.msdn.com/b/dataaccesstechnologies/archive/2012/01/20/every-bug-is-a-microsoft-bug-until-proven-otherwise.aspx
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Non-numeric character error

    This is my error:
    javax.servlet.ServletException: ORA-01858: a non-numeric character was found where a numeric was expected
    This is my code:
    ResultSet myRs = myStmt.executeQuery("select count(*) dexCount from cs_dexia where userid = '" + vUserid + "'");
              int vCount = 0;     
                   while(myRs.next()){
                        vCount = myRs.getInt("dexCount");
              out.println(vCount);
                   if(vCount > 0)
                   response.sendRedirect("swapform.jsp");
    What have I done wrong?

    I have changed that and am now getting:
    javax.servlet.ServletException: ORA-00904: invalid column name
    the query runs in my sql tool no problem, could it be something to do with the alias?

Maybe you are looking for