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");

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

  • 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.

  • Pretty printing xml with sql

    Hello
    I have to pretty print xml which is stored in data base column ( clob)
    My table
    create table mytab
    myxml clob);mydata
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Us name="Step">
    <my name ="st">
    <colol name="t"/>
    </my>
    </Us>any idea/suggestion?
    Edited by: user10647455 on Dec 19, 2011 2:04 PM

    Thanks !
    I tired this as well
    select XMLSerialize( document xmltype(myxml) as CLOB INDENT ) from mytab;

  • 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

  • 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

  • Relational output from XML with attributes

    I'm using a 10g
    I have this XML.
    <items>
    <item name="Book" price="12" itemnumber="230" quantity="57" detail="Oracle book" company="Oracle" />
    <item name="Book" price="23" itemnumber="244" quantity="7" detail="XML book" company="Oracle" />
    </items>
    I want the following relational output:
    name price itemnumber quantity detail company
    Book 12 230 57 Oracle book Oracle
    Book 23 244 7 XML book Oracle
    I am new to this xml stuff and would appreciate any help.
    Thanks!

    You can solve this via xmltable (>= V. 10.2) or the use of a table(xmlsequence(extract())) contruct (<= V. 10.1 <<) or, for instance, via XQuery (>= V. 10.2).

  • Printig documents with attributes

    Printing documents with attributes
    We are using word files for documentation within the solution manager. While printing such documents all attribute information will not be printed.
    Does anybody know how to add to the printout the attributes like:
    Title, Technical Name, Documentation Type, Status, Priority, Person Responsible, etc.
    During the “normal” printing such information will be not on the paper.

    A solution!
    It turns out the problem in my case was in fact Suitcase. Previously, I'd tried turning it off, but that didn't fix the problem, so this time, I uninstalled it completely and the problem disappeared. I then began re-adding it (installed 15.0.1, upgraded it, etc.) and the problem resurfaced with the addition of the Photoshop-specific plugin. Deleting that plugin solved the problem. So it seems that "disabling" Suitcase by stopping the TypeCore doesn't seem to actually disable all of the tentacles it sticks into your system.
    You can find the plugin here: Applications / Adobe Photoshop CS6 / Plug-ins / Automate / ExtensisFontManagementPSCS6.plugin
    (After a restart, I also had to delete the font cache, as described here http://helpx.adobe.com/photoshop/kb/troubleshoot-fonts-photoshop-cs5.html but your mileage may vary.)
    Alternately, if you don't want to delete the plugin, disabling it from within Photoshop seems to work as well. To do that, go to File > Automate > Extensis, click Preferences..., then deselect Enable Suitcase Fusion 4 Auto-Activation.
    Fortunately, the plugin doesn't seem necessary at all to use the the core functionality of Suitcase (enabling and disabling fonts) in Photoshop. I didn't even know what these app-specific plugins did until researching this problem, and I still don't quite understand the point of them. I guess they allow you to let the apps for which they're installed do a little bit more of their own management (enable a font via Suitcase that isn't enabled system-wide), but that seems like more control than I need--if I'm enabling a font, I want all my software to be able to use it.
    Anyway, the problem seems to be completely solved on my system now, though I just did all this, so more testing over the next few days is required. I'll post here if any issues crop up. I'm interested in hearing if this solves it for anyone else as well.

  • XML Parsing attributes with encoded ampersand causes wrong order

    Hi all,
    I am writing in the forum first (because it could be that i am doing something wrong.... but i think it is a bug. Nonetheless, i thought i'd write my problem up here first.
    I am using Java 6, and this has been reproduced on both windows and linux.
    java version "1.6.0_03"
    Problem:
    read XML file into org.w3c.dom.Document.
    XML File has some attributes which contain ampersand. These are escaped as (i think) is prescribed by the rule of XML. For example:
    <?xml version="1.0" encoding="UTF-8"?>
         <lang>
              <text dna="8233" ro="chisturi de plex coroid (&gt;=1.5 mm)" it="Cisti del plesso corioideo(&gt;=1.5mm)" tr="Koro&#305;d pleksus kisti (&gt;=1.5 mm)" pt_br="Cisto do plexo cor&oacute;ide (&gt;=1,5 mm)" de="Choroidplexus Zyste (&gt;=1,5 mm)" el="&Kappa;&#973;&sigma;&tau;&epsilon;&iota;&sigmaf; &chi;&omicron;&rho;&omicron;&epsilon;&iota;&delta;&omicron;&#973;&sigmaf; &pi;&lambda;&#941;&gamma;&mu;&alpha;&tau;&omicron;&sigmaf; (&gt;= 1.5 mm)" zh_cn="&#33033;&#32476;&#33180;&#22218;&#32959;&#65288;&gt;= 1.5 mm&#65289;" pt="Quisto do plexo coroideu (&gt;=1,5 mm)" bg="&#1050;&#1080;&#1089;&#1090;&#1072; &#1085;&#1072; &#1093;&#1086;&#1088;&#1080;&#1086;&#1080;&#1076;&#1085;&#1080;&#1103; &#1087;&#1083;&#1077;&#1082;&#1089;&#1091;&#1089; (&gt;= 1.5 mm)" fr="Kystes du plexus choroide (&gt;= 1,5 mm)" en="Choroid plexus cysts (&gt;=1.5 mm)" ru="&#1082;&#1080;&#1089;&#1090;&#1099; &#1089;&#1086;&#1089;&#1091;&#1076;&#1080;&#1089;&#1090;&#1099;&#1093; &#1089;&#1087;&#1083;&#1077;&#1090;&#1077;&#1085;&#1080;&#1081; (&gt;=1.5 mm)" es="Quiste del plexo coroideo (&gt;=1.5 mm)" ja="&#33032;&#32097;&#33180;&#22178;&#32990;&#65288;&gt;=1.5mm&#65289;" nl="Plexus choroidus cyste (&gt;= 1,5 mm)" />
    </lang>As you might understand, we need to have the fixed text '>' for later processing. (not the greater than symbol '>' but the escaped version of it).
    Therefore, I escape the ampersand (encode?) and leave the rest of the text as is. And so my > becomes >
    All ok?
    Symptom:
    in fetching attributes, for example by the getAttribute("en") type call, the wrong attribute values are fetched.
    Not only that, if i only read to Document instance, and write back to file, the attributes are shown mixed up.
    eg:
    dna: 8233, ro=chisturi de plex coroid (>=1.5 mm), en=&#1082;&#1080;&#1089;&#1090;&#1099; &#1089;&#1086;&#1089;&#1091;&#1076;&#1080;&#1089;&#1090;&#1099;&#1093; &#1089;&#1087;&#1083;&#1077;&#1090;&#1077;&#1085;&#1080;&#1081; (>=1, de=Choroidplexus Zyste (>=1,5 mm)Here you can see that 'en' is shown holding what looks like greek, ... (what is ru as a country-code anyway?) where it should have obviously had the english text that originally was associated with the attribute 'en'
    This seems very strange and unexpected to me. I would have thought that in escaping (encoding) the ampersand, i have fulfilled all requirements of me, and that should be that.
    There is also no error that seems to occur.... we simply get the wrong order when fetching attributes.
    Am I doing something wrong? Or is this a bug that should be submitted?
    Kind Regards, and thanks to all responders/readers.
    Sean
    p.s. previously I had not been escaping the ampersand. This meant that I lost my ampersand in fetching attributes, AND the attribute order was ALSO WRONG!
    In fact, the wrong order was what led me to read about how to correctly encode ampersand at all. I had been hoping that correctly encoding would fix the order problem, but it didn't.
    Edited by: svaens on Mar 31, 2008 6:21 AM

    Hi kdgregory ,
    Firstly, sorry if there has been a misunderstanding on my part. If i did not reply to the question you raised, I appologise.
    In this 'reply' I hope not to risk further misunderstanding, and have simply given the most basic example which will cause the problem I am talking about, as well as short instructions on what XML to remove to make the problem disappear.
    Secondly, as this page seems to be displayed in ISO 8859-1, this is the reason the xml I have posted looks garbled. The xml is UTF-8. I have provided a link to the example xml file for the sample below
    [example xml file UTF-8|http://sean.freeshell.org/java/less2.xml]
    As for your most recent questions:
    Is it specified as an entity? To my knowledge (so far as my understanding of what an entity is) , yes, I am including entities in my xml. In my below example, the entities are the code for the greater than symbol. I am under the understanding that this is allowed in XML ??
    Is it an actual literal character (0xA0)? No, I am specifying 'greater than' entity (code?) in order to include the actual symbol in the end result. I am encoding it in form 'ampersand', 'g character', 't character', 'colon' in order for it to work, according to information I have read on various web pages. A quick google search will show you where I got such information from, example website: https://studio.tellme.com/general/xmlprimer.html
    Here is my sample program. It is longer than the one you kindly provided only because it prints out all attributes of the element it looks for. To use it, only change the name of the file it loads.
    I have given the xml code seperately so it can be easily copied and saved to file.
    Results you can expect from running this small test example?
    1. a mixed up list of attributes where attribute node name no longer matches its assigned attribute values (not for all attributes, but some).
    2. removing the attribute bg from the 'text' element will reduce most of these symptoms, but not all. Removing another attribute from the element will most likely make the end result look normal again.
    3. No exception is thrown by the presence of non xml characters.
    IMPORTANT!!! I have only just (unfortunately) noticed what this page does to my unicode characters... all the the international characters get turned into funny codes when previewed and viewed on this page.
    Whereas the only codes I am explicitly including in this XML is the greater than symbol. The rest were international characters.
    Perhaps that is the problem?
    Perhaps there is an international characters problem?
    I am quite sure that these characters are all UTF-8 because when I open up this xml file in firefox, It displays correctly, and in checking the character encoding, firefox reports UTF-8.
    In order to provide an un-garbled xml file, I will provide it at this link:
    link to xml file: [http://sean.freeshell.org/java/less2.xml]
    Again, sorry for any hassle and/or delay with my reply, or poor reply. I did not mean to waste anyones time.
    It will be appreciated however if an answer can be found for this problem. Chiefly,
    1. Is this a bug?
    2. Is the XML correct? (if not, then all those websites i've been reading are giving false information? )
    Kindest Regards,
    Sean
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    public class Example
        public static void main(String[] argv)
              try
                   FileInputStream fis = new FileInputStream("/home/sean/Desktop/chris/less2.xml");
                 Document doc = DocumentBuilderFactory.newInstance()
                 .newDocumentBuilder()
                 .parse(new InputSource(fis));
                   Element root = doc.getDocumentElement();
                   NodeList textnodes = root.getElementsByTagName("text");
                   int len = textnodes.getLength();
                   int index = 0;
                   int attindex = 0;
                   int attrlen = 0;
                   NamedNodeMap attrs = null;
                   while (index<len)
                        Element te = (Element)textnodes.item(index);
                        attrs = te.getAttributes();
                        attrlen = attrs.getLength();
                        attindex = 0;
                        Node node = null;
                        while (attindex<attrlen)
                             node = attrs.item(attindex);          
                             System.out.println("attr: "+node.getNodeName()+ " is shown holding value: " + node.getNodeValue());
                             attindex++;                         
                        index++;
                        System.out.println("-------------");
                 fis.close();
              catch(Exception e)
                   System.out.println("we've had an exception, type "+ e);
    }  [example xml file|http://sean.freeshell.org/java/less2.xml]
    FOR THE XML, Please see link above, as it is UTF-8, and this page is not. Edited by: svaens on Apr 7, 2008 7:03 AM
    Edited by: svaens on Apr 7, 2008 7:23 AM
    Edited by: svaens on Apr 7, 2008 7:37 AM
    Edited by: svaens on Apr 7, 2008 7:41 AM

  • Issue with working on a webservice that has  xml elements with attributes

    This is  a branchout of Thread: Some more complex sample of invokin WS needed_
    We are working on a project that involves a outbound SALT Web service call that includes complex elements with attributes..We are looking for options of how to use FML API's to pass these attribute values from the application code.
    We opened a ticket with oracle where we were suggested to frame the entire xml and pass the xml using the FML32 of the complex element. But when we framed the xml for Service and put the entire XML which includes the attributes using the FML ID of Service.
    Please find a sample Schema and XML similar to the one we are working on...its associated code
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:element name="Service" type="Service_Type" nillable="true">
              <xs:annotation>
                   <xs:documentation>Comment describing your root element</xs:documentation>
              </xs:annotation>
         </xs:element>
         <xs:complexType name="Service_Type">
              <xs:sequence>
                   <xs:element name="DateTime" type="xs:dateTime" nillable="true">
                   </xs:element>
                   <xs:element name="UUID" nillable="true">
                   </xs:element>
                   <xs:element name="Status" type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded">
                   </xs:element>
              </xs:sequence>
              <xs:attribute name="Version" type="xs:string" use="required">
              </xs:attribute>
              <xs:attribute name="Name" type="xs:string" use="required">
              </xs:attribute>
         </xs:complexType>
    </xs:schema>
    The sample XML is :
    ___<?xml version="1.0" encoding="UTF-8"?>___
    ___<!--Sample XML file generated by XMLSpy v2010 rel. 2 (http://www.altova.com)-->___
    ___<Service Name="TestService" Version="1.1" xsi:noNamespaceSchemaLocation="Untitled6.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">___
    ___     <DateTime>2001-12-17T09:30:47Z</DateTime>___
    ___     <UUID>text</UUID>___
    ___</Service>___
    wsdlcvt generated the mif file with Service as a FML32 type and all its child elements as "mbstring". We tried to leave as it is and we also tried to replace all the child elements and just had a mif entry for "Service" as a mbstring neither produced a different output...Tried to dump using Ferror32 which did not dump any..._
    The sample C/C++ code as per suggestions were to do the following...
    _1) Have a string with the entire XML for Service_
    xmldata="<Service Name=\"TestService"\ Version="1.1\"_ xsi:noNamespaceSchemaLocation=\"Untitled6.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">_
    _     <DateTime>2001-12-17T09:30:47Z</DateTime>_
    _     <UUID>text</UUID>_
    _</Service>";_
    _2) Use Fmbpack32 to create a mbstring data_
    _memcpy(reqmbptr, (char*)xmldata.data(),xmldata.length());_
    _len=xmldata.length();_
    _Fmbpack32(mbcodeName,reqmbptr,len, packdata,(FLDLEN32 *)&packedlen,0);_
    userlog("Size of packedlen is %d",packedlen);
    3) Add the packed data to the output buffer
    Fadd32(fmlbuffer,Service, packdata,packedlen );
    But we do not see the Service tag populated in the GWWS outbound request.Everything else makes it....any help on how to move ahead would be appreciated...

    It seems you switch to the 10gR3 GA and now the whole XML data is mapped to FLD_MBSTRING.
    I will forward my sample to you by mail, but this sample is not offical sample, it is just QA test case. You can refere it and check what's the difference.
    Please let me know your mail address.
    Regards,
    Xu he

  • XML Schema Collection (SQL Server 2012): Complex Schema Collection with Attribute - Should xs or xsd be used in the coding?

    Hi all,
    I just got a copy of the book "Pro SQL Server 2008 XML" written by Michael Coles (published by Apress) and try to learn the XML Schema Collection in my SQL Server 2012 Management Studio (SSMS2012). I studied Chapter 4 XML Collection of the book
    and executed the following code of Listing 4-8 Complex Schema with Attribute:
    -- Pro SQL Server 2008 XML by Michael Coles (Apress)
    -- Listing04-08.sql Complex XML Schema with Attribute
    -- shcColes04-08.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress
    -- 6 April 2015 8:00 PM
    CREATE XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_attribute
    AS
    N'<?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="item">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="name" />
    <xs:element name="color" />
    <xs:group ref="id-price" />
    <xs:group ref="size-group" />
    </xs:sequence>
    <xs:attribute name="id" />
    <xs:attribute name="number" />
    </xs:complexType>
    </xs:element>
    <xs:group name="id-price">
    <xs:choice>
    <xs:element name="list-price" />
    <xs:element name="standard-cost" />
    </xs:choice>
    </xs:group>
    <xs:group name="size-group">
    <xs:sequence>
    <xs:element name="size" />
    <xs:element name="unit-of-measure" />
    </xs:sequence>
    </xs:group>
    </xs:schema>';
    GO
    DECLARE @x XML (dbo.ComplexTestSchemaCollection_attribute);
    SET @x = N'<?xml version="1.0"?>
    <item id="749" number="BK-R93R-62">
    <name>Road-150 Red, 62</name>
    <color>Red</color>
    <list-price>3578.27</list-price>
    <size>62</size>
    <unit-of-measure>CM</unit-of-measure>
    </item>';
    SELECT @x;
    GO
    DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_attribute;
    It worked nicely. But, I just found out the coding that was downloaded from the website of Apress and I just executed was different from the coding of Listing 4-8 listed in the book: all the <xs: ....> and </xs: ..> in my SSMS2012 are
    listed as <xsd:...> and </xsd:...> respectively in the book!!??  The same thing happens in the Listing 4-3 Simple XML Schema, Listing 4-5 XML Schema and Valid XML Document with Comple Type Definition, Listion 4-6 XML Schema and XML
    Document Document with Complex Type Using <sequence> and <choice>, and Listing 4-7 Complex XML Schema and XML Document with Model Group Definition (I executed last week) too.  I wonder: should xs or xsd be used in the XML
    Schema Collection of SSMS2012?  Please kindly help,  clarify this matter and explain the diffirence of using xs and xsd for me.
    Thanks in advance,
    Scott Chang   

    Hi Scott,
    Using xs or xsd depends on how you declare the namespace prefix.
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="item">
    I've posted a very good link in your last question, just in case you might have missed it, please see the below link.
    Understanding XML Namespaces
    In an XML document we use a namespace prefix to qualify the local names of both elements and attributes . A prefix is really just an abbreviation for the namespace identifier (URI), which is typically quite long. The prefix is first mapped to a namespace
    identifier through a namespace declaration. The syntax for a namespace declaration is:
    xmlns:<prefix>='<namespace identifier>'
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • XML tag with attributes and one value via XSU

    I need to generate a XML structure with attributes in the opening tag, and just one value in the body, like this:
    <PRODUCT-LIST-PRICE NET-PRICE="0" CURRENCY="USD">9.99</PRODUCT-LIST-PRICE>
    Without an object type, I can just create tags like this
    XML3
    <PRODUCT-LIST-PRICE>9.99</PRODUCT-LIST-PRICE>
    (with no attributes, but a single value) via the followig statement
    SELECT sys_xmlgen ('9.99',
    sys.xmlgenformattype.createFormat('PRODUCT-LIST-PRICE')
    ).getClobVal() "XML3"
    FROM DUAL;
    Having an object "productlisteprice_type", defined by
    CREATE OR REPLACE TYPE productlisteprice_type AS OBJECT
    "@NET-PRICE" VARCHAR2(10),
    "@CURRENCY" VARCHAR2(10),
    "PRICE" VARCHAR2(20)
    I just get XML like this
    XML2
    <PRODUCT-LIST-PRICE NET-PRICE="0" CURRENCY="USD">
    <PRICE>9.99</PRICE>
    </PRODUCT-LIST-PRICE>
    (with attributes, but no direct value beneath the "PRODUCT-LIST-PRICE" tag) via the following statement
    SELECT sys_xmlgen ( productlisteprice_type(0,'USD','9.99'),
    sys.xmlgenformattype.createFormat('PRODUCT-LIST-PRICE')
    ).getClobVal() "XML2"
    FROM DUAL;
    Not what I need :-(
    Are there any possibilities in XSU to get the needed XML code? Or do I have to do some post-production via XSQL???
    Another question: Is it possible to use specific keywords like "online" as XML tagnames, via objects? The objects don't allow "online" as a field name...
    Thanks in advance,
    Holger

    I need to generate a XML structure with attributes in the opening tag, and just one value in the body, like this:
    <PRODUCT-LIST-PRICE NET-PRICE="0" CURRENCY="USD">9.99</PRODUCT-LIST-PRICE>
    Without an object type, I can just create tags like this
    XML3
    <PRODUCT-LIST-PRICE>9.99</PRODUCT-LIST-PRICE>
    (with no attributes, but a single value) via the followig statement
    SELECT sys_xmlgen ('9.99',
    sys.xmlgenformattype.createFormat('PRODUCT-LIST-PRICE')
    ).getClobVal() "XML3"
    FROM DUAL;
    Having an object "productlisteprice_type", defined by
    CREATE OR REPLACE TYPE productlisteprice_type AS OBJECT
    "@NET-PRICE" VARCHAR2(10),
    "@CURRENCY" VARCHAR2(10),
    "PRICE" VARCHAR2(20)
    I just get XML like this
    XML2
    <PRODUCT-LIST-PRICE NET-PRICE="0" CURRENCY="USD">
    <PRICE>9.99</PRICE>
    </PRODUCT-LIST-PRICE>
    (with attributes, but no direct value beneath the "PRODUCT-LIST-PRICE" tag) via the following statement
    SELECT sys_xmlgen ( productlisteprice_type(0,'USD','9.99'),
    sys.xmlgenformattype.createFormat('PRODUCT-LIST-PRICE')
    ).getClobVal() "XML2"
    FROM DUAL;
    Not what I need :-(
    Are there any possibilities in XSU to get the needed XML code? Or do I have to do some post-production via XSQL???
    Another question: Is it possible to use specific keywords like "online" as XML tagnames, via objects? The objects don't allow "online" as a field name...
    Thanks in advance,
    Holger

  • Create Checkbox with Attributes from XML file

    Hi
    I have some problem. I want to create some checkbox with attribute from a XML file
    my Xml file look like this:
    <group type="Content Relation" color="255, 255, 255" active="true">
    so I want to create for example a check box with name as Content Relation, Background color is RGB(255, 255, 255) and it's checked. All of these Attribute I have readed and save them as String. My question, how can I create a Color object with the color Attribute from the XML file?
    Is it better if I define my XML file like this:
    <group>
    <type>Content Relation</type>
    <color>
    <red>255</red>
    <green>255</green>
    <blue>255</blue>
    </color>
    <active>true</active>
    </group>

    IMO attributes are much easier to parse then textnodes
    altho
    <color red='255' green='255' blue='255'/>
    might be easier

  • XSLT bug with attributes+in memory DOM

    Hello,
    I know there was a thread about this one some time ago but i
    don't know the current state of this matter, so :
    The XSLT processor has problems with attributes when the DOM was
    build dynamically (attributes are returned as being empty). When
    i save the same DOM, reload it and then do the transform
    attributes are properly transformed.
    The Version 2.0.0.1 of the Java parser states to have solved a
    problem when accessing attributes (bug #920536) but this seems to
    be an other one (i tried 2.0.0.0 and 2.0.0.1 and both had this
    problem).
    Bye Heiko.
    null

    We were unable to reproduce the problem you illustrated. We got
    the output:
    <HTML>
    <BODY>
    the value is : 1
    </BODY>
    </HTML>
    irrespective of whether the lines were commented out. Can you
    describe your environment - JRE/JDK, OS. etc?
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    You wrote:
    : Hello,
    : the following program illustrates what i mean :
    : package testing;
    : import oracle.xml.parser.v2.*;
    : import org.w3c.dom.*;
    : import java.io.*;
    : public class XMLTest {
    : public static final void main(String [] args) throws
    : Exception {
    : XMLDocument doc=new XMLDocument();
    : doc.setVersion("1.0");
    : doc.setStandalone("yes");
    : Node root=doc.createElement("ROOT");
    : Node att=doc.createAttribute("value");
    : att.setNodeValue("1");
    : root.getAttributes().setNamedItem(att);
    : doc.appendChild(root);
    : doc.print(new FileOutputStream("c:\\test.xml"));
    : DOMParser parser=new DOMParser();
    : parser.parse(new FileInputStream("c:\\test.xml"));
    : doc=parser.getDocument();
    : XSLStylesheet xsl=new XSLStylesheet(new
    : FileInputStream("c:\\test.xsl"), null);
    : XMLDocument out=new XMLDocument();
    : out.appendChild(new XSLProcessor().processXSL(xsl,
    doc));
    : out.print(System.out);
    : with the stylesheet test.xsl as follows :
    : <?xml version="1.0"?>
    : <xsl:stylesheet
    : xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
    : xmlns="http://www.w3.org/Profiles/xhtml1-transitional"
    : default-space="strip"
    : indent-result="yes"
    : >
    : <xsl:template match="ROOT">
    : <HTML>
    : <BODY>
    : the value is : <xsl:value-of select="@value"/>
    : </BODY>
    : </HTML>
    : </xsl:template>
    : </xsl:stylesheet>
    : if you run the program as given the result is :
    : the value is:
    : but when you uncomment the lines storing & retrieving the
    : document the result is as i would expect it :
    : the value is: 1
    : Bye Heiko.
    null

  • Unable to print xml publisher report in excel format in R12

    Hi All,
    We are unable to print xml publisher report in excel format in R12. We were able to see the excel output but it's printing junk characters while printing and it's printing without any issue with PDF format.
    Please let me know how to fix this issue.
    Thanks,
    Raja

    Hi Raja,
    I presume you have gone through the debugging process of testing your template locally first to get the expected result.....
    If yes, this note might probably be helpful "Changing Output Format to RTF or Excel in XML Publisher Request Does Not Display Output Correctly (Doc ID 404512.1)"
    Good Luck,
    Lamine Balde

Maybe you are looking for

  • How to use BAPI_MATERIAL_AVAILABILITY Function Module....

    Hi Experts, I want to know actual free available quantity (ATP Qty.) for mass materials, How to use BAPI_MATERIAL_AVAILABILITY function module ? I have select all material from MARA and inserted in itab. LOOP AT ITAB. CALL FUNCTION 'BAPI_MATERIAL_AVA

  • Why can't Lightroom import or even recognize images have been (saved as) in photoshop

    Lightroom 5 dosn't read photos saved as tiff or jpeg from photoshop cc when importing??? i Have both latest version running on iMac latest version as well! I Have no other problems! I wonder if it's a bug or some annoying ignored feature? I Tried wit

  • Is it possible to make a shared folder between profiles?

    Hi, My e-mail is a mess with personal and work e-mail and urgent and unimportant email mixed and I am losing a lot of productivity trying to manage the onslaught. I would like to be able to create a new profile for only important work e-mail. I'm won

  • Creation of standby logical controlfile

    can anybody let me know how to create standby logical controlfile.... i know how to create physical standby control file.... when i created a logical standby controlfile and after mounting the logical standby database, i got an erorr database name is

  • Cfgrid and rowStatus.Action

    I posted this under 'Rich Forms' as well (just trying to cover all the bases). I'm having a problem pulling out the rowstatus property using actionscript. If I use the following lines of code I receive an appropriate response (ie: the Index and value