Connecting Tech Pros Worldwide Forums | Help | Site Map

I need an Expert.

Newbie
 
Join Date: Jul 2007
Posts: 2
#1: Jul 18 '07
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)
Expand|Select|Wrap|Line Numbers
  1. [b]<?xml version="1.0" encoding="UTF-8" ?> 
  2. - <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">
  3. - <ReportArea Level="0" Type="Report" ReportDate="">
  4. - <Items Type="Header">
  5.   <Text>7/18/2007</Text> 
  6.   </Items>
  7. - <Item Level="1" Type="Details">
  8.   <strPartNumber FieldName="{STOCK.PARTNUMBER}">004-351-0</strPartNumber> 
  9.   <strNomenclature FieldName="{STOCK.DESCRIPTN}">TIRE</strNomenclature> 
  10.   <strQuantity FieldName="{STOCK.QTY_INSTOCK}">1.00</strQuantity> 
  11.   <strSafetyLevel FieldName="{STOCK.MINQTYLEVEL}">0.00</strSafetyLevel> 
  12.   <strASL FieldName="{STOCK.MAXQTYLEVEL}">1.00</strASL>
  13.  
(This is how I need it to be)
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" ?> 
  2. - <BSASStock:StockStatus xmlns:BSASStock="http://www.w3.org/2001/XMLSchema-instance" reportDate="2007-06-01" BSASStock:schemaLocation="BSAS-Stock.xsd">
  3. - <Items>
  4. - <item strPartNumber="01-P24481F001">
  5.   <strNomenclature>"POWER CONTROL PTRA200"</strNomenclature> 
  6.   <strQuantity>"4"</strQuantity> 
  7.   <strSafetyLevel>"3"</strSafetyLevel> 
  8.   <strASL>"6"</strASL> 
  9.   </item>
  10. - <item strPartNumber="01-P25390B002">
  11.   <strNomenclature>"SATCOM REMOTE CONTROL"</strNomenclature> 
  12.   <strQuantity>"3"</strQuantity> 
  13.   <strSafetyLevel>"7"</strSafetyLevel> 
  14.   <strASL>"13"</strASL> 
  15.   </item>
  16.  
MY SCHEMA
Expand|Select|Wrap|Line Numbers
  1.  <?xml version="1.0" encoding="UTF-8" ?> 
  2. - <xsd:schema xmlns="urn:crystal-reports:schemas" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" targetNamespace="urn:crystal-reports:schemas" elementFormDefault="qualified">
  3. - <xsd:attributeGroup name="FieldAttributes">
  4.   <xsd:attribute name="FieldName" type="xsd:string" /> 
  5.   </xsd:attributeGroup>
  6. - <xsd:complexType name="DecimalFieldBaseType">
  7. - <xsd:simpleContent>
  8. - <xsd:extension base="xsd:decimal">
  9.   <xsd:attributeGroup ref="FieldAttributes" /> 
  10.   <xsd:anyAttribute namespace="##any" /> 
  11.   </xsd:extension>
  12.   </xsd:simpleContent>
  13.   </xsd:complexType>
  14. - <xsd:complexType name="FloatFieldBaseType">
  15. - <xsd:simpleContent>
  16. - <xsd:extension base="xsd:float">
  17.   <xsd:attributeGroup ref="FieldAttributes" /> 
  18.   <xsd:anyAttribute namespace="##any" /> 
  19.   </xsd:extension>
  20.   </xsd:simpleContent>
  21.   </xsd:complexType>
  22. - <xsd:complexType name="StringFieldBaseType">
  23. - <xsd:simpleContent>
  24. - <xsd:extension base="xsd:string">
  25.   <xsd:attributeGroup ref="FieldAttributes" /> 
  26.   <xsd:anyAttribute namespace="##any" /> 
  27.   </xsd:extension>
  28.   </xsd:simpleContent>
  29.   </xsd:complexType>
  30. - <xsd:complexType name="DateFieldBaseType">
  31. - <xsd:simpleContent>
  32. - <xsd:extension base="xsd:date">
  33.   <xsd:attributeGroup ref="FieldAttributes" /> 
  34.   <xsd:anyAttribute namespace="##any" /> 
  35.   </xsd:extension>
  36.   </xsd:simpleContent>
  37.   </xsd:complexType>
  38. - <xsd:complexType name="TimeFieldBaseType">
  39. - <xsd:simpleContent>
  40. - <xsd:extension base="xsd:time">
  41.   <xsd:attributeGroup ref="FieldAttributes" /> 
  42.   <xsd:anyAttribute namespace="##any" /> 
  43.   </xsd:extension>
  44.   </xsd:simpleContent>
  45.   </xsd:complexType>
  46. - <xsd:complexType name="DateTimeFieldBaseType">
  47. - <xsd:simpleContent>
  48. - <xsd:extension base="xsd:timeInstant">
  49.   <xsd:attributeGroup ref="FieldAttributes" /> 
  50.   <xsd:anyAttribute namespace="##any" /> 
  51.   </xsd:extension>
  52.   </xsd:simpleContent>
  53.   </xsd:complexType>
  54. - <xsd:complexType name="BoolFieldBaseType">
  55. - <xsd:simpleContent>
  56. - <xsd:extension base="xsd:boolean">
  57.   <xsd:attributeGroup ref="FieldAttributes" /> 
  58.   <xsd:anyAttribute namespace="##any" /> 
  59.   </xsd:extension>
  60.   </xsd:simpleContent>
  61.   </xsd:complexType>
  62. - <xsd:complexType name="PictureBaseType">
  63.   <xsd:attribute name="gtype" type="xsd:string" /> 
  64.   <xsd:attribute name="src" type="xsd:string" /> 
  65.   <xsd:anyAttribute namespace="##any" /> 
  66.   </xsd:complexType>
  67. - <xsd:complexType name="RowTotalBaseType">
  68. - <xsd:simpleContent>
  69. - <xsd:extension base="xsd:string">
  70.   <xsd:attribute name="RowNumber" type="xsd:integer" use="required" /> 
  71.   </xsd:extension>
  72.   </xsd:simpleContent>
  73.   </xsd:complexType>
  74. - <xsd:complexType name="ColumnTotalBaseType">
  75. - <xsd:simpleContent>
  76. - <xsd:extension base="xsd:string">
  77.   <xsd:attribute name="ColumnNumber" type="xsd:integer" use="required" /> 
  78.   </xsd:extension>
  79.   </xsd:simpleContent>
  80.   </xsd:complexType>
  81. - <xsd:complexType name="BSASStockStatusType">
  82. - <xsd:sequence>
  83.   <xsd:element name="ReportArea" type="ReportAreaType" /> 
  84.   </xsd:sequence>
  85.   </xsd:complexType>
  86. - <xsd:complexType name="ItemType">
  87. - <xsd:sequence>
  88.   <xsd:element name="strPartNumber" type="StringFieldBaseType" /> 
  89.   <xsd:element name="strNomenclature" type="StringFieldBaseType" /> 
  90.   <xsd:element name="strQuantity" type="FloatFieldBaseType" /> 
  91.   <xsd:element name="strSafetyLevel" type="FloatFieldBaseType" /> 
  92.   <xsd:element name="strASL" type="FloatFieldBaseType" /> 
  93.   </xsd:sequence>
  94.   <xsd:attribute name="Level" type="xsd:integer" use="required" /> 
  95.   <xsd:attribute name="Type" type="xsd:string" use="required" /> 
  96.   </xsd:complexType>
  97. - <xsd:complexType name="ItemsType">
  98. - <xsd:choice minOccurs="0" maxOccurs="unbounded">
  99. - <xsd:sequence>
  100.   <xsd:element name="Text" type="xsd:string" /> 
  101.   </xsd:sequence>
  102.   </xsd:choice>
  103.   <xsd:attribute name="Type" type="xsd:string" use="required" /> 
  104.   </xsd:complexType>
  105. - <xsd:complexType name="ReportAreaType">
  106. - <xsd:sequence>
  107.   <xsd:element name="Items" type="ItemsType" /> 
  108. - <xsd:sequence minOccurs="1" maxOccurs="unbounded">
  109.   <xsd:element name="Item" type="ItemType" /> 
  110.   </xsd:sequence>
  111.   <xsd:element name="Items" type="ItemsType" /> 
  112.   </xsd:sequence>
  113.   <xsd:attribute name="Level" type="xsd:integer" use="required" /> 
  114.   <xsd:attribute name="Type" type="xsd:string" use="required" /> 
  115.   <xsd:attribute name="ReportDate" type="xsd:date" use="default" value="" /> 
  116.   </xsd:complexType>
  117.   <xsd:element name="BSASStockStatus" type="BSASStockStatusType" /> 
  118.   </xsd:schema>
Original Schema

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8" ?> 
  2. - <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:BSASStock="http://www.BSAS.com" targetNamespace="http://www.BSAS.com" elementFormDefault="unqualified" attributeFormDefault="unqualified">
  3. - <annotation>
  4.   <documentation>Created as a test specification for sending of BSAS Stock Data to Army Copyright 2007 (c) BSAS - All rights reserved.</documentation> 
  5.   </annotation>
  6.   <element name="StockStatus" type="BSASStock:StockStatusType" /> 
  7. - <complexType name="StockStatusType">
  8. - <sequence>
  9.   <element name="Items" type="BSASStock:ItemsType" /> 
  10.   </sequence>
  11.   <attribute name="reportDate" type="date" /> 
  12.   </complexType>
  13. - <complexType name="ItemsType">
  14. - <sequence>
  15. - <element name="item" minOccurs="0" maxOccurs="unbounded">
  16. - <complexType>
  17. - <sequence>
  18.   <element name="strNomenclature" type="string" /> 
  19.   <element name="strQuantity" type="string" /> 
  20.   <element name="strSafetyLevel" type="string" /> 
  21.   <element name="strASL" type="string" /> 
  22.   <element name="strVendor" type="string" /> 
  23.   </sequence>
  24.   <attribute name="strPartNumber" type="string" /> 
  25.   </complexType>
  26.   </element>
  27.   </sequence>
  28.   </complexType>
  29.   </schema>
  30.  
I apologize for the length this is my first time use.

Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#2: Jul 24 '07

re: I need an Expert.


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?
Newbie
 
Join Date: Jun 2009
Posts: 8
#3: Jun 16 '09

re: I need an Expert.


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!
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,652
#4: Jun 17 '09

re: I need an Expert.


what does the crystal report file look like?
Newbie
 
Join Date: Jun 2009
Posts: 8
#5: Jun 17 '09

re: I need an Expert.


Please find the attachment which shows u how the crytal report looks like.
Attached Files
File Type: zip Report1.zip (3.4 KB, 2 views)
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,652
#6: Jun 17 '09

re: I need an Expert.


the problem is to get a program reading the file… isn't in Crystal an export function to HTML or text?
Newbie
 
Join Date: Jun 2009
Posts: 8
#7: Jun 17 '09

re: I need an Expert.


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

I want its XML code ,can u help?
Attached Files
File Type: zip Report1.zip (433 Bytes, 3 views)
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,652
#8: Jun 17 '09

re: I need an Expert.


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…
Newbie
 
Join Date: Jun 2009
Posts: 8
#9: Jun 17 '09

re: I need an Expert.


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 ?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,652
#10: Jun 17 '09

re: I need an Expert.


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.
Newbie
 
Join Date: Jun 2009
Posts: 8
#11: Jun 17 '09

re: I need an Expert.


yeah that s true but i want some automated function or program which does this.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,652
#12: Jun 17 '09

re: I need an Expert.


any decent script language should be capable to do so.

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