Skip to Content
0
Former Member
Oct 11, 2006 at 01:26 PM

From XML string to XML.

22 Views

Hi Guys,

I have scenario wherein there is whole XML in a single element and i want to retrieve it to target XML structure. How do i do it?

Source message is:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- http://AltInn.no/webservices/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/">

<SubmitBatchPwResult><?xml version="1.0"?> <b><DataBatchInReceipt schemaVersion="1.0" batchId="9e7d6e34-60b3-4c42-89f8-dce662913d3f" enterpriseSystemId="826" status="OK"><DataUnitInReceipt sendersReference="fd1fc4b6-ffee-47dd-aeee-d3d57b1d6b2e" submissionReference="{A07CD759-BC7C-4AC8-92BD-EE98D2CFD363}" status="OK" timeReceived="2006-10-11T14:16:14"><Message><MessageEntry type="Default" logged="2006-10-11T14:16:15">Sendt til Altinn</MessageEntry></Message></DataUnitInReceipt></DataBatchInReceipt></b></SubmitBatchPwResult>

</SubmitBatchPwResponse>

The target XSD is:

<?xml version="1.0" encoding="ISO-8859-1"?>

http://www.w3.org/2001/XMLSchema">

<xsd:element name="DataUnitInReceipt">

<xsd:annotation>

<xsd:documentation>

Status information per dataunit or attachment in a batch.

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:sequence>

<xsd:element name="Message" minOccurs="0" form="qualified">

<xsd:complexType>

<xsd:sequence>

<xsd:element name="MessageEntry" minOccurs="0" maxOccurs="unbounded" form="qualified">

<xsd:annotation>

<xsd:documentation>

Additional information.This is usually a textual representation, but is XML representation for ValidationError messages

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:sequence>

<xsd:any namespace="##any" processContents="skip" />

</xsd:sequence>

<xsd:attribute name="type" use="required">

<xsd:annotation />

<xsd:simpleType>

<xsd:restriction base="xsd:string">

<xsd:enumeration value="Default" />

<xsd:enumeration value="VersionError" />

<xsd:enumeration value="GenericError" />

<xsd:enumeration value="Recipient" />

<xsd:enumeration value="AttachmentNotAllowedError" />

<xsd:enumeration value="ValidationError" />

<xsd:enumeration value="SubFormNotAllowedError" />

<xsd:enumeration value="KID" />

<xsd:enumeration value="EnterpriseSigningError" />

<xsd:enumeration value="Received" />

<xsd:enumeration value="SignedByParticipant" />

<xsd:enumeration value="SignedByAccountant" />

<xsd:enumeration value="DeletedWorkFlow" />

<xsd:enumeration value="AddedWorkFlow" />

<xsd:enumeration value="Archived" />

</xsd:restriction>

</xsd:simpleType>

</xsd:attribute>

<xsd:attribute name="logged" type="xsd:dateTime" use="required">

<xsd:annotation />

</xsd:attribute>

</xsd:complexType>

</xsd:element>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</xsd:sequence>

<xsd:attribute name="sendersReference" use="required">

<xsd:annotation>

<xsd:documentation>

Unique id for the data on the original senders side. Must be unique within the system id.

</xsd:documentation>

</xsd:annotation>

<xsd:simpleType>

<xsd:restriction base="xsd:string">

<xsd:minLength value="1" />

</xsd:restriction>

</xsd:simpleType>

</xsd:attribute>

<xsd:attribute name="submissionReference" use="required">

<xsd:annotation>

<xsd:documentation>

This is the identification of the initial storage of the dataunit or attachment. This is globally unique within AltInn

</xsd:documentation>

</xsd:annotation>

<xsd:simpleType>

<xsd:restriction base="xsd:string">

<xsd:minLength value="1" />

</xsd:restriction>

</xsd:simpleType>

</xsd:attribute>

<xsd:attribute name="workflowReference" type="xsd:string">

<xsd:annotation>

<xsd:documentation>

Identification of the dataunit or attachment when submittet to the worflow module. This is globally unique within AltInn.

</xsd:documentation>

</xsd:annotation>

</xsd:attribute>

<xsd:attribute name="archiveReference" type="xsd:string">

<xsd:annotation>

<xsd:documentation>

Identification of the dataunit or attachment when submittet to the archive. This is globally unique within AltInn.

</xsd:documentation>

</xsd:annotation>

</xsd:attribute>

<xsd:attribute name="receiversReference" type="xsd:string">

<xsd:annotation>

<xsd:documentation>

Identification of the dataunit or attachment from the reciever of the data. The uniqueness of this reference cannot be guaranteed.

</xsd:documentation>

</xsd:annotation>

</xsd:attribute>

<xsd:attribute name="status" type="xsd:string" use="required">

<xsd:annotation>

<xsd:documentation>

Status of the dataunit. The possible statuses are given in the documentation. The status may be supplemented by the message element.

</xsd:documentation>

</xsd:annotation>

</xsd:attribute>

<xsd:attribute name="timeReceived" use="required" />

</xsd:complexType>

</xsd:element>

<xsd:element name="DataBatchInReceipt">

<xsd:annotation>

<xsd:documentation>

Container for the receipts in a batch.

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:sequence>

<xsd:element name="Message" type="xsd:string" minOccurs="0" form="qualified">

<xsd:annotation>

<xsd:documentation>

Additional information accompanying the status

</xsd:documentation>

</xsd:annotation>

</xsd:element>

<xsd:element ref="DataUnitInReceipt" maxOccurs="unbounded" />

</xsd:sequence>

<xsd:attribute name="schemaVersion" type="xsd:decimal" use="required">

<xsd:annotation>

<xsd:documentation>

Corresponding schema version

</xsd:documentation>

</xsd:annotation>

</xsd:attribute>

<xsd:attribute name="batchId" use="required">

<xsd:annotation>

<xsd:documentation>

Unique id of the batch within the scope of the enterpriseSystemId.

</xsd:documentation>

</xsd:annotation>

<xsd:simpleType>

<xsd:restriction base="xsd:string">

<xsd:minLength value="1" />

<xsd:maxLength value="50" />

</xsd:restriction>

</xsd:simpleType>

</xsd:attribute>

<xsd:attribute name="enterpriseSystemId" type="xsd:int" use="required">

<xsd:annotation>

<xsd:documentation>

Unique id of the system sending data. This id is obtained from registering the system with AltInn

</xsd:documentation>

</xsd:annotation>

</xsd:attribute>

<xsd:attribute name="status" use="required">

<xsd:annotation>

<xsd:documentation>

Status of the batch as a whole. The status may be Ok even though individual statuses of dataunits are not Ok. The possible statuses are given in the documentation. The status may be supplemented by the message element.

</xsd:documentation>

</xsd:annotation>

<xsd:simpleType>

<xsd:restriction base="xsd:string">

<xsd:enumeration value="OK" />

<xsd:enumeration value="AccessDenied" />

<xsd:enumeration value="FormatError" />

<xsd:enumeration value="ValidationError" />

<xsd:enumeration value="AllreadyExists" />

<xsd:enumeration value="DoesNotExist" />

<xsd:enumeration value="GenericError" />

<xsd:enumeration value="InternalError" />

<xsd:enumeration value="SigningAuthenticationError" />

<xsd:enumeration value="SigningAuthorisationError" />

<xsd:enumeration value="SigningOptionError" />

<xsd:enumeration value="VirusDetected" />

<xsd:enumeration value="DuplicateDataUnit" />

<xsd:enumeration value="AuthorizationFailed" />

</xsd:restriction>

</xsd:simpleType>

</xsd:attribute>

</xsd:complexType>

</xsd:element>

</xsd:schema>

Pls advice on how to go about this.

Regards

Ashish