Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java File Parser

  • 13-07-2005 11:34am
    #1
    Registered Users, Registered Users 2 Posts: 995 ✭✭✭


    I need to write a single Java class to parse the following type of string input that will be loaded from a file.
    The goal is to extract the XML and store each XML doc in a String array.

    (After that each string in the string array is stored as a BLOB to be eventually loaded into an Oracle staging area after transformation.)

    Below is the type of input string. I want to ditch all entries beginning with '@' and have each XML doc as a discrete string that I will add to a string array.

    Any ideas? Im working on this myself but I'm pretty certain that there are better programmers who would have ideas of a better solution.

    @DOC
    @APPID abgtest
    @APPHNDL 108
    @DOCSTD OAGIS
    @DOCTYP AddPurchaseOrder
    @DOCREV 001
    @MFGPROSITE abgtest
    @ACKLVLREQD 0
    @ORIGDOCID 00000032
    @DOCLNG ge
    @CODEPG iso8859-1
    @SRCCOMP
    @SRCPROC xqsopopb.p
    @SRCUSERID iri
    @DATA
    <?xml version="1.0"?> <AddPurchaseOrder> <ApplicationArea> <Sender> <LogicalId>3333-3333</LogicalId> <Component>INTO58</Component> <Task>98-572-4553</Task> <ReferenceId>32</ReferenceId> </Sender> <BODId>32</BODId> </ApplicationArea> <DataArea> <PurchaseOrder> <Header> <DocumentIds> <DocumentId> <Id>50153942</Id> </DocumentId> <CustomerDocumentId> <Id>110332</Id> </CustomerDocumentId> </DocumentIds> <DocumentReferences> <PurchaseOrderDocumentReference> <Note></Note> </PurchaseOrderDocumentReference> </DocumentReferences> <ShipNote></ShipNote> <Priority></Priority> <TransportationTerm> <FreightTerms></FreightTerms> </TransportationTerm> <Parties> <BillToParty> <Addresses> <Address> <AddressLine> </AddressLine> </Address> </Addresses> </BillToParty> <ShipToParty> <Addresses> <Address> <AddressLine>Firma 02</AddressLine> <AddressLine>Kuhbrueckenstr. 18</AddressLine> <AddressLine>Postfach 10 13 03</AddressLine> <City>Hameln</City> <PostalCode>31785</PostalCode> <Region></Region> <AddressID></AddressID> <StateOrProvince>D</StateOrProvince> <County>Niedersachsen</County> <Country>GER</Country> </Address> </Addresses> </ShipToParty> <CarrierParty> <Name></Name> <Addresses> <DropShipAddress> <AddressLine></AddressLine> </DropShipAddress> </Addresses> </CarrierParty> </Parties> <UserArea> <Header_UserArea> <ModeOfShipment></ModeOfShipment> </Header_UserArea> </UserArea> </Header> <Line> <LineNumber>1</LineNumber> <OrderItem> <ItemIds> <ItemId> <Id>04S</Id> </ItemId> </ItemIds> <ProductLine>00319368</ProductLine> </OrderItem> <OrderQuantity>1</OrderQuantity> <NeedDeliveryDate> 2005-07-27 </NeedDeliveryDate> <ShipNote></ShipNote> <Priority></Priority> <Parties> <CarrierParty> <Addresses> <DropShipAddress> <AddressLine></AddressLine> </DropShipAddress> </Addresses> </CarrierParty> </Parties> <DocumentReferences> <PurchaseOrderDocumentReference> <Note></Note> </PurchaseOrderDocumentReference> </DocumentReferences> <UserArea> <Line_UserArea> <PartialShipmentAllowed></PartialShipmentAllowed> </Line_UserArea> </UserArea> </Line> </PurchaseOrder> </DataArea> </AddPurchaseOrder>
    @DOCEND

    @DOC

    <?xml version="1.0"?> <AddPurchaseOrder> ......
    </AddPurchaseOrder>

    @DOCEND


Advertisement