Converting Schema attributes to elements

I have trouble registering a schema into Oracle. The problem seems to be that the schema defines Attributes and Oracle does not like Attributes.
Does someone have a XSL to convert schema attributes into elements?
I am able to convert the attributes in the XML data file to elements.
Any help will be appreciated
Thanks
SP

The following xml schema is from the Oracle XML guide. It has attributes in it.
I've used XMLSpy to validate my xsd before, and it indicated they where valid when indeed it was not. That is why I now use the link I sent previously.
The purchase-order XML schema is contained in file po.xsd:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Purchase order schema for Example.com.
Copyright 2000 Example.com. All rights reserved.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
<xsd:element name="comment" type="xsd:string"/>
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:element name="shipTo" type="USAddress"/>
<xsd:element name="billTo" type="USAddress"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="items" type="Items"/>
</xsd:sequence>
<xsd:attribute name="orderDate" type="xsd:date"/>
</xsd:complexType>
<xsd:complexType name="USAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="zip" type="xsd:decimal"/>
</xsd:sequence>
<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
</xsd:complexType>
<xsd:complexType name="Items">
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="productName" type="xsd:string"/>
<xsd:element name="quantity">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="USPrice" type="xsd:decimal"/>
<xsd:element ref="comment" minOccurs="0"/>
<xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="partNum" type="SKU" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

Similar Messages

  • Converting schema in dtd using xsl

    Hey all,
    I have a problem with an xsl transformtion.
    Somewhere on the web I found a xsl-stylesheet to convert schema's into valid dtd's
    http://crism.maden.org/consulting/pub/xsl/xsd2dtd.xsl
    I've used a program from the JavaTM Web Services Developer Pack to run this xsl on existing schema's but the results are definately nothing like a dtd ... what is this n00b doing wrong .... Heeelp ...
    * @(#)Stylizer.java 1.9 98/11/10
    * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
    * Redistribution and use in source and binary forms, with or
    * without modification, are permitted provided that the following
    * conditions are met:
    * - Redistributions of source code must retain the above copyright
    *   notice, this list of conditions and the following disclaimer.
    * - Redistribution in binary form must reproduce the above
    *   copyright notice, this list of conditions and the following
    *   disclaimer in the documentation and/or other materials
    *   provided with the distribution.
    * Neither the name of Sun Microsystems, Inc. or the names of
    * contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    * This software is provided "AS IS," without a warranty of any
    * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
    * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
    * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
    * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
    * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR
    * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE OR
    * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE
    * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,
    * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
    * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
    * THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
    * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    * You acknowledge that this software is not designed, licensed or
    * intended for use in the design, construction, operation or
    * maintenance of any nuclear facility.
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.w3c.dom.Document;
    import org.w3c.dom.DOMException;
    // For write operation
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import java.io.*;
    public class Stylizer
        // Global value so it can be ref'd by the tree-adapter
        static Document document;
        public static void main (String argv [])
            if (argv.length != 2) {
                System.err.println ("Usage: java Stylizer stylesheet xmlfile");
                System.exit (1);
            DocumentBuilderFactory factory =
                DocumentBuilderFactory.newInstance();
            //factory.setNamespaceAware(true);
            //factory.setValidating(true);
            try {
                File stylesheet = new File(argv[0]);
                File datafile   = new File(argv[1]);
                DocumentBuilder builder = factory.newDocumentBuilder();
                document = builder.parse(datafile);
                // Use a Transformer for output
                TransformerFactory tFactory = TransformerFactory.newInstance();
                StreamSource stylesource = new StreamSource(stylesheet);
                Transformer transformer = tFactory.newTransformer(stylesource);
                DOMSource source = new DOMSource(document);
                StreamResult result = new StreamResult(System.out);
                transformer.transform(source, result);
            } catch (TransformerConfigurationException tce) {
               // Error generated by the parser
               System.out.println ("\n** Transformer Factory error");
               System.out.println("   " + tce.getMessage() );
               // Use the contained exception, if any
               Throwable x = tce;
               if (tce.getException() != null)
                   x = tce.getException();
               x.printStackTrace();
            } catch (TransformerException te) {
               // Error generated by the parser
               System.out.println ("\n** Transformation error");
               System.out.println("   " + te.getMessage() );
               // Use the contained exception, if any
               Throwable x = te;
               if (te.getException() != null)
                   x = te.getException();
               x.printStackTrace();
             } catch (SAXException sxe) {
               // Error generated by this application
               // (or a parser-initialization error)
               Exception  x = sxe;
               if (sxe.getException() != null)
                   x = sxe.getException();
               x.printStackTrace();
            } catch (ParserConfigurationException pce) {
                // Parser with specified options can't be built
                pce.printStackTrace();
            } catch (IOException ioe) {
               // I/O error
               ioe.printStackTrace();
        } // main
    }Cybu

    here is a XSD that is converted okay:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
         <xs:element name="pvDepot">
              <xs:complexType>
                   <xs:attribute name="pvId" type="xs:ID" use="required"/>
                   <xs:attribute name="status" type="xs:string" use="required"/>
                   <xs:attribute name="languagePivot" type="xs:string"/>
                   <xs:attribute name="versionPivot" type="xs:string"/>
                   <xs:attribute name="finalVersion" default="false">
                        <xs:simpleType>
                             <xs:restriction base="xs:NMTOKEN">
                                  <xs:enumeration value="true"/>
                                  <xs:enumeration value="false"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
                   <xs:attribute name="comment" type="xs:string"/>
              </xs:complexType>
         </xs:element>
         <xs:element name="pvIndex">
              <xs:complexType>
                   <xs:choice minOccurs="0" maxOccurs="unbounded">
                        <xs:element ref="pvOOText"/>
                        <xs:element ref="pvDepot"/>
                        <xs:element ref="pvPresence"/>
                        <xs:element ref="resultatVoteAN"/>
                   </xs:choice>
                   <xs:attribute name="pvId" type="xs:ID" use="required"/>
                   <xs:attribute name="pvSittingDate" type="xs:string" use="required"/>
                   <xs:attribute name="pvSittingId" type="xs:string" use="required"/>
                   <xs:attribute name="pvStatus" default="edition">
                        <xs:simpleType>
                             <xs:restriction base="xs:NMTOKEN">
                                  <xs:enumeration value="edition"/>
                                  <xs:enumeration value="provisional"/>
                                  <xs:enumeration value="final"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
              </xs:complexType>
         </xs:element>
         <xs:element name="pvOOText">
              <xs:complexType>
                   <xs:attribute name="pvId" type="xs:ID" use="required"/>
                   <xs:attribute name="type" default="SESSION">
                        <xs:simpleType>
                             <xs:restriction base="xs:NMTOKEN">
                                  <xs:enumeration value="FREE"/>
                                  <xs:enumeration value="SESSION"/>
                                  <xs:enumeration value="COVERPAGE"/>
                                  <xs:enumeration value="TRANSFER"/>
                                  <xs:enumeration value="PETITION"/>
                                  <xs:enumeration value="DEPOSIT"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
                   <xs:attribute name="status" type="xs:string" use="required"/>
                   <xs:attribute name="languagePivot" type="xs:string"/>
                   <xs:attribute name="versionPivot" type="xs:string"/>
                   <xs:attribute name="finalVersion" default="false">
                        <xs:simpleType>
                             <xs:restriction base="xs:NMTOKEN">
                                  <xs:enumeration value="true"/>
                                  <xs:enumeration value="false"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
                   <xs:attribute name="comment" type="xs:string"/>
              </xs:complexType>
         </xs:element>
         <xs:element name="pvPresence">
              <xs:complexType>
                   <xs:attribute name="pvId" type="xs:ID" use="required"/>
                   <xs:attribute name="status" type="xs:string" use="required"/>
                   <xs:attribute name="finalVersion" default="false">
                        <xs:simpleType>
                             <xs:restriction base="xs:NMTOKEN">
                                  <xs:enumeration value="true"/>
                                  <xs:enumeration value="false"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
                   <xs:attribute name="comment" type="xs:string"/>
              </xs:complexType>
         </xs:element>
         <xs:element name="resultatVoteAN">
              <xs:complexType>
                   <xs:attribute name="pvId" type="xs:ID" use="required"/>
                   <xs:attribute name="status" type="xs:string" use="required"/>
                   <xs:attribute name="finalVersion" default="false">
                        <xs:simpleType>
                             <xs:restriction base="xs:NMTOKEN">
                                  <xs:enumeration value="true"/>
                                  <xs:enumeration value="false"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
                   <xs:attribute name="comment" type="xs:string"/>
              </xs:complexType>
         </xs:element>
    </xs:schema>

  • Did not find needed xsi:type attribute on element anyType

    The followings exception is thrown when using the access a web service using the
    proxy jar.
    The return xml contains
    <debts xm:bind="debts is return.safaccount.debts">
    <anyType xm:multiple="debt in return.safaccount.debts">{debt}</anyType>
    </debts>
    debts is a vector contains Serializable Object class.
    How do you resolve this?
    <Nov 14, 2002 2:36:27 PM ICT> <Error> <HTTP> <101019> <[ServletContext(id=553030
    0,name=EAIService,context-path=/EAIService)] Servlet failed with IOException
    java.rmi.RemoteException: web service invoke failed; nested exception is:
    javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.sch
    ema.binding.DeserializationException: did not find needed xsi:type attribute on
    element <anyType>
    javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.schema.bind
    ing.DeserializationException: did not find needed xsi:type attribute on element
    <anyType>
    at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:296)
    at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:35
    9)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:465)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav

    Hi Daniel,
    This is really an "constructing and XMLMap issue" with WebLogic Workshop, so I
    would post it on that newsweb group:
    weblogic.developer.interest.workshop
    BTW: Serialization/Deserialization required instanciable classes with no-arg constructors.
    You should attach the WSDL for this web service, so that folks can see what Workshop
    generated for the schema element(s). This (the schema elements) is probably where
    the problem starts :-) Also, state if that is the default xmlmap generated by
    Workshop, or a custom one.
    Regards,
    Mike Wooten
    "daniel" <[email protected]> wrote:
    >
    The followings exception is thrown when using the access a web service
    using the
    proxy jar.
    The return xml contains
    <debts xm:bind="debts is return.safaccount.debts">
    <anyType xm:multiple="debt in return.safaccount.debts">{debt}</anyType>
    </debts>
    debts is a vector contains Serializable Object class.
    How do you resolve this?
    <Nov 14, 2002 2:36:27 PM ICT> <Error> <HTTP> <101019> <[ServletContext(id=553030
    0,name=EAIService,context-path=/EAIService)] Servlet failed with IOException
    java.rmi.RemoteException: web service invoke failed; nested exception
    is:
    javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.sch
    ema.binding.DeserializationException: did not find needed xsi:type attribute
    on
    element <anyType>
    javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.schema.bind
    ing.DeserializationException: did not find needed xsi:type attribute
    on element
    <anyType>
    at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:296)
    at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:35
    9)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
    a:465)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav

  • Not able to convert string attribute to number and date please help me out

    not able to convert string attribute to number and date attribute. While using string to date conversion it shows result as failure.As I am reading from a text file. please help me out

    Hi,
    You need to provide an example value that's failing and the date formats in the reference data you're using. It's more than likely you don't have the correct format in your ref data.
    regards,
    Nick

  • Error while converting schema from oracle to SQL server

    Hello,
    I am getting following error while converting schema from oracle to SQL server using SSMA.
    I get Errors 1-3 while migrating procedures and error 4 while migrating a table.
    1- O2SS0050: Conversion of identifier 'SYSDATE' is not supported.
    2- O2SS0050: Conversion of identifier 'to_date(VARCHAR2, CHAR)' is not supported.
    3- O2SS0050: Conversion of identifier 'regexp_replace(VARCHAR2, CHAR)' is not supported.
    4- O2SS0486: <Primary key name> constraint is disabled in Oracle and cannot be converted because SQL Server does not support disabling of primary or unique constraint.
    Please suggest.
    Thanks.

    The exact statement in oracle side which causing this error (O2SS0050:
    Conversion of identifier 'to_date(VARCHAR2, CHAR)' is not supported.) is below:
    dStartDate:= to_date(sStartDate,'MON-YYYY');
    Statement causing error O2SS0050:
    Conversion of identifier 'regexp_replace(VARCHAR2, CHAR)' is not supported is below.
    nCount2:= length(regexp_replace(sDataRow,'[^,]'));
    So there is no statement which is using to_date(VARCHAR2,
    CHAR) and regexp_replace(VARCHAR2, CHAR) in as such. 'MON-YYYY'  and '[^,]'
    are CHAR values hence SSMA is unable to convert it from varchar2 to char.
    Regarding SYSDATE issue, you mean to put below code in target(SQL) side in SSMA ?
    dDate date := sysdate;
    Thanks.

  • Validate xml with complextype schema without root element!

    Hi All!
    I have a problem that. I want to validate a xml data of complextype but the schema i want to validate is[b] not have root element.
    For example:
    The schema like that
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema targetNamespace="www.thachpn.test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="www.thachpn.test" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:complexType name="Name">
              <xs:sequence>
                   <xs:element name="FirstName" type="xs:string"/>
                   <xs:element name="LastName" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
    </xs:schema>
    and the xml data i want to validate like this
    <?xml version="1.0" encoding="UTF-8"?>
    <Name xmlns="www.thachpn.test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <FirstName>Pham</FirstName>
         <LastName>Thach</LastName>
    </Name>
    My Algorithm is like that:
    I create a complextype object by above schema
    then i create new element with given name and namespace
    after that i use schema of this element to validate xml data.
    I use xmlparserv2 lib of oracle
    But i can not find how to create complextype from schema or create element with have complextype.
    Please help me.
    Thanks a lot!

    <?xml version="1.0" encoding="UTF-8"?>
    Modify the schema.
    Add a root element.
    <xs:schema targetNamespace="www.thachpn.test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="www.thachpn.test" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xsd:element name="Name" type="Name"/>
    <xs:complexType name="Name">
    <xs:sequence>
    <xs:element name="FirstName" type="xs:string"/>
    <xs:element name="LastName" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>

  • Convert XML to XSLT element to rowset

    Hello,
    I have a web service which returns XML. I need to create an omniportlet using web service.
    The xml format is not in <rowset> format, so I need to convert to rowset format.
    I believe omniportlet understands only in rowset format.
    So how do I convert the format from <element> to <rowset> format?
    Thanks in advance.

    Damian,
    Develop an XSLT to convert the XML to text.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="text"/>
    <xsl:template match="/transfers">
    <xsl:apply-templates select="case"/>
    <xsl:apply-templates select="events/event"/>
    <xsl:apply-templates select="roles/role"/>
    </xsl:template>
    <xsl:template match="case">
    INSERT INTO CASE (CASE_ID, CLOSED_FLAG) VALUES (<xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="casenumber"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>, <xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="closed"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>);
    </xsl:template>
    <xsl:template match="event">
    INSERT INTO EVENT (EVENT_NUM, CASE_ID, DETAILS, USER) VALUES (<xsl:value-of select="eventid"/>,
    <xsl:text disable-output-escaping="yes">"</xsl:text><xsl:value-of
    select="casenumber"/><xsl:text disable-output-escaping="yes">"</xsl:text>, <xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="narrative"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>, <xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="operator"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>);
    </xsl:template>
    <xsl:template match="role">
    INSERT INTO ROLES (ROLE_NUM, PARTY_ID, CASE_ID) VALUES (<xsl:value-of select="roleid"/>,
    <xsl:text disable-output-escaping="yes">"</xsl:text><xsl:value-of
    select="partyid"/><xsl:text disable-output-escaping="yes">"</xsl:text>, <xsl:text
    disable-output-escaping="yes">"</xsl:text><xsl:value-of select="casenumber"/><xsl:text
    disable-output-escaping="yes">"</xsl:text>);
    </xsl:template>
    </xsl:stylesheet>thanks,
    Deepak

  • Where is the schema for this element: weblogic-wsee-standaloneclient

    i can't find the schema for this element anywhere: weblogic-wsee-standaloneclient. it is found int the <servicename>_internaldd.xml doc that is generated by the clientgentask ant task. can someone inform me of where it is?
    thanks, shane

    http://www.bea.com/ns/weblogic/90/weblogic-standalone-wsclient.xsd
    -- Rob
    WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • How can I convert the attribut lastLogon ...

    Hi,
    How can I convert the attribut lastLogon on an Active
    Directory Microsoft?
    Attributes ar = ctx.getAttributes(dn, attrs);
    if (ar != null) {
    for (int i=0; i<attrs.length; i++) {
    Attribute attr = ar.get(attrs);
    if (attr != null) {
    String values="";
    for ( Enumeration vals=attr.getAll();
    vals.hasMoreElements(); ) {
    values += vals.nextElement();
    if ( vals.hasMoreElements() )
    values += "\t";
    entry += SRV.SEPARATOR + values;
    When I take the value of the restrained attribut of the
    enumeration how I make convert it for example in a date ?
    I am using Windows2000 Advanced server.
    An example of lastLogon attribue is "126949578544450976".
    Any help is greatly appreciated.
    R.F.

    It looks to be the same format at accountExpires.
    If so, your in luck, I worked that one out back in January:
    http://forum.java.sun.com/thread.jsp?forum=51&thread=346718

  • When I convert my cataloge from elements 10 to elements 11 all the tags disappear

    When I convert my cataloge from elements 10 to elements 11 all the tags disappear.  How can I get them back

    In PSE11
    File->Manage Catalogs->Convert and point to your PSE10 catalog
    http://help.adobe.com/en_US/elementsorganizer/using/WSae2ea3b149d0c3591ae939f103860b3d59-7 f59_WIN.html#WS3d021fd412237a2f14afb0171392eec10c6-7fff

  • How to create/add attributes in element list in Screen (example 100)

    HI,
    how to create/add attributes in element list in Screen (example 100)
    I mean after creating screen ..it has "OK CODE " attribute in element list tab in 100 screen.
    I want to create "container" in Element list tab in my screen 100 program
    I want to create new layout " container" in the element tab (i know if i click on layout button where i can create manually)
    Thanks
    Edited by: Raja on Apr 29, 2009 4:19 PM

    Hi Raja,
    Do you remember how you resolved this problem? I am facing the same. Appreciate your response.
    Thanks,
    Shailaja

  • Mapping attributes to elements

    Hi,
    I have a file that looks similar to this...(I've simplified it for the post)
    <XPacket>
       <XField Type="integer" Name="SerialNumber">13781</XField>
       <XField Type="string" Name="Mfr">Johnson</XField>
       <XField Type="XPacket" Name="Counters">
          <XField Type="XPacketArray" Name="Metrics" ArraySize="20">
            <XElement Type="XPacket" Index="0">
               <XField Type="integer" Name="position">7</XField>
               <XField Type="integer" Name="value">523</XField>
            <XElement Type="XPacket" Index="1">
               <XField Type="integer" Name="position">9</XField>
               <XField Type="integer" Name="value">62</XField>
           </XElement>
         </XField>
       </XField>
    </XPacket>
    First of all there's a problem defining a data-type for the mapping; it's ugly, but I've been able to do that using 'occurs' for each of the duplicated elements.
    I need to map this to a file that looks like this.
    <Output>
      <SerialNumber>13781</SerialNumber>
      <Mfr>Johnson</Mfr>
      <Counters>
        <Metrics>
          <Reading0>
            <position>7</position>
            <value>523</value>
          </Reading0>
          <Reading1>
            <position>9</position>
            <value>62</value>
          </Reading1>
        </Metrics>
      </Counters>
    </Output>
    Essentially, I need to convert the NAME attribute value (where it exists) to an element and fetch the associated value.
    I've tried a few different approaches with graphical mapping, but I reckon that's the wrong choice and it seems to me that an XSLT mapping is the best approach. With help from w3schools, I'm getting close, but I'm having trouble with the complex elements (where an element has a child element).
    Any help would be gratefully accepted !!
    Thanks,
    Guy

    in   CREATE OBJECT lr_choice the object id have to refer to name of node.
      CREATE OBJECT lr_choice
         EXPORTING
           id = 'CHOICE'.

  • XML Annotation related to schema attribute processContents="skip".

    Hello all,
    I have a XML schema (.xsd) having one element like:
    <xs:element name="XMLTest" minOccurs="1" maxOccurs="1">
       <xs:complexType>
          <xs:sequence>
             <xs:any minOccurs="0" maxOccurs="1" processContents="skip"></xs:any>
          </xs:sequence>
       </xs:complexType>
    </xs:element>I have specified attribute processContent="skip" for element, because I don't want any kind of process on this element.
    now, when I create classes from this schema file using "XJC" tool It don't add any annotation related to processContent="skip" attribute in my class.
    Because of this whenever any operation performed on instance of schema class it's content will be processed (when I don't want them to be processed). It means this class is processed like any other normal class.
    Can any one please suggest me
    - how can I get same effect as processContent="skip" attribute, using javax.xml.bind.
    - or any other suggestions or way for doing same.
    Thanks a lot in advance,
    typurohit

    Release 9.2.0.3 under Linux.
    No imports, just the xml:lang attribute as indicated in the above XPATH. XMLSpy thinks the schema is fine, but Oracle has the problem with that attribute.
    http://www.w3.org/XML/1998/namespace has some suggestions dealing with the xml:lang attribute, but it seems like this should work as is.
    Thanks for your speedy review and continued input.
    Dave

  • Binding XML Schema to Repeating Elements - What am I doing wrong?

    I managed to successfully bind a schema to a basic form and aside from some Reader Enabled issues it works as expected.
    My next project is to do the same but with a form that features repeating subforms.
    I have written my schema and validated and all seems well.  When I bind it to the form though it makes certain fields behave in an odd way.
    The form is made up of three sections.  The first is a single subform of non repeating fields.  Parts Two is a table with repeating rows and Part Three is a collection of fields with an Add/Delete button using the instance manager script.
    When I bind these fields and add rows I get strange results.  In Part Two pressing the Add button copies the entire row rather than creating a new one.  Changing the value of one row changes the others.
    In Part Three I can create entirely new subforms using the Add button but the this.parent.index +1; script stops working.
    Does anyone know why this might be happening and how I can resolve it?
    The schema is below:
    <xsd:element name = "RemoteWorking">
    <xsd:complexType>
      <xsd:sequence>
       <xsd:element name = "PartZero">
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name = "RequireAddHardWare" />
          <xsd:element name = "RequireRemoteWork" />
         </xsd:sequence>
        </xsd:complexType>
       </xsd:element>
       <xsd:element name = "PartOne">
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name = "Surname" />
          <xsd:element name = "FirstName" />
          <xsd:element name = "UserName" />
          <xsd:element name = "JobTitle" />
          <xsd:element name = "Role" />
          <xsd:element name = "LineManager" />
          <xsd:element name = "Directorate" />
          <xsd:element name = "PersonnelCategory" />
          <xsd:element name = "CONumber" />
          <xsd:element name = "TelephoneNumber" />
          <xsd:element name = "BuildingCode" />
          <xsd:element name = "RoomNumber" />
          <xsd:element name = "WorkingHours" />
          <xsd:element name = "AltContact" />
         </xsd:sequence>
        </xsd:complexType>
       </xsd:element>
       <xsd:element name = "PartTwo" maxOccurs = "unbounded">
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name = "AdditionalHardware" maxOccurs = "unbounded" />
         </xsd:sequence>
        </xsd:complexType>
       </xsd:element>
       <xsd:element name = "PartThree" maxOccurs = "unbounded">
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name = "ItemRequired" />
          <xsd:element name = "UserAccountName" />
          <xsd:element name = "CostCentre" />
          <xsd:element name = "BusinessCase" />
          <xsd:element name = "Device" />
         </xsd:sequence>
         <xsd:attribute name="ItemNo" type="xsd:integer" use="required"/>
        </xsd:complexType>
       </xsd:element>
       <xsd:element name = "PartFour">
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name = "Unite" />
         </xsd:sequence>
        </xsd:complexType>
       </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>

    The binding expressions needs to indicate that you can have more than one PartTwo section. To accomplish this you will need to add a [*] to the binding expressions that use teh PartTwo node. If you want to keep it simply, bind the subform that holds th information for PartTwo to the PartTwo node, then add the [*] to the end of the expression. Then al children of that node will get expressions like $.Name of the Node that it is referencing.
    Hope that helps
    Paul

  • How can I convert a char to element? urgent !!!

    I have a String put into an charArray. now I want to convert this char to an Element-Type. Whats the right way ???
    thanks a lot for help

    private String htmlTagFilter(String htf)There is absolutely no way to get 'attributes' starting with the above method declaration. String doesn't have that information and nothing you do to it will get it.
    Now maybe the value of the string has text which describes an attribute. But if that is the case then you are going to have to go looking for it. That means parsing the string to find pieces and then extract it.
    getAttributes()-Method from class javax.swing.text. There is no such class. I would guess you are referring to javax.swing.text.Element and its method getAttributes().
    However that method returns an AttributeSet which is an interface. So to create your own AttributeSet you are going to have to know in great detail what exactly goes into that before you can parse a string and create it.
    I will go out on a limb here and suggest that you don't really want to parse that String. You are trying to achieve an objective and got off on this tangent. And if you explain how you got the string and what you want to do with it, maybe some one could explain how to do what you want.

Maybe you are looking for