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.
Similar Messages
-
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. -
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 ProductionHi,
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> -
Is there any way of finding out the namespace prefix if there is one, from a DOMParser instance or a XMLDocument instance?
I have a DOMParser instance and I don't know whether there is a namespace specification in it. If there is, I need to know what it is so I can update my XPath expressions to use the appropriate prefix.
I have tried the XMLDocument.getNamespace function but it doesn't seem to be implemented (or it is depricated).
Any help would be greatly appreciated.You're right on track with the namespaces hunch.
XPath 1.0 does not provide the ability to search on the default namespace.
That is, even if you document looks like this:<foo xmlns="urn:bar"/>you cannot use any compliant XPath 1.0 implementation to find the <foo> element with the pattern /foo, since in XPath 1.0 /foo finds the <foo> element that is the child of the root with a null namespace URI.
In the example above, the namespace uri of the <foo> element is urn:bar, so in particular it's not null.
With XPath 1.0, you need to specifically qualify the foo element with a namespace prefix that is bound to the same namespace URI as your default namespace.
So, your XPath would need to look like /xxx:foo where xxx is an arbitrary namespace prefix associated with the urn:bar namespace URI.
The selectNodes, selectSingleNode, and valueOf methods all have an overloading which takes an instance of the oracle.xml.parser.v2.NSResolver interface as the 2nd argument. This argument is used to resolve what namespace prefixes found in the XPath search string map to.
To implement the NSResolver interface, you need only implement a single method:
String resolveNamespacePrefix(String prefix);
In the example above, this method would return the string "urn:bar" when passed the prefix string "xxx" so that the XPath of /xxx:foo would match the <foo> element with urn:bar namespace uri in the example document above.
Steve Muench
Development Lead, Oracle XSQL Pages Framework
Lead Product Manager for BC4J and Lead XML Evangelist, Oracle Corp
Author, Building Oracle XML Applications
null -
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 AMHi 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 -
XPath expression with multiple namespaces?
Hello all.
I have been scouring the forums and Google and can't seem to find anything similar to my problem.
I have the following XML with three namespaces. Two are defined in the root element and the third is defined in the the IdSession element. To make things even more confusing, the second and third namespaces have the same prefix, 'f'.
This is the xml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<NamespaceTestCall xmlns="http://my.default/namespace"
xmlns:f="http://my.second/namespace">
...<f:Level1>
......<f:IdSession xmlns:f="http://my.third/namespace">12345</f:IdSession>
......<Language>ENG</Language>
...</f:Nivel1>
</NamespaceTestCall>
My question is, how do I get at the IdSession element? Don't I need to create an XPath object and assign it more than one NamespaceContext?
This is what I am doing:
Document xmlDocument = loadXML(xmlSource);
XPath xpathEvaluator = XPathFactory.newInstance().newXPath();
xpathEvaluator.setNamespaceContext(new NamespaceContextProvider("a", "http://my.third/namespace"));
... xpathEvaluator.evaluate("//a:IdSession", ...);
This code works but it might not return the 'IdSession' I want, since by searching like this '//a:IdSession' it is looking in the whole document. If there were another 'IdSession' somewhere else in the document with the same URI, it would be returned. I want the 'IdSession' that lives inside of 'Level1'.
So what I would like to do is something like this:
... xpathEvaluator.evaluate("/*/Level1/a:IdSession", ...);
But this does NOT work because 'Level1' has its own namespace. So what it seems like I need to do is the following:
... xpathEvaluator.evaluate("/*/b:Level1/a:IdSession", ...);
Having already added the 'Level1' namespace to the XPath object, with the prefix 'b'. But unlike JDOM, there is no 'add' functionality, only 'set', meaning if you call set twice the second call overwrites the first.
Is there anyway to do this?
Many thanks!
BobHello,
Sorry, that was my bad. I should have explained that NamespaceContextProvider is nothing more than my implementation of the NamespaceContext interface. The way I did it, I simply implemented getNamespaceURI() and getPrefix(). And the constructor accepted two parameters -- prefix and URI. So my problem was that when I assigned this NamespaceContext to my XPath object it would only have one prefix and one URI.
But I found an implementation here:
http://www.oreillynet.com/cs/user/view/cs_msg/50304
that instead of only having one prefix and URI uses a map. Thus its method setNamespace() adds the prefix and URi to the map, and getPrefix() and getPrefixes() retrieve them from the map.
Now when I want to use more than one namespace I simply call setNamespace() as many times as necessary, adding a prefix and URI pair each time, and when I am done I assign it to my XPath object.
And it works!
Thanks for the response!
Bob -
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.
FrankIssue was solved, found it in the bi publisher options in word 2003
-
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?
ThanksHi 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 -
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 -
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 -
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 -
Revision: 5899
Author: [email protected]
Date: 2009-04-02 17:36:40 -0700 (Thu, 02 Apr 2009)
Log Message:
Re:Sparkified this example with latest namespaces and prefixes.
Modified Paths:
flex/sdk/trunk/frameworks/projects/flex4/asdoc/en_US/mx/components/examples/ListExample.m xmlI am not sure what's happening with IE9 (no live site) but I had real problems viewing your code in Live View - until I removed the HTML comment marked below. Basically your site was viewable in Design View but as soon a I hit Live view, it disappeared - much like IE9. See if removing the comment solves your issue.
<style type="text/css">
<!-- /*Remove this */
body {
margin: 0;
padding: 0;
color: #000;
background:url(Images/websitebackgroundhomee.jpg) repeat scroll 0 0;
font-family: David;
font-size: 15px;
height:100%; -
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.3Hi,
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? -
Dear all,
I'm using code generated by NW Developer Studio 2004s for use inside Portal components acting as a web service consumer. The problem is that the code generated includes a namespace prefix for each element in the body of the message, but ECC (ERP 6.0) doesn't like the namespace prefixes (the namespace was not recognised by the ECC mapping tool.)and throws back a DeliveryException.
The SOAP message created by the generated NWDS code is:
<?xml version="1.0" encoding="UTF-8" ?>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wn3="http://www.w3.org/1999/XMLSchema" xmlns:wn2="http://www.w3.org/2000/10/XMLSchema" xmlns:wn1="http://www.w3.org/2001/XMLSchema" xmlns:wn0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wn4="urn:sap-com:document:sap:rfc:functions" xmlns:tns="urn:sap-com:document:sap:rfc:functions">
- <SOAP-ENV:Body>
- <wn4:Z_APPOINTMENT_GET_JCO_ORG>
<wn4:DATE_FROM>2007.01.01</wn4:DATE_FROM>
<wn4:DATE_TO>2008-02-02</wn4:DATE_TO>
<wn4:USERID>EGREO</wn4:USERID>
</wn4:Z_APPOINTMENT_GET_JCO_ORG>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I've had a very good look around the generated code - the serializers for creating the soap request - but could not find what exactly might be changed to leave off the prefixes.
I am using portal server 2004s
Many thanks for any advice/help
RezaI find out how should I do that.
/Reza -
Namespace prefix in Root element missing during variable assignment
In bpel 10.1.3.4, I need qualified element Namespaces in one of the target variables. I have an xsd that has elementFormDefault = "qualified" set, therefore all elements being referred to would have the namespace prefixed. This is working for all child elements, but not the root element. How can i get the root element prefixed with the namespace?
If i use transform or copy/append operation to populate in the target variable the variable gets populated something like this :
<Invoice xmlns:pidx="http://www.api.org/pidXML/v1.0" pidx:transactionPurposeIndicator="Original" pidx:version="1.0" xmlns="http://www.api.org/pidXML/v1.0">
<pidx:InvoiceProperties>
<pidx:InvoiceNumber>test123</pidx:InvoiceNumber>
</pidx:InvoiceProperties>
</Invoice>
Whereas i need :
<*pidx:*Invoice xmlns:pidx="http://www.api.org/pidXML/v1.0" pidx:transactionPurposeIndicator="Original" pidx:version="1.0" xmlns="http://www.api.org/pidXML/v1.0">
<pidx:InvoiceProperties>
<pidx:InvoiceNumber>test123</pidx:InvoiceNumber>
</pidx:InvoiceProperties>
</*pidx:*Invoice>
Is there some way to accomplish this?
Regards,
SandeepHi Sandeep,
We have exactly the same issue, but, when we implemented the solution, we are getting the following error, when we tried to compile the code, we are using 11.1.1.4.0 version of SOA 11g, appreciate if there is any way you can help us on this:
Jul 12, 2011 2:40:28 PM com.collaxa.cube.CubeLogger info
INFO: validating "BPELProcess1.bpel" ...
oracle.jrf.UnknownPlatformException: JRF is unable to determine the current application server platform.
at oracle.jrf.ServerPlatformSupportFactory.getInstance(ServerPlatformSupportFactory.java:79)
at oracle.integration.platform.blocks.WLSPlatformConfigurationProvider.<clinit>(WLSPlatformConfigurationProvider.java:44)
at oracle.integration.platform.blocks.FabricConfigManager.<clinit>(FabricConfigManager.java:154)
at oracle.integration.platform.blocks.xpath.FabricXPathFunctionResolver.loadXpathFunctions(FabricXPathFunctionResolver.java:282)
at oracle.integration.platform.blocks.xpath.FabricXPathFunctionResolver.loadXPathConfigFile(FabricXPathFunctionResolver.java:156)
at oracle.integration.platform.blocks.xpath.FabricXPathFunctionResolver.init(FabricXPathFunctionResolver.java:49)
at com.collaxa.cube.xml.xpath.BPELXPathFunctionNameResolver.loadFabricXpathFunctions(BPELXPathFunctionNameResolver.java:57)
at com.collaxa.cube.xml.xpath.BPELXPathFunctionNameResolver.<init>(BPELXPathFunctionNameResolver.java:48)
at com.collaxa.cube.xml.xpath.BPELXPathFunctionNameResolver.<clinit>(BPELXPathFunctionNameResolver.java:44)
at com.collaxa.cube.lang.compiler.bpel.XPathExprValidatorVisitor.<init>(XPathExprValidatorVisitor.java:122)
at com.collaxa.cube.lang.compiler.bpel.AssignValidator.<init>(AssignValidator.java:89)
at com.collaxa.cube.lang.compiler.bpel.BpelParser.<init>(BpelParser.java:452)
at com.collaxa.cube.lang.compiler.bpel.BPELValidator.validate(BPELValidator.java:60)
at com.collaxa.cube.lang.compiler.BPEL1Processor.validate(BPEL1Processor.java:329)
at com.collaxa.cube.lang.compiler.BPEL1Processor.process(BPEL1Processor.java:153)
at com.collaxa.cube.lang.compiler.CubeParserHelper.compile(CubeParserHelper.java:47)
at oracle.fabric.bpel.bpelc.BPELComponentValidator.validate(BPELComponentValidator.java:40)
at oracle.soa.scac.ValidateComposite.validateComponentTypeServicesReferences(ValidateComposite.java:1117)
at oracle.soa.scac.ValidateComposite.doValidation(ValidateComposite.java:500)
at oracle.soa.scac.ValidateComposite.run(ValidateComposite.java:150)
at oracle.soa.scac.ValidateComposite.main(ValidateComposite.java:135)
Jul 12, 2011 2:40:29 PM CubeProcessGenerator compile
WARNING: classpath is: C:\oracle\Middleware\jdeveloper\jdev\extensions\oracle.sca.modeler.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.mgmt_11.1.1\soa-infra-mgmt.jar;C:\oracle\Middleware\oracle_common\modules\oracle.fabriccommon_11.1.1\fabric-common.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\orabpel.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.mediator_11.1.1\mediator_client.jar;C:\oracle\Middleware\oracle_common\modules\oracle.mds_11.1.1\mdsrt.jar;C:\oracle\Middleware\oracle_common\modules\oracle.xdk_11.1.0\xmlparserv2.jar;C:\oracle\Middleware\oracle_common\modules\oracle.xdk_11.1.0\xml.jar;C:\oracle\Middleware\jdeveloper\jdev\extensions;;C:\JDeveloper\mywork\InvoiceTransferApp\InvoiceTransferProj\SCA-INF\classes;C:\JDeveloper\mywork\InvoiceTransferApp\InvoiceTransferProj\SCA-INF\classes;C:\JDeveloper\mywork\InvoiceTransferApp\InvoiceTransferProj\SCA-INF\gen-classes;C:\oracle\Middleware\oracle_common\modules\commonj.sdo_2.1.0.jar;C:\oracle\Middleware\oracle_common\modules\oracle.fabriccommon_11.1.1\fabric-common.jar;C:\oracle\Middleware\oracle_common\modules\oracle.xdk_11.1.0\xmlparserv2.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\bpel1-1-xbeans.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\orabpel-common.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\orabpel.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\bpel_coherence_config.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\orabpel-exts.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\thirdparty.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\bpm-analytics.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\orabpel-thirdparty.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\wsif-binding.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\orabpel-validator.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\monitor-rt-xbean.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\oracle.soa.bpmn.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\orabpel1.jar;C:\oracle\Middleware\jdeveloper\soa\modules\user-patch.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.thirdparty.jar;C:\oracle\Middleware\jdeveloper\uddi\lib\oracle.soa.uddi.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\bpm-infra.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\testfwk-xbeans.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\fabric-ext.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\soa-infra-scheduler.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\xmlunit-1.1.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\soa-infra-tools.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\soa-xpath-exts.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\oracle-soa-client-api.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.wls.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\fabric-client.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime-ext-was.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime-ext-wls.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\oracle.soa.fabric.jar;C:\oracle\Middleware\jdeveloper\soa\modules\oracle.soa.ext_11.1.1\classes
Regards,
Sireesh
Maybe you are looking for
-
Images in lightroom look VERY DARK in library?! Please help...
I have been using Lightroom for a while now and have had no problems. I have recently opened lightroom and all the images in the library are now extremely dark and contrasty (i have not made any changes). When I open the RAW files in PS or Bridge
-
'Sort by last name' not working in Address Book
In Address book, the 'sort' function (under preferences-General) does not work for half my contacts (all people rather than companies). This does not work for 'by first name', nor 'by last name'. This random list appears at the top of address book, f
-
Forum Experts, We have a scenario where we need to update HR Infotype tables in ECC 6.0 using batch data from an HR legacy system as a source. This will be a daily process, with expected volumes between 1000 and 5000 adds and/or changes. Does anyo
-
How to enable HTTPS Port in abap system
Hello All, Hope all are doing great,can any one please tell me the procedure step by step how can i enable https port in my only abap system,is it required to enable ssl also for this?.. Regards, Syed
-
Why is my keyboard only working in Finder?
I was typing in Pages and then I randomly typed a bunch of keys. Something happened and now I can only type things in in Finder. The Brighntess keys ect. All work fine. Thanks.