Attribute tag in xml file

Hi
what is the use of attribute tag in repository xml inside <property > tag
example <property name="xyz" column-name="xyx" data-type="string">
<attribute name="abc" value=/abc/xyz/componentName/>
</property>
here what is use of attribute tag and also when that component is is invoked
please give me clear explanation about that.

By attribute we are passing some extra information (like resourceBundle, unique etc) about property/item-descriptor etc.
you can refer below url:
http://docs.oracle.com/cd/E23507_01/Platform.20073/RepositoryGuide/html/s1605samplecompositerepositorydefinit01.html
-RMishra

Similar Messages

  • How can we get  tag of XML file using SAX

    Hi ,
    I'm parsing one SAX parser , I'have almost done this parsing. i have faced problem for one case, i'e how can we get tag from XML file using SAX parser?
    XML file is
    <DFProperties>
    <AccessType>
    <Get/>
    </AccessType> <Description>
    gdhhd
    </Description>
    <DFFormat>
    <chr/>
    </DFFormat>
    <Scope>
    <Permanent/>
    </Scope>
    <DFTitle>gsgd</DFTitle>
    <DFType>
    <MIME>text/plain</MIME>
    </DFType>
    </DFProperties>
    I want out like GET and Permanent... means this one tag which is present inside of another tag.
    Handler class like
    public void startElement(String namespaceURI, String localName,
                   String qName, Attributes atts) throws SAXException {
    if(_ACCESSTYPE.equals(localName)){
                   accessTypeElement=ACCESSTYPE;
    public void characters(char[] ch, int start, int length)
                   throws SAXException {
    if (_ACCESSTYPE.equals(_accessTypeElement)) {
                   String strValue = new String(ch, start, length);
                   System.out.println("Accestype-----------------------------> " + strValue);
                   //System.out.println(" " + strValue);
    public void endElement(String namespaceURI, String localName, String qName)
                   throws SAXException {
    if (_ACCESSTYPE.equals(localName)) {
                   _accessTypeElement = "";
    . please any body help me

    Hi ,
    I have one problem,Please help me.
    1. How can I'll identify where exactly my Node is ended,means how how can we find corresponding nodename? in partcular place
    <Node> .............starttag1
    <NodeName>Test</NodeName>
    <Node>................starttag2
    <nodeName>test1</NodeName>
    </Node>..................endtag2
    <Node>.....................starttag3
    <NodeName><NodeName>
    <Node> .........................starttag4
    <NodeName>test4</NodeName>
    </Node>.......enddtag4
    </Node>...........end tag3
    </Node>............endtag1
    my code is below
    private final String _NODENAME = "NodeName";
    private final String _NODE = "Node";
    private String _nodeElement = "";
         private String _NodeNameElement = "";
    public void startElement(String namespaceURI, String localName,
                   String qName, Attributes atts) throws SAXException {
    if (_NODENAME.equals(localName)) {
                   NodeNameElement = NODENAME;
    if(_NODE.equals(localName)){
         System.out.println("start");
         if (_NODENAME.equals(localName)) {
                   NodeNameElement = NODENAME;
    public void characters(char[] ch, int start, int length)
                   throws SAXException {
    if (_NODENAME.equals(_NodeNameElement)) {
                   String strValue = new String(ch, start, length);
                   String sttt=strValue;
                   System.out.println("NODENAME: ************* " + strValue);
    if(_NODE.equals(_nodeElement)){
                   if (_NODENAME.equals(_NodeNameElement)) {
                        String strValue = new String(ch, start, length);
                        String sttt=strValue;
                        System.out.println("nodevalue********** " + strValue);
    public void endElement(String namespaceURI, String localName, String qName)
                   throws SAXException {
    if (_NODENAME.equals(localName)) {
                   _NodeNameElement = "";
    if(_NODE.equals(localName)){
                   System.out.println("NODENAME: %%%%%%%%%");
    please help me. How can I figure node ending for particular nodename

  • How to get nodes and its attributes of an XML file usiong DOM parsing?

    how to get nodes and its attributes of an XML file usiong DOM parsing?
    i am new to XML parsing.......
    Thanking you........

    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;      ...
    //Setup the document
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
         Document doc = docBuilder.parse (new File("MY_XML_FILE.xml"));
    //get elemets by name
         String elementValue = doc.getElementsByTagName("MY_ELEMENT").item(0).getTextContent();
    //This method can return multiple nodes, in this instance I get item(0) , first nodeRead the api for other methods of getting data.

  • How to change the attributes of an XML file

    hi peeps 'ope you can help me here i need to change the attributes of an xml file, i parse it first using a DOM parser but i cant find a way to change the attributes in the XML file, setAttribute() works only at runtime and doesn't change the attribute in the file itself. I can't find a method that will answer my question. I've searched through the forum and found similar threads....they say in order to write and change the attribute i must use the write() method of the XmlDocument class defined in com.sun.xml.tree.XmlDocument. But, i found another thread, and it says that com.sun.xml.tree.XmlDocument is not safe to use and i should use org.apache.crimson.tree.XmlDocument.....i can't find the XmlDocument class and the API for this package so i really dont know where to start...hope you guys can help me! thnx

    thanks for responding roland....i already found the solution...i didn't use the XmlDocument class because i can't find any documents about it except for JAXP 1.0 here is my code snippet...i used the TransformerFactory and Transformer class to write
    import org.w3c.dom.*;
    import org.w3c.dom.traversal.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    Document doc = null;
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    dbf.setValidating(false);
    doc = db.parse(fileGetFile); //this is the XML file
    n1 = (Node)doc.getDocumentElement();
    e1 = (Element) n1;
    NodeList nodeList = doc.getElementsByTagName ("File");
    //just insert whatever you want to do with the XML...parse it..set/change the attribute..etc....sample snippet below changes the attribute downloaded to "no"
    for(int iWriteFailed = 0; iWriteFailed <nodeList.getLength() ; iWriteFailed ++){     
    n2 = nodeList.item(iWriteFailed);
    e2 = (Element) n2;          
    e2.setAttribute("downloaded", "no");}
    try{
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.transform(new DOMSource(doc), new StreamResult ( new FileOutputStream ( fileGetFile) ) );}
    catch(Exception trans){}
    thanks for responding and keeping the information interchange alive here in the forum...
    Pau

  • How to get a sub tag in xml file

    As the xml file is the below thing ------
    <?xml version="1.0" encoding="UTF-8"?>
    <addRequest xmlns:spml="urn:oasis:names:tc:SPML:2:0">
         <data>
         <attributes>
                   <attr name="Objectclass">
                        <value>SafePolicy</value>
                   </attr>
                   <attr name="name">
                        <value>NewPolicy</value>
                   </attr>
                   <attr name="Resource">
                        <value>NewResourceclass</value>
                   </attr>
                   <attr name="Description">
                        <value>This is a New AccessPolicy</value>
                   </attr>
              </attributes>
         </data>
    </addRequest>
    The Schema has only the data and i was able to get the data object and the data can contain any namespace ,so i had the attributes and which inturn contain the attr and value .I have to get the Attributes , so that i can get the attr(name) and value pairs.Initially i did the unmarshal stuff and got until data but giving an error when i try to obtain the other tags .Can any body send the code for obtaining that by using the unmarshalling concept please.I need it .
    Thank you,

    Thank you,
    As i was trying to obtain the input to UI from an xml file by which the axis converts to java objects and inturn have to get the reply as xml file . The error was in the jar files ,when i loaded the jar files another time my code started working.

  • How to apply style to partial text within a tag in xml file

    I have created a webpage using Dreamweaver CS4 Spry Regions. Everything is functioning as expecting, however now I need to apply a style to part of the text. Every occurance of the company name needs to be in italics - the problem is that the company name appears within different parts of the text within a set of tags.
    http://www.certifiedangusbeef.com/private1/sales/facts/index.php
    ie - <description> this is my company name which must appear in italics</description>
    In this example, only "company name" needs to be italicized. We have created an XSL file that applies the italics properly when the XML file is viewed in the browser. But it does not have any effect on the final web page - as though spry is blocking the XSL or we've missed a step in linking all the files together.
    Here's the XSL code:
    <?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="facts.xml" --><!DOCTYPE xsl:stylesheet  [
    <!ENTITY nbsp   "&#160;">
    <!ENTITY copy   "&#169;">
    <!ENTITY reg    "&#174;">
    <!ENTITY trade  "&#8482;">
    <!ENTITY mdash  "&#8212;">
    <!ENTITY ldquo  "&#8220;">
    <!ENTITY rdquo  "&#8221;">
    <!ENTITY pound  "&#163;">
    <!ENTITY yen    "&#165;">
    <!ENTITY euro   "&#8364;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:template match="node()|@*">
            <xsl:copy>
                <xsl:apply-templates select="node()|@*"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="text()[ancestor::description]" name="replace">
            <xsl:param name="pString" select="."/>
            <xsl:choose>
                <xsl:when test="contains($pString,'Certified Angus Beef ®')">
                    <xsl:value-of select="substring-before($pString,'Certified Angus Beef ®')"/>
                    <i>Certified Angus Beef<sup> &reg;</sup> </i>
                    <xsl:call-template name="replace">
                        <xsl:with-param name="pString"
                        select="substring-after($pString,'Certified Angus Beef ®')"/>
                    </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$pString"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
        <xsl:template match="text()[ancestor::item]" name="replace1">
            <xsl:param name="pString" select="."/>
            <xsl:choose>
                <xsl:when test="contains($pString,'Certified Angus Beef ®')">
                    <xsl:value-of select="substring-before($pString,'Certified Angus Beef ®')"/>
                    <i>Certified Angus Beef<sup> &reg;</sup> </i>
                    <xsl:call-template name="replace">
                        <xsl:with-param name="pString"
                        select="substring-after($pString,'Certified Angus Beef ®')"/>
                    </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$pString"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
    </xsl:stylesheet>

    An element attribute is set with the method
    setAttribute(String name,
                             String value)or the
    setAttributeNode(Attr newAttr)method.

  • How to pick up values of particular tag from XMl file & store into an array

    Hi , i m using sax parser to read below xml file.
    <dvd-list>
    <dvd>
    <id>001</id>
         <title>Bollywood</title>
         <name>Lord of the rings</name>
         <length>150</length>
         <actor>Jonathan Austin</actor>
         <actor>Nicole Kidman</actor>
    </dvd>
    <dvd>
    <id>002</id>
         <title>Hollywood</title>
         <name>Taare Zamin pe</name>
         <length>200</length>
         <actor>Amir Khan</actor>
         <actor>Darsheel</actor>
    </dvd>
    <dvd>
    <id>003</id>
         <title>Bollywood</title>
         <name>Matrix reloaded</name>
         <length>150</length>
         <actor>Mickel</actor>
         <actor>Hally Berry</actor>
    </dvd>
    </dvd-list>
    & i want to store it into an arraylist .
    I declared arraylist a class var .
    i want to store all ids into an arraylist ...
    below is my code public void endElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
             if(qName.equals("id"))
       for (int i = 0; i < atts.getLength (); i++) {
                    list.add(i,atts.getValue (i));
           // showData ("</"+qName+">");
        }not working ... plz help me in this regard
    thanks a lot

    thanks , my id tag has no attribute...
    but sir again i m facing 1 problem
    to pick up values of tag i wrote below code public void startElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
             System.out.println("localName"+qName);
             str=qName;
        public void characters (char buf [], int offset, int len)
        throws SAXException
             String s = new String(buf, offset, len);
          System.out.println("char>>"+s);
          s.trim();
          if(str.equals("id"))
               list.add(s);
              if(str.equals("name"))
                   list.add(s);
              if(str.equals("title"))
                   list.add(s);
              if(str.equals("length"))
                   list.add(s);
              if(str.equals("actor"))
                   list.add(s);   
        public void endElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
        }here my list size shud be 5 ideally but it is showing 30!!!!
    also debug stmt sysout(char>>+s); is showing series of
    char>> ...it means charactes(0 method is being called several times ...while my xml contains
    <dvd-list>
    <dvd>
    <id>001</id>
         <title>Bollywood</title>
         <name>Lord of the rings</name>
         <length>150</length>
         <actor>Jonathan Austin</actor>
    </dvd>
    </dvd-list>
    plz help me in this regard to understand this flow....
    thanks a lot in advance

  • How to read the attribute of the xml file using jaxb

    Thanks,
    Buddy as i have a issue i have to read the xml file using jaxb and xml file contains this data and i have read the attribute like name , desc and action for a particular menu name pls tell the code how to do this it will be a great favour to me
    thanx in advance
    Rasool
    <contextmenu>
    <menu name='Lead' >
    <menuitem name='newlead' desc='New Lead' action='/leads.do?dispatch=insert' />
    <menuitem name='editlead' desc='Edit Lead' action='' />
    <menuitem name='leadinfo' desc='Lead Information' action='' />
    </menu>
    <menu name='Cases' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    <menu name='Contact' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    </contextmenu>

    What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
    After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
    Thanx all for your help and attention!!!

  • Extracting data from a tag of  xml file which is(xml) in a  Field of Csv.

    We have a xlm script which is stored in the clob column of the csv file. we have to extract one value from the <tag> and reject remaining data.
    Sample:-
    <ROW>
    <ID>100</ID>
    <ORDER_DATE>2000.12.20</ORDER_DATE>
    <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
    <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
    <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
    <SHIPTO_STATE>CA</SHIPTO_STATE>
    <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>
    Required Output:-
    We have to extract the "500 Marine World Parkway"
    from tag <SHIPTO_STREET>
    and the above sample xml file is in one of the column which is clob datatype
    Any idea How to perform the above activity in PL/SQL ?

    As BP suggested you can use an XPATH query to extract that information from your XML. However it depends a bit on your XML data.
    Here are two examples:
    one row XML
    select extractvalue(xmltype('<ROW>
    <ID>100</ID>
    <ORDER_DATE>2000.12.20</ORDER_DATE>
    <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
    <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
    <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
    <SHIPTO_STATE>CA</SHIPTO_STATE>
    <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>')
    ,'//SHIPTO_STREET/text()') as result
    from dual;
    RESULT
    500 Marine World Parkway
    multi rows XML
    select extractvalue(column_value,'SHIPTO_STREET/text()') as result
    from table(xmlsequence(extract(xmltype('<ROWS>
    <ROW>
      <ID>100</ID>
      <ORDER_DATE>2000.12.20</ORDER_DATE>
      <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
      <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
      <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
      <SHIPTO_STATE>CA</SHIPTO_STATE>
      <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>
    <ROW>
      <ID>200</ID>
      <ORDER_DATE>2000.12.20</ORDER_DATE>
      <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
      <SHIPTO_STREET>Test</SHIPTO_STREET>
      <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
      <SHIPTO_STATE>CA</SHIPTO_STATE>
      <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>
    </ROWS>'
    ),'ROWS/ROW/SHIPTO_STREET')));
    RESULT
    500 Marine World Parkway
    Test

  • How to find the existence of a tag in  XML file through  XSLT Mapping?

    Hello Friends,
    Working on an SAP XI interface ,I have come across a situation where I need to map the values only when a particular tag exists in the inbound XML file.I need to use the XSLT mapping for the same.
    Requesting your advice on as to how may I validate the existence of a tag through XSLT mapping?
    Thanks.

    Hello Friends
    After research , I could also find another way to check the existence of a node .We can even use CHOOSE to check the existence.
    <xsl:choose>
          <xsl:when test="(/mynode)">
              your action if the mynode is found
          </xsl:when>
          <xsl:otherwise>
                    action if mynode is not found
          </xsl:otherwise>
    </xsl:choose>
    Thanks.
    Wishes
    Richa

  • Add XML Tag to XML File (Idoc to XML File)

    Hi there.
    Just a question regarding the addition of a tag header in an XML file please?
    Idoc - > XI -> file (XML File)
    We have a need to add something like this below in bold to XML Tag Header in the inbound file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"
    MSGTYPE="ORDERS"?>
    Any ideas on how this can be managed would be apreciated please?
    Thank you.
    Mick.

    Hi Carlos.
    Thanks for your reply. I like what you are suggesting, however, I have no knowledge of Java and how to implement this Java addition to the mapping interface.
    I would appreciate any hints you may have. The value that I am trying to add to the tag header is exactly as it is below(the value in bold) and it can in fact be fixed, i.e. I am not looking to dynamically determine the values in the additional tag but just add the value as it is below...
    <?xml version="1.0" encoding="UTF-8"?>
    <?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"
    MSGTYPE="ORDERS"?>
    I would appreciate any input from you on that.
    Thanks in advance Carlos.
    Mick.

  • No Namespace tag in XML file

    Hi
    I wish to read an XML file coming from another system and then update my data base using RFC.
    The problem is that the incoming file does not contain a namespace tag which XI understands
    (For e.g. <ns:UpdateTablexmlns:ns="urn:BuisScenario:TEST">)
    Due to which it is not reading the data contained in the file.
    If I use the XML file which is generated through XI then it is working fine as it contains the relevant namespace.
    But as my XML file is coming from a different system and is not generated by XI, I wish to know how can we add the namespace tag to it so that XI can understand the file. Or is there any other way in which the file can be read.
    Has anybody face similar problem?
    Hoping for a quick response.
    Regards
    Satish

    Hi Stephan
    The problem of namespace is solved now, what I did was, I followed your suggestion and I have left the field for XML Namespace in the message type empty and the scenario works. Now I am facing another problem.
    My incoming XML file looks like as given below:
        <Case_Details>
         <Case1>                          <Case_EPC>1232312313313</Case_EPC>               <Item_ID>PR001</Item_ID>                    <Quantity>50</Quantity>                    </Case1>
         <Case2>                         <Case_EPC>1232312313314</Case_EPC>               <Item_ID>PR002</Item_ID>                    <Quantity>200</Quantity>                    </Case2>
         <Case3>                         <Case_EPC>1232312313315</Case_EPC>               <Item_ID>PR003</Item_ID>                    <Quantity>520</Quantity>
         </Case3>
       </Case_Details>
    The problem is when I duplicate the cases while testing the message mapping I do not get the desired result as the tag names are different. The mapping which I have done does not cater for Case1, Case2, Case3 coming in the incoming XML file, Instead of this only case tag comes without the numbering(1,2,3) due to which my fields are not getting populated.
    The sample XML generated from my mapping is given below.
      <Case_Details>
            <Case>                          <Case_EPC>1232312313313</Case_EPC>               <Item_ID>PR001</Item_ID>                    <Quantity>50</Quantity>                    </Case>
         <Case>                         <Case_EPC>1232312313314</Case_EPC>               <Item_ID>PR002</Item_ID>                    <Quantity>200</Quantity>                    </Case>
         <Case>                         <Case_EPC>1232312313315</Case_EPC>               <Item_ID>PR003</Item_ID>                    <Quantity>520</Quantity>
         </Case>
        </Case_Details>
    So in this scenario the different cases do not have numbering and thus the mapping fails when the original XML file is the input.
    Kindly advice what is to be done.
    Regards
    Satish

  • How to make the tags in XML file case insensitive

    Hi,
    I have a ReadXML class which reads an xml file. This class also has a method which receives a string-child from another class and uses this string-chile to match it with the child tag in the xml file, and returns the child tag's value.
    Now, my problem is this, the child tag in xml may be in a case different from the case of the string-child received from another class.
    How do I modify it, so the program does not return a null pointer exception because the strings did not match for want of uppercase or lowercase letters.
    Thanks
    Sangeetha

    I'm not sure what you are getting at. Is a string child the contents of a node treated as text?
    If you are trying to match a child node regardless of case I doubt this is possible as the XML standard says an XML document is case sensitive so if your parser ignored case it would not be XML complient.
    Hope this helps.

  • Add xmlns tag to Xml file using DBMS_XMLGEN

    I am using Oracle Release 10.1.0.4.2 version .
    I want to create a xml file according to some data available in the relational database tables. For the same i created object types and then view with the object types since data is scattered in many tables.
    Then i used DBMS_XMLGEN.getxml to generate the xml with query from the object view.
    Is there an option to add xmlns attribute to the generated xml file.
    Please let me know if any additional details are needed.

    If you want to add the namespace declaration in the root element, I don't think it's possible with DBMS_XMLGEN directly.
    You can instruct DBMS_XMLGEN to treat some object fields as XML attributes by prefixing them with "@" (e.g. "@my_attribute") but you cannot control that for enclosing elements.
    A possible solution is to add it afterwards using XSLT, or insertChildXML, but apparently the latter is not available in your version.
    However...
    For the same i created object types and then view with the object types since data is scattered in many tables.Since the data comes from different tables, why not use SQL and SQL/XML functions to build the document?
    It's straightforward, simple, and doesn't need additional objects.
    select xmlelement("Departments",
             xmlattributes('http://xmlns.example.org' as "xmlns")
           , xmlagg(
               xmlelement("Department",
                 xmlattributes(d.deptno as "Id")
               , xmlelement("Name", d.dname)
               , xmlelement("Employees"
                 , xmlagg(
                     xmlelement("Employee",
                       xmlattributes(e.empno as "Id")
                     , xmlforest(
                         e.ename as "Name"
                       , e.job as "Job"
                     ) order by e.empno
               ) order by d.deptno
    from scott.dept d
         join scott.emp e on e.deptno = d.deptno
    group by d.deptno, d.dname
    ;Output :
    <Departments xmlns="http://xmlns.example.org">
      <Department Id="10">
        <Name>ACCOUNTING</Name>
        <Employees>
          <Employee Id="7782">
            <Name>CLARK</Name>
            <Job>MANAGER</Job>
          </Employee>
          <Employee Id="7839">
            <Name>KING</Name>
            <Job>PRESIDENT</Job>
          </Employee>
          <Employee Id="7934">
            <Name>MILLER</Name>
            <Job>CLERK</Job>
          </Employee>
        </Employees>
      </Department>
      <Department Id="20">
        <Name>RESEARCH</Name>
        <Employees>
          <Employee Id="7369">
            <Name>SMITH</Name>
            <Job>CLERK</Job>
          </Employee>
          <Employee Id="7566">
            <Name>JONES</Name>
            <Job>MANAGER</Job>
          </Employee>
          <Employee Id="7902">
            <Name>FORD</Name>
            <Job>ANALYST</Job>
          </Employee>
        </Employees>
      </Department>
      <Department Id="30">
        <Name>SALES</Name>
        <Employees>
          <Employee Id="7499">
            <Name>ALLEN</Name>
            <Job>SALESMAN</Job>
          </Employee>
          <Employee Id="7521">
            <Name>WARD</Name>
            <Job>SALESMAN</Job>
          </Employee>
          <Employee Id="7654">
            <Name>MARTIN</Name>
            <Job>SALESMAN</Job>
          </Employee>
          <Employee Id="7698">
            <Name>BLAKE</Name>
            <Job>MANAGER</Job>
          </Employee>
          <Employee Id="7844">
            <Name>TURNER</Name>
            <Job>SALESMAN</Job>
          </Employee>
          <Employee Id="7900">
            <Name>JAMES</Name>
            <Job>CLERK</Job>
          </Employee>
        </Employees>
      </Department>
    </Departments>

  • Getting attributes from a XML File, stored in Oracle

    Hello,
    my problem is the following
    I have a xml file that looks like that:
    <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
    <root path="H:\musik">
    <directory name="Bj�rk - Homogenic" path="H:\musik\Bj�rk - Homogenic">
    <file album="Homogenic" artist="Bjoerk" comment=""
    completename="Bjoerk - Hunter" genre="Techno"
    name="01 - Hunter.mp3"
    path="H:\musik\Bj�rk - Homogenic\01 - Hunter.mp3"
    title="Hunter" year="1997"/>
    <file album="Homogenic" artist="Bjoerk" comment=""
    completename="Bjoerk - Joga" genre="" name="02 - Joga.mp3"
    path="H:\musik\Bj�rk - Homogenic\02 - Joga.mp3" title="Joga" year="1994"/>
    </directory>
    <directory name="Blank & Jones - In Da Mix" path="H:\musik\Blank & Jones - In Da Mix">
    <file album="In da Mix" artist="Blank & Jones" comment=""
    completename="Blank & Jones - On a journey (Intro)"
    genre="Dance" name="01 - On a journey (Intro).mp3"
    path="H:\musik\Blank & Jones - In Da Mix\01 - On a journey (Intro).mp3"
    title="On a journey (Intro)" year="1999"/>
    <file album="In da Mix" artist="Blank & Jones" comment=""
    completename="Blank & Jones - Cream" genre="Dance"
    name="02 - Cream.mp3"
    path="H:\musik\Blank & Jones - In Da Mix\02 - Cream.mp3"
    title="Cream" year="1999"/>
    </directory>
    </root>
    This file I have stored in Oracle as table of XML Type.
    Now I have build a little Java Programm, that displays the XML File like the File structure in the Windows Explorer.
    I want, when I choose a file in the File structure, that the ID3 Informations like album artist a.s.o. can be displayed. My problem is, I couldn't get these informations e.g. in an array from the database. Any suggestions how I could realize this in Java?
    Thx for any comments
    Max

    Try this:
    select extract(xmltypefieldname, '//xpath/field@attribute').getStringVal() from yourtable where yourwhereclause
    You can also select elements that match certain attributes by using a predicate such as field[@attr = myval][@attr2 = myval2]...
    Hope this helps.

Maybe you are looking for