Resetting Default Namespace Using JDOM

Is it possible to reset the default namespace on a JDOM Document? I've tried setting a namespace declaration on the root element with the following code:
Element myRootElement = myDocument.getRootElement();
Namespace namespace = Namespace.getNamespace("http://whatever.com");
myRootElement.addNamespaceDeclaration(namespace);Since the Document already has a default namespace, I get the following stack trace:
org.jdom.IllegalAddException: The namespace xmlns="http://whatever.com" could not be added as a namespace to "rdf:RDF": The namespace prefix "" collides with an additional namespace declared by the element
     at org.jdom.Element.addNamespaceDeclaration(Element.java:339)Does anyone have any suggestions or hints? Perhaps its not even possible? Thanks in advance for any help.

pass the RootElement to the following method:
public void someMethod(org.jdom.Element element) {
org.jdom.Namespace xhtml = org.jdom.Namespace.getNamespace("html","http://www.watever.com");
if (element.getNamespace() == org.jdom.Namespace.NO_NAMESPACE) {
element.setNamespace(xhtml);
java.util.List childElements = element.getChildren();
java.util.Iterator iterator = childElements.iterator();
while (iterator.hasNext()) {
org.jdom.Element child = (org.jdom.Element) iterator.next();
someMethod(child);
}

Similar Messages

  • How to parse XML document with default namespace with JDOM XPath

    Hi All,
    I am having difficulty parsing using Saxon and TagSoup parser on a namespace html document. The relevant content of this document are as follows:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body>
        <div id="container">
            <div id="content">
                <table class="sresults">
                    <tr>
                        <td>
                            <a href="http://www.abc.com/areas" title="Hollywood, CA">hollywood</a>
                        </td>
                        <td>
                            <a href="http://www.abc.com/areas" title="San Jose, CA">san jose</a>
                        </td>
                        <td>
                            <a href="http://www.abc.com/areas" title="San Francisco, CA">san francisco</a>
                        </td>
                        <td>
                            <a href="http://www.abc.com/areas" title="San Diego, CA">San diego</a>
                        </td>
                  </tr>
    </body>
    </html>
    Below is the relevant code snippets illustrates how I have attempted to retrieve the contents (value of  <a>):
                 import java.util.*;
                 import org.jdom.*;
                 import org.jdom.xpath.*;
                 import org.saxpath.*;
                 import org.ccil.cowan.tagsoup.Parser;
    ( 1 )       frInHtml = new FileReader("C:\\Tmp\\ABC.html");
    ( 2 )       brInHtml = new BufferedReader(frInHtml);
    ( 3 ) //    SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    ( 4 )       SAXBuilder saxBuilder = new SAXBuilder("org.ccil.cowan.tagsoup.Parser");
    ( 5 )       org.jdom.Document jdomDocument = saxbuilder.build(brInHtml);
    ( 6 )       XPath xpath =  XPath.newInstance("/ns:html/ns:body/ns:div[@id='container']/ns:div[@id='content']/ns:table[@class='sresults']/ns:tr/ns:td/ns:a");
    ( 7 )       xpath.addNamespace("ns", "http://www.w3.org/1999/xhtml");
    ( 8 )       java.util.List list = (java.util.List) (xpath.selectNodes(jdomDocument));
    ( 9 )       Iterator iterator = list.iterator();
    ( 10 )     while (iterator.hasNext())
    ( 11 )     {
    ( 12 )            Object object = iterator.next();
    ( 13 ) //         if (object instanceof Element)
    ( 14 ) //               System.out.println(((Element)object).getTextNormalize());
    ( 15 )             if (object instanceof Content)
    ( 16 )                   System.out.println(((Content)object).getValue());
    ….This program would work on the same document without the default namespace, hence, it would not be necessary to include “ns” prefix along in the XPath statements (line 6-7) either. Moreover, I was using “org.apache.xerces.parsers.SAXParser” to have successfully retrieve content of <a> from the same document without default namespace in the past.
    I would like to achieve the following objectives if possible:
    ( i ) Exclude DTD and namespace in order to simplifying the parsing process. How this could be done?
    ( ii ) If this is not possible, how to include it in XPath statements (line 6-7) so that the value of <a> is picked up correctly?
    ( iii ) Would changing from “org.apache.xerces.parsers.SAXParser” to “org.ccil.cowan.tagsoup.Parser” make any difference as far as using XPath is concerned?
    ( iv ) Failing to exlude DTD, how to change the lookup of a PUBLIC DTD to a local SYSTEM one and include a local DTD for reference?
    I am running JDK 1.6.0_06, Netbeans 6.1, JDOM 1.1, Saxon6-5-5, Tagsoup 1.2 on Windows XP platform.
    Any assistance would be appreciated.
    Thanks in advance,
    Jack

    Here's an example of using a custom EntityResolver with the standard DocumentBuilder provided by the JDK. The code may or may not be similar for the parsers that you're using.
    import java.io.IOException;
    import java.io.StringReader;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.xml.sax.EntityResolver;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    public class ParseExamples
        private final static String COMMON_XML
            = "<music>"
            +     "<artist name=\"Anderson, Laurie\">"
            +         "<album>Big Science</album>"
            +         "<album>Strange Angels</album>"
            +     "</artist>"
            +     "<artist name=\"Fine Young Cannibals\">"
            +         "<album>The Raw & The Cooked</album>"
            +     "</artist>"
            + "</music>";
        private final static String COMMON_DTD
            = "<!ELEMENT music (artist*)>"
            + "<!ELEMENT artist (album+)>"
            + "<!ELEMENT album (#PCDATA)>"
            + "<!ATTLIST artist name CDATA #REQUIRED>";
        public static void main(String[] argv)
        throws Exception
            // this version uses just a SYSTEM identifier - note that it gets turned
            // into a file: URL
            String xml = "<!DOCTYPE music SYSTEM \"bar\">"
                       + COMMON_XML;
            // this version uses both PUBLIC and SYSTEM identifiers; the SYSTEM ID
            // gets munged, the PUBLIC ID doesn't
    //        String xml = "<!DOCTYPE music PUBLIC \"foo\" \"bar\">"
    //                   + COMMON_XML;
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setValidating(true);
            DocumentBuilder db = dbf.newDocumentBuilder();
            db.setEntityResolver(new EntityResolver()
                public InputSource resolveEntity(String publicId, String systemId)
                    throws SAXException, IOException
                    System.out.println("publicId = " + publicId);
                    System.out.println("systemId = " + systemId);
                    return new InputSource(new StringReader(COMMON_DTD));
            Document dom = db.parse(new InputSource(new StringReader(xml)));
            System.out.println("root element name = " + dom.getDocumentElement().getNodeName());
    }

  • Output XML with a default namespace using XQuery

    I'm having a problem with namespaces in an XQuery within ALSB.
    We receive XML from a file which doesn't have any namespace and have to transform it into a different structure, giving it a default namespace such as below:
    Input XML
    <inputRoot>
         <inputAccountName>Joe Bloggs</inputAccountName>
         <inputAccountNumber>10938393</inputAccountNumber>
    </inputRoot>
    Desired output XML
    <outputRoot xmlns="http://www.example.org/outputSchema">
         <outputAccounts>
              <outputAccountName>Joe Bloggs</outputAccountName>
              <outputAccountNumber>10938393</outputAccountNumber>
         </outputAccounts>
    </outputRoot>
    When I attempt to do this using XQuery mapper tool, I end up with a namespace prefix on the outputRoot. The XQuery and result follows:
    XQuery
    declare namespace xf = "http://tempuri.org/XQueryProject/scratchTransformations/test/";
    declare namespace ns0 = "http://www.example.org/outputSchema";
    declare function xf:test($inputRoot1 as element(inputRoot))
    as element(ns0:outputRoot) {
    <ns0:outputRoot>
    <outputAccounts>
    <outputAccountName>{ data($inputRoot1/inputAccountName) }</outputAccountName>
    <outputAccountNumber>{ data($inputRoot1/inputAccountNumber) }</outputAccountNumber>
    </outputAccounts>
    </ns0:outputRoot>
    declare variable $inputRoot1 as element(inputRoot) external;
    xf:test($inputRoot1)
    Result
    <ns0:outputRoot xmlns:ns0="http://www.example.org/outputSchema">
         <outputAccounts>
              <outputAccountName>inputAccountName_1</outputAccountName>
              <outputAccountNumber>inputAccountNumber_1</outputAccountNumber>
         </outputAccounts>
    </ns0:outputRoot>
    How can I write the XQuery in such a way thay the namespace prefix isn't output? I've tried many different methods with no success. I can't declare a default element namespace because my input element doesn't have a namespace
    Thanks in advance

    I spoke too soon, it didn't work quite as perfectly as I'd thought :-) It turns out our client can't handle the xml with the namespace prefix but we've worked out the solution to return XML in the format we originally needed.
    Example below:
    XQuery
    declare namespace xf = "http://tempuri.org/XQueryProject/scratchTransformations/test/";
    declare default element namespace "http://www.example.org/outputSchema";
    declare namespace ns1 = ""
    declare function xf:test($inputRoot1 as element(ns1:inputRoot))
    as element(outputRoot) {
    <outputRoot>
    <outputAccounts>
    <outputAccountName>{ data($inputRoot1/inputAccountName) }</outputAccountName>
    <outputAccountNumber>{ data($inputRoot1/inputAccountNumber) }</outputAccountNumber>
    </outputAccounts>
    </outputRoot>
    declare variable $inputRoot1 as element(inputRoot) external;
    xf:test($inputRoot1)

  • RE: Reset Default framework using system tools

    Everyone,
    We are in a situation where in all the portal pages are not shown when we try to change some paramaters in default framwork page and saved
    Now only the top roles tabs only visible not even content admin is visble..everything is not shown except the roles in the top.
    Can somebody tell me how to reset Default framework page in VA,configtool,NWA..etc
    your help would be greatly appreciated..Thanks.

    I figured..Thanks.

  • Can you validate an XMLElement that uses the default namespace?

    We have a partner that we communicate with via XML over HTTP and the schema that they gave us for their request/response does not specify a namespace. I am able to import the schema and create variables from its elements to send the request and get a response back but when I try to validate the response I am getting an error.
    We are using SOA Suite 11g and the bpelx:validate action to try to validate the variable but it consistently gives back the following error message.
    java.lang.IllegalArgumentException: null schema location for ns=null [Cause=null schema location for ns=null]
    I am pretty sure this is because there is no namespace specified in the response data. Is there anyway that I can validate this XML against the schema without a namespace? This is an existing interface that we are converting so we don't have the flexibility to ask the partner to change their interface. I am able to validate the same XML data in XML Spy against the schema and have been able to recreate this problem with a different small xsd with the default namespace.
    I think I can write a java utility to perform the validation and call it using the embedded java action but I am hoping there is a way to do it within the tool.

    Hi,
    For Crystal Design related queries, close this thread and start the thread in the [SAP Crystal Reports Design forums|http://forums.sdn.sap.com/forum.jspa?forumID=300&start=0]
    - Bhushan

  • Format using default namespace prefix.

    Is there any way to format XML using default namespace prefix in an expression?
    My expression is as follows:
    oraext:get-content-as-string(bpws:getVariableData('JmsMdx_InputVariable','body'))

    This seems wrong to me. I've filed Bug 2400119 to get this looked into by development.
    I'd expect any document with an appropriate qualified name to be found by your XPath expression, irrespective of whether syntactically one of the documents happened to use the default namespace syntax.

  • Assign default namespace to XML fragment using XQuery

    Hi everybody!
    I need to add a default namespace declaration to a XML fragment using XQuery. I wrote following statement to assign fragment to $body:
    <soap-env:Body>{
    fn-bea:inlinedXML($content/text())}
    </soap-env:Body>
    The problem is "$content/text()" has no namespace declaration so I need to assign a default namespace (xmlns="") to it in order to apply some XQuery transformations to its content.
    I know this can be easily done with a XSLT but I would like use XQuery instead.
    Could anyone tell me how I could perform this task?
    Thank you in advance,
    Daniel.

    Re: xquery function - send namespace as binding variable and define it in a tag

  • Using default namespace with XMLNode.valueOf()

    XMLNode.valueOf(String, NSResolver) takes in a namespace resolver. Is it possible to specify a default namespace with the namespace resolver so that if the XSL Pattern is not qualified, e.g., "/myElt/bar", default namespace will be used?
    Thanks.
    - sam
    null

    XMLNode.valueOf(String, NSResolver) takes in a namespace resolver. Is it possible to specify a default namespace with the namespace resolver so that if the XSL Pattern is not qualified, e.g., "/myElt/bar", default namespace will be used?
    Thanks.
    - sam
    null

  • XML DB: using default namespace gives different result

    In Oracle9i R2 I created an XMLTYPE table based on a XML schema. The schema uses a namespace. When I insert an instance document that has a namespace prefix for every element querying works fine. When I insert an instance document that has the namespace defined as the default namespace, the query returns an empty row for that document. It seems to me that before storing the document the namespaces must be expanded and hence there should be no difference between the two documents and the query should return a value for both rows. Any thoughts? Thanks in advance! Below is the script and the results of the queries.
    ==========
    THE SCRIPT
    ==========
    DROP TABLE islands_xsd
    BEGIN
    DBMS_XMLSCHEMA.DELETESCHEMA('http://www.cumquat.nl/xsd/island.xsd', DBMS_XMLSCHEMA.DELETE_CASCADE);
    END;
    BEGIN
    DBMS_XMLSCHEMA.REGISTERSCHEMA('http://www.cumquat.nl/xsd/island.xsd',
    '<?xml version="1.0"?>
    <schema targetNamespace="http://www.cumquat.nl/xsd/island.xsd"
    xmlns:isl="http://www.cumquat.nl/xsd/island.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="island" type="isl:islandType"/>
    <complexType name="islandType">
    <sequence>
    <element name="name" type="string"/>
    <element name="country" type="string"/>
    <element name="total_area" type="positiveInteger"/>
    <element name="shoreline" type="positiveInteger"/>
    <element name="pop_density" type="integer"/>
    <element name="dist_continent" type="integer"/>
    </sequence>
    </complexType>
    </schema>');
    END;
    CREATE TABLE islands_xsd OF XMLTYPE
    XMLSCHEMA "http://www.cumquat.nl/xsd/island.xsd"
    ELEMENT "island"
    INSERT INTO islands_xsd VALUES (XMLTYPE(
    '<?xml version="1.0"?>
    <isl:island xmlns:isl="http://www.cumquat.nl/xsd/island.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.cumquat.nl/xsd/island.xsd http://www.cumquat.nl/xsd/island.xsd">
    <isl:name>Aldabra</isl:name>
    <isl:country>Seychelles</isl:country>
    <isl:total_area>13</isl:total_area>
    <isl:shoreline>104</isl:shoreline>
    <isl:pop_density>0</isl:pop_density>
    <isl:dist_continent>6</isl:dist_continent>
    </isl:island>'))
    INSERT INTO islands_xsd VALUES (XMLTYPE(
    '<?xml version="1.0"?>
    <island xmlns="http://www.cumquat.nl/xsd/island.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.cumquat.nl/xsd/island.xsd http://www.cumquat.nl/xsd/island.xsd">
    <name>Amsterdam</name>
    <country>France</country>
    <total_area>9</total_area>
    <shoreline>51</shoreline>
    <pop_density>0</pop_density>
    <dist_continent>30</dist_continent>
    </island>'))
    SELECT i.EXTRACT('/isl:island/isl:name', 'xmlns:isl="http://www.cumquat.nl/xsd/island.xsd"')
    FROM islands_xsd i
    SELECT i.EXTRACT('/isl:island/isl:name', 'xmlns:isl="http://www.cumquat.nl/xsd/island.xsd"').GETSTRINGVAL()
    FROM islands_xsd i
    SELECT i.EXTRACT('/isl:island/isl:name/text()', 'xmlns:isl="http://www.cumquat.nl/xsd/island.xsd"').GETSTRINGVAL()
    FROM islands_xsd i
    =======================================
    THE RESULTS OF RUNNING THE QUERIES
    =======================================
    SQL> SELECT i.EXTRACT('/isl:island/isl:name', 'xmlns:isl="http://www.cumquat.nl/xsd/island.xsd"')
    2 FROM islands_xsd i
    3 /
    I.EXTRACT('/ISL:ISLAND/ISL:NAME','XMLNS:ISL="HTTP://WWW.CUMQUAT.NL/XSD/ISLAND.XS
    XMLTYPE()
    2 rows selected.
    SQL> SELECT i.EXTRACT('/isl:island/isl:name', 'xmlns:isl="http://www.cumquat.nl/xsd/island.xsd"').GE
    TSTRINGVAL()
    2 FROM islands_xsd i
    3 /
    I.EXTRACT('/ISL:ISLAND/ISL:NAME','XMLNS:ISL="HTTP://WWW.CUMQUAT.NL/XSD/ISLAND.XS
    <isl:name xmlns:isl="http://www.cumquat.nl/xsd/island.xsd">Aldabra</isl:name>
    2 rows selected.
    SQL> SELECT i.EXTRACT('/isl:island/isl:name/text()', 'xmlns:isl="http://www.cumquat.nl/xsd/island.xs
    d"').GETSTRINGVAL()
    2 FROM islands_xsd i
    3 /
    I.EXTRACT('/ISL:ISLAND/ISL:NAME/TEXT()','XMLNS:ISL="HTTP://WWW.CUMQUAT.NL/XSD/IS
    Aldabra
    2 rows selected.

    This seems wrong to me. I've filed Bug 2400119 to get this looked into by development.
    I'd expect any document with an appropriate qualified name to be found by your XPath expression, irrespective of whether syntactically one of the documents happened to use the default namespace syntax.

  • Is it possible to use a CONSTANT as Default Namespace?

    Hi,
    I create from a table and an XML-field a view. For the command XMLTABLE I have to use a DEFAULT namespace.
    Is it possible instead of a fixed string to use a constant variable which I read using a function?
    As example:
    CREATE OR REPLACE VIEW pain_001 AS
    SELECT i.iban_ausz_id IBAN_AUSZ_ID
    ,oc.PmtCdtInstrId PmtInf_CdtInstrId
    FROM IBAN_AUSZ_E i
    ,XMLTABLE(XmlNamespaces(DEFAULT 'http://www.six-interbank-clearing.com/de/pain.001.001.03.ch.02.xsd'),
    '/Document/CstmrCdtTrfInitn/PmtInf/CdtTrfTxInf'
    PASSING i.pain_001
    COLUMNS
    PmtCdtInstrId NUMBER PATH 'PmtId/InstrId'
    ) oc
    I want to replace 'http://www.six-interbank-clearing.com/de/pain.001.001.03.ch.02.xsd' with a function wich returns a constant variable like "package_name.get_const".
    Is this possible?
    Thanks in Advance.

    odie_63 wrote:
    Hi,
    I want to replace 'http://www.six-interbank-clearing.com/de/pain.001.001.03.ch.02.xsd' with a function wich returns a constant variable like "package_name.get_const".
    Is this possible?No, it's not possible. It has to be a string literal.but for dynamic sql (EXECUTE IMMEDIATE) looks like it's possible

  • Problem with default namespaces

    Hello,
    I'm using version 2.3.10 of Berkeley XML.
    All my XML documents have a default namespace declared in the root element, like this:
    <rootElement xmlns="http://www....something.../something">
    but I get errors when I query the documents - and the only way of avoiding the errors seems to be by manually removing the default namespace attribute.
    I tried setting the XmlQueryContext.setNamespace("", myUri) - but it doesn't work. I saw this mentioned in another post - and you said it was scheduled to work that way in the next release.
    Can you tell me when the next release will be, and what I can do right now to get around this problem. I need to keep the xmlns attribute in the root element since I have other applications which need to access the documents before I put them into the database and they make use of it.
    Kind Regards
    Swami Kevala

    Hi Swami,
    You have two options:
    1) Bind a prefix to your namespace URI, and use that prefix in your queries:
    XmlQueryContext.setNamespace("pre", myUri);
    XmlManager.query("/pre:rootElement", qc);
    2) Bind the default element namespace inside the query:
    XmlManager.query("declare default element namespace \"" + myUri + "\"; /rootElement", qc);
    John

  • How to suppress n0: default Namespace prefix in Transformations

    Hi,
    I use Simple Transformations for serialization of deep structured data.
    In the XML File the whole tree needs to use a special namespace. Therefore i use the attribute xmlns="ABC.de" without a namespace prefix in my root element. During serialization SAP generates a default namespace prefix like 'n0:'.
    Is it possible to suppress the generated namespace prefix?
    Thank you very much for reply
    René
    Edited by: René Libbert on Feb 14, 2012 8:09 AM

    Maybe somebody is interested.
    It seems to be a problem on old 640. On a NW 702 the result is as expected. NW 700 was not tested.
    Workaround for the 640 is to use as result a STRING field not an XSTRING.
    Greetings René

  • Replacing default namespace in OSB message flow

    I'm in the process of setting up a simple OSB proxy and could use some help figuring out how to change a default namespace in the response from the business service.
    The proxy and business service use different namespaces which we'll call "http://foo.com/namespace/proxy" and "http://foo.com/namespace/business". In my routing request message flow, the contents of $body look like this and I'm able to use a Rename action with XQuery expression "./sof:*" to change "http://foo.com/namespace/proxy" to "http://foo.com/namespace/business":
    <sof:Execute xmlns:sof="http://foo.com/namespace/proxy">
    <sof:adminName>MyAdaptor</sof:adminName>
    <sof:request>
    [escaped payload omitted]
    </sof:request>
    </sof:Execute>
    This works fine, but in the response message flow, I need to revert the namespace and am having difficulty because the response uses a default namespace instead of using a prefix:
    <ExecuteResponse xmlns="http://foo.com/namespace/business">
    <ExecuteResult>
    [escaped payload omitted]
    </ExecuteResult>
    </ExecuteResponse>
    If I define a prefix P2L in the expression editor to correspond to "http://foo.com/namespace/business", I'm able to reference the ExecuteResponse element as "./P2L:ExecuteResponse", but then I get stuck.
    If I try use a Rename action to change the namespace for "./P2L:*", only the ExecuteResponse element is renamed to <sof:ExecutResponse xmlns:sof="http://foo.com/namespace/proxy">. Upstream in the calling application, there's an XML stream reader exception because (I assume) ExecuteResult is not found and parsed.
    I also tried using a Replace action against "./P2L:ExecuteResponse/@xmlns" to replace its contents with "http://foo.com/namespace/proxy". I also tried "./P2L:ExecuteResponse/@P2L:xmlns". Neither worked.
    Can anyone tell me what I'm doing wrong, or suggest a different approach? Assume that changing the calling application or business service is not an option.
    Thanks!

    >
    If I define a prefix P2L in the expression editor to correspond to "http://foo.com/namespace/business", I'm able to reference the ExecuteResponse element as "./P2L:ExecuteResponse", but then I get stuck.
    If I try use a Rename action to change the namespace for "./P2L:*", only the ExecuteResponse element is renamed to <sof:ExecutResponse xmlns:sof="http://foo.com/namespace/proxy">. Upstream in the calling application, there's an XML stream reader exception because (I assume) ExecuteResult is not found and parsed.
    >
    You pattern "./P2L:\*" matches just one element so it's ok that the payload's namespace wasn't touched. If you want to rename namespace for all elements try "//P2L:*". However, I'm not sure whether this is what you want. Try do describe what you do, what you want and what you get instead.
    >
    I also tried using a Replace action against "./P2L:ExecuteResponse/@xmlns" to replace its contents with "http://foo.com/namespace/proxy". I also tried "./P2L:ExecuteResponse/@P2L:xmlns". Neither worked.
    >
    I think it's not a good approach to replace content of xmlns as this attribute is not a common xml attribute.

  • Default Namespace Support

    Hi,
    I am NOT using the XPath helper package. I am using xslprocessor.selectNodes() to get a nodelist.
    My xml document contains a default namespace, and I cannot change it.
    Is there a work around to the fact that default namespaces is not supported? I'm getting "Namespace prefix 'x' is used but not declared" on the following pl/sql line:
    guests := xslprocessor.selectNodes(xmldom.makeNode(xmldoc), '/xml/rs:data/z:row');
    I'm willing to jump through a few hoops, if necessary.
    Thanks for any insight!
    Regina

    Correction. Please use the following test case.
    1. Create an application and a project in JDeveloepr 11g.
    2. Add an XML document. catalog.xml, from the New Gallery.
    What doesn't generate an error.
    3. Copy the following XML documen to catalog.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <catalog xmlns:journal="http://www.xdk11g.com/xpath">
    <journal:journal journal:date="November-December 2008">
    <journal:article journal:section="ORACLE DEVELOPER">
    <title>Instant ODP.NET Deployment</title>
    <author>Mark A. Williams</author>
    </journal:article>
    </journal:journal>
    <journal date="March-April 2008">
    <article section="TECHNOLOGY">
    <title>Oracle Database 11g Redux</title>
    <author>Tom Kyte</author>
    </article>
    </journal>
    </catalog>
    4. Select Search>XPath Search.
    5. Add a namespace mapping with Add button.
    Prefix: journal
    URI: http://www.xdk11g.com/xpath
    6. Specify an XPath expression in Expression field.
    /catalog/journal:journal
    7. Click on OK. The jounal:journal node gets selected.
    What generates an error (the bug).
    8. Copy the following XML document to catalog.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <catalog xmlns="http://www.xdk11g.com/xpath/defaultNamespace">
    <journal date="November-December 2008">
    <article section="ORACLE DEVELOPER">
    <title>Instant ODP.NET Deployment</title>
    <author>Mark A. Williams</author>
    </article>
    </journal>
    <journal date="March-April 2008">
    <article section="TECHNOLOGY">
    <title>Oracle Database 11g Redux</title>
    <author>Tom Kyte</author>
    </article>
    </journal>
    </catalog>
    9. Add a namespace mapping with Add button for the default namespace. Specify prefix as empty.
    Prefix:
    URI: http://www.xdk11g.com/xpath/defaultNamespace
    10. Specify an XPath expression in Expression field.
    /catalog/journal
    11. Click on OK. The journal node does not get selected.

  • Change the default namespace in soap message generated by webservice proxy

    I have a requirement where the default namespace generated by the webservice proxy has to be changed. For example, below is a soap request message generated by the proxy:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ns0="http://siebel.com/asi/"
    xmlns:ns1="http://www.siebel.com/xml/getAllSecurityValuesResponse/PS"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <env:Header>
    <wsse:Security
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    env:mustUnderstand="1"
    xmlns:xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <wsse:UsernameToken
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:Username>kaoliver</wsse:Username>
    <wsse:Password
    Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">db2</wsse:Password>
    </wsse:UsernameToken>
    </wsse:Security>
    </env:Header>
    <env:Body>
    <ns0:SearchSecurityServicegetAllSecurityValues_1>
    <Login>kaoliver</Login>
    </ns0:SearchSecurityServicegetAllSecurityValues_1>
    </env:Body>
    </env:Envelope>
    In the above message, I want to change the oasis namespace to a different namespace. Where are the default namespaces defined in the proxy classes generated by Jdev so that I can change them?
    Thanks in advance,
    Warm Regards,
    Shashi Anand B

    >
    If I define a prefix P2L in the expression editor to correspond to "http://foo.com/namespace/business", I'm able to reference the ExecuteResponse element as "./P2L:ExecuteResponse", but then I get stuck.
    If I try use a Rename action to change the namespace for "./P2L:*", only the ExecuteResponse element is renamed to <sof:ExecutResponse xmlns:sof="http://foo.com/namespace/proxy">. Upstream in the calling application, there's an XML stream reader exception because (I assume) ExecuteResult is not found and parsed.
    >
    You pattern "./P2L:\*" matches just one element so it's ok that the payload's namespace wasn't touched. If you want to rename namespace for all elements try "//P2L:*". However, I'm not sure whether this is what you want. Try do describe what you do, what you want and what you get instead.
    >
    I also tried using a Replace action against "./P2L:ExecuteResponse/@xmlns" to replace its contents with "http://foo.com/namespace/proxy". I also tried "./P2L:ExecuteResponse/@P2L:xmlns". Neither worked.
    >
    I think it's not a good approach to replace content of xmlns as this attribute is not a common xml attribute.

Maybe you are looking for

  • Flex 4.1 SDK compilation error=3

    I just downloaded SDK 4.1 and tried to compile my application but I'm getting the following error: C:\projects\MyProject\build.xml:119:Execute failed: java.io.IOException:CreateProcess: "C:\Program Files\Adobe\Adobe Flash Builder Plug-in Beta 2\sdks\

  • Can movies be uploaded in Photo Stream?

    Can movies made on iPhone, iPad or any camera be uploaded to Photo Stream? I took a move with iPhone and it did not upload. Then I pushed movie from iPhoto to Photo Stream and it did not upload. Thanks

  • EXSLT implementation

    I was wondering if there is any plan to make the oracle XSLT processor supporting the valuable EXSL extensions http://www.exslt.org/

  • HT1695 I have the new ipad4'32gb non cellular,but I can't use ipad anywhere,very disappointing.What are my options?

    I have the new ipad4 but I didn't know it was non cellular so am very disappointed  with the wifi signal when I leave home hub .What are my options now?

  • JSP templates in Jdeveloper

    Hello! I want to know: Is possibility in JDeveloper 10g or 11g to built Jsp pages from meta-data level. With this I mean that, when I say that in data base will be attribute "Order", then I have this field in 3 forms automatically??? If yes then mayb