Generating XML with attributes using XSU

Oracle document claims if the sql is:
select empno as @empno from employee
Using XSU to generate XML will produce and XML document with EMPNO as an attribute instead of element name. But this does not seem to work. There is an exception:
<ERROR>oracle.xml.sql.OracleXMLSQLException: Character '&' is not allowed in an XML tag name.</ERROR
Is there anything wrong or is there a work around

Oracle document claims if the sql is:
select empno as @empno from employee
Using XSU to generate XML will produce and XML document with EMPNO as an attribute instead of element name. But this does not seem to work. There is an exception:
<ERROR>oracle.xml.sql.OracleXMLSQLException: Character '&' is not allowed in an XML tag name.</ERROR
Is there anything wrong or is there a work around

Similar Messages

  • XML with attributes?

    Hello
    I've got a table XYZ with the fields ABC and DEF. I want Oracle XE database to give me the following XML back:
    <ROWSET>
    <ROW ABC="..." DEF="..."/>
    <ROW ABC="..." DEF="..."/>
    </ROWSET>
    the fields as attributes. I know only how to get XML with elements but I need xml attributes. Does anybody know how this works with ODP.NET? I use the XmlCommandType property, r=ExecuteXmlReader() function and "doc.load(r)". In the past I got XML with attributes using Oracle9i R2, OO4O and MS Visual Basic 6. I set a property for each column.
    Regards
    Marcus Warm
    (Germany)
    [Oracle 10g Express Edition R2, Visual Studio 2005 VB, ADO.NET 2.0, Windows
    XP]
    <<also posted in de.comp.datenbanken.misc>>

    Hi
    In this case you have to change your Source structure and map the attrbute values to target and in receiver channel you can perform your content conversion.
    Regards
    Ramg
    Edited by: Ramkumar Ganesh on Apr 28, 2010 11:09 PM

  • EBS-R12 Generate XML (with data) from Embedded Data Definition

    Hi
    I'm new to running XMLP/BIP in EBS.
    I have found the extensive set of data definitions and templates in EBS and they work great out of the box.
    I, however, need to make template modifications.
    To this end, a correctly structured XML data template - containing all the data fields - is needed for loading into the template-builder in Word.
    If for example I take the embedded R12 data definition - XLAJELINESRPT.xml - for Posted Payable Invoices, and load it into the template builder, it provides the structure of the data template and not the structure of the output XML data.
    I have tried several ways to run the Data definition through XMLP using the concurrent manager attempting to intercept the generated XML (with data) but it either completes the process and uses the linked output template - producing the PDF - or other output - or if I remove the (output template altogether) it fails with an error.
    Maybe I'm missing an obvious step, but there has to be a way of taking the very comprehensive Data Definitions embedded in R12 EBS and using them in custom report templates.
    If I've totally missed the point, please give me the steps to follow.
    Many thaks in anticipation.
    Mike MacMurray

    HI Mike,
    You cannot load your Data Template into the MS Word Template Builder plugin, as it cannot be run to generate XML this way.
    You have two options to get the data from an XML Publisher Report run as a concurrent program in EBS.
    1) Using the XML Publisher Administrator responsibility, set an end date for both the Data Defintion and Template Definitions associated with the XLAJELINESRPT report.
    2) Leave the concurrent program, Data Defintions and Template Definitions exactly as they are and run the report. Once the report has completed, select the Concurrent Request, click "Diagnostics" then click "View XML". This will open the XML in a new browser window. You can then right click, View Source and then save this document locally.
    You can then load this XML into the MS Word Template Builder and start building your template.
    I hope this helps.
    Regards,
    Cj

  • Error? on Example 16-7 XMLFOREST: Generating Elements with Attribute and Ch

    Error in example on page http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb13gen.htm#i1028612
    Example 16-7 XMLFOREST: Generating Elements with Attribute and Child Elements
    Example appears as
    SELECT XMLElement("Emp",
                      XMLAttributes(e.first_name ||' '|| e.last_name AS "name"),
                      XMLForest(e.hire_date, e.department AS "department"))
    AS "RESULT"
    FROM employees e WHERE e.department_id = 20;
    1. employees table not qualified as hr.employees
    2. e.department as "department" should be e.department_id as "department"
    corrected would be
    SELECT XMLElement("Emp",
                      XMLAttributes(e.first_name ||' '|| e.last_name AS "name"),
                      XMLForest(e.hire_date, e.department_id AS "department"))
    AS "RESULT"
    FROM hr.employees e WHERE e.department_id = 20;albert

    It was subreport-related, though I still do not know the exact root cause.
    I was having trouble with both the built-in export as well as a custom process.
    Removing the subreports as suggested, I isolated the failure to one of the three subs and rebuilt this subreport from scratch (it was only three fields) and now the report has no trouble with the pdf export. I am not sure if it had a resolvable technical issue or if it was just corrupted, as it is now working, I am not going to expend much energy on finding out.
    Thanks for the suggestion.

  • Generate XML with tag names generated dynamically.

    Hi Mark,
    I want to generate xml in the following way using SQLXoperators.
    But only problem is when i use the operator, the tag name should be supplied before in hand as parameter.
    So it works well when the data for the tags are stored in seperate columns then its pretty simple.
    But lets say the whole hierarchy of the nodes is stored in one table with ID-->PARENTID relationship and the text is stored in a column called description.
    Now using CONNECT BY PRIOR i get the hierarchy and now based on the description value i have to generate the tags and then fill in the other details.
    This is just a summary of what i want. the below sample has much more than that and actual data comes from more than one table.
    But if i get the solution for what i asked before i think i can build the test of the thing.
    <?xml version="1.0" encoding="UTF-8"?>
    <SequenceData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SequenceData.xsd">
         <Header>
              <TemplateName>Template(XML)</TemplateName>
              <TemplateVersion>1.1</TemplateVersion>
              <CreatedUser>rsh2kor</CreatedUser>
              <CreatedDate>17-06-2005 12.12.22</CreatedDate>
         </Header>
         <List>
              <LoadPoints>
                   <LoadPoint description="Loadpoint1_in_list(level one)">
                        <SetPhase>
                             <SetPhaseVariables>
                                  <SetPhaseVariable>
                                       <Name>pRail</Name>
                                       <Unit>bar</Unit>
                                       <Value>100</Value>
                                       <SettlingTime>0.0</SettlingTime>
                                  </SetPhaseVariable>
                             </SetPhaseVariables>
                             <MonitoredVariables>
                                  <MonitoredVariable>
                                       <ID>12344<ID>
                                       <Name>MeasPoint</Name>
                                       <Unit>pascal</Unit>
                                       <Limit>10</Limit>
                                       <Tolerance>0.0</Tolerance>
                                       <Operator>&gt;</Operator>
                                       <AlertType>STOP</AlertType>
                                  </MonitoredVariable>
                             </MonitoredVariables>
                        </SetPhase>
                        <WaitPhase>
                             <WaitingTime>10</WaitingTime>
                             <MonitoredVariables>
                                  <MonitoredVariable>
                                       <Name>MeasPoint</Name>
                                       <Unit>pascal</Unit>
                                       <Limit>10</Limit>
                                       <Tolerance>0.0</Tolerance>
                                       <Operator>&gt;</Operator>
                                       <AlertType>STOP</AlertType>
                                  </MonitoredVariable>
                             </MonitoredVariables>
                        </WaitPhase>
                        <MeasPhase>
                             <MeasPhaseVariables>
                                  <MeasPhaseVariable>
                                       <Name>MeasPoint</Name>
                                       <Unit>pascal</Unit>
                                       <Result>0</Result>
                                  </MeasPhaseVariable>
                             </MeasPhaseVariables>
                        </MeasPhase>
                   </LoadPoint>
              </LoadPoints>
         </List>
         <Loop Iteration="5">
              <LoadPoints>
                   <LoadPoint description="Loadpoint2_in_Loop">
                        <SetPhase>
                             <SetPhaseVariables>
                                  <SetPhaseVariable LoopCount="1">
                                       <Name>pRail</Name>
                                       <Unit>bar</Unit>
                                       <Value>10</Value>
                                       <SettlingTime>0.0</SettlingTime>
                                  </SetPhaseVariable>
                                  <SetPhaseVariable LoopCount="2">
                                       <Name>pRail</Name>
                                       <Unit>bar</Unit>
                                       <Value>20</Value>
                                       <SettlingTime>0.0</SettlingTime>
                                  </SetPhaseVariable>
                                  <SetPhaseVariable LoopCount="3">
                                       <Name>pRail</Name>
                                       <Unit>bar</Unit>
                                       <Value>30</Value>
                                       <SettlingTime>0.0</SettlingTime>
                                  </SetPhaseVariable>
                                  <SetPhaseVariable LoopCount="4">
                                       <Name>pRail</Name>
                                       <Unit>bar</Unit>
                                       <Value>40</Value>
                                       <SettlingTime>0.0</SettlingTime>
                                  </SetPhaseVariable>
                                  <SetPhaseVariable LoopCount="5">
                                       <Name>pRail</Name>
                                       <Unit>bar</Unit>
                                       <Value>50</Value>
                                       <SettlingTime>0.0</SettlingTime>
                                  </SetPhaseVariable>
                             </SetPhaseVariables>
                             <MonitoredVariables>
                                  <MonitoredVariable>
                                       <Name>MeasPoint</Name>
                                       <Unit>pascal</Unit>
                                       <Limit>10</Limit>
                                       <Tolerance>0.0</Tolerance>
                                       <Operator>&gt;</Operator>
                                       <AlertType>STOP</AlertType>
                                  </MonitoredVariable>
                             </MonitoredVariables>
                        </SetPhase>
                        <WaitPhase>
                             <WaitingTime>10</WaitingTime>
                             <MonitoredVariables>
                                  <MonitoredVariable>
                                       <Name>MeasPoint</Name>
                                       <Unit>pascal</Unit>
                                       <Limit>10</Limit>
                                       <Tolerance>0.0</Tolerance>
                                       <Operator>&gt;</Operator>
                                       <AlertType>STOP</AlertType>
                                  </MonitoredVariable>
                             </MonitoredVariables>
                        </WaitPhase>
                        <MeasPhase>
                             <MeasPhaseVariables>
                                  <MeasPhaseVariable>
                                       <Name>MeasPoint</Name>
                                       <Unit>pascal</Unit>
                                       <Result>0</Result>
                                  </MeasPhaseVariable>
                             </MeasPhaseVariables>
                        </MeasPhase>
                   </LoadPoint>
              </LoadPoints>
              <List>
                   <LoadPoints>
                        <LoadPoint description="Loadpoint3_in_list(level two)">
                             <MonitoredVariables/>
                             <SetPhase>
                                  <SetPhaseVariables>
                                       <SetPhaseVariable>
                                            <Name>pRail</Name>
                                            <Unit>bar</Unit>
                                            <Value>100</Value>
                                            <SettlingTime>0.0</SettlingTime>
                                       </SetPhaseVariable>
                                  </SetPhaseVariables>
                                  <MonitoredVariables>
                                       <MonitoredVariable>
                                            <Name>MeasPoint</Name>
                                            <Unit>pascal</Unit>
                                            <Limit>10</Limit>
                                            <Tolerance>0.0</Tolerance>
                                            <Operator>&gt;</Operator>
                                            <AlertType>STOP</AlertType>
                                       </MonitoredVariable>
                                  </MonitoredVariables>
                             </SetPhase>
                             <WaitPhase>
                                  <WaitingTime>10</WaitingTime>
                                  <MonitoredVariables>
                                       <MonitoredVariable>
                                            <Name>MeasPoint</Name>
                                            <Unit>pascal</Unit>
                                            <Limit>10</Limit>
                                            <Tolerance>0.0</Tolerance>
                                            <Operator>&gt;</Operator>
                                            <AlertType>STOP</AlertType>
                                       </MonitoredVariable>
                                  </MonitoredVariables>
                             </WaitPhase>
                             <MeasPhase>
                                  <MeasPhaseVariables>
                                       <MeasPhaseVariable>
                                            <Name>MeasPoint</Name>
                                            <Unit>pascal</Unit>
                                            <Result>0</Result>
                                       </MeasPhaseVariable>
                                  </MeasPhaseVariables>
                             </MeasPhase>
                        </LoadPoint>
                   </LoadPoints>
              </List>
         </Loop>
    </SequenceData>
    Pls help as soon as possible.
    Thanks.

    I'm not Mark, but check out this article it may be helpful.
    http://www.oracle.com/technology/oramag/oracle/05-may/o35asktom.html
    In 10g there are other SQL statements besides connect by prior for parent child relationships.
    such as:
    CONNECT_BY_ROOT—returns the root of the hierarchy for the current row; this greatly simplifies our query. (See below for an example).
    CONNECT_BY_ISLEAF—is a flag to tell you if the current row has child rows.
    CONNECT_BY_ISCYCLE—is a flag to tell you if the current row is the beginning of an infinite loop in your hierarchy. For example, if A is the parent of B, B is the parent of C, and C is the parent of A, you would have an infinite loop. You can use this flag to see which row or rows are the beginning of an infinite loop in your data.
    NOCYCLE—lets the CONNECT BY query recognize that an infinite loop is occurring and stop without error (instead of returning a CONNECT BY loop error).

  • How to write XML with attributes to a table in Oracle?

    I tried to find solutions over the internet. Some of the stuff I looked at:https://forums.oracle.com/thread/2182669 http://www.club-oracle.com/forums/how-to-insert-data-from-xml-to-table-t2845/
    In all these cases, the solution considers XML structure with only nodes and child nodes but not attributes. In fact, one of the solutions suggests transforming the XML into a canonical form with only nodes w/o attributes.
    This is a sample of xml structure I am working with:
    Sample XML
    <rep type="P" title="P List"> <as> <a id="3" /> <a id="4" /> </as> </rep>
    I am working with oracle client 11.2 and SQL developer
    My question is: how to write XML data into a table with attributes also as column values, beside the nodes?

    My question is: how to write XML data into a table with attributes also as column values, beside the nodes
    The question you should be asking is : "how do I access attributes in the XPath language?"
    and the answer to that is easily found in any XPath tutorial you may find over the Internet, it is not related to Oracle in particular.
    Short answer : you use an "attribute::" axis before the attribute name, or more commonly a "@", e.g. @type, @id etc.
    Using the method described in the first link, something like this will extract the root attributes :
    SELECT x.*
    FROM XMLTable(
           '/rep'
           passing <xmltype variable/column goes here>
           columns type  varchar2(1)  path '@type'
                 , title varchar2(30) path '@title'
    ) x ;
    For deeper levels, use additional XMLTable calls as described in the mentioned post.

  • Generate xml-rpc request using xsd

    Hi All,
    I have one xsd file . I want to generate xml-rpc request file using this xsd file. If any body have any tools for that , can you please share this name with me. It's great help for me...
    Thank You,
    Pattanaik

    That's an interesting question. I thought it would be obvious that xmlbeans or "normal" xml-rpc packages would handle this.
    It turns out this doesn't seem to be true.
    Are you saying that you're trying to pass an object to a method and you want to deserialize the object into a java object of a type that is defined via an XSD? If this is the case you can use xmlbeans to do the xsd<->java mapping, then use just about any xml-rpc service to do the actual RPC mechanism.
    It's interesting that these two technologies haven't converged though...

  • Generate XML with SAX (OutputFormat/XMLSerializer deprecated)

    Hi,
    I'm working on a project using an old code, written by don't-know-who, which generates XML code from data obtained at the moment, at run-time, and then returns it as a String.
    Recently, my project included a new version (2.9) of the xercesImpl.jar library, and now classes OutputFormat and XMLSerializer have become deprecated.
    I'd like to update the old code. Do you know how to modify my code in order to do exactly the same things with a "new" approach which is not deprecated?
    I tried to search in the net and I found this FAQ <http://xerces.apache.org/xerces2-j/faq-general.html#faq-6>, but I didn't understand at all how to convert my code. :(
    Here's a "semplified" version of my method:
    public String generateDocument() {
        OutputFormat of = new OutputFormat("XML", "UTF-8", true);
        of.setIndent(1);
        of.setIndenting(true);
        StringWriter sw = new StringWriter();
        XMLSerializer xs = new XMLSerializer(sw, of);
        try {
            ContentHandler hd = xs.asContentHandler();
            hd.startDocument();
            AttributesImpl atts = new AttributesImpl();
            atts.addAttribute("", "", "id", "CDATA", "1");
            hd.startElement("", "", "addressBook", atts);
            atts.clear();
            hd.startElement("", "", "name", atts);
            String s = "John";
            hd.characters(s.toCharArray(), 0, s.length());
            hd.endElement("", "", "name");
            hd.startElement("", "", "surname", atts);
            s = "Smith";
            hd.characters(s.toCharArray(), 0, s.length());
            hd.endElement("", "", "surname");
            hd.endElement("", "", "addressBook");
            hd.endDocument();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        return sw.toString();
    }This code returns a String with this content:
    <addressBook id="1">
      <name>John</name>
      <surname>Smith</surname>
    </addressBook>Thanks a lot.

    This is easy. You have to somewhen learn the basics of the Java XML APIs, e.g. the DOM API. Or fight like a man through
    http://java.sun.com/webservices/reference/tutorials/jaxp/html/dom.html
    http://java.sun.com/webservices/reference/tutorials/jaxp/html/intro.html
    http://java.sun.com/webservices/docs/1.6/tutorial/doc/index.html.

  • Generating XML from Database using XSQL

    Hi ,
    I have been using Reports as an intermidiate to generate XML (by giving concurrent program o/p type as XML). Now, i want it to be done from SQL or PL/SQL. I am able to achieve this using XSQL functions. I placed the SQL in a .sql file and registered it as a concurrent program. It was giving me XML output.
    I have two problems here.
    1. How can i know whether i have generated valid xml or not?
    2. When i am linking this concurrent program to XML Publisher, publisher is not able to read thie output from the concurrent prograam. It is erroring out. Why?
    Thanks
    sap

    Save the XML file - try to open it with IE and/or Firefox.
    If that doesn't work you know already something is wrong.
    You may try to cut&paste it into notepad and save as UTF-8.
    Then try it out with the Template Builder for Wrod.
    If you can't figure it out and run the report with a SMALL dataset six (ie. 1)
    and post it here.

  • It seems you cannot clone objects with attributes using lazy loading in JPA

    I have an entity with an attribute using lazy loading:
    @Entity
    public class B {
    @ManyToOne(fetch=FetchType.LAZY)
    private A a;
    @Entity
    public class A {
    Assume the following code:
    A a1 = new A();
    A a2 = new A();
    B b1 = EntityManager.find(B.class, ...);
    b1.setA(a1);
    B b2 = b1.clone();
    b2.setA(a2);
    Now with lazy loading enabled I get b1.getA() == a2 instead of b1.getA() == a1. Moreover, the debugger displays the same value holder in b1 and b2 for the attribute a. It appears as if cloning does not make a (deep) copy of the value holder managing the attribute a.
    How can I create a copy b2 of b1, such that the value holder managing a in b1 is a different object as the value holder managing a in b2?
    Thanks, Thomas.

    I have filed a bug to have this addressed in Oracle TopLink 11gR1. I would recommend you file a bug against TopLink Essentials in GlassFish or if you have a support contract report the issue to metalink to have the issue resolved.
    If this is urgent I did try fixing the issue with a small helper method using some reflection. This method is simplified through its throwing of Exception. If you wish to use something like this I would recommend proper error handling.
         * Helper method for cloning an entity and fixing the woven value-holders to
         * complete a proper shallow cloning.
        public static Employee clone(Employee entity) throws Exception {
           Employee clone = entity.clone();
           // Now fix the cloned ValueHolder references
           Field[] fields = entity.getClass().getDeclaredFields();
           for (int index = 0; index < fields.length; index++) {
               Field field = fields[index];
               if (field.getName().startsWith("_toplink_")) {
                   field.setAccessible(true);
                   ValueHolderInterface vhi = (ValueHolderInterface)field.get(entity);
                   Object value = vhi.isInstantiated() ? vhi.getValue() : null;
                   field.set(clone, new ValueHolder(value));
           return clone;
        }Doug

  • Generating XMLs from CSVs using DOM parser......

    Hi,
    I am trying to generate XMLs from CSV files using DOM parser. XMLs are getting generated but the problem is that i am using Encoding "ISO-8859-1" but XMLs are getting generated in UTF-8 encoding.
    Please refer to the code below and advice. (where are the code tags gone ????? )
    Source domSource = new DOMSource(document);
    ByteArrayOutputStream xmlStream = new ByteArrayOutputStream();
    Result result = new StreamResult(xmlStream);
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.transform(domSource, result);
    xmlStream.close();
    generatedXml = new String(xmlStream.toByteArray(), "*ISO-8859-1*");

    Use transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1") to specify the character set.

  • XML with attributes 2 CSV with file adapter

    Hi,
    I have used this [link|http://help.sap.com/saphelp_nw04/Helpdata/EN/24/4cad3baabd4737bab64d0201bc0c6c/content.htm] to convert a xml file to a csv file. That works fine so far as long as my source file is like this:
    <root>
    <tag>
    <element1>
    <element2>
    </tag>
    </root>
    But what can I do if I have it like this?
    <root>
    <tag element1="something" element2="nothing" ...>
    </tag>
    </root>
    With my current settings in my file receiver channel the attributes in this example element1, element2 are not being postet in the csv file and I have no idea how to do this. The link from above does not mention anything like this. Is it possible, at all?
    Best regards.
    Oliver.

    Hi
    In this case you have to change your Source structure and map the attrbute values to target and in receiver channel you can perform your content conversion.
    Regards
    Ramg
    Edited by: Ramkumar Ganesh on Apr 28, 2010 11:09 PM

  • Generate XML with answer values

    Hi Forum,
    I wnat to know if there is any function or method to generate a xml, a string, with the answer values. I want to generate this string to attach this survey with the all fields completed in an activity.
    Regards and thanks in advance,
    Mon

    Hi,
    you can use one of the following Classes for XML conversion.
    CL_PROXY_XML
    CL_CRM_XML_PROVIDER
    CL_CXF_XML_TOOLS
    Also if none of the above is useful, you can search one in SE24 with XML.
    There are lots and one will be definitely useful.
    Please reward with points in case helpful.
    Sharif.

  • Printing XML with attributes

    Hi,
    I wrote some code to generate DOM trees, and some more code to print a tree as a string.
    But my the string loses attributes - i.e. all tags come out without attributes. And I am not sure why....
    public static String getStringXml(Document xmlDoc)
              //Output the XML to string
              TransformerFactory fac = TransformerFactory.newInstance();
              Transformer transformer = null;
              StringWriter writer = new StringWriter();
              try
                   transformer = fac.newTransformer();
                   transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
                   StreamResult result = new StreamResult(writer );
                   DOMSource source = new DOMSource(xmlDoc);
                   transformer.transform(source, result);
              catch (TransformerConfigurationException e)
                   e.printStackTrace();
              catch (TransformerException e)
                   e.printStackTrace();
              return writer.toString();
         }

    It is possible I am doing something wrong when adding attriubtes:
    Element myElement = xmlDoc.createElement("myElement");
    myElement.setAttribute("id", "first");

  • Generate XML file dynamically using java

    Hi,
    I searched on this topic on the net and also in this forum but everything leads to parsing an existing file using JAXP technology. But i need to create an xml file dynamically from the data coming from a different source. I can do it manually by writting the content to a file. But i am sure there is a better way for it. I would be obliged if some one could give me and example java class which produces a simple xml file or direct me to any resource online.
    Thank you in advance.

    Yes you can create the xml file dynamically. Like this,
    BufferedWriter bw = new BufferedWriter(new FileWriter("xyz.xml"));
    bw.write(buffer.toString()); //where buffer is StringBuffer whcih contains the your xml data
    bw.close();
    Remember to close the BufferedWriter, otherwise it will create the file but don't write anything.
    Hope this will help u.
    ....yogesh

Maybe you are looking for