Setting namespace prefix with JAXB

I'm trying to build and use a JAXB application.
1. Generate the Java source files by submitting the XML Schema with Namespace to the binding compiler.
2. Compile the Java source code.
3. Marshal the data to new XML documents(valid XML document).
But namespace prefix of XML Schema doesn't equal namespace prefix of new XML document.
The prefix of new XML Schema is "heo". But, the prefix of new XML document set as "ns1" at discretion.
Is there any way to solve namespace prefix setting?
Thank you for your help.

Why is java the only one doing this?
I know prefixes are arbitrary, but when groups/individuals design XML docs, the instinct is to specify unique prefixes and to expect them coming in and out of other systems.
When joe-developer emails an API to a buddy, she's got to include a lot more info every time, not just "cool:news" vs. "bad:news" but "cool:news" and "xmlns:cool=uri-foobar-smyte" and ...
Sooo much simpler to handle the xml when its not only declared correctly, but you can expect specific prefixes. Less lines in writing tests, less lines in parsing out namespace declarations in order to expand them to uris and then map those to the random prefixes... blah.
If you are concerned about dropping uri's then THAT should be the exception to the rule, then you write tests to lookup the namespace-uri.
I suppose sun's xml stack is kind of a lesson to teach us developers to handle xml the orthodox way, using random prefixes, thanks for that.
Classic: look at the amount of code it takes to parse xml in java. Then add on complexity (weirdness) in terms of random prefixes .... then compare that to .net/python/ruby/php/perl/c/c++ ... sun is all alone on this one and about 10x more verbose.
At least honor the xml prefixes declared and developers round the world will appreciate the boost in productivity.
Word!
-jhn

Similar Messages

  • Remove namespace prefix with the XMLAnonymizerBean is possible at SOAP Adap

    Hello,
    I am wondering is it possible Remove namespace prefix with the XMLAnonymizerBean at SOAP Receiver Adaptor?
    Thanks

    Hi Rajiv,
    Pl. go through this blog:
    /people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean
    Also if you want to use this at sender side, SOAP adapter will not support. Please check stefans reply in this thread:
    XMLAnonymizerBean doesnt work
    Regards,
    ---Satish

  • Changing / Setting Namespace Prefix in SAX

    I am using sax to parse a document and I was wondering how I could change an existing namespace prefix or add one to the front of every element. I am using an XML standard called PIDX which requires each element to look like this "<pidx:ELEMENTNAME>". I know this should not be required but the standard requires it. I am familiar with using the startElement and endElment methods but I am not sure how to set a prefix. Any help or examples would be appreciated.

    I recognize all of the words in the item you posted, but when I tried to parse the whole message, I got nothing.
    If you are using SAX to parse a document, it is just telling you what it sees by calling the various SAX methods like startElement, etc. If the XML document should have namespaces for all elements and it doesn't, it is not the fault of SAX, but of the program that created the XML data. So, you cannot set a prefix in SAX. You can be told by SAX that it saw a prefix, and by not seeing a call, you can tell that there was no prefix.
    How is the XML data generated? That is where you should first be concerned.
    In this case, SAX is just the messenger telling you what is in the XML data.
    Dave Patterson

  • Namespace Prefix with DOM

    Hey everyone,
    I have a document and I would like to add a prefix to an existing tag so basically I want
    <Record>
    to be
    <rec:Record>
    the code I am trying is
    private static void addRecPrefix(Document inDoc) throws XPathExpressionException
            if (inDoc == null)
                return;
            XPathFactory factory = XPathFactory.newInstance();
            XPath xpath = factory.newXPath();
            XPathExpression expr = xpath.compile("//Record");
            Object evalResult = expr.evaluate(inDoc, XPathConstants.NODESET);
            if (evalResult == null)return;
            NodeList record Tags = (NodeList)evalResult;
            for(int i=0; i<recordTags.getLength() ;i++)
                Node currentNode = recordTags.item(i);
                currentNode.setPrefix("rec");
                System.out.println(currentNode.getPrefix());
        }rec is a namespace created in the parent node and it is part of the document, however, when I run the code I get a NAMESPACE_ERR.
    How am I supposed to do this?
    UPDATE!!!!!!!!
    got it to work using this inside the loop
    Node currentNode = cdfTags.item(i);
    inDoc.renameNode(currentNode,"","rec:Record");
    is this the best way?
    Edited by: partyk1d24 on Jul 9, 2008 8:22 AM

    Hi Rajiv,
    Pl. go through this blog:
    /people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean
    Also if you want to use this at sender side, SOAP adapter will not support. Please check stefans reply in this thread:
    XMLAnonymizerBean doesnt work
    Regards,
    ---Satish

  • Namespace error with JAXB

    Hello everyone! This is my problem:
    I am using jaxb to unmarshall a xml file. When I unmarshall, the program doesn�t work at this point:
    JAXBContext jc = JAXBContext.newInstance("com.claynet.core.clom");
    Unmarshaller u = jc.createUnmarshaller();
    u.setValidating(true);
    Clom clom =
    (Clom)u.unmarshal(
    new FileInputStream( ".." + File.separatorChar +
    "webapps"+ File.separatorChar + "claybrary" + File.separatorChar
    + "objetosCLOM" + File.separatorChar + file_name.trim()) );
    The error I get is the following one:
    javax.xml.bind.UnmarshalException: Probably namespace URI of tag "clom" is wrong (correct one is "http://www.clayformacion.com/xsd/clomv1.0")
    - with linked exception:
    [com.sun.msv.verifier.ValidityViolation: Probably namespace URI of tag "clom" is wrong (correct one is "http://www.clayformacion.com/xsd/clomv1.0")]
    The problem seems to be a conflict with the namespace, but the schema has the namespace correctly set:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:clom="http://www.clayformacion.com/xsd/clomv1.0" xmlns="http://www.clayformacion.com/xsd/clomv1.0" targetNamespace="http://www.clayformacion.com/xsd/clomv1.0" elementFormDefault="qualified">
    The validation inside the unmarshalling crash.
    Is there any errors with the code? Can Anyone help me?
    Thanks

    Looks like error is clear namespace mismatch...try changing the following url in wsdl and regen the code
    http://example.ws found http://example.ws/xsd

  • SQL function to extract XML namespace prefix

    Hi,
    I have the following document
    <ns4:product xmlns:ns1="www.abc.com" xmlns:ns2="www.def.com" xmlns:ns3="www.ghi.com" xmlns:ns4="www.jkl.com">
    <ns4:productline>Widget</ns4:productline>
    </ns4:product>
    I'm trying to find a SQL function which will enable me to extract the namespace prefix with the value "www.jkl.com". This is so that I can then use the prefix as part of the xpath expression to search for an element value in the document eg. extractvalue('/ns4:product/ns4:productline')
    Thanks

    Try DBMS_XMLDOM.GetNameSpace

  • Extracting a namespace prefix

    Hi,
    I have the following document
    <ns4:product xmlns:ns1="www.abc.com" xmlns:ns2="www.def.com" xmlns:ns3="www.ghi.com" xmlns:ns4="www.jkl.com">
    <ns4:productline>Widget</ns4:productline>
    </ns4:product>
    I'm trying to find a SQL function which will enable me to extract the namespace prefix with the value "www.jkl.com". This is so that I can then use the prefix as part of the xpath expression to search for an element value in the document eg. extractvalue('/ns4:product/ns4:productline')
    Thanks

    Hi,
    This one's tricky, so tricky that I think it's not possible using Oracle built-in XML DML functions.
    Even XQuery Update cannot do it (for now) because, likewise, the prefix is always redeclared at child level.
    The only thing I can think of is XSLT (or maybe DOM manipulation) :
    SQL> select xmlserialize(document
      2           xmltransform(
      3             xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"/>')
      4           , xmltype(
      5  '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      6     xmlns:def="myns_namespace"
      7     xmlns:ns0="namespace">
      8    <xsl:template match="ns0:A">
      9      <xsl:copy>
    10        <xsl:element name="def:B"/>
    11      </xsl:copy>
    12    </xsl:template>
    13  </xsl:stylesheet>')
    14         )
    15        indent
    16      )
    17  from dual;
    XMLSERIALIZE(DOCUMENTXMLTRANSF
    <A xmlns="namespace" xmlns:def="myns_namespace">
      <def:B/>
    </A>

  • Using selectSingleNode with namespace prefixes like "xmlsns:xsi"???

    I'm having a little trouble manipulating a document with the xmlparserv2 library. The XMLNode.selectSingleNode method does not seem to work when the attribute in question is part of a namespace. For example, I have a document that has a schema declaration like so:
    ****CUT****
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="..\XMLStressTestCase.xsl"?>
    <XMLTestCase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../XmlStressTestCase.xsd" Name="Engenious (Switch) Eligible Test" MaxTime="30000">
    ****CUT****
    If I create an XMLDocument (myDoc) from the file in question and try to execute the following line of code
    Node n = myDoc.selectSingleNode("@xmlns:xsi");
    I get the following error
    " Namespace prefix 'xmlns' used but not declared."
    In google I found a thread (http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ugJD7hJ3BHA.2236%40tkmsftngp02&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dxmlns%2B%252B%2BselectSingleNode%26sa%3DN%26tab%3Dwg)that points to setProperty/selectionNamespaces
    as qa possible way to resolve the problem in the MSXML implementation. It looks like the oracle XDK has the same method, but I can't seem to find any documentation on the values that are supported for that method (http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/javadoc/oracle/xml/parser/v2/XMLNode.html#setProperty(java.lang.String, java.lang.Object))
    Any help? Should I be declaring the namespace in my XML someplace?

    In fact it used to be possible to set a NamespacePrefixMapper that controls the namespace prefixes in the JAXB 2.0 from Glasfish like this:
    marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new MyNamespacePrefixMapper());
    When using the Java 6 implementation of JAXB this coded will throw an exception. Has anyone got a clue how to control the namespace prefix in Java 6?
    Thanks,
    Ager

  • Printing with Apex generates error (namespace prefix ref....)

    Hello forum helpers,
    i have installed bi publisher standalone and bi publisher desktop with MS Word 2003.
    I have generated a rtf document as a template.
    I loaded this rtf template into the apex database and started the TEST REPORT BUTTON in apex report queries.
    But i have seen no report.
    So, I have placed a xdodebug.cfg file into the folder java/jre/lib and so i have several logfiles created after processing printing.
    This logfiles shows this lines, which i do not understand:
    [030211_051252364][oracle.apps.xdo.template.FOProcessor][STATEMENT] Log file 'xdo_030211_051252364_fo_data_14.xsl' is created.
    [030211_051252364][oracle.apps.xdo.template.FOProcessor][STATEMENT] FOProcessor.setData(InputStream) is called.
    [030211_051252364][oracle.apps.xdo.template.FOProcessor][STATEMENT] Log file 'xdo_030211_051252364_fo_data_15.xml' is created.
    [030211_051252379][oracle.apps.xdo.template.FOProcessor][STATEMENT] Log file 'xdo_030211_051252364_fo_out6.out' is created.
    [030211_051252379][oracle.apps.xdo.template.FOProcessor][STATEMENT] FOProcessor.setOutput(OutputStream)is called.
    [030211_051252379][oracle.apps.xdo.template.FOProcessor][STATEMENT] FOProcessor.setOutputFormat(byte)is called with ID=3.
    [030211_051252379][oracle.apps.xdo.template.FOProcessor][STATEMENT] Start Memory: max=247MB, total=62MB, free=23MB
    [030211_051252379][oracle.apps.xdo.template.FOProcessor][STATEMENT] FOProcessor.generate() called.
    [030211_051252379][oracle.apps.xdo.template.FOProcessor][STATEMENT] createFO(Object, Object) is called.
    [030211_051252395][oracle.apps.xdo.common.xml.XSLT10gR1][STATEMENT] Oracle XML Developers Kit 10.1.0.5.0 - Production
    [030211_051252395][oracle.apps.xdo.common.xml.XSLT10gR1][STATEMENT] Scalable Feature Disabled
    [030211_051252410][oracle.apps.xdo.common.xml.XSLTWrapper][ERROR] XSL error:
    XML-22008: (Error) Namespace prefix 'ref' used but not declared.
    [030211_051252410][oracle.apps.xdo.template.FOProcessor][STATEMENT] clearInputs(Object) is called.
    [030211_051252426][oracle.apps.xdo.template.FOProcessor][STATEMENT] clearInputs(Object) done. All inputs are cleared.
    [030211_051252426][oracle.apps.xdo.template.FOProcessor][ERROR] End Memory: max=247MB, total=62MB, free=20MB
    [030211_051252426][][EXCEPTION] java.lang.reflect.InvocationTargetException
    You see, that an xml-22008 Error appears.
    In google i only found, that the declaration of this reference must be before using it. Seems to be logical.
    But the template is generated by BI Publisher himself, so now i do not understand.
    I have no choice to declare references, the xml file is made by bi publisher.
    Has anyone a solution for this ?
    Thank you for help.
    Frank

    Issue was solved, found it in the bi publisher options in word 2003

  • How to add an element with a namespace prefix (Part 2)

    Hi all,
    I previously asked a question about adding an attribute with a namespace prefix to an element that already exists and that declares the namespace prefix here:
    https://forums.oracle.com/thread/2610142
    I received an answer that works, but now I am stumped again when I have to add an element where the element name has the namespace prefix.
    For example, let's say I already have this element:
    <A xmlns="namespace" xmlns:def="myns_namespace"/>
    And I want to add this element:
    <def:B/>
    To produce this:
    <A xmlns="namespace" xmlns:def="myns_namespace">
         <def:B/>
    </A>
    and NOT this:
    <A xmlns="namespace" xmlns:def="myns_namespace">
         <def:B  xmlns:def="myns_namespace"/>
    </A>
    This does not work:
    SELECT
    xmlserialize(document
        appendChildXML(
         xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"/>')
        , '/A'
        , xmlelement("def:D")
        , 'xmlns="namespace" xmlns:def="myns_namespace"'
      indent)
    FROM dual;
    Because of this error:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00234: namespace prefix "def" is not declared
    Error at line 1
    31011. 00000 -  "XML parsing failed"
    *Cause:    XML parser returned an error while trying to parse the document.
    *Action:   Check if the document to be parsed is valid.
    Is there any way to do this without the child element having the duplicate namespace declaration?
    My oracle version is:
    Oracle Database 11g Release 11.1.0.7.0 - 64bit Production

    Hi,
    This one's tricky, so tricky that I think it's not possible using Oracle built-in XML DML functions.
    Even XQuery Update cannot do it (for now) because, likewise, the prefix is always redeclared at child level.
    The only thing I can think of is XSLT (or maybe DOM manipulation) :
    SQL> select xmlserialize(document
      2           xmltransform(
      3             xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"/>')
      4           , xmltype(
      5  '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      6     xmlns:def="myns_namespace"
      7     xmlns:ns0="namespace">
      8    <xsl:template match="ns0:A">
      9      <xsl:copy>
    10        <xsl:element name="def:B"/>
    11      </xsl:copy>
    12    </xsl:template>
    13  </xsl:stylesheet>')
    14         )
    15        indent
    16      )
    17  from dual;
    XMLSERIALIZE(DOCUMENTXMLTRANSF
    <A xmlns="namespace" xmlns:def="myns_namespace">
      <def:B/>
    </A>

  • Delete namespace and prefix with Seeburger X.400 receiver

    Dear experts,
    I have a problem deleting a namespace and prefixes "ns0" from an XML output. When testing I was using an FTP receiver adapter with the AnonymizerBean which worked perfectly. I referred to: /people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean
    Now I have a Seeburger X.400 receiver adapter and the AnonymizerBean does not work anymore.
    The output message looks like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:ORDERRESPONSE xmlns:ns0="http://www.opentrans.org/XMLSchema/1.0" version="1.0">
    <ns0:ORDERRESPONSE_HEADER>
    <ns0:ORDERRESPONSE_INFO>
    <ns0:ORDER_ID>xxxxx</ns0:ORDER_ID>
    So I need to get rid of the namespace and the prefixes "ns0". Does anyone know how to configure the module of the X.400 receiver adapter to do this?
    Thank you very much for your help!
    Best regards,
    Peter

    Hey Guys,
    I am having issues with using anonymizer bean. Below is the data with namespaces I would like to strip:
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:ExecuteXMLRequest xmlns:ns1="http://decisionintellect.com/inteport/">
    - <ns1:_sRequestXML>
    - <ns1:inteflow>
    - <ns1:request cd_type="submit">
    - <ns1:user>
      <ns1:id_oper>INTERFACE</ns1:id_oper>
      <ns1:tx_password>password</ns1:tx_password>
      </ns1:user>
      <ns1:cd_service>SUBMIT</ns1:cd_service>
      <ns1:cd_product>IFE</ns1:cd_product>
      <ns1:id_channel>INTEGATE</ns1:id_channel>
      <ns1:id_company>OFFICEWORKS</ns1:id_company>
      <ns1:id_merchant>OFFICEWORKS</ns1:id_merchant>
      <ns1:cd_country>61</ns1:cd_country>
      <ns1:cd_security>IFE</ns1:cd_security>
      </ns1:request>
    - <ns1:application_details>
      <ns1:id_product_credit>COMMERCIAL DECISIONING</ns1:id_product_credit>
      <ns1:id_reference_internal>[APP-ID]</ns1:id_reference_internal>
      <ns1:id_reference_external>[customer ref here]</ns1:id_reference_external>
      <ns1:id_merchant_submit>OFFICEWORKS</ns1:id_merchant_submit>
      </ns1:application_details>
    - <ns1:service>
    - <ns1:application>
    - <ns1:finance>
      <ns1:cd_type_finance>TERMS 30</ns1:cd_type_finance>
      <ns1:am_finance>4000</ns1:am_finance>
      </ns1:finance>
    - <ns1:applicant cd_type="Principal" fg_new="0">
    - <ns1:company>
      <ns1:cd_type_entity>SLTR</ns1:cd_type_entity>
      <ns1:tx_company_abn>41552470947</ns1:tx_company_abn>
      <ns1:nm_company_legal>WESTON, DEAN</ns1:nm_company_legal>
      <ns1:cd_type_industry>OTHER</ns1:cd_type_industry>
      <ns1:no_directors>1</ns1:no_directors>
      <ns1:no_employees>1</ns1:no_employees>
      </ns1:company>
      </ns1:applicant>
    - <ns1:applicant cd_type="CoBorrower1" fg_new="0">
    - <ns1:individual>
      <ns1:cd_title>Mr</ns1:cd_title>
      <ns1:nm_firstname>Dean</ns1:nm_firstname>
      <ns1:nm_surname>Weston</ns1:nm_surname>
      <ns1:dt_dob>1968-12-29</ns1:dt_dob>
      <ns1:cd_gender>M</ns1:cd_gender>
      <ns1:fg_act_privacy>1</ns1:fg_act_privacy>
      <ns1:cd_residence>61</ns1:cd_residence>
      </ns1:individual>
    - <ns1:address>
    - <ns1:current_address>
      <ns1:tx_no_unit>1</ns1:tx_no_unit>
      <ns1:tx_no_street>1</ns1:tx_no_street>
      <ns1:nm_street>Test</ns1:nm_street>
      <ns1:cd_type_street>Rd</ns1:cd_type_street>
      <ns1:nm_suburb>Testerville</ns1:nm_suburb>
      <ns1:cd_state>VIC</ns1:cd_state>
      <ns1:cd_postcode>3000</ns1:cd_postcode>
      <ns1:ct_address_at_time>21</ns1:ct_address_at_time>
      <ns1:cd_country>61</ns1:cd_country>
      </ns1:current_address>
      </ns1:address>
    - <ns1:address>
    - <ns1:previous_address>
      <ns1:tx_no_street>2</ns1:tx_no_street>
      <ns1:nm_street>Wayback</ns1:nm_street>
      <ns1:cd_type_street>Crs</ns1:cd_type_street>
      <ns1:nm_suburb>Sydney</ns1:nm_suburb>
      <ns1:cd_state>NSW</ns1:cd_state>
      <ns1:cd_postcode>2000</ns1:cd_postcode>
      <ns1:ct_address_at_time>117</ns1:ct_address_at_time>
      <ns1:cd_country>61</ns1:cd_country>
      </ns1:previous_address>
      </ns1:address>
    - <ns1:identification>
    - <ns1:drivers_license>
      <ns1:id_number>123456789</ns1:id_number>
      <ns1:fg_verified>1</ns1:fg_verified>
      </ns1:drivers_license>
      </ns1:identification>
    - <ns1:contact>
    - <ns1:home_phone>
      <ns1:tx_area>03</ns1:tx_area>
      <ns1:tx_number>99998888</ns1:tx_number>
      </ns1:home_phone>
      </ns1:contact>
    - <ns1:contact>
    - <ns1:work_phone>
      <ns1:tx_area>03</ns1:tx_area>
      <ns1:tx_number>88887777</ns1:tx_number>
      </ns1:work_phone>
      </ns1:contact>
    - <ns1:contact>
    - <ns1:other_phone>
      <ns1:tx_number>0400123123</ns1:tx_number>
      <ns1:cd_type>Mobile</ns1:cd_type>
      </ns1:other_phone>
      </ns1:contact>
    - <ns1:contact>
    - <ns1:other_phone>
      <ns1:tx_area>03</ns1:tx_area>
      <ns1:tx_number>77776666</ns1:tx_number>
      <ns1:cd_type>Other</ns1:cd_type>
      </ns1:other_phone>
      </ns1:contact>
      </ns1:applicant>
      </ns1:application>
      </ns1:service>
      </ns1:inteflow>
      </ns1:_sRequestXML>
      </ns1:ExecuteXMLRequest>
    Anonymizer bean is stripping the namespace prefix ns1 but it is also stripping the address http://decisionintellect.com/inteport/.
    Below is my anonymizer bean config in PI:
    Processing seq:
    1                    AF_Modules/XMLAnonymizerBean               local enterprise bean            0
    Module config:
    0                   anonymizer.acceptNamespaces                    http://decisionintellect.com/inteport ''
    0                    anonymizer.quote                                          '
    Can someone please suggest how to keep the http://decisionintellect.com/inteport and remove rest of namespace prefixes

  • Unknown namespace prefix Error - when using custom Aliases with RDF aliases

    I am getting unknown namespace prefix error when I use custome SEM_ALIAS with rdf SEM_ALIAS. It seems once you specify custom SEM_ALIAS, the default rdf alias is not recognized. Following are the details of queries
    I have a sem_Model "test" which has "event" as a class and "Merger" as a sub-class of event, with "acquiringorg" as a property having the domain "org". "Org" is also defined as a class with the literal attribute "hasname". I have added one instance of "merger" class with appropriate values for "acquiringorg" property. There is one instance or "Org" as well for reference in the instance above.
    the following query(return all objects having property "acquiringorg" and its .e. "hasName" attribute for the object) runs fine and returns appropriate resultset
    select x event,z acquiringorg ,l acquireeorg from table(SEM_MATCH(
    '(?x Evnt:AcquiringOrg ?y)(?k orgn:hasName ?l)',
    SEM_MODELS('test'),
    null,
    SEM_ALIASES(SEM_ALIAS('Evnt','http://www.abc.com/Event/Merger/'),
    SEM_ALIAS('orgn','http://www.abc.com/Org/')),
    null));
    However when I want to add another criteria i.e. show me events of type merger(?x rdf:type :Merger) , the query fails with the "unknown namespace prefix error" as above
    select x event,z acquiringorg ,l acquireeorg from table(SEM_MATCH(
    '(?x rdf:type :Merger)(?x Evnt:AcquiringOrg ?y)(?k orgn:hasName ?l)',
    SEM_MODELS('test'),
    null,
    SEM_ALIASES(SEM_ALIAS('Evnt','http://www.abc.com/Event/Merger/'),
    SEM_ALIAS('orgn','http://www.abc.com/Org/')),
    null));
    specifying "rdf" ALIAS explicitly also does not work
    select x event,z acquiringorg ,l acquireeorg from table(SEM_MATCH(
    '(?x rdf:type :Merger)(?x Evnt:AcquiringOrg ?y)(?k orgn:hasName ?l)',
    SEM_MODELS('test'),
    null,
    SEM_ALIASES(_SEM_ALIAS('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'),_
    SEM_ALIAS('Evnt','http://www.abc.com/Event/Merger/'),
    SEM_ALIAS('orgn','http://www.abc.com/Org/')),
    null));
    I am unable to figure out why default namespace i.e. rdf is returning this error
    Stuck at this point badly!!Any pointers would be useful!!

    Full error details are as below
    ORA-29532: Java call terminated by uncaught Java exception: oracle.spatial.rdf.server.ParseException: Unknown namespace prefix ''
    ORA-06512: at "MDSYS.RDF_MATCH_IMPL_T", line 153
    ORA-06512: at "MDSYS.RDF_MATCH_IMPL_T", line 842
    ORA-06512: at "MDSYS.RDF_MATCH_IMPL_T", line 235
    ORA-06512: at line 1
    29532. 00000 - "Java call terminated by uncaught Java exception: %s"
    *Cause:    A Java exception or error was signaled and could not be
    resolved by the Java code.
    *Action:   Modify Java code, if this behavior is not intended.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Xpath with unknown namespace prefix

    Given XML that looks like this
       <nnn:XXX>
         <mmm:YYY>value</mmm:YYY>
       </nnn:XXX>
    And in the above the 'mmm' can vary but the 'YYY' doesn't.
    Can one construct an XPath expression that explicity returns the node-set for the inner element block using 'YYY'?
    I am not looking for a first node or indexed solution but rather one that explicitly uses 'YYY' and not 'mmm' in some way.
    I tried several variations (guesses) using the function Contains but that did nothing but produce syntax errors.

    The namespace prefix is meaningless, it's only the namespace URI that is significant, so there's no XPath way of searching given a namespace prefix. But fortunately you have the opposite problem, you don't care about the namespace at all. The XPath function local-name() returns the local part of the name of a node, in your example the "YYY" part of the element name.

  • XMLStreamReaderBase tries to create a QName with a null namespace prefix

    Given the following xml:
    <foo>
    <bar type="value"/>
    </foo>
    Calling getAttributeName(index) while on the 'bar' element will cause an IllegalArgumentException as XMLStreamReaderBase tries to create a javax.xml.namespace.QName with a null prefix instead of using XMLConstants.DEFAULT_NS_PREFIX
    java.lang.IllegalArgumentException: prefix cannot be "null" when creating a QName
    at javax.xml.namespace.QName.<init>(QName.java:170)
    at weblogic.xml.stax.XMLStreamReaderBase.getAttributeName(XMLStreamReaderBase.java:339)

    Hi, were you able to solve this issue? I am also facing the same!
    Deepak

  • Extracting XML values with namespace prefixes

    Hint: I put this topic in "SQL and PL/SQL" but that was a bad idea, I think.
    Hi!
    I have a XML file:<?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/styl.xsl"?>
    <wnio:Deklaracja
    xmlns:adr="http://crd.gov.pl/xml/schematy/adres/2008/05/09/"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:inst="http://crd.gov.pl/xml/schematy/instytucja/2008/05/09/"
    xmlns:meta="http://crd.gov.pl/xml/schematy/meta/2008/05/09/"
    xmlns:oso="http://crd.gov.pl/xml/schematy/osoba/2008/05/09/"
    xmlns:str="http://crd.gov.pl/xml/schematy/struktura/2009/11/16/"
    xmlns:wnio="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
    xsi:schemaLocation="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/ http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/schemat.xsd">
                                <wnio:OpisDokumentu><str:CID>[email protected]</str:CID><meta:Identyfikator typIdentyfikatora="idFormularza"><meta:Wartosc>InstytucjaPubliczna/Deklaracja podatku od środków transportowych DT-1</meta:Wartosc></meta:Identyfikator></wnio:OpisDokumentu>
                                <wnio:Naglowek>
                                    <wnio:KodFormularza kodSystemowy="DT-1(3)"/>
                                    <wnio:WariantFormularza>3</wnio:WariantFormularza>
                                    <wnio:Rok>2008</wnio:Rok>
                                    <wnio:ObowiazekSkladaniaDeklaracji>1</wnio:ObowiazekSkladaniaDeklaracji>
                                    <wnio:MiejsceSkladania/>
                                </wnio:Naglowek>
                                <wnio:Podatnik>
                                    <wnio:OsobaPrawna>
                                        <wnio:NIP>345678901</wnio:NIP>
                                        <wnio:PelnaNazwa>Testowa Instytucja Publiczna</wnio:PelnaNazwa>
                                        <wnio:NazwaSkrocona/>
                                        <wnio:REGON>234512345</wnio:REGON>
                                    </wnio:OsobaPrawna>
                                    <wnio:AdresSiedzibyZamieszkania>
                                        <wnio:KodKraju>PL</wnio:KodKraju>
                                        <wnio:Wojewodztwo>ŚLĄSKIE</wnio:Wojewodztwo>
                                        <wnio:Powiat>Katowice</wnio:Powiat>
                                        <wnio:Gmina>Katowice (gmina miejska)</wnio:Gmina>
                                        <wnio:Ulica>ul. Mikołowska</wnio:Ulica>
                                        <wnio:NrDomu>100</wnio:NrDomu>
                                        <wnio:NrLokalu>924</wnio:NrLokalu>
                                        <wnio:Miejscowosc>Katowice (miasto)</wnio:Miejscowosc>
                                        <wnio:KodPocztowy>40-065</wnio:KodPocztowy>
                                        <wnio:Poczta>Katowice</wnio:Poczta>
                                    </wnio:AdresSiedzibyZamieszkania>
                                </wnio:Podatnik>
                                <wnio:PozycjeSzczegolowe>
                                    <wnio:D.1>
                                        <wnio:P_22/>
                                        <wnio:P_23/>
                                    </wnio:D.1>
                                    <wnio:D.2>
                                        <wnio:P_28/>
                                        <wnio:P_29/>
                                    </wnio:D.2>
                                    <wnio:P_82/>
                                    <wnio:P_83/>
                                </wnio:PozycjeSzczegolowe>
                                <wnio:Zalacznik_DT-1A>
                                    <wnio:P_1/>
                                    <wnio:P_2/>
                                    <wnio:P_22>1</wnio:P_22>
                                </wnio:Zalacznik_DT-1A>
                                <wnio:Zalacznik_DT-1A>
                                    <wnio:P_1/>
                                    <wnio:P_2/>
                                    <wnio:P_22>3</wnio:P_22>
                                </wnio:Zalacznik_DT-1A>
                            </wnio:Deklaracja>and an overloaded function:
    function dodaj_DT1_z_xml(p_dt1 in out nocopy XMLType) return number as
      r_dt1   POD_SRTR_DT1%rowtype;
      r_dt1a  POD_SRTR_DT1A%rowtype;
      r_sdek  POD_SRTR_DEKLARACJE%rowtype;
      l_wariantDT1  number(2);
      l_xosf  XMLType;
      l_xosp  XMLType;
      l_xadr  XMLType;
      l_xszcz XMLType;
      l_zal   XMLType;
      l_z     XMLType;
      l_zno   pls_integer;
      l_xml   XMLType;
      l_ns    varchar2(10);
    -- xmlns:wnio="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"
    begin
      if --p_dt1.existsNode('/wnio:Deklaracja')=0 and
         p_dt1.existsNode('/Deklaracja','xmlns:wnio="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"')=0
      then  return -2;  end if;
      if p_dt1.existsNode('/wnio:Deklaracja')=1 then
        l_ns := 'wnio:';
      end if;
      if p_dt1.existsNode('/'||l_ns||'Deklaracja')=0 then                     return -2;  end if;
      if p_dt1.existsNode('/'||l_ns||'Deklaracja/'||l_ns||'Naglowek')=0 then            return -3;  end if;
      if p_dt1.existsNode('/'||l_ns||'Deklaracja/'||l_ns||'Podatnik')=0 then            return -4;  end if;
      if p_dt1.existsNode('/'||l_ns||'Deklaracja/'||l_ns||'PozycjeSzczegolowe')=0 then  return -5;  end if;
      return 1;
    end;
    function dodaj_DT1_z_xml(p_dt1 in out nocopy CLOB) return number is
      l_xml   XMLType;
    begin
      l_xml := XMLType(p_dt1);
      return dodaj_DT1_z_xml(l_xml);
    end dodaj_DT1_z_xml;I run the code:declare
      v_clob  CLOB;
      v_out   number;
    begin
      SELECT dok_content INTO v_clob FROM EPUAP.epuap_dokumenty WHERE dok_id=13;
      v_out := POD_PCK_SRTR_DT1.DODAJ_DT1_Z_XML(v_clob);
      DBMS_OUTPUT.put_line(v_out);
    end;the output is -2. What must I change to find the node "wnio:Deklaracja"? I'm newbie in XML and namespaces :(
    Help me, please...
    Oracle version is 10.2.0.3

    Hi,
    If you declare a namespace prefix then corresponding elements must be qualified.
    So, either do :
    p_dt1.existsNode('/wnio:Deklaracja','xmlns:wnio="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"')or use a default namespace declaration :
    p_dt1.existsNode('/Deklaracja','xmlns="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"')BTW, could you explain what are you trying to accomplish?

Maybe you are looking for

  • Mac air shuts down when i connect usb

    everytime i connect a usb to the port my mac ***** down.. why is this happening and what can i do about it??? any help is apreciated cuz im not good with technology

  • Generic problem in passing arguments  ( question )

    I wrote some generic class that hold some generic map. When i looking some key in this map - i want to have the value of the key and set this value to some argument that i pass to the function that look for it. I dont want to return the value as retu

  • 1.0.1 & 1.0.2 and still stopping music while surfing & slow email sending

    I know this is an old issue, but are others still seeing this with the music after two updates? I will have a full set of ATT bars, on WiFi and my reply emails launch only after a minute or more. Is it possible to see the email launch progress? Thank

  • I have two ipods and they both stopped working on my home computer.

    My Ipod 4gb has worked great until know. I plugged it in and it doesn't show up on my computer any longer. I took it to work and it worked fine. Is this a USB port issue or could we have messed with the setting during a upgrade? or, does the memory a

  • Using go_record built-in

    HI I have a master block and detail block though the detail block is populated by the procedure which populates when user double mouse click on the master block. Now,if user moves up and down the master record i have to clear the detail block. I am u