我正在从数据库中获取xml并使用Spring boot将其发送回json reposne中,但格式不正确.xml附加了\ n和空格
响应正文(JSON):
{
"environment":null,
"policyNo":null,
"latestXML":null,
"interfaceMessageId":null,
"product":null,
"productCode":null,
"shortName":null,
"xml":"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<TXLife xmlns:txr=\"http://ACORD.org/Standards/Life/2\">\n <TXLifeRequest PrimaryObjectID=\"Holding_0001\">\n <TransRefGUID>ID_323533B1-AE2A-A6EE-96FA-F1912312220D02E0F</TransRefGUID>\n <TransType tc=\"103\">New Business Submission</TransType>\n <TransSubType tc=\"1015700001\"/>\n <TransExeDate>2018-03-26</TransExeDate>\n <TransExeTime>06:34:07-05:00</TransExeTime>\n <TransMode tc=\"2\">ORIGINAL</TransMode>\n <TestIndicator tc=\"1\">True</TestIndicator>\n <OLifE Version=\"2.22.0\">\n <SourceInfo>\n <SourceInfoName>E-App</SourceInfoName>\n <FileControlID>ELIXIR</FileControlID>\n </SourceInfo>\n <FormInstance ProviderPartyID=\"VP00001\" id=\"FormInstance1\">\n <FormName>IndividualLifeApplicationForm</FormName>\n <QuestionNumber>substanceUsageTreatment</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>studentOrLicensedPilot</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>otherSportsActivities</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>driverLicenseOrMovingDUIViolations</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>felonyConviction</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>servingProbation</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>aidsArcHiv</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>diagnosticAdvice</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>treatmentAdvice</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>nursingCare</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>wheelChair</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>assistanceDailyLiving</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>sleepApnea</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>bloodRelatedProblems</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>cancerRelatedProblem</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>breathRelatedProblem</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>neurologicalProblem</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>mentalHealthProblem</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>digestiveSystemProblem</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>smokerHistory</QuestionNumber>\n <ResponseText>N</ResponseText>\n <SectionIdentifier>16</SectionIdentifier>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>alcoholUsage</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>otherInsApplications</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>highCholesterol</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>arthritisProblem</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>extendedTimeOffWork</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderMedicalDiagnosed</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderMedicalNotTreated</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderHyperactivity-ADD</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderFAS-Down</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderAnorexiaBulimiaSucide</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderAIDS-ARC</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderCancerHepatits</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderLungHeartDisorders</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderTestsNotStartedOrIncomplete</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>piMilitaryDutyOrReserves</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>lastOtherPhysicians</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>alcoholDrinksPerOccasion</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>alcoholDrinksPerWeek</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>ownTypeOfID</QuestionNumber>\n <ResponseText>DriverLicense</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>ownOtherGovID</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>otherInsurance</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>childRiderAdditionalInfo</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>modifiedCoverage</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>modificationDate</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>modificationReason</QuestionNumber>\n <ResponseText/>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>pcVerifyIdentityPersonally</QuestionNumber>\n <ResponseText>Y</ResponseText>\n </FormResponse>\n <FormResponse>\n <QuestionNumber>personalPhysicianExists</QuestionNumber>\n <ResponseText>N</ResponseText>\n </FormResponse>\n <FormResponse>\n \n <Coverage id=\"ID_1F5BF4D1-C46B-4675-8289-6CAC901F511E\">\n <PlanName>Foresters Your Term</PlanName>\n <ShortName>Foresters Your Term</ShortName>\n <MarketingName>Foresters Your Term</MarketingName>\n <ProductCode>T25X17</ProductCode>\n <LifeCovStatus tc=\"8\">PENDING</LifeCovStatus>\n <LifeCovTypeCode tc=\"6\">Level Term</LifeCovTypeCode>\n <IndicatorCode tc=\"1\">BASE</IndicatorCode>\n <CurrentAmt>200000.0</CurrentAmt>\n <InitCovAmt>200000.0</InitCovAmt>\n <CovOption id=\"COVOPTN001\">\n <PlanName>Accidental Death Rider</PlanName>\n <RoutingNum>064000017</RoutingNum>\n <BankName>Bank1</BankName>\n </Banking>\n </Holding>\n </OLifE>\n </TXLifeRequest>\n</TXLife>"
}
答案 0 :(得分:0)
在分配XML字符串之前,您应该替换所有空格和\ n \ r \ t。