I need an Expert.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NewGuytoNetworking
    New Member
    • Jul 2007
    • 2

    #1

    I need an Expert.

    I have an XML that my company sends out daily it used to be created by SQL but I now have to use crystal reports and I can't seem to get it to line up the same. Please help with any references or how to rewrite my schema. I will try to provide pictures of what currently have.

    (This is Mine from Crystal Reports)
    Code:
    [B]<?xml version="1.0" encoding="UTF-8" ?> 
    - <BSASStockStatus xmlns="urn:crystal-reports:schemas" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation="urn:crystal-reports:schemas Stock_Status_Columns788.xsd">
    - <ReportArea Level="0" Type="Report" ReportDate="">
    - <Items Type="Header">
      <Text>7/18/2007</Text> 
      </Items>
    - <Item Level="1" Type="Details">
      <strPartNumber FieldName="{STOCK.PARTNUMBER}">004-351-0</strPartNumber> 
      <strNomenclature FieldName="{STOCK.DESCRIPTN}">TIRE</strNomenclature> 
      <strQuantity FieldName="{STOCK.QTY_INSTOCK}">1.00</strQuantity> 
      <strSafetyLevel FieldName="{STOCK.MINQTYLEVEL}">0.00</strSafetyLevel> 
      <strASL FieldName="{STOCK.MAXQTYLEVEL}">1.00</strASL>
    (This is how I need it to be)
    Code:
    <?xml version="1.0" ?> 
    - <BSASStock:StockStatus xmlns:BSASStock="http://www.w3.org/2001/XMLSchema-instance" reportDate="2007-06-01" BSASStock:schemaLocation="BSAS-Stock.xsd">
    - <Items>
    - <item strPartNumber="01-P24481F001">
      <strNomenclature>"POWER CONTROL PTRA200"</strNomenclature> 
      <strQuantity>"4"</strQuantity> 
      <strSafetyLevel>"3"</strSafetyLevel> 
      <strASL>"6"</strASL> 
      </item>
    - <item strPartNumber="01-P25390B002">
      <strNomenclature>"SATCOM REMOTE CONTROL"</strNomenclature> 
      <strQuantity>"3"</strQuantity> 
      <strSafetyLevel>"7"</strSafetyLevel> 
      <strASL>"13"</strASL> 
      </item>
    MY SCHEMA
    Code:
     <?xml version="1.0" encoding="UTF-8" ?> 
    - <xsd:schema xmlns="urn:crystal-reports:schemas" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" targetNamespace="urn:crystal-reports:schemas" elementFormDefault="qualified">
    - <xsd:attributeGroup name="FieldAttributes">
      <xsd:attribute name="FieldName" type="xsd:string" /> 
      </xsd:attributeGroup>
    - <xsd:complexType name="DecimalFieldBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:decimal">
      <xsd:attributeGroup ref="FieldAttributes" /> 
      <xsd:anyAttribute namespace="##any" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="FloatFieldBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:float">
      <xsd:attributeGroup ref="FieldAttributes" /> 
      <xsd:anyAttribute namespace="##any" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="StringFieldBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:string">
      <xsd:attributeGroup ref="FieldAttributes" /> 
      <xsd:anyAttribute namespace="##any" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="DateFieldBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:date">
      <xsd:attributeGroup ref="FieldAttributes" /> 
      <xsd:anyAttribute namespace="##any" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="TimeFieldBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:time">
      <xsd:attributeGroup ref="FieldAttributes" /> 
      <xsd:anyAttribute namespace="##any" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="DateTimeFieldBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:timeInstant">
      <xsd:attributeGroup ref="FieldAttributes" /> 
      <xsd:anyAttribute namespace="##any" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="BoolFieldBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:boolean">
      <xsd:attributeGroup ref="FieldAttributes" /> 
      <xsd:anyAttribute namespace="##any" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="PictureBaseType">
      <xsd:attribute name="gtype" type="xsd:string" /> 
      <xsd:attribute name="src" type="xsd:string" /> 
      <xsd:anyAttribute namespace="##any" /> 
      </xsd:complexType>
    - <xsd:complexType name="RowTotalBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:string">
      <xsd:attribute name="RowNumber" type="xsd:integer" use="required" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="ColumnTotalBaseType">
    - <xsd:simpleContent>
    - <xsd:extension base="xsd:string">
      <xsd:attribute name="ColumnNumber" type="xsd:integer" use="required" /> 
      </xsd:extension>
      </xsd:simpleContent>
      </xsd:complexType>
    - <xsd:complexType name="BSASStockStatusType">
    - <xsd:sequence>
      <xsd:element name="ReportArea" type="ReportAreaType" /> 
      </xsd:sequence>
      </xsd:complexType>
    - <xsd:complexType name="ItemType">
    - <xsd:sequence>
      <xsd:element name="strPartNumber" type="StringFieldBaseType" /> 
      <xsd:element name="strNomenclature" type="StringFieldBaseType" /> 
      <xsd:element name="strQuantity" type="FloatFieldBaseType" /> 
      <xsd:element name="strSafetyLevel" type="FloatFieldBaseType" /> 
      <xsd:element name="strASL" type="FloatFieldBaseType" /> 
      </xsd:sequence>
      <xsd:attribute name="Level" type="xsd:integer" use="required" /> 
      <xsd:attribute name="Type" type="xsd:string" use="required" /> 
      </xsd:complexType>
    - <xsd:complexType name="ItemsType">
    - <xsd:choice minOccurs="0" maxOccurs="unbounded">
    - <xsd:sequence>
      <xsd:element name="Text" type="xsd:string" /> 
      </xsd:sequence>
      </xsd:choice>
      <xsd:attribute name="Type" type="xsd:string" use="required" /> 
      </xsd:complexType>
    - <xsd:complexType name="ReportAreaType">
    - <xsd:sequence>
      <xsd:element name="Items" type="ItemsType" /> 
    - <xsd:sequence minOccurs="1" maxOccurs="unbounded">
      <xsd:element name="Item" type="ItemType" /> 
      </xsd:sequence>
      <xsd:element name="Items" type="ItemsType" /> 
      </xsd:sequence>
      <xsd:attribute name="Level" type="xsd:integer" use="required" /> 
      <xsd:attribute name="Type" type="xsd:string" use="required" /> 
      <xsd:attribute name="ReportDate" type="xsd:date" use="default" value="" /> 
      </xsd:complexType>
      <xsd:element name="BSASStockStatus" type="BSASStockStatusType" /> 
      </xsd:schema>
    Original Schema

    Code:
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:BSASStock="http://www.BSAS.com" targetNamespace="http://www.BSAS.com" elementFormDefault="unqualified" attributeFormDefault="unqualified">
    - <annotation>
      <documentation>Created as a test specification for sending of BSAS Stock Data to Army Copyright 2007 (c) BSAS - All rights reserved.</documentation> 
      </annotation>
      <element name="StockStatus" type="BSASStock:StockStatusType" /> 
    - <complexType name="StockStatusType">
    - <sequence>
      <element name="Items" type="BSASStock:ItemsType" /> 
      </sequence>
      <attribute name="reportDate" type="date" /> 
      </complexType>
    - <complexType name="ItemsType">
    - <sequence>
    - <element name="item" minOccurs="0" maxOccurs="unbounded">
    - <complexType>
    - <sequence>
      <element name="strNomenclature" type="string" /> 
      <element name="strQuantity" type="string" /> 
      <element name="strSafetyLevel" type="string" /> 
      <element name="strASL" type="string" /> 
      <element name="strVendor" type="string" /> 
      </sequence>
      <attribute name="strPartNumber" type="string" /> 
      </complexType>
      </element>
      </sequence>
      </complexType>
      </schema>
    I apologize for the length this is my first time use.
    Last edited by Dormilich; Jun 17 '09, 05:35 AM. Reason: fixed code tags
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    I am not an expert but hope I can help you spin it in the right direction:-)

    What is not working?

    And why do you need to re-write your schema?

    Comment

    • meghna2210
      New Member
      • Jun 2009
      • 8

      #3
      Crystal report to XML

      i saw this topic and i need a similiar kind of help

      I have an issue where i need to parse crystal report file and convert it into XML code.

      Moreover , i wish to explore as RDL in reporting services is in XML , lik wise crystal supports which language , is it html?

      I need to convert that crystal report into RDL in reporting sevrices which is actually XML code.

      so i basically need a parser which converts Crystal to RDL or if its not available i need some basic stuff which help me to write code or aany Program which converts cyrstal report supporting language in to XML code.

      NY help would be highly appreciated!

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        what does the crystal report file look like?

        Comment

        • meghna2210
          New Member
          • Jun 2009
          • 8

          #5
          Please find the attachment which shows u how the crytal report looks like.
          Attached Files

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            the problem is to get a program reading the file… isn't in Crystal an export function to HTML or text?

            Comment

            • meghna2210
              New Member
              • Jun 2009
              • 8

              #7
              Here u go ..its a html code of the attached report .....!!!

              I want its XML code ,can u help?
              Attached Files

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                ideally, they would output it in XHTML, then there would be no problem. but with a little luck this file may parse as XML (non-validating).

                I could imagine reading this HTML with Javascript and saving as X(HT)ML…

                Comment

                • meghna2210
                  New Member
                  • Jun 2009
                  • 8

                  #9
                  this was just a demo file which i showed u.

                  i really need some stuff where i can convert this HTML code to XML , is there any free convertors available that you have come across ?

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #10
                    let's put it this way… if you quote all attribute values (<tr valign=top> → <tr valign="top">), add the attribute values where missing (<td nowrap> → <td nowrap="nowrap" >) close all empty elements (<br> → <br/>) and prepend an XML prolog, then you have XML.

                    one of the most simple ways to do this is using Regular Expressions and the appropriate string replace function of your favourite script language.
                    Last edited by Dormilich; Jun 17 '09, 12:47 PM. Reason: added RegEx

                    Comment

                    • meghna2210
                      New Member
                      • Jun 2009
                      • 8

                      #11
                      yeah that s true but i want some automated function or program which does this.

                      Comment

                      • Dormilich
                        Recognized Expert Expert
                        • Aug 2008
                        • 8694

                        #12
                        any decent script language should be capable to do so.

                        it should also be not too complicated to convert the CSV output to XML.

                        Comment

                        Working...