How to map XML to database object ?

Hello,
We are trying to convert XML file into XMLType object and then to our custom object type using registered XSD definition. So we doing this : clob with xml -> XMLObject -> our MMS_T object.
The problem we experienced with transfering values of "type" and "status" attributes to object values MMS_T.TYPE and MMS_T.STATUS. Note that types MMS_T and ERROR_T are automatically created during schema
(XSD) registration. See and try Listing 1.
The second Listing contains anonymous pl/sql block with our testcase, please run it after registering schema. The output You will get should look like this one :
Schema based
Well-formed
<?xml version="1.0" encoding="UTF-8"?>
<mms-provisioning xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdb="http://xmlns.oracle.com/xdb" type="subscription"
status="error">
<error code="1">Some error</error>
<serviceID>iDnes</ser
Type:,Status:,Error:1-Some error,ServiceID:iDnes,Method:SMS,MSISDN:+420602609903
The problem is visible on the last line, where "Type" and "Status" object attributes should have its values that should come from XML, but they haven't. Where we were wrong ?
Please help,
Thanks & Regards,
Radim.
Note
====
When we are trying to do xml.schemaValidate() in our example, it raises folowong errors :
ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00310: local element or attribute should be namespace qualified
ORA-06512: at "SYS.XMLTYPE", line 0
ORA-06512: at line 27
Listing 1
=========
declare
xsd clob:=
'<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified"
attributeFormDefault="unqualified"
xdb:mapStringToNCHAR="false"
xdb:mapUnboundedStringToLob="false"
xdb:storeVarrayAsTable="false"
>
<xs:element name="mms-provisioning" xdb:SQLType="MMS_T">
<xs:complexType>
<xs:sequence>
<xs:element name="error" minOccurs="0" xdb:SQLName="ERROR" xdb:SQLType="ERROR_T">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="code" type="xs:decimal" use="required" xdb:SQLName="CODE" xdb:SQLType="NUMBER"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="serviceID" type="xs:string" xdb:SQLName="SERVICEID" xdb:SQLType="VARCHAR2"/>
<xs:element name="method" type="xs:string" xdb:SQLName="METHOD" xdb:SQLType="VARCHAR2"/>
<xs:element name="msisdn" type="xs:string" xdb:SQLName="MSISDN" xdb:SQLType="VARCHAR2"/>
</xs:sequence>
<xs:attribute name="type" type="type_t" use="required" xdb:SQLName="TYP" xdb:SQLType="VARCHAR2"/>
<xs:attribute name="status" type="status_t" use="required" xdb:SQLName="STATUS" xdb:SQLType="VARCHAR2"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="status_t">
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
<xs:enumeration value="new"/>
<xs:enumeration value="pending"/>
<xs:enumeration value="subscribed"/>
<xs:enumeration value="error"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="type_t">
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
<xs:enumeration value="subscription"/>
<xs:enumeration value="unsubscription"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>';
begin
dbms_XMLSchema.RegisterSchema (
SchemaURL => 'http://www.eurotel.cz/xsd/mms-provisioning.xsd', SchemaDoc => xsd
end;
Listing 2
=========
declare
o mms_t;
doc clob :=
'<?xml version="1.0" encoding="UTF-8"?>
<mms-provisioning type="subscription" status="error">
<error code="1">Some error</error>
<serviceID>iDnes</serviceID>
<method>SMS</method>
<msisdn>+420602608696</msisdn>
</mms-provisioning>';
xml XMLType;
begin
xml := XMLType.createXML(XMLData => doc,schema => 'http://www.eurotel.cz/xsd/mms-provisioning.xsd'); --
if xml.isSchemaBased() = 1 then
dbms_output.put_line('Schema based');
else
dbms_output.put_line('Non-Schema based');
end if;
if xml.isFragment() = 1 then
dbms_output.put_line('Fragment');
else
dbms_output.put_line('Well-formed');
end if;
--Crashes with errors
--xml.schemaValidate();
dbms_output.put_line(substr(xml.getstringval(),1,255));
xml.toObject(o,schema => 'http://www.eurotel.cz/xsd/mms-provisioning.xsd', element => 'mms-provisioning');
dbms_output.put_line(
'Type:'||o.typ||
',Status:'||o.status||
',Error:'||o.error.code||'-'||o.error.sys_xdbbody$||
',ServiceID:'||o.serviceid||
',Method:'||o.method||
',MSISDN:'||o.msisdn);
end;
/

thanks for the reply
my source XML response will be looking something like this (it will be reponsed in a long string):
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<status>
<retCode>00</retCode>
<retCodeDesc>OK</retCodeDesc>
<rRobjectId>09002347802d2981</rRobjectId>
<rFileSize>7</rFileSize>
<rTotalPages>1</rTotalPages>
</status>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
my RFC is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions">
<xsd:element name="ZRFC_SET_DOCUMENT.Response">
<xsd:complexType>
<xsd:all>
<xsd:element name="RETCODE" type="xsd:string" minOccurs="0" />
<xsd:element name="RETCODEDESC" type="xsd:string" minOccurs="0" />
<xsd:element name="RFILESIZE" type="xsd:string" minOccurs="0" />
<xsd:element name="RROJECTID" type="xsd:string" minOccurs="0" />
<xsd:element name="RTOTALPAGES" type="xsd:string" minOccurs="0" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Similar Messages

  • How to map XML File input to VO (eventually to update table) upon fileupld

    Reqirement: I am downloading an XML File (basically name-value pair) from user using OAMessageFileUploadBean. I need to take this file and update to an existing record in the table (cs_incidents_all). XML File schema is well-known in advance.
    Approach: Don't know what is the best, but I'm thinking if there is an OAF way to map the XML File (Blobdomain) to VO and get the rowIMPL.getColumn1Value to fetch all the datavalues then loop thru all the columns (xml-tags) and finally call plsql APIs which will update/insert into table (cs_incidents_all)
    Is this possible in OAF? If so please shed some light as to how to map XML File to VO.
    If this is not possible then please let me know the other way. I have to do this inside the oaf.
    Thank you,

    Can someone please let me know if this is possible in OAF?

  • How to map a collection of object in TopLink?

    For (simple) example, I've a XSD that defines:
    <xsd:complexType name="AttachmentType">
    <xsd:sequence>
    <xsd:element name="docID" nillable="false" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="MyDocType">
    <xsd:sequence>
    <xsd:element name="attachment" nillable="true" minOccurs="0"
    maxOccurs="unbounded" type="tns:AttachmentType"/>     
    </xsd:sequence>
    </xsd:complexType>
    This XSD is referenced by a WSDL. Using JDeveloper to generate a Java Web Service using the WSDL and will get the following classes:
    public class AttachmentType implements java.io.Serializable
    protected java.lang.String docID;
    public AttachmentType() {    }
    public java.lang.String getDocID() {        return docID;    }
    public void setDocID(java.lang.String docID) {        this.docID = docID;    }
    public class MyDocType implements java.io.Serializable
    protected AttachmentType[] attachment;
    public MyDocType () {    }
    public AttachmentType[] getAttachment() {        return attachment;    }
    public void setAttachment(AttachmentType[] attachment)
    this.attachment = attachment;
    Now I want to generate a XML document from MyDocType. I use TopLink (JAXB) to do the mapping. However, how to map the 'attachment' of type AttachmentType[]? TopLink seems only allowing List/Set/Collection container options.
    Anyone can help?
    Note: I have to use the classes generated from WSDL.
    Thanks!!

    Thanks. I'm using TopLink Workbench for the mapping
    and have no idea on how to specify the XML
    transformation mapping for array attribute. Can you
    tell me more?I was putting together an example of the transformation mapping but came up with a better way. It turns out that a transformation mapping isn't ideal because you have to take over some of the responsibility for converting XML to objects. A better solution is to intercept the calls to the getter and setter for the AttachmentType[] and convert between an Array and List. Just map the Array as a composite collection in the workbench and customize the attachment attribute mapping in code.
    Each mapping in TopLink has Accessor object responsible for getting and setting values in objects. If you choose method or direct access the mapping will have a different Accessor class. So the solution is to use an Accessor that converts the List TopLink builds into an Array of the correct type on set. On get, the Accessor creates a List from the Array.
    You can introduce a custom Accessor using an After Load method. I've put a complete example up on my googlepages account[1]. The key code is listed below. Note that this code assumes you're using direct instance variable access. Also, this code works with TopLink 10.1.3.2 and the TopLink 11 preview. It won't work with previous versions.
    The After Load class that changes the mapping accessor:
    public class MyDocCustomizer {
         public static void customize(ClassDescriptor descriptor) {
              XMLCompositeCollectionMapping mapping = (XMLCompositeCollectionMapping)
                   descriptor.getMappingForAttributeName("attachment");
              InstanceVariableAttributeAccessor existingAccessor =
                   (InstanceVariableAttributeAccessor) mapping.getAttributeAccessor();
              ListArrayTransformationAccessor transformationAccessor =
                   new ListArrayTransformationAccessor(AttachmentType.class, "attachment");
              transformationAccessor.initializeAttributes(descriptor.getJavaClass());
              mapping.setAttributeAccessor(transformationAccessor);
    }The custom InstanceVariableAccessor subclass:
    public class ListArrayTransformationAccessor extends
              InstanceVariableAttributeAccessor {
         private Class arrayClass;
         public ListArrayTransformationAccessor(Class arrayClass, String attributeName) {
              super();
              this.arrayClass = arrayClass;
              this.setAttributeName(attributeName);
         public Object getAttributeValueFromObject(Object anObject)
                   throws DescriptorException {
              Object[] attributeValueFromObject =
                   (Object[]) super.getAttributeValueFromObject(anObject);
              return Arrays.asList(attributeValueFromObject);
         public void setAttributeValueInObject(Object anObject, Object value)
                   throws DescriptorException {
              List collection = (List)value;
              Object[] array = (Object[]) Array.newInstance(arrayClass, collection.size());
              for (int i = 0; i < collection.size(); i++) {
                   Object element = collection.get(i);
                   Array.set(array, i, element);
              super.setAttributeValueInObject(anObject, array);
    }--Shaun
    http://ontoplink.blogspot.com
    [1] http://shaunmsmith.googlepages.com/Forum-519205-OXM-Array.zip

  • Mapping XML to Existing Objects

    In Castor I can defined how I want to map existing XML to an existing (not auto-generated) object. Can I do the same in JAXB? I have searched the JAXB documentation, but haven't found a way to map XML to Java without having JAXB generate the Java classes from a schema.
    http://castor.exolab.org/xml-mapping.html
    -- John

    Perhaps JSR 222 will address this issue?
    http://www.jcp.org/en/jsr/detail?id=222
    -- John

  • How to parse XML to Java object... please help really stuck

    Thank you for reading this email...
    If I have a **DTD** like:
    <!ELEMENT person (name, age)>
    <!ATTLIST person
         id ID #REQUIRED
    >
    <!ELEMENT name ((family, given) | (given, family))>
    <!ELEMENT age (#PCDATA)>
    <!ELEMENT family (#PCDATA)>
    <!ELEMENT given (#PCDATA)>
    the **XML** like:
    <person id="a1">
    <name>
         <family> Yoshi </family>
         <given> Samurai </given>
    </name>
    <age> 21 </age>
    </person>
    **** Could you help me to write a simple parser to parse my DTD and XML to Java object, and how can I use those objects... sorry if the problem is too basic, I am a beginner and very stuck... I am very confuse with SAXParserFactory, SAXParser, ParserAdapter and DOM has its own Factory and Parser, so confuse...
    Thank you for your help, Yo

    Hi, Yo,
    Thank you very much for your help. And I Wish you are there...I'm. And I plan to stay - It's sunny and warm here in Honolulu and the waves are up :)
    A bit more question for dear people:
    In the notes, it's mainly focus on JAXB,
    1. Is that mean JAXB is most popular parser for
    parsing XML into Java object? With me, definitely. There are essentially 3 technologies that allow you to parse XML documents:
    1) "Callbacks" (e.g. SAX in JAXP): You write a class that overrides 3 methods that will be called i) whenever the parser encounters a start tag, ii) an end tag, or iii) PCDATA. Drawback: You have to figure out where the heck in the document hierarchy you are when such a callback happens, because the same method is called on EACH start tag and similarly for the end tag and the PCDATA. You have to create the objects and put them into your own data structure - it's very tedious, but you have complete control. (Well, more or less.)
    2) "Tree" (e.g. DOM in JAXP, or it's better cousin JDOM): You call a parser that in one swoop creates an entire hierarchy that corresponds to the XML document. You don't get called on each tag as with SAX, you just get the root of the resulting tree. Drawback: All the nodes in the tree have the same type! You probably want to know which tags are in the document, don't you? Well, you'll have to traverse the tree and ask each node: What tag do you represent? And what are your attributes? (You get only strings in response even though your attributes often represent numbers.) Unless you want to display the tree - that's a nice application, you can do it as a tree model for JTree -, or otherwise don't care about the individual tags, DOM is not of much help, because you have to keep track where in the tree you are while you traverse it.
    3) Enter JAXB (or Castor, or ...): You give it a grammar of the XML documents you want to parse, or "unmarshall" as the fashion dictates to call it. (Actually the name isn't that bad, because "parsing" focuses on the input text while "unmarshalling" focuses on the objects you get, even though I'd reason that it should be marshalling that converts into objects and unmarshalling that converts objects to something else, and not vice versa but that's just my opinion.) The JAXB compiler creates a bunch of source files each with one (or now more) class(es) (and now interfaces) that correspond to the elements/tags of your grammar. (Now "compiler" is a true jevel of a misnomer, try to explain to students that after they run the "compiler", they still need to compile the sources the "compiler" generated with the real Java compiler!). Ok, you've got these sources compiled. Now you call one single method, unmarshall() and as a result you get the root node of the hierarchy that corresponds to the XML document. Sounds like DOM, but it's much better - the objects in the resulting tree don't have all the same type, but their type depends on the tag they represent. E.g if there is the tag <ball-game> then there will be an object of type myPackage.BallGame in your data structure. It gets better, if there is <score> inside <ball-game> and you have an object ballGame (of type BallGame) that you can simply call ballGame.getScore() and you get an object of type myPackage.Score. In other words, the child tags become properties of the parent object. Even better, the attributes become properties, too, so as far as your program is concerned there is no difference whether the property value was originally a tag or an attribute. On top of that, you can tell in your schema that the property has an int value - or another primitive type (that's like that in 1.0, in the early release you'll have to do it in the additional xjs file). So this is a very natural way to explore the data structure of the XML document. Of course there are drawbacks, but they are minor: daunting complexity and, as a consequence, very steep learning curve, documentation that leaves much to reader's phantasy - read trial and error - (the user's guide is too simplicistic and the examples too primitive, e.g. they don't even tell you how to make a schema where a tag has only attributes) and reference manual that has ~200 pages full of technicalities and you have to look with magnifying glas for the really usefull stuff, huge number of generated classes, some of which you may not need at all (and in 1.0 the number has doubled because each class has an accompanying interface), etc., etc. But overall, all that pales compared to the drastically improved efficiency of the programmer's efforts, i.e. your time. The time you'll spend learning the intricacies is well spent, you'll learn it once and then it will shorten your programming time all the time you use it. It's like C and Java, Java is order of magnitude more complex, but you'd probably never be sorry you gave up C.
    Of course the above essay leaves out lots and lots of detail, but I think that it touches the most important points.
    A word about JAXB 1.0 vs. Early Release (EA) version. If you have time, definitively learn 1.0, they are quite different and the main advantage is that the schema combines all the info that you had to formulate in the DTD and in the xjs file when using the EA version. I suggested EA was because you had a DTD already, but in retrospect, you better start from scratch with 1.0. The concepts in 1.0 are here to stay and once your surmounted the learning curve, you'll be glad that you don't have to switch concepts.
    When parser job is done,
    what kind of Java Object we will get? (String,
    InputStream or ...)See above, typically it's an object whose type is defined as a class (and interface in 1.0) within the sources that JABX generates. Or it can be a String or one of the primitive types - you tell the "compiler" in the schema (xjs file in EA) what you want!
    2. If we want to use JAXB, we have to contain a
    XJS-file? Something like:In EA, yes. In 1.0 no - it's all in the schema.
    I am very new to XML, is there any simpler way to get
    around them? It has already take me 4 days to find a
    simple parser which give it XML and DTD, then return
    to me Java objects ... I mean if that kind of parser
    exists....It'll take you probably magnitude longer that that to get really familiar with JAXB, but believe me it's worth it. You'll save countless days if not weeks once you'll start developing serious software with it. How long did it take you to learn Java and it's main APIs? You'll either invest the time learning how to use the software others have written, or you invest it writing it yourself. I'll take the former any time. But it's only my opinion...
    Jan

  • How to invoke Reverse Engineer database objects utility

    Hi,
    I am using oracle designer 6.0 with patch 7 and oracle 8.1.7
    can you please guide me how to get the database object ( like table defition ) into the orale designer application.
    Regards,
    Gouri

    Gouri,
    In the Design Editor, select the
    'Generate' -> 'Capture Design of' -> 'Server Model...'
    menu item.
    - Suresh

  • How to delete/mark obsolete database objects from ODI model?

    Hi,
    ODI never deletes objects while reverse engineering.
    So is it way to automate deletion or marking obsolete database objects (dropped or renamed fields, constraints) from an ODI model?
    Does someone use ODI Java API (http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e17060/overview-tree.html) or direct updating SNP_% repository tables to do it?

    I can help you with marking obsolete database objects.
    In the model, there is an option "Display the metadata changes in the Model Tree". Check this.
    This will show you what has changed or is obsolete.

  • How to pass xml data as objects into Database using store procedures

    Hi All,
         I don't have much knowledge on store procedure,can anybody help how to pass the xml as objects in Database using store procedure.
    My Requirement is I have a table with three fields EMPLOYEE is table name and the fields are EMP_ID,EMP_TYPE AND EMP_DET,I have to insert the employees xml data into corresponding fields in the table.
    Input Data
    <ROWSET>
       <ROW>
         <EMP_ID>7000</EMP_ID>
          <EMP_TYPE>TYPE1</EMP_TYPE>
         <EMP_DET>DEP</EMP_DET>
      <ROW>
      <ROW>
         <EMP_ID>7000</EMP_ID>
         <EMP_TYPE>TYPE2</EMP_TYPE>
        <EMP_DET>DEP2</EMP_DET>
    <ROW>
    <ROW>
         <EMP_ID>7000</EMP_ID>
         <EMP_TYPE>TYPE3</EMP_TYPE>
        <EMP_DET>DEP3</EMP_DET>
    <ROW>
    <ROWSET>
    So each row values has to inserted into resp fields in the table.
    Regards
    Mani

    Do you have a similar structure in your stored procedure ?
    In that case you can simply call the procedure from soa using db adapter and do a mapping to assign the values.

  • How to map XML file to various of object in the RFC

    hello
    I recieve XML file (not devided to elements, but XML file)'
    and I would like to map it to a RFC that has various object.
    I there a way to do it?
    if it involve a java code, does any one has a written code example?
    THX
    Kfir

    thanks for the reply
    my source XML response will be looking something like this (it will be reponsed in a long string):
    <?xml version='1.0' encoding='UTF-8'?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    <SOAP-ENV:Header>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <status>
    <retCode>00</retCode>
    <retCodeDesc>OK</retCodeDesc>
    <rRobjectId>09002347802d2981</rRobjectId>
    <rFileSize>7</rFileSize>
    <rTotalPages>1</rTotalPages>
    </status>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    my RFC is:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions">
    <xsd:element name="ZRFC_SET_DOCUMENT.Response">
    <xsd:complexType>
    <xsd:all>
    <xsd:element name="RETCODE" type="xsd:string" minOccurs="0" />
    <xsd:element name="RETCODEDESC" type="xsd:string" minOccurs="0" />
    <xsd:element name="RFILESIZE" type="xsd:string" minOccurs="0" />
    <xsd:element name="RROJECTID" type="xsd:string" minOccurs="0" />
    <xsd:element name="RTOTALPAGES" type="xsd:string" minOccurs="0" />
    </xsd:all>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>

  • How to import Oracle 8i database objects into an Oracle 10g database ?

    Hi all,
    We plan to use Oracle 10g , but untill now we use Oracle 8i 8.1.7.4.1 .
    I want to know how to import all of our Oracle 8i objects stuff to the new Oracle 10g database ; and should I create tablespaces or can I import simply the Oracle 8i tablespaces.
    Thank you very much indeed

    If you use 1 database schema for your application , export the schema only
    for example
    export NLS_LANG env before
    export hr/hr file=hr.dmp log=hr.dmp
    On 10g
    ======
    create the user,tablespaces etc
    import the user
    run the utlrp.sql
    you are ready
    export NLS_LANG env before
    import system/password file=hr.dmp log=hr.dmp fromuser=hr touser=hr

  • SharePoint 2010: How to map documentset attibutes to objects - In SharePoint Webpart

    Hey,
    I guess it's a pretty simple question but I really do not get one inch closer to a solution. I'm working on a WebPart on SharePoint 2010 which manages a documentset (document library with an custom content type). Creating an storing of documentssets works fine
    by now but I do have problems in mapping the stored sets to my c# objects backwards. I actually do not find the fields in my object structure while debugging my code
    I create the docuemtset like this...
    internal DocumentSet CreateDocumentSet(SPList spListObject, SPContentType spContentType, object itemToCreate, Type typeOfItemToCreate)
    var properties = new Hashtable();
    Guid id = Guid.NewGuid();
    //Description
    foreach (PropertyInfo p in typeOfItemToCreate.GetProperties())
    properties.Add(p.Name, p.GetValue(itemToCreate, null));
    SPFolder parentFolder = spListObject.RootFolder;
    DocumentSet docSet = DocumentSet.Create(parentFolder, InnovationListName + "_" + id, spContentType.Id, properties, false);
    return docSet;
    I'm thinking of somethink like this ...
    internal MyObject DocSetToObject(SPList list, int ID)
    var docset = DocumentSet.GetDocumentSet(list.GetItemById(ID).Folder);
    return new MyObject
    Text= docset...,
    Id = docset...,
    Tags= docset...,
    Title = docset...,
    Hope you can help me out.. This problem is killn me  ^^ ;-)
    Thanks
    Spanky

    Hi,
    According to your description, you might want to create a class to perform the CRUD operations against a DocumentSet in your library.
    Here is a demo about how to handle an item for your reference:
    //Create a MyItemWrapper.cs:
    public class MyItemWrapper
    public int ID { get; set; }
    public string Title { get; set; }
    SPList list;
    SPListItem item;
    public MyItemWrapper()
    using (SPSite site = new SPSite("http://sp"))
    using (SPWeb web = site.RootWeb)
    list = web.Lists["List2"];
    item = list.Items[0];
    this.ID = item.ID;
    this.Title = item["Title"].ToString();
    public void setTitle(string t)
    item["Title"] = t;
    item.Update();
    this.Title = t;
    Feel free to reply if this is not what you want.
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to get xml into java object

    yo
    i want to get the xml doc into some object like Document
    i have downloaded code:
    public class Echo extends org.xml.sax.helpers.DefaultHandler
    this class compiles fine but when i instantiate the class in code i get:
    "Exception in thread 'main' java.lang.NoClassDefFoundError: org/xml/sax/helpers/DefaultHandler"
    Please, what does this mean and how do i get this to recognise that i want to use a specific parser
    thanks a lot

    You are probably not specifying the XML jar files (xalan.jar & xerces.jar) on the run line. What is the command you are using?
    Actually, which "jars" you use is dependent on which version of the XML Java release you downloaded (Winter or Fall).

  • How to map XML to Web Dynpro context nodes?

    Hi All,
    Could anyone tell how xml string can be bound to context nodes ? In my requirement i need to serialize context nodes value to string and deserialize it back to nodes for implementing back naviagtion between views.
    I didnt see much threads achieving this giving details on class cl_wdr_xml_convert_util and methods if_wd_client_conversion_util~string_to_struct.
    I am using wd_context->to_xml to convert into xml.
    From this format, i want to bind it back to context  node.
    When i use this below approch i get short dumb.
    Serialization to xml:
    lv_data_string = wd_context->to_xml( ).
    Deserialization:
      DATA lv_typedescr           TYPE REF TO cl_abap_typedescr.
      FIELD-SYMBOLS:
                     <fs_data>    TYPE ANY TABLE.
      CALL METHOD cl_abap_typedescr=>describe_by_object_ref
        EXPORTING
          p_object_ref         = wd_context
        RECEIVING
          p_descr_ref          = lv_typedescr
        EXCEPTIONS
          reference_is_initial = 1
          OTHERS               = 2.
       try.
      CALL METHOD cl_wdr_xml_convert_util=>if_wd_client_conversion_util~string_to_struct
        EXPORTING
          in            = lv_data_string
          typedescr = lv_typedescr
        IMPORTING
          data      =  <fs_data>
      CATCH cx_wdr_conversion_exception into lo_err .
      lv_exp = lo_err->get_text( ).
    ENDTRY.
      wd_context->bind_table( values = <fs-data>.
    Using this way, i get a short dumb as assert statement is failed as value for  typedescr->type_kind is '*'.
    method if_wd_client_conversion_util~string_to_struct.
      assert typedescr->type_kind = cl_abap_typedescr=>typekind_struct1
          or typedescr->type_kind = cl_abap_typedescr=>typekind_struct2.
      raise exception type cx_wdr_conversion_exception
        exporting textid = cx_wdr_conversion_exception=>illegal_type.
    On debugging changing this value to required also made no difference, as no value could be assigned to the field symbol.
    Suggest a soution to do this.

    Hi Thomas,
    Thanks for your replies.
    I have corrected it, but the field symbol is empty and while debugging it says data type is incorrect.
    code:
      FIELD-SYMBOLS:
                     <fs_data>    TYPE ANY TABLE.
    data:       lsbp type ZXBPCENTRAL,
                   go_ref type ref to data.
    CALL METHOD cl_abap_typedescr=>describe_by_data " ( before it was describe_by_object_ref)
    EXPORTING
    p_data = lsbp
    receiving
    p_descr_ref = lv_typedescr.
    try.
    CALL METHOD cl_wdr_xml_convert_util=>if_wd_client_conversion_util~string_to_struct
    EXPORTING
    in = lv_data_string
    typedescr = lv_typedescr
    IMPORTING
    data = go_ref "<fs_data>
    CATCH cx_wdr_conversion_exception into lo_err .
    lv_exp = lo_err->get_text( ).------> Here the error says " Invalid data type and hence, there is no data.
    ENDTRY.
    assign go_ref->* to <fs_data>.
    I am still looking for solution and thanks a lot ....

  • How to map xml to a fixed length string?

    Hi All,
    I have a requirement to map request xml to a string of fixed length and format:
    For eg,
    Source:
    <Person>
    <Name>George</Name>
    <Age>21</Age>
    </Person>
    Target:
    String of format
    Name : 8 chars
    Age : 2chars.
    so the required mapping should result in
    "George 21".
    Note: 2 blanks after "George" to allow for 8 characters. Is this kind of mapping possible using ALSB xquery? I have tried to create a MFL representation for the string , and used it in the xquery as the targer but it is generating
    "George21".Only data present in source is getting mapped :(

    My advice would be to use MFL transformation for that.
    Documentation about MFL can be found at edocs: http://edocs.bea.com/alsb/docs26/fbhelp/index.html
    Find tips and tricks about ALSB at my blog: http://dev2dev.bea.com/blog/jordinho/

  • Mapping XML and Database

    Hi,
    I have a design problem in my application. It goes on like this:
    For every XML Request-Response query, I have a Session Bean which accesses database tables. I have to refer to 4-5 tables to fulfil each request. All the tables follow the parent-child relationship(onto 4-5 levels, depending upon the number of queries) which means for one row in parent table there are multiple rows in child tables and so on.
    Now, in my XML response, I need to follow the same schema in form of tags. For example:
    <table1Info>
    <data1>1212</data1>
    <table2Info> (tags could be multiple)
    <data2>1212</data2>
    <table3Info> (tags could be multiple)
    <data3>1212</data3>
    <table4Info> (tags could be multiple)
    <data4>1212</data3>
    </table4Info>
    </table3Info>
    </table2Info>
    </table1Info>
    So far, so good! I can happily select data from multiple tables and generate the XML response by serially concatenating the response string. My problem is that I want to write a single query to fetch all the data instead of fetching data corresponding the parent tag and then making another query to fetch data from child table(which corresponds to child tag).
    If i do a join of all tables in a single query, I need to do a lot of checking in java code inside the loop and figure out when a parent data has changed and the upcoming values correspond to next parent data(and thereby close all the child tags and open the next parent tag). It can sometimes become quite messy and cumbersome. Is there a cleaner way of doing it? Any ideas wud be welcome...Please let me know if i need to elaborate more ..
    Thanks,
    Prashant

    What is wrong with issuing the query each time for the child? Performance? It more accurately models what you are trying to do than the approach you mention.
    steve - http://www.fdsapi.com - an api used to generate dynamic xml and html

Maybe you are looking for

  • ITunes 10.5 W7 x64 Problem (Policy 8.0 MS Error) Help?

    I have been trying for 2 days to install 10.5, I have 10.4 installed without an issue. However, I get this error when I install 10.5: An error occurred during the installation or assembly "policy.8.0.Microsoft.VC80.CRT,type="win32-policy",version="8.

  • How to capture the data within the given range of maximum and minimum values ? from csv files

    My requirement, 1. Here, the user will provide the range like maximum and minimum values, based on this range, the VI should capture the data within the given range. ( from CSV file as attached ) 2. Then VI should calcluate the average value for capt

  • Problem importing since start 2013

    Hello everybody, First here is my configuration - version of iPhoto. i photo 11 v 9.4.2 - version of the Operating System. OS lion I have the french version so i hope the translation will be good (and mmy english understandable) ! Since 2013, when i

  • Array into dll

    I built a dll in LV 7. One of the inputs was an array of strings. LV created the following typedef for this input: typedef struct { long dimSize; LStrHandle elt[1]; } TD2; typedef TD2 **TD2Hdl; The function prototype generated by LV is: void __stdcal

  • Question - How does the Priority feature of the Send Port work?

    How does the Priority feature of the Send Port work?