2011-09-28 3 views
2

JAXB (2.2.13)를 사용하여 만든 소스 XML 파일을 전달하여 FOP (0.95)를 사용하여 문서를 생성합니다. 실제로 실행할 때 실제로 PDF가 생성됩니다. 데이터 소스 XML에 제공되지 않았던 경우는 내가 기대했던 모양)와 유일한 로그 출력은 다음과 같습니다JAXB와 함께 사용할 때 데이터를 사용하지 않는 FOP

DEBUG [FOP] target-resolution set to: 72.0dpi (px2mm=0.35277778) 
INFO [org.apache.fop.layoutmgr.table.TableLayoutManager] table-layout="fixed" and width="auto", but auto-layout not supported => assuming width="100%" 
WARN [org.apache.fop.layoutmgr.PageBreakingAlgorithm] Part/page 0 overflows the available area in block-progression dimension. (fo:static-content, no context info available) 

을하지만 난 패키지 정보의 라인

@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.blah.com/ctms/Comparison") 

을 주석 처리합니다. JAXB에 의해 내 XSD에서 생성 된 Java 파일을 다시 컴파일하면 PDF가 올바르게 생성됩니다.

아무것도 만들지 않고 생성 된 JAXB 코드를 사용할 수 있도록 변경해야 할 분명한 변경이 있습니까? 아니면 디버깅을 통해 어떤 일이 일어나는지 확인할 수 있습니까?

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pi="http://www.blah.com/ctms/Comparison" targetNamespace="http://www.blah.com/ctms/Comparison" elementFormDefault="unqualified"> 
<xs:element name="comparison"> 
    <xs:annotation> 
     <xs:documentation>Document containing comparison data for report</xs:documentation> 
    </xs:annotation> 
    <xs:complexType> 
     <xs:sequence> 
      <xs:element name="sub-category" type="pi:sub-category" minOccurs="0" maxOccurs="unbounded"/> 
      <xs:element name="import-id" type="xs:string"/> 
      <xs:element name="row-no" type="xs:string"/> 
      <xs:element name="investigator-no" type="xs:string"/> 
      <xs:element name="clinical-personnel-name" type="xs:string"/> 
      <xs:element name="report-footer-message" type="xs:string"/> 
      <xs:element name="checklist" type="pi:checklist" minOccurs="0" maxOccurs="unbounded"/> 
    <xs:element name="properties" type="pi:properties" minOccurs="0" maxOccurs="1"/> 
     </xs:sequence> 
    </xs:complexType> 
</xs:element> 
<xs:complexType name="field-type"> 
    <xs:sequence> 
     <xs:element name="importValue" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> 
     <xs:element name="existingValue" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> 
    </xs:sequence> 
    <xs:attribute name="name" type="xs:string" use="required"/> 
</xs:complexType> 
<xs:complexType name="record-type"> 
    <xs:sequence> 
     <xs:element name="field" type="pi:field-type" minOccurs="0" maxOccurs="unbounded"/> 
    </xs:sequence> 
</xs:complexType> 
<xs:complexType name="sub-category"> 
    <xs:sequence> 
    <xs:element name="record" type="pi:record-type" minOccurs="0" maxOccurs="unbounded"/> 
    <xs:element name="message" type="xs:string" minOccurs="0" maxOccurs="1"/> 
    </xs:sequence> 
    <xs:attribute name="name" type="xs:string" use="required"/> 
</xs:complexType> 
<xs:complexType name="checklist"> 
    <xs:sequence> 
     <xs:element name="checklist-no" type="xs:string"/> 
     <xs:element name="checklist-title" type="xs:string"/> 
     <xs:element name="checklist-description" type="xs:string"/> 
     <xs:element name="checklist-status" type="xs:string"/> 
     <xs:element name="completed-by" type="xs:string"/> 
     <xs:element name="completed-date" type="xs:string"/> 
     <xs:element name="question-item" type="pi:question-item" maxOccurs="unbounded"/> 
    </xs:sequence> 
</xs:complexType> 
<xs:complexType name="question-item"> 
    <xs:sequence> 
     <xs:element name="item-desc" type="xs:string"/> 
     <xs:element name="response" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> 
     <xs:element name="item-no" type="xs:string"/> 
    </xs:sequence> 
</xs:complexType> 

다음은 생성 된 XML의 예는 다음과 같습니다 :

내 XSD이다

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<ns2:comparison xmlns:ns2="http://www.blah.com/ctms/Comparison"> 
    <sub-category name="Specialist Fields"> 
     <record> 
      <field name="Specialist Field"> 
       <importValue>Adult Endocrinologist [AE]</importValue> 
       <existingValue>Adult Endocrinologist [AE]</existingValue> 
      </field> 
      <field name="Key Opinion Leader"> 
       <importValue></importValue> 
       <existingValue>No</existingValue> 
      </field> 
      <field name="Board Certification"> 
       <importValue></importValue> 
       <existingValue>Yes</existingValue> 
      </field> 
     </record> 
     <record> 
      <field name="Specialist Field"> 
       <importValue>Cardiac Surgeon [CS]</importValue> 
       <existingValue>Cardiac Surgeon [CS]</existingValue> 
      </field> 
      <field name="Key Opinion Leader"> 
       <importValue></importValue> 
       <existingValue>No</existingValue> 
      </field> 
      <field name="Board Certification"> 
       <importValue>No</importValue> 
       <existingValue>Yes</existingValue> 
      </field> 
     </record> 
    </sub-category> 
    <sub-category name="Clinical Personnel Address"> 
     <record> 
      <field> 
       <importValue>2-Line 1</importValue> 
       <importValue>Florida [US-FL]</importValue> 
       <importValue>United States of America [USA]</importValue> 
      </field> 
     </record> 
     <record> 
      <field> 
       <existingValue>Line 1</existingValue> 
       <existingValue>Florida [US-FL]</existingValue> 
       <existingValue>United States of America [USA]</existingValue> 
      </field> 
     </record> 
    </sub-category> 
    <sub-category name="Membership Information"> 
     <record> 
      <field name="Association/Society"> 
       <importValue>The Dennis the Menace Fan Club</importValue> 
      </field> 
      <field> 
       <existingValue>Tufty Club</existingValue> 
      </field> 
     </record> 
    </sub-category> 
    <sub-category name="Centre"> 
     <record> 
      <field name="Centre"> 
       <existingValue>Centre Name 313</existingValue> 
       <existingValue>Address Line 1 for Cneter 313</existingValue> 
       <existingValue>Address Line 2 for Cneter 313</existingValue> 
       <existingValue>Address Line 3 for Cneter 313</existingValue> 
       <existingValue>Address Line 4 for Cneter 313</existingValue> 
       <existingValue>Centre Town City 313</existingValue> 
       <existingValue>P_C 313</existingValue> 
       <existingValue>ZZ Country CA0................ [CA0]</existingValue> 
      </field> 
      <field> 
       <existingValue>Centre Name 312</existingValue> 
       <existingValue>Address Line 1 for Cneter 312</existingValue> 
       <existingValue>Address Line 2 for Cneter 312</existingValue> 
       <existingValue>Address Line 3 for Cneter 312</existingValue> 
       <existingValue>Address Line 4 for Cneter 312</existingValue> 
       <existingValue>Centre Town City 312</existingValue> 
       <existingValue>P_C 312</existingValue> 
       <existingValue>ZZ Country CA0................ [CA0]</existingValue> 
      </field> 
     </record> 
     <message>The system identified 2 Centres as being a potential match to the imported Centre details and therefore both the imported Centre and each Centre associated to the existing Clinical Personnel is listed below.</message> 
    </sub-category> 
    <sub-category name="Clinical Personnel"> 
     <record> 
      <field name="Investigator Alias Code"> 
       <importValue>5656</importValue> 
       <existingValue>545</existingValue> 
      </field> 
      <field name="Title"> 
       <existingValue>Mrs</existingValue> 
      </field> 
     </record> 
    </sub-category> 
    <sub-category name="Therapeutic Interests"> 
     <record> 
      <field name="Therapeutic Group/Interest"> 
       <importValue>Therapeutic Interest Group Descripti Max [ABCDEFZ]/Therapeutic Interest Description 012 Max [ABCDEFZ]</importValue> 
      </field> 
     </record> 
    </sub-category> 
    <sub-category name="Fraud and Misconduct Events"> 
     <record> 
      <field name="Event"> 
       <importValue>Very Bad Things [VBAD]</importValue> 
       <existingValue>Very Bad Things [VBAD]</existingValue> 
      </field> 
      <field name="Event Date"> 
       <importValue>10-Jan-2011</importValue> 
       <existingValue>01-Sep-2011</existingValue> 
      </field> 
     </record> 
     <record> 
      <field name="Event"> 
       <importValue>Bad Things [BAD]</importValue> 
       <existingValue>Bad Things [BAD]</existingValue> 
      </field> 
      <field name="Event Date"> 
       <importValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> 
       <existingValue>22-Sep-2011</existingValue> 
      </field> 
     </record> 
     <record> 
      <field name="Event"> 
       <existingValue>Extremely Bad Things [EBAD]</existingValue> 
      </field> 
      <field name="Event Date"> 
       <existingValue>14-Sep-2011</existingValue> 
      </field> 
     </record> 
    </sub-category> 
    <import-id>30</import-id> 
    <row-no>2</row-no> 
    <investigator-no>153</investigator-no> 
    <clinical-personnel-name>Mrs B B SPECIALIST</clinical-personnel-name> 
    <report-footer-message>Report Produced at 28-09-2011 09:42 by Mr Installation</report-footer-message> 
    <properties><property key="heading.clinicalPersonnelComparisonReport">Clinical Personnel Comparison Report</property><property key="heading.importId">Import Id</property><property key="heading.recordNo">Record No</property><property key="heading.existingDuplicateClinicalPersonnel">Existing Duplicate Clinical Personnel</property><property key="heading.clinicalPersonnelComparisonReportTitle">This report details the differences which exist between the imported Clinical Personnel and the existing master Clinical Personnel.</property><property key="heading.clinicalPersonnelComparisonReportTitleNoDifferences">No differences exist between the imported Clinical Personnel and the existing master Clinical Personnel.</property><property key="heading.followingClinicalPersonnelDetailsDiffer">The following Clinical Personnel details differ:-</property><property key="heading.clinicalPersonnelDetails">Clinical Personnel Details</property><property key="heading.itemName">Item Name</property><property key="heading.importValue">Import Value</property><property key="heading.existingClinicalPersonnelValue">Existing Clinical Personnel Value</property><property key="heading.addressDetails">Address Details</property><property key="heading.noDifferencesIdentified">No differences identified</property><property key="heading.addressType">Address Type</property><property key="heading.field">Field</property><property key="heading.importAddress">Import Address</property><property key="heading.existingClinicalPersonnelAddress">Existing Clinical Personnel Address</property><property key="heading.fraudMisconduct">Fraud and Misconduct</property><property key="heading.event">Event</property><property key="heading.eventDate">Event Date</property><property key="heading.associatedCentre">Associated Centre</property><property key="heading.importCentre">Import Centre</property><property key="heading.existingClinicalPersonnelCentre">Existing Clinical Personnel Centre</property><property key="heading.specialistsFields">Specialist Fields</property><property key="heading.therapeuticInterests">Therapeutic Interests</property><property key="heading.therapeuticGroupInterest">Therapeutic Group/Interest</property><property key="heading.membershipInformation">Membership Information</property><property key="heading.invMembershipsInformationMembership">Association/Society</property><property key="heading.investigatorNo">Investigator No</property><property key="heading.existingClinicalPersonnelChecklists">Existing Clinical Personnel Checklist(s)</property><property key="heading.checklistNo">Checklist No</property><property key="heading.title">Title</property><property key="heading.description">Description</property><property key="heading.status">Status</property><property key="heading.completedBy">Completed By</property><property key="heading.completedDate">Completed Date</property><property key="heading.question">Question</property><property key="heading.response">Response</property></properties> 
</ns2:comparison> 


업데이트 나는 또한 XSD에 elementFormDefault="qualified" 설정을 시도하지만 (나는 위의 파일을했습니다 유일한 편집 "ㅋ"내 작업의 이름을 대체하는 것입니다) 도움이되지 않습니다 (생성 된 XML이 "ns2"네임 스페이스 접두사를 잃어 버리지 만)

답변

1

XSL-FO는 어떻게 작성합니까? 일부 XSLT 변환? 이 변환이 기본 네임 스페이스의 문서를 기대하는 것처럼 보입니다. 당신이 그대로 XSLT를 유지하려면

  • , 당신은 namespaceless로 스키마를 변경해야이 그렇다면

    다음이 approch 두 가지 방법이있다.

  • XSLT를 변경하는 것이 좋으면 빈 네임 스페이스 대신 네임 스페이스에서 요소를 처리하도록하십시오. elementFormDefault="qualified"attributeFormDefault="unqualified"을 사용하십시오. 이는 일반적인 관행입니다.

결정은 주로 당신의 스키마의 네임 스페이스에 관심이 있다면 질문에 기반합니다. 그렇지 않으면, 첫 번째 방법은 적은 노력으로 비용이 들게됩니다. 나 개인적으로, 나는 두 번째 옵션을 선택할 것이고, 나는 네임 스페이스가 중요하다고 생각한다.

또 다른 방법은 네임 스페이스를 유지하면서 FOP로 렌더링하기 전에 XSLT를 사용하여 드롭하는 것입니다.

+0

예, 코드는 XSLT를 사용하고있어 기꺼이 변경합니다. 두 번째 방법을 시도해 보겠습니다. –

+0

불행히도 두 번째 방법은 저에게 효과적이지 않았습니다. 결국 나는 네임 스페이스를 제거하는 것을 끝냈는데, 그 이유는 주로 마감일에 있기 때문에 이것은 응용 프로그램의 순수한 내부 공간이므로 네임 스페이스의 부족은 별 문제가되지 않습니다. 감사 –

관련 문제