Objects to XML

I use XStream to parse the following Objects to XML, the problem is what to do with:
class Tag {
@XStreamAsAttribute
List<SubTag1> st1 = new ArrayList<SubTag1>();
@XStreamAsAttribute
List<SubTag2> st2 = new ArrayList<SubTag2>();
...When the class Tag is converted to XML it will always contain both a 'st1' and 'st2' even when I only
have a Tag that ONLY contains 'st1'.
Tag should be able to contain:
1) List of SubTag1
or
2) List of SubTag2
or
3) List of SubTag1 and List of SubTag2
How do I make sure to only process the Lists if they contains elements?

Looks like you need a converter, for more info you could try the [XStream mailing list|http://xstream.codehaus.org/list-user.html].

Similar Messages

  • How do I add a variable into an object as xml

    I have a xml document with 2 protection order numbers. I want to get the information for one of them which is **protectionOrderNumber="1400042"**. I would like to add strPoNumber variable to the object objXmlCaseDoc. Inside this object is the xml
    that was read and put inside the object. I want at the beginning of the xml code inside the objXmlCaseDoc to add the protectionOrderNumber at the end of the first line. This should be added at the beginning of the xml document. In my object (objXmlCaseDoc)
    there is no variable strPoNumber. This is why I want to add it at the top. The object has xml document in it. 
    It should look like this:
    <Integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:IXML="http://tsgweb.com" xmlns:CMCodeQueryHelper="urn:CMCodeQueryHelper" protectionOrderNumber="1400042">
    My vb code: I have the variable strPoNumber and the object where the xml document is. Object name is objXmlCaseDoc
    I want to add the line of code where I have comment Tranform case information into the output format near the bottom of the code.
    Option Strict On
    Option Explicit On
    Imports System.Xml
    Public Class BcaPoRequests
    Shared Sub Main()
    Dim objMessageProcessor As New MessageProcessor
    Dim objSchemasCollection As New Msc.Integration.MessageBroker.Library.v4.SchemasCollection
    Dim objTransformsCollection As New Msc.Integration.MessageBroker.Library.v4.TransformsCollection
    objMessageProcessor.ProcessInputQueue(False, False, objSchemasCollection, objTransformsCollection)
    End Sub
    Private Class MessageProcessor
    Inherits Msc.Integration.ServiceCatalog.Library.v4.SoapMessageProcessor
    Protected Overrides Sub ProcessMessage(ByRef aobjBroker As ServiceCatalog.Library.v4.Broker, ByRef aobjXMLInputSoapEnvelopeDoc As System.Xml.XmlDocument, ByRef aobjInstantiatedObjectsCstrollection As Microsoft.VisualBasic.Collection, ByRef aobjConsumer As ServiceCatalog.Library.v4.Consumer)
    MyBase.ProcessMessage(aobjBroker, aobjXMLInputSoapEnvelopeDoc, aobjInstantiatedObjectsCollection, aobjConsumer)
    Dim objXmlMessageDoc As XmlDocument
    Dim objXmlMessageNode As XmlNode
    Dim objNameTable As NameTable
    Dim objXMLNameSpaceManager As XmlNamespaceManager
    Dim objXMLSchemaException As Xml.Schema.XmlSchemaException
    Dim strCaseNumber As String
    Dim strPoNumber As String
    Dim objXmlCaseDoc As XmlDocument
    'create a namespace manager used for queries into inputmessage (because of namespace)
    objNameTable = New NameTable
    objXMLNameSpaceManager = New XmlNamespaceManager(objNameTable)
    objXMLNameSpaceManager.AddNamespace("ext", "http://www.courts.state.mn.us/ProtectionOrderExtension/1.0")
    objXMLNameSpaceManager.AddNamespace("exc", "http://www.courts.state.mn.us/ProtectionOrderQuery/1.0")
    objXMLNameSpaceManager.AddNamespace("soap", "http://www.w3.org/2003/05/soap-envelope")
    objXMLNameSpaceManager.AddNamespace("wsa", "http://schemas.xmlsoap.org/ws/2004/08/addressing")
    objXmlMessageNode = aobjXMLInputSoapEnvelopeDoc.DocumentElement.SelectSingleNode("soap:Body/exc:ProtectionOrderQueryRequest", objXMLNameSpaceManager)
    objXmlMessageDoc = New XmlDocument
    objXmlMessageDoc.LoadXml(objXmlMessageNode.OuterXml)
    'Check authorization
    'Validate the input message
    objXMLSchemaException = aobjBroker.ValidateXmlDocument(objXmlMessageDoc, "ProtectionOrderQuery_1_0.xsd", "NiemExchanges\ProtectionOrders\Exchange", , False)
    If Not objXMLSchemaException Is Nothing Then
    'return fault if invalid
    aobjBroker.Reply(aobjBroker.CreateSoapFault(Msc.Integration.Utility.Library.v4.Soap.udtSoapCodes.Sender, Msc.Integration.Utility.Library.v4.Xml.FormatXmlSchemaValidationErrorText(objXMLSchemaException), Msc.Integration.Utility.Library.v4.Soap.udtSoapRoles.RoleUltimateReceiver, aobjXMLInputSoapEnvelopeDoc, "soap:InvalidMessage", "soap:Body", Msc.Integration.Utility.Library.v4.Soap.GetReplyEndpointReference(aobjXMLInputSoapEnvelopeDoc), aobjXMLInputSoapEnvelopeDoc.DocumentElement.SelectSingleNode("soap:Header/wsa:MessageID", objXMLNameSpaceManager).InnerText, aobjConsumer))
    Exit Sub
    End If
    'Get the case number and the PO number from the input message
    strCaseNumber = objXmlMessageDoc.DocumentElement.SelectSingleNode("ext:CourtFileNumber", objXMLNameSpaceManager).InnerText
    strPoNumber = objXmlMessageDoc.DocumentElement.SelectSingleNode("ext:ProtectionOrderID", objXMLNameSpaceManager).InnerText
    'Get the case information from Mncis
    'Code for calling the case
    objXmlCaseDoc = Msc.Integration.Mncis.Library.v4.Case.GetIxmlForCaseNumber(strCaseNumber, "CourtCaseHeader,ProtectionOrder,SubjectParties,HearingTrialSetting", False)
    'Tranform case information into the output format
    End Sub
    End Class
    End Class
    xslt code
    <?xml version="1.0" encoding="UTF-8"?>
    <?altova_samplexml file:///Z:/Training%20with%20Tim%20XML%20code%20various/BcaRequestIxml.xml?>
    <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:poq="http://www.courts.state.mn.us/ProtectionOrderQuery/1.0" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0" xmlns:nc="http://niem.gov/niem/niem-core/2.0" xmlns:j="http://niem.gov/niem/domains/jxdm/4.1" xmlns:mscef="courts.state.mn.us/extfun" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:exsl="urn:schemas-microsoft-com:xslt" extension-element-prefixes="exsl" exclude-result-prefixes="mscef msxsl exsl">
    <xsl:import href="../General/ExtensionFunctions.xsl"/>
    <xsl:import href="MNCIS_PO_BCA_ProtectionOrder_1_0.xsl"/>
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <!-- Path to environment folder used by document function. Relative to location of stylesheet. -->
    <xsl:param name="gEnvPath">../..</xsl:param>
    <xsl:template match="/">
    <xsl:variable name="vPoNumber">
    <xsl:value-of select="Integration/@protectionOrderNumber"/>
    </xsl:variable>
    <poq:ProtectionOrderQueryResponse>
    <xsl:for-each select="//Integration/ProtectionOrder[ProtectionOrderNumber=$vPoNumber]">
    <xsl:call-template name="ProtectionOrder"/>
    </xsl:for-each>
    </poq:ProtectionOrderQueryResponse>
    </xsl:template>
    </xsl:stylesheet>
    XML document output  from my xslt code
    <?xml version="1.0" encoding="UTF-8"?>
    <poq:ProtectionOrderQueryResponse xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:poq="http://www.courts.state.mn.us/ProtectionOrderQuery/1.0" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0" xmlns:nc="http://niem.gov/niem/niem-core/2.0" xmlns:j="http://niem.gov/niem/domains/jxdm/4.1">
    <ext:ProtectionOrder xmlns:exc="http://www.courts.state.mn.us/ProtectionOrderServiceExchange/1.0" xmlns:s="http://niem.gov/niem/structures/2.0" xmlns:usps="http://niem.gov/niem/usps_states/2.0">
    <j:CourtOrderEnforcementAgency>
    <nc:OrganizationIdentification>
    <nc:IdentificationID>MN0700000</nc:IdentificationID>
    </nc:OrganizationIdentification>
    </j:CourtOrderEnforcementAgency>
    <ext:ForeignOrderIdentification>
    <nc:IdentificationID/>
    <ext:ForeignOrderIdentificationTypeCode/>
    </ext:ForeignOrderIdentification>
    <ext:HearingHeldIndicator>false</ext:HearingHeldIndicator>
    <nc:Location s:id="DB1618611387">
    <nc:LocationAddress>
    <nc:StructuredAddress>
    <nc:LocationStreet>
    <nc:StreetFullText>3434 Bohnsack Way</nc:StreetFullText>
    <nc:StreetFullText>Unit 75 B</nc:StreetFullText>
    <nc:StreetFullText/>
    </nc:LocationStreet>
    <nc:LocationCityName>New Prague</nc:LocationCityName>
    <nc:LocationStateUSPostalServiceCode>MN</nc:LocationStateUSPostalServiceCode>
    <nc:LocationPostalCode>56071</nc:LocationPostalCode>
    </nc:StructuredAddress>
    </nc:LocationAddress>
    </nc:Location>
    <ext:ProtectedParty>
    <ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">1987-11-21</ext:PersonBirthDate>
    <nc:PersonName>
    <nc:PersonGivenName>Jennifer</nc:PersonGivenName>
    <nc:PersonMiddleName>Marie</nc:PersonMiddleName>
    <nc:PersonSurName>O'Brien</nc:PersonSurName>
    <nc:PersonNameSuffixText/>
    <nc:PersonFullName>O'Brien, Jennifer Marie</nc:PersonFullName>
    </nc:PersonName>
    <ext:PersonRaceCode/>
    <nc:PersonSexCode>F</nc:PersonSexCode>
    <ext:PetitionerIndicator>true</ext:PetitionerIndicator>
    </ext:ProtectedParty>
    <ext:ProtectedParty>
    <ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">2008-03-24</ext:PersonBirthDate>
    <nc:PersonName>
    <nc:PersonGivenName>Eli</nc:PersonGivenName>
    <nc:PersonMiddleName>Rose</nc:PersonMiddleName>
    <nc:PersonSurName>Noir</nc:PersonSurName>
    <nc:PersonNameSuffixText/>
    <nc:PersonFullName>Noir, Eli Rose</nc:PersonFullName>
    </nc:PersonName>
    <ext:PersonRaceCode/>
    <nc:PersonSexCode>F</nc:PersonSexCode>
    <ext:PetitionerIndicator>false</ext:PetitionerIndicator>
    </ext:ProtectedParty>
    <ext:ProtectionOrderBradyIndicator>N</ext:ProtectionOrderBradyIndicator>
    <ext:ProtectionOrderCondition>
    <ext:ConditionText>Respondent must not have any contact with the Protected Person(s) whether in person, with or through other persons, by telephone, mail, e-mail, through electronic devices, social media, or by any other means except as follows: [] </ext:ConditionText>
    <ext:ConditionCode>08</ext:ConditionCode>
    </ext:ProtectionOrderCondition>
    <ext:ProtectionOrderCondition>
    <ext:ConditionText>Respondent must stay a reasonable distance away from the residence(s) of the Protected Person(s), specifically as follows: [distance]; and Respondent must stay a reasonable distance away from ANY FUTURE RESIDENCES of the Protected Person(s). </ext:ConditionText>
    <ext:ConditionCode>04</ext:ConditionCode>
    </ext:ProtectionOrderCondition>
    <ext:ProtectionOrderCondition>
    <ext:ConditionText>Respondent shall not call or enter Petitioner's place of employment which includes all land, parking lots, and buildings at: </ext:ConditionText>
    <ext:ConditionCode>04</ext:ConditionCode>
    </ext:ProtectionOrderCondition>
    <ext:ProtectionOrderExpirationDate>2015-12-22</ext:ProtectionOrderExpirationDate>
    <ext:ProtectionOrderFinding>
    <ext:FindingText>Respondent personally appeared or had reasonable notice and opportunity to be heard. The procedures for service upon Respondent set forth in the Minnesota Domestic Abuse Act (Minn.Stat. 518B.01) were followed, and the court has jurisdiction over the parties and subject matter. </ext:FindingText>
    <ext:FindingCode>OAH1</ext:FindingCode>
    </ext:ProtectionOrderFinding>
    <ext:ProtectionOrderFinding>
    <ext:FindingText>Acts of domestic abuse have occurred, including the following: [] </ext:FindingText>
    <ext:FindingCode>OAH4A</ext:FindingCode>
    </ext:ProtectionOrderFinding>
    <ext:ProtectionOrderID>1400042</ext:ProtectionOrderID>
    <ext:ProtectionOrderIssuingCourt>
    <nc:OrganizationIdentification>
    <nc:IdentificationID>MN070015J</nc:IdentificationID>
    </nc:OrganizationIdentification>
    <ext:CourtFaxNumber>
    <nc:TelephoneNumberFullID>952-496-8211</nc:TelephoneNumberFullID>
    </ext:CourtFaxNumber>
    <ext:CourtTelephoneNumber>
    <nc:TelephoneNumberFullID>952-496-8200</nc:TelephoneNumberFullID>
    <nc:TelephoneSuffixID/>
    </ext:CourtTelephoneNumber>
    </ext:ProtectionOrderIssuingCourt>
    <ext:ProtectionOrderIssuingDate>2014-12-22</ext:ProtectionOrderIssuingDate>
    <ext:ProtectionOrderIssuingJudicialOfficial>
    <nc:PersonName>
    <nc:PersonGivenName>Do</nc:PersonGivenName>
    <nc:PersonMiddleName>P.</nc:PersonMiddleName>
    <nc:PersonSurName>Ande</nc:PersonSurName>
    <nc:PersonNameSuffixText/>
    <nc:PersonFullName>Ande, Do P.</nc:PersonFullName>
    </nc:PersonName>
    </ext:ProtectionOrderIssuingJudicialOfficial>
    <ext:ProtectionOrderOtherIdentification>
    <nc:IdentificationID>12345</nc:IdentificationID>
    <ext:ProtectionOrderOtherIdentificationTypeCode>NCICNUM</ext:ProtectionOrderOtherIdentificationTypeCode>
    </ext:ProtectionOrderOtherIdentification>
    <ext:ProtectionOrderService>
    <ext:ProtectionOrderServiceAgency>
    <nc:OrganizationIdentification>
    <nc:IdentificationID>MN0191000</nc:IdentificationID>
    </nc:OrganizationIdentification>
    </ext:ProtectionOrderServiceAgency>
    <ext:ProtectionOrderServiceDate>2015-01-10</ext:ProtectionOrderServiceDate>
    <ext:ProtectionOrderServiceTime>16:25:00-06:00</ext:ProtectionOrderServiceTime>
    <ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
    <ext:ProtectionOrderServiceTypeCode>BYPUB</ext:ProtectionOrderServiceTypeCode>
    </ext:ProtectionOrderService>
    <ext:ProtectionOrderService>
    <ext:ProtectionOrderServiceAgency>
    <nc:OrganizationIdentification>
    <nc:IdentificationID>MN0191000</nc:IdentificationID>
    </nc:OrganizationIdentification>
    </ext:ProtectionOrderServiceAgency>
    <ext:ProtectionOrderServiceDate>2015-01-10</ext:ProtectionOrderServiceDate>
    <ext:ProtectionOrderServiceTime>16:25:00-06:00</ext:ProtectionOrderServiceTime>
    <ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
    <ext:ProtectionOrderServiceTypeCode>BYPUB</ext:ProtectionOrderServiceTypeCode>
    </ext:ProtectionOrderService>
    <ext:ProtectionOrderService>
    <ext:ProtectionOrderServiceAgency>
    <nc:OrganizationIdentification>
    <nc:IdentificationID>MN0191000</nc:IdentificationID>
    </nc:OrganizationIdentification>
    </ext:ProtectionOrderServiceAgency>
    <ext:ProtectionOrderServiceDate>2015-01-10</ext:ProtectionOrderServiceDate>
    <ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
    <ext:ProtectionOrderServiceTypeCode>BYPUB</ext:ProtectionOrderServiceTypeCode>
    </ext:ProtectionOrderService>
    <ext:ProtectionOrderService>
    <ext:ProtectionOrderServiceAgency>
    <nc:OrganizationIdentification>
    <nc:IdentificationID>MN0250800</nc:IdentificationID>
    </nc:OrganizationIdentification>
    </ext:ProtectionOrderServiceAgency>
    <ext:ProtectionOrderServiceDate>2015-01-09</ext:ProtectionOrderServiceDate>
    <ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
    <ext:ProtectionOrderServiceTypeCode>BYMAIL</ext:ProtectionOrderServiceTypeCode>
    </ext:ProtectionOrderService>
    <ext:ProtectionOrderService>
    <ext:ProtectionOrderServiceAgency>
    <nc:OrganizationIdentification>
    <nc:IdentificationID>MN0720100</nc:IdentificationID>
    </nc:OrganizationIdentification>
    </ext:ProtectionOrderServiceAgency>
    <ext:ProtectionOrderServiceDate>2014-12-22</ext:ProtectionOrderServiceDate>
    <ext:ProtectionOrderServiceToCode>Respondent</ext:ProtectionOrderServiceToCode>
    <ext:ProtectionOrderServiceTypeCode>BYPUB</ext:ProtectionOrderServiceTypeCode>
    </ext:ProtectionOrderService>
    <ext:ProtectionOrderStatus>
    <ext:ProtectionOrderStatusCode>SBJO</ext:ProtectionOrderStatusCode>
    <ext:ProtectionOrderStatusDate>2014-12-22</ext:ProtectionOrderStatusDate>
    </ext:ProtectionOrderStatus>
    <ext:ProtectionOrderTypeCode>OFP</ext:ProtectionOrderTypeCode>
    <ext:QualifyingRelationship>
    <ext:QualifyingRelationshipCode>LIVTOGTHR</ext:QualifyingRelationshipCode>
    <ext:QualifyingRelationshipText>Lived Together</ext:QualifyingRelationshipText>
    </ext:QualifyingRelationship>
    <ext:Respondent>
    <nc:PersonEthnicityCode/>
    <nc:PersonEyeColorCode/>
    <nc:PersonHairColorCode>XXX</nc:PersonHairColorCode>
    <nc:PersonHeightMeasure>
    <nc:MeasureText>71</nc:MeasureText>
    <nc:MeasureUnitText>inches</nc:MeasureUnitText>
    <nc:LengthUnitCode>INH</nc:LengthUnitCode>
    </nc:PersonHeightMeasure>
    <ext:PersonRaceCode>W</ext:PersonRaceCode>
    <nc:PersonSexCode>M</nc:PersonSexCode>
    <nc:PersonWeightMeasure>
    <nc:MeasureText>210</nc:MeasureText>
    <nc:MeasureUnitText>pounds</nc:MeasureUnitText>
    <nc:WeightUnitCode>LBR</nc:WeightUnitCode>
    </nc:PersonWeightMeasure>
    <ext:AddressReference ext:currentIndicator="true">
    <nc:LocationReference s:ref="DB1618611387"/>
    </ext:AddressReference>
    <ext:PersonBirthDate ext:approximateDateIndicator="true" ext:currentIndicator="false">1990-12-23</ext:PersonBirthDate>
    <ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="false">1989-12-23</ext:PersonBirthDate>
    <ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">1991-12-23</ext:PersonBirthDate>
    <ext:PersonName ext:currentIndicator="true">
    <nc:PersonGivenName>Guy</nc:PersonGivenName>
    <nc:PersonMiddleName>Andr</nc:PersonMiddleName>
    <nc:PersonSurName>Noir</nc:PersonSurName>
    <nc:PersonNameSuffixText>Jr.</nc:PersonNameSuffixText>
    <nc:PersonFullName>Noir Jr , Guy Andr</nc:PersonFullName>
    </ext:PersonName>
    </ext:Respondent>
    <ext:RespondentPresentAtHearingIndicator>false</ext:RespondentPresentAtHearingIndicator>
    </ext:ProtectionOrder>
    <ext:SupersededProtectionOrderID xmlns:exc="http://www.courts.state.mn.us/ProtectionOrderServiceExchange/1.0" xmlns:s="http://niem.gov/niem/structures/2.0" xmlns:usps="http://niem.gov/niem/usps_states/2.0"/>
    <ext:Hearing xmlns:exc="http://www.courts.state.mn.us/ProtectionOrderServiceExchange/1.0" xmlns:s="http://niem.gov/niem/structures/2.0" xmlns:usps="http://niem.gov/niem/usps_states/2.0">
    <ext:HearingDateTime>2015-01-20T09:00:00-06:00</ext:HearingDateTime>
    <ext:HearingLocationText>Scott County</ext:HearingLocationText>
    </ext:Hearing>
    </poq:ProtectionOrderQueryResponse>

    Inert to root as first nood.
    http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.insertbefore(v=vs.110).aspx
    Dim doc As New XmlDocument()
    doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" & _
    "<title>Pride And Prejudice</title>" & _
    "</book>")
    Dim root As XmlNode = doc.DocumentElement
    'Create a new node.
    Dim elem As XmlElement = doc.CreateElement("price")
    elem.InnerText = "19.95"
    'Add the node to the document.
    root.InsertBefore(elem, root.FirstChild)
    Console.WriteLine("Display the modified XML...")
    doc.Save(Console.Out)
    remember make the reply as answer and vote the reply as helpful if it helps.

  • How can I use XStream to persist complicated Java Object  to XML & backward

    Dear Sir:
    I met a problem as demo in my code below when i use XTream to persist my Java Object;
    How can I use XStream to persist complicated Java Object to XML & backward??
    See
    [1] main code
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.ArrayList;
    import com.thoughtworks.xstream.XStream;
    import com.thoughtworks.xstream.io.xml.DomDriver;
    public class PhoneList {
         ArrayList<PhoneNumber> phones;
         ArrayList<Person> person;
         private PhoneList myphonelist ;
         private LocationTest location;
         private PhoneList(String name) {
         phones = new ArrayList<PhoneNumber>();
         person = new ArrayList<Person>();
         public ArrayList<PhoneNumber> getphones() {
              return phones;
         public ArrayList<Person> getperson() {
              return person;
         public void addPhoneNumber(PhoneNumber b1) {
              this.phones.add(b1);
         public void removePhoneNumber(PhoneNumber b1) {
              this.phones.remove(b1);
         public void addPerson(Person p1) {
              this.person.add(p1);
         public void removePerson(Person p1) {
              this.person.remove(p1);
         public void BuildList(){
              location = new LocationTest();
              XStream xstream = new XStream();
              myphonelist = new PhoneList("PhoneList");
              Person joe = new Person("Joe, Wallace");
              joe.setPhone(new PhoneNumber(123, "1234-456"));
              joe.setFax(new PhoneNumber(123, "9999-999"));
              Person geo= new Person("George Nixson");
              geo.setPhone(new PhoneNumber(925, "228-9999"));
              geo.getPhone().setLocationTest(location);          
              myphonelist.addPerson(joe);
              myphonelist.addPerson(geo);
         public PhoneList(){
              XStream xstream = new XStream();
              BuildList();
              saveStringToFile("C:\\temp\\test\\PhoneList.xml",convertToXML(myphonelist));
         public void saveStringToFile(String fileName, String saveString) {
              BufferedWriter bw = null;
              try {
                   bw = new BufferedWriter(
                             new FileWriter(fileName));
                   try {
                        bw.write(saveString);
                   finally {
                        bw.close();
              catch (IOException ex) {
                   ex.printStackTrace();
              //return saved;
         public String getStringFromFile(String fileName) {
              BufferedReader br = null;
              StringBuilder sb = new StringBuilder();
              try {
                   br = new BufferedReader(
                             new FileReader(fileName));
                   try {
                        String s;
                        while ((s = br.readLine()) != null) {
                             // add linefeed (\n) back since stripped by readline()
                             sb.append(s + "\n");
                   finally {
                        br.close();
              catch (Exception ex) {
                   ex.printStackTrace();
              return sb.toString();
         public  String convertToXML(PhoneList phonelist) {
              XStream xstream = new  XStream(new DomDriver());
              xstream.setMode(xstream.ID_REFERENCES) ;
              return xstream.toXML(phonelist);
         public static void main(String[] args) {
              new PhoneList();
    }[2].
    import java.io.Serializable;
    import javax.swing.JFrame;
    public class PhoneNumber implements Serializable{
           private      String      phone;
           private      String      fax;
           private      int      code;
           private      String      number;
           private      String      address;
           private      String      school;
           private      LocationTest      location;
           public PhoneNumber(int i, String str) {
                setCode(i);
                setNumber(str);
                address = "4256, Washington DC, USA";
                school = "Washington State University";
         public Object getPerson() {
              return null;
         public void setPhone(String phone) {
              this.phone = phone;
         public String getPhone() {
              return phone;
         public void setFax(String fax) {
              this.fax = fax;
         public String getFax() {
              return fax;
         public void setCode(int code) {
              this.code = code;
         public int getCode() {
              return code;
         public void setNumber(String number) {
              this.number = number;
         public String getNumber() {
              return number;
         public void setLocationTest(LocationTest bd) {
              this.location = bd;
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(location);
            f.getContentPane().add(location.getControls(), "Last");
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
         public LocationTest getLocationTest() {
              return location;
         }[3].
    package test.temp;
    import java.io.Serializable;
    public class Person implements Serializable{
         private String           fullname;
           @SuppressWarnings("unused")
         private PhoneNumber      phone;
           @SuppressWarnings("unused")
         private PhoneNumber      fax;
         public Person(){
         public Person(String fname){
                fullname=fname;           
         public void setPhone(PhoneNumber phoneNumber) {
              phone = phoneNumber;
         public void setFax(PhoneNumber phoneNumber) {
              fax = phoneNumber;
         public PhoneNumber getPhone() {
              return phone ;
         public PhoneNumber getFax() {
              return fax;
        public String getName() {
            return fullname ;
        public void setName(String name) {
            this.fullname      = name;
        public String toString() {
            return getName();
    }[4]. LocationTest.java
    package test.temp;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class LocationTest extends JPanel implements ChangeListener
        Ellipse2D.Double ball;
        Line2D.Double    line;
        JSlider          translate;
        double           lastTheta = 0;
        public void stateChanged(ChangeEvent e)
            JSlider slider = (JSlider)e.getSource();
            String name = slider.getName();
            int value = slider.getValue();
            if(name.equals("rotation"))
                tilt(Math.toRadians(value));
            else if(name.equals("translate"))
                moveBall(value);
            repaint();
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            if(ball == null)
                initGeom();
            g2.setPaint(Color.green.darker());
            g2.draw(line);
            g2.setPaint(Color.red);
            g2.fill(ball);
        private void initGeom()
            int w = getWidth();
            int h = getHeight();
            int DIA = 30;
            int padFromEnd = 5;
            line = new Line2D.Double(w/4, h*15/16, w*3/4, h*15/16);
            double x = line.x2 - padFromEnd - DIA;
            double y = line.y2 - DIA;
            ball = new Ellipse2D.Double(x, y, DIA, DIA);
            // update translate slider values
            int max = (int)line.getP1().distance(line.getP2());
            translate.setMaximum(max);
            translate.setValue(max-padFromEnd);
        private void tilt(double theta)
            // rotate line from left end
            Point2D pivot = line.getP1();
            double lineLength = pivot.distance(line.getP2());
            Point2D.Double p2 = new Point2D.Double();
            p2.x = pivot.getX() + lineLength*Math.cos(theta);
            p2.y = pivot.getY() + lineLength*Math.sin(theta);
            line.setLine(pivot, p2);
            // find angle from pivot to ball center relative to line
            // ie, ball center -> pivot -> line end
            double cx = ball.getCenterX();
            double cy = ball.getCenterY();
            double pivotToCenter = pivot.distance(cx, cy);
            // angle of ball to horizon
            double dy = cy - pivot.getY();
            double dx = cx - pivot.getX();
            // relative angle phi = ball_to_horizon - last line_to_horizon
            double phi = Math.atan2(dy, dx) - lastTheta;
            // rotate ball from pivot
            double x = pivot.getX() + pivotToCenter*Math.cos(theta+phi);
            double y = pivot.getY() + pivotToCenter*Math.sin(theta+phi);
            ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
            lastTheta = theta;  // save theta for next time
        private void moveBall(int distance)
            Point2D pivot = line.getP1();
            // ball touches line at distance from pivot
            double contactX = pivot.getX() + distance*Math.cos(lastTheta);
            double contactY = pivot.getY() + distance*Math.sin(lastTheta);
            // find new center location of ball
            // angle lambda = lastTheta - 90 degrees (anti-clockwise)
            double lambda = lastTheta - Math.PI/2;
            double x = contactX + (ball.width/2)*Math.cos(lambda);
            double y = contactY + (ball.height/2)*Math.sin(lambda);
            ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
        JPanel getControls()
            JSlider rotate = getSlider("rotation angle", "rotation", -90, 0, 0, 5, 15);
            translate = getSlider("distance from end",  "translate", 0, 100, 100,25, 50);
            JPanel panel = new JPanel(new GridLayout(0,1));
            panel.add(rotate);
            panel.add(translate);
            return panel;
        private JSlider getSlider(String title, String name, int min, int max,
                                  int value, int minorSpace, int majorSpace)
            JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, value);
            slider.setBorder(BorderFactory.createTitledBorder(title));
            slider.setName(name);
            slider.setPaintTicks(true);
            slider.setMinorTickSpacing(minorSpace);
            slider.setMajorTickSpacing(majorSpace);
            slider.setPaintLabels(true);
            slider.addChangeListener(this);
            return slider;
    }OK, My questions are:
    [1]. what I generated XML by XSTream is very complicated, especially for object LocationTest, Can we make it as simple as others such as Person object??
    [2]. after I run it, LocationTest will popup and a red ball in a panel will dsiplay, after I change red ball's position, I hope to persist it to xml, then when I read it back, I hope to get same picture, ie, red ball stiil in old position, How to do that??
    Thanks a lot!!

    Positive feedback? Then please take this in a positive way: if you want to work on persisting Java objects into XML, then GUI programming is irrelevant to that goal. The 1,000 lines of code you posted there appeared to me to have a whole lot of GUI code in it. You should produce a smaller (much smaller) example of what you want to do. Calling the working code from your GUI program should come later.

  • Dynamically create Value Objects from XML file

    Hi
    I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.

    Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.

  • How do I check if section and subdivision exist inside object's xml?

    My function is working but not as I expect it to. The problem is that when Section and Subvision are not found in the object aobjXmlGetStatuteRequestNode xml, I get an error NullReference Exception was unhandled by user code. Object reference not set
    to an instance of an object. 
    For that reason, because the two elements are optional, I would like to check if they exist before adding their value into the xml inside the object objXmlRequestMessageDoc.
    The if statement I used in my function did not work. When it found Section element, it did not check for Subdivision. 
    How do I check for both and add them if they exist. If they do not exist, I do not need to do anything and should not throw an error since they are optional.
     Object aobjXmlGetStatuteRequestNode has this xml
    <ns:GetStatutesRequest xmlns:ns="http://www.courts.state.mn.us/StatuteService/1.0">
    <ns:Statute>
    <ns:Chapter>169</ns:Chapter>
    <!--Optional:-->
    <ns:Section>191</ns:Section>
    <!--Optional:-->
    <ns:Subdivision>a</ns:Subdivision>
    </ns:Statute>
    The following output in the objXmlRequestMessageDoc object is correct but this does not work when Section and or Subdivision are not found in the object aobjXmlGetStatuteRequestNode.
    <ns:BasicSearchQueryRequest xmlns:ns="http://crimnet.state.mn.us/mnjustice/statute/service/4.0">
    <ns1:BasicSearchCriteria xmlns:ns1="http://crimnet.state.mn.us/mnjustice/statute/messages/4.0">
    <ns2:Chapter xmlns:ns2="http://crimnet.state.mn.us/mnjustice/statute/4.0"/169</ns2:Chapter>>
    <ns2:Section xmlns:ns2="http://crimnet.state.mn.us/mnjustice/statute/4.0"/>191</ns2:Chapter>
    <ns2:Subdivision xmlns:ns2="http://crimnet.state.mn.us/mnjustice/statute/4.0"/>a</ns2:Chapter>
    </ns1:BasicSearchCriteria>
    </ns:BasicSearchQueryRequest>
    My Function
    Function GetStatutesByChapter(ByVal aobjXmlGetStatuteRequestNode As XmlNode, ByVal aobjXMLNameSpaceManager As XmlNamespaceManager, ByVal aobjBroker As ServiceCatalog.Library.v4.Broker) As XmlDocument
    Dim objXmlRequestMessageDoc As XmlDocument
    Dim objXmlResponseMessageDoc As XmlDocument
    Dim intCount As Integer
    aobjBroker.PostMessageWarehouseInformationalMessage("Chapter found.", 1)
    objXmlResponseMessageDoc = New XmlDocument
    'Add the first element into the document GetStatuteByChapter with its namespace
    objXmlResponseMessageDoc.AppendChild(objXmlResponseMessageDoc.CreateElement("BasicSearchQueryResponse", "http://crimnet.state.mn.us/mnjustice/statute/service/4.0"))
    'Create the BCA request message
    objXmlRequestMessageDoc = New XmlDocument
    objXmlRequestMessageDoc.AppendChild(objXmlRequestMessageDoc.CreateElement("ns:BasicSearchQueryRequest", aobjXMLNameSpaceManager.LookupNamespace("ns")))
    objXmlRequestMessageDoc.SelectSingleNode("ns:BasicSearchQueryRequest", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns1:BasicSearchCriteria", aobjXMLNameSpaceManager.LookupNamespace("ns1")))
    objXmlRequestMessageDoc.SelectSingleNode("ns:BasicSearchQueryRequest/ns1:BasicSearchCriteria", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns2:Chapter", aobjXMLNameSpaceManager.LookupNamespace("st")))
    objXmlRequestMessageDoc.SelectSingleNode("ns:BasicSearchQueryRequest/ns1:BasicSearchCriteria", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns2:Section", aobjXMLNameSpaceManager.LookupNamespace("st")))
    objXmlRequestMessageDoc.SelectSingleNode("ns:BasicSearchQueryRequest/ns1:BasicSearchCriteria", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns2:Subdivision", aobjXMLNameSpaceManager.LookupNamespace("st")))
    objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Chapter", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Chapter", aobjXMLNameSpaceManager).InnerText
    objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Section", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Section", aobjXMLNameSpaceManager).InnerText
    objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Subdivision", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Subdivision", aobjXMLNameSpaceManager).InnerText
    'check if there is a section and or subdivision if it is there then set the value
    'If Not (aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Section", aobjXMLNameSpaceManager).InnerText) Is Nothing Then
    ' objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Section", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Section", aobjXMLNameSpaceManager).InnerText
    'End If
    'check if there is a section and or subdivision if it is there then set the value
    aobjBroker.PostMessageWarehouseSnapshot(objXmlRequestMessageDoc.OuterXml, "Request Message", 1)
    'Call the BCA service
    intCount = 0
    'Count how many Statute node found
    CType(objXmlResponseMessageDoc.SelectSingleNode("ss:GetStatutesResponse/ss:StatutesXml/ss:Statutes", aobjXMLNameSpaceManager), System.Xml.XmlElement).SetAttribute("totalCount", CStr(intCount))
    Return objXmlResponseMessageDoc
    End Function

    I have resolved this issue by using two if statements as follows
    'check if there is a section and or subdivision if it is there then set the value
    If Not (aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Section", aobjXMLNameSpaceManager) Is Nothing) Then
    objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Section", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Section", aobjXMLNameSpaceManager).InnerText
    End If
    If Not (aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Subdivision", aobjXMLNameSpaceManager) Is Nothing) Then
    objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Subdivision", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Subdivision", aobjXMLNameSpaceManager).InnerText
    End If

  • Object to xml inheritance feature in toplink

    i created a project for object to xml mapping but require "inheritance features to be included ".i tried but it gives --"missing class indicator " and other root error
    any help please

    or send me your email i will mail you the require stuff as its to much to paste here my id is ::[email protected]
    or [email protected]

  • WD(ABAP) - How to convert PDF object to XML

    I know there is a way available to converting PDF object to XML in JAVA. However how to achieve this goal in ABAP?
    In Web Dynpro ABAP, I can bind a context attribute to the pdfSource property of interactive form element. There also should be method to able to convert the binary content of this attribute to XML format, right? Does anyone know it?
    Your help would be greatly appreciated.

    Hi all,
    As an extension to Fred's question, is it possible to later use the generated XML data and present it in a PDF template?  It used to be possible using the FDF format, but Adobe seem to have discontinued that. 
    My basic requirement is to send the form data to a third party in XML format and for them to be able to view it in human-readable format, preferably using a PDF as a template. 
    Is this possible?
    Thanks,
    Jonathan

  • Converting object to XML

    I am using the following code to convert an object into XML:
    public function objectToXML(obj:Object, qname:String="root"):XML
                   var qName:QName = new QName(qname);
                   var xmlDocument:XMLDocument = new XMLDocument();
                   var simpleXMLEncoder:SimpleXMLEncoder = new SimpleXMLEncoder(xmlDocument);
                   var xmlNode:XMLNode = simpleXMLEncoder.encodeValue(obj, qName, xmlDocument);
                   var xml:XML = new XML(xmlDocument.toString());
                   return xml;
    The resultant XML will have nodeName "item". Is it possible to customize it?
    Thanks

    If it is a simple object, maybe build up a string on your own.

  • Sending Custom Java Objects over XML!!

    Hello all !
    Can anybody please tell me how can I send custom Java Objects through XML? For example we can set attributes for a node using the setAttribute method, it accepts only strings, also the setTextContent method requires text and sets the node's value.Can I some way set my own Java object as the value of a particular node or attach it to the node?
    Thanks in advance.

    Kami_Pakistan wrote:
    So I should rather go for Marshalling or Serialization or is there any other work-around possible?I don't know. You didn't say what you had against text formats. Since all Java objects are composed of primitives when you get right down to the bottom, everything in Java can be serialized as text versions of those primitives. So you're going to have to explain why you think a work-around is necessary at all.

  • WBEM SDK - Mapping CIM Object to XML

    Hi all !
    In Sun WBEM SDK such classes as CIMClass, CIMProperty, CIMInstance have
    methods toXML(.....).
    Where can I find specification, used for CIM-to-XML mapping in Sun WBEM SDK?
    I will appreciate any assistance you might be able to offer me.
    Thank you in advance for your attention.
    Please, mail me on [email protected]
    Sincerely yours,
    Ihor Krivenchuck

    To construct an object from XML, builder pattern looks like a good option. Here is a quick design
    public class XMLCoder{
    public static Object decode(InputSream in, XMLBeanMapper xm) throws some_exception_if_ASM_object_is_in_inconsistent_state {
    public static void encode(OutputStream out, XMLBeanMapper){
    public class BeanProperty{
    private String name;
    priavte String value;
    .. cons,accessors and muatators ...
    public interface XMLBeanMapper{
    public void setProperty(BeanProperty bp);
    public Object getObject() throws some_exception_if_ASM_object_is_in_inconsistent_state ;
    public BeanProperty getNextProperty();//returns null if no more property needs to be converted to xml
    for each class that needs conversion to and from XML, you need a XMLBeanMapper class.
    XMLCoder.encode parses XML, creates a BeanProperty from each element and calls setProperty of XMLBeanMapper. The XMLBeanMapper calls necessary method of your ASM object to set the value. When it is done with parsing the xml document, it calls the getObject on the XMLBeanMapper and returns the object or throws exception if needed.
    XMLCoder.decode keeps calling the getNextProperty unless it returns null. It writes necessary xml element from the data provided by the BeanProperty instance.
    Depending on how complex your xml is you will probably need to change the BeanProperty class to keep the XMLcoder generic. For example to handle child elements, you may chain BeanProperty instances, or if the XML may have arbitrarily more information for a property than a name-value pair, you may need to use a hashtable.
    Benefits:
    You have a generic class to parse XML
    The unique XmlBeanMapper implementation for each ASM type will be pretty simple. You can have a generic XmlBeanMapper implementation when the xml elements contains the name of the method
    Disadvantages:
    You need to write and maintain a XMLBeanMapper implementation for each type of ASM class.

  • Serializing Java Objects to XML files

    Hi,
    We looking for SAP library which can serialize Java Objects into XML files.
    Can you point us were to find it ?
    We have found such open source library called "XStream" at the following link
    http://www.xml.com/pub/a/2004/08/18/xstream.html
    Is it allowed to use that library inside SAP released software ?
    Thanks
    Orit

    How about https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/83f6d2fb-0c01-0010-a2ba-a2ec94ba08f4 [original link is broken] [original link is broken]? Depends on your use cases...
    Both are supported in SAP NW CE 7.1.
    HTH!
    -- Vladimir

  • Create value object from xml

    So I've got a value object with 100 fields.
    I have a ASP.net web service that returns the value objects
    as XML (I really don't want to use WebOrb...).
    I don't want to write a lot of code like this:
    vo.Field1 = voXML.Field1;
    vo.Field2 = voXML.Field2;
    vo.Field3 = voXML.Field3;
    Is there an easier/faster way to do this? Can't I do some
    sort of for/each loop. The element names are identical to the field
    names.
    Thanks.

    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Live Docs_Book_Parts&file=usingas_053_9.html#220936

  • Error while loadjava xmlparserv2.jar: ORA-04043: object oracle/xml/.. does not exist

    In Oracle8i.15, I tried to install xmlparserv2.jar after I downloaded xdk_plsql_9_2_0_2_0.zip and upzip to local machine.
    However, when I issued the follwoing command:
    loadjava -v -r -user SYSTEM/manager -force xmlparserv2.jar
    For each class, it has the following error message:
    resolving: oracle/xml/async/DOMBuilderErrorListener
    Error while resolving class oracle/xml/async/DOMBuilderErrorListener
    ORA-04043: object oracle/xml/async/DOMBuilderErrorListener does not exist
    resolving: oracle/xml/comp/CXMLParser
    Error while resolving class oracle/xml/comp/CXMLParser
    ORA-04043: object oracle/xml/comp/CXMLParser does not exist
    How can I solve this problem?
    Thanks in advance.

    Do you mean you use 8.1.5? You can't directly load the xmlparserv2.jar to it.

  • Object Oriented XML Instances - existing standard?

    Hi All
    I am in search for a standard/package that can remove
    redundancy and reduce inconsistencies in XML. It ought
    to be done by using object oriented XML instances. I do
    not mean XML schema languages like SOX. The
    concept I refer to is used earlier on in the config-file. I
    have implemented a simple version but as soon as I
    realized its potential I also realized that there has to be
    an existing standard out there. I have searched the web
    without any luck, but since I am new to XML there is a big
    chance that I have missed it. I would be grateful if anyone
    could point me in the right direction.
    To clarify I have an example. Its a small part from the
    config-file used by my database bridge and this part is
    used to define fields and tables. Following two attributes
    are reserved
    1. did - the identity of this instance. The name space for
    this definition is restricted to the tag name, but can be
    seen from anywhere in the project.
    2. eid - the identity of the instance that this instance extends.
    <database did="my database">
      <field_definitions>
        <field did="super" key="no" unique="no" visible="yes" allow_null="no"/>
        <field did="boolean" eid="super" class="ops.dbb.FieldBoolean"
               default="false"/>
        <field did="integer" eid="super" class="ops.dbb.FieldInteger"
               default="0" display_size="10"/>
        <field did="auto_inc" eid="integer" class="ops.dbb.FieldAutoInc"
            key="yes" unique="yes" name="id" visible="no"/>
        <field did="string" eid="super" class="ops.dbb.FieldString"/>
        <field did="string_10" eid="string" size="10"/>
        <field did="note" eid="string" size="50" name="note" allow_null="yes"/>
      </field_definitions>
      <tables>
        <table did="users">
          <field eid="auto_inc"/>
          <field did="username" eid="string_10"/>
          <field did="password" eid="string_10" visible="no"/>
          <field eid="note"/>
        </table>
        <table did="admin_users" eid="users">
          <field did="security_level" eid="integer"/>
        </table>
      </tables>
    </database>If there are only a few tables this might not be
    justified, but used in a project with hundreds of
    tables, this will help considerable.
    As fun as it is to reinvent the wheel, I am trying
    not to.

    Either there are functions in JAXB that I am missing
    or you are misunderstanding me jmwollny. I understand
    that given a valid XSD schema JAXB will generate
    interfaces and classes that I can work with instead of
    working with XML files directly. This is really cool,
    but it is not the concept I am looking for. When I
    write 'Object Oriented XML Instances' I do not
    referring to Java, I mean that the XML elements in the
    config-file are capable of inheritance, creating
    interfaces, creating abstract elements and more. Here
    is a smaller example.
      <field did="super" key="no" unique="no"/>
      <field did="integer" eid="super" unique="yes"/>If we take a look at the second field where
    did="integer", it is inheriting the attribute key="no"
    from the field where did="super" since the attribute
    eid="super" exists. We can also see that since
    polymorphism is supported, unique="yes" in the second
    field is replacing unique="no" in the first field.
    The reason why I think this is helpful is because it
    will reduce redundancy and inconsistencies in the
    config-file.

  • Serialising data objects using XML

    Does the support for XML in wl6.0 mean that java data objects can be serialized using xml entirely within weblogic (currently we use a 3rd party product, and are hoping to remove this if possible)?

    What about SOAP?
    Isn't that what SOAP does - marshals and unmarshals between objects and XML
    You can use SOAP from Java, or C++ or whatever.
    Contrary to a commonly held perception, SOAP doesn't require remote
    transmission of the serialized XML datastream.
    Where is the SOAP support for WLS6 ? I heard it was separately
    downloadable?
    "Alex Thomas" <[email protected]> wrote in message
    news:3a532681$[email protected]..
    >
    With some limitations, yes, if you are starting from a DTD - see the docsfor the WebLogic DTD2Parser tool which generates a high-speed custom parser
    for a given DTD.
    >
    This tool anticipates the JAXB standard (aka Data Binding, formerlyProject Adelard) - see http://java.sun.com/xml/ - which is due fairly
    shortly AFAIK.
    >
    If you were wanting to start with arbitrary Java classes and serializethem to XML you'd have to wait longer unfortunately, though there are some
    implementations around, e.g. http://www.wutka.com/jox.html. This would then
    correspond to marshalling if the objects were parameters to an RPC of some
    kind.
    >
    cheers
    (another) alex
    "alex" <[email protected]> wrote:
    What I should have said is: can wl6 automatically populate java objects
    from xml and vice versa? I believe this is called 'data marshalling and
    unmarshalling', but I cannot find references to this in the doco.
    >>
    >

Maybe you are looking for

  • Firefox hangs & doesn't respond when I try to login to ebay

    Practically everytime I try to log into ebay the page hangs. If it goes straight to the hour-glass - then 'programme not responding ' is displaying. I have to switch off - then the 'ending programme box' ( ? or whatever it's called) comes up. Sometim

  • Transfer iTunes and Outlook data to a new PC

    I'm successfully logged into Homeshare with my old computer and I've tried the methods listed here, but can't get to the "import" button that is supposed to import selected items. Is there an easy way to just take my data (Music and Outlook data incl

  • Differences in KE5Z and KSB1

    Hello Experts, We have posted a cost document between two cost center that belongs to the same profit center. When looking at KSB1 (Cost line items for cost centers) we can see the value but when looking at  KE5Z for the profit center we can't see th

  • Approval Flows

    Dear SAP Colleagues, My questions are these; 1. Do we need to do customizing in the case of adding more than one approvers for a document (such as requisition, PO, voucher, leave request, etc) and if so please give me a hint of such customization?

  • How does load-balancing with WebCache work - is there still a bottleneck?

    Hello, We're migrating an old Forms 6i app to 10.1.2.0.2 (apps servers = Redhat Linux), and are starting to consider using WebCache to loadbalance between two application servers. My question is this - say we have apps servers A and B, both running F