xml - Java SAX Parse Exception: Content is not allowed in trailing section -
i'm trying parse simple xml document sax, , following error:
org.xml.sax.saxparseexception: content not allowed in trailing section.
i've checked xml , seems fine, there nothing (not white space) after closing tag. how i'm starting parsing (although don't think there should probleme that...):
saxparserfactory spf = saxparserfactory.newinstance(); saxparser sp = spf.newsaxparser(); xmlreader xr = sp.getxmlreader(); xr.setcontenthandler(new slatemplateparsinghandler(this, xr)); inputsource = new inputsource(); is.setcharacterstream(new stringreader(xml.trim())); xr.parse(is);
any ideas wrong?
thanks,
ivan
edit: i've used w3schools xml validator check xml , says has no errors.
here xml:
<?xml version='1.0' encoding='utf-8' ?> <sla xmlns="http://www.ibm.com/wsla" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.ibm.com/wsla wsla.xsd" name="sample wsla document" > <parties> <serviceprovider name="service_provider"> <!-- should filled --> </serviceprovider> <serviceconsumer name="service_consumer"> <!-- should filled --> </serviceconsumer> </parties> <servicedefinition name='sampleservice'> <schedule name='businessdayschedule'> <period> <start>2008-11-02t20:50:00</start> <end>2009-11-20t20:50:00</end> </period> <interval> <milliseconds>4000</milliseconds> </interval> </schedule> <schedule name="hourlyschedule"> <period> <start>2008-11-30t14:00:00.000-05:00</start> <end>2008-12-31t14:00:00.000-05:00</end> </period> <interval> <minutes>60</minutes> </interval> </schedule> <schedule name="availabilityschedule"> <period> <start>2008-11-30t14:00:00.000-05:00</start> <end>2008-12-31t14:00:00.000-05:00</end> </period> <interval> <minutes>1</minutes> </interval> </schedule> <schedule name="5minuteschedule"> <period> <start>2008-11-30t14:00:00.000-05:00</start> <end>2008-12-31t14:00:00.000-05:00</end> </period> <interval> <minutes>5</minutes> </interval> </schedule> <wsdlsoapoperation name='sampleoperation'> <!-- sla parameters --> <!-- current usage of cpu (for process) --> <slaparameter name="performance" type="double" unit="khz"> <!-- possible mapping hz --> <metric>performance_metric</metric> </slaparameter> <!-- cpu clock speed --> <slaparameter name="clockspeed" type="double" unit="mhz"> <!-- possible mapping ghz --> <metric>clockspeed_metric</metric> </slaparameter> <!-- total memory consumption --> <slaparameter name="totalmemoryconsumption" type="double" unit="mbit"> <!-- possible mapping kbit --> <metric>total_memory_consumption_metric</metric> </slaparameter> <!-- response time --> <slaparameter name="responsetime" type="double" unit="milliseconds"> <!-- possible mapping seconds --> <metric>response_time_metric</metric> </slaparameter> <!-- availability --> <slaparameter name="availability" type="double" unit="percent"> <metric>availability_metric</metric> </slaparameter> <!-- overload percentage --> <slaparameter name="overloadpercentage" type="float" unit="percent"> <metric>overload_percentage_metric</metric> </slaparameter> <!-- transaction rate (transactions/hour) --> <!-- possible mapping transactions/second --> <slaparameter name="transactionrate" type="float" unit="transactions/hour"> <metric>transactions_metric</metric> </slaparameter> <!-- availability - current downtime --> <slaparameter name="av_currentdowntime" type="long" unit="minutes"> <!-- possible mapping hours --> <metric>current_down_time_metric</metric> </slaparameter> <!-- availability - uptime ratio --> <slaparameter name="av_uptimeratio" type="float"> <metric>up_time_ratio_metric</metric> </slaparameter> <!-- error rate (the total number of internal server errors divided total number of requests during fice minute period) --> <slaparameter name="errorrate" type="float"> <metric>error_rate_metric</metric> </slaparameter> <!-- number of cpu cores --> <slaparameter name="cpucores" type="long"> <metric>cpu_cores_metric</metric> </slaparameter> <!-- metrics --> <!-- total memory consumption --> <metric name="total_memory_consumption_metric" type="double" unit="mbit"> <source>serviceprovider</source> <measurementdirective resulttype="double" xsi:type="statusrequest"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> <!-- <metric name="usage_cost_metric" type="double" unit="euro"> <source>serviceprovider</source> <function resulttype="double" xsi:type="times"> <operand> <metric> total_memory_consumption_metric </metric> </operand> <operand> <constant> usagecostperunitineuro </constant> </operand> </function> </metric> --> <!-- <metric name="penalty_cost_metric" type="long" unit="euro"> <source>serviceprovider</source> <measurementdirective resulttype="double" xsi:type="statusrequest"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> --> <!-- cpu used process --> <metric name="performance_metric" type="double" unit="khz"> <source>serviceprovider</source> <function resulttype="double" xsi:type="times"> <operand> <metric>process_cpu_load_metric</metric> </operand> <operand> <function resulttype="double" xsi:type="divide"> <operand> <metric>clock_speed_metric</metric> </operand> <operand> <longscalar>100</longscalar> </operand> </function> </operand> </function> </metric> <!-- available clock speed --> <metric name="clockspeed_metric" type="double" unit="mhz"> <source>serviceprovider</source> <function resulttype="double" xsi:type="times"> <operand> <metric>clock_speed_metric</metric> </operand> <operand> <longscalar>1</longscalar> </operand> </function> </metric> <!-- percentage of cpu-usage process --> <metric name="process_cpu_load_metric" type="double" unit="percent"> <source>serviceprovider</source> <measurementdirective resulttype="double" xsi:type="statusrequest"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> <!-- clock speed of cpu process running on --> <metric name="clock_speed_metric" type="double" unit="mhz"> <source>serviceprovider</source> <measurementdirective resulttype="double" xsi:type="statusrequest"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> <!-- space free use on storage device --> <!-- <metric name="free_diskspace" type="double" unit="percent"> <source>serviceprovider</source> <measurementdirective resulttype="double" xsi:type="statusrequest"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> --> <!-- space used specific customer --> <!-- <metric name="user_diskspace" type="double" unit="ghz"> <source>serviceprovider</source> <measurementdirective resulttype="double" xsi:type="statusrequest"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> --> <!-- availability --> <metric name="availability_metric" type="double" unit="percent"> <source>serviceprovider</source> <measurementdirective resulttype="double" xsi:type="statusrequest"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> <!-- overload percentage --> <metric name="overload_percentage_metric" type="float" unit="percent"> <source>serviceprovider</source> <function xsi:type="percentagegreaterthanthreshold" resulttype="float"> <metric>utilizationtimeseries</metric> <value> <floatscalar>0.8</floatscalar> <!-- 80% --> </value> </function> </metric> <metric name="utilizationtimeseries" type="ts"> <source>serviceprovider</source> <function xsi:type="tsconstructor" resulttype="float"> <schedule>businessdayschedule</schedule> <metric>probedutilization</metric> <window>12</window> </function> </metric> <metric name="probedutilization" type="float"> <source>serviceprovider</source> <measurementdirective xsi:type="gauge" resulttype="float"> <measurementuri> ***unused*** </measurementuri> </measurementdirective> </metric> <!-- transactions --> <metric name="transactions_metric" type="long" unit="transactions/hour"> <source>serviceprovider</source> <function xsi:type="minus" resulttype="double"> <operand> <function xsi:type="tsselect" resulttype="long"> <operand> <metric>sumtransactiontimeseries</metric> </operand> <element>0</element> </function> </operand> <operand> <function xsi:type="tsselect" resulttype="long"> <operand> <metric>sumtransactiontimeseries</metric> </operand> <element>-1</element> </function> </operand> </function> </metric> <metric name="sumtransactiontimeseries" type="ts" unit="transactions"> <source>serviceprovider</source> <function xsi:type="tsconstructor" resulttype="ts"> <schedule>hourlyschedule</schedule> <metric>sumtransactions</metric> <window>2</window> </function> </metric> <!-- response time --> <metric name="response_time_metric" type="long" unit="milliseconds"> <source>serviceprovider</source> <function xsi:type="minus" resulttype="double"> <operand> <function xsi:type="tsselect" resulttype="long"> <operand> <metric>sumresponsetimetimeseries</metric> </operand> <element>0</element> </function> </operand> <operand> <function xsi:type="tsselect" resulttype="long"> <operand> <metric>sumresponsetimetimeseries</metric> </operand> <element>-1</element> </function> </operand> </function> </metric> <metric name="sumresponsetimetimeseries" type="ts" unit="milliseconds"> <source>serviceprovider</source> <function xsi:type="tsconstructor" resulttype="ts"> <schedule>hourlyschedule</schedule> <metric>sumresponsetime</metric> <window>2</window> </function> </metric> <metric name="sumtransactions" type="long" unit="tansactions"> <source>serviceprovider</source> <measurementdirective xsi:type="invocationcount" resulttype="long"/> </metric> <metric name="sumresponsetime" type="long" unit="milliseconds"> <source>serviceprovider</source> <measurementdirective xsi:type="sumresponsetime" resulttype="long"/> </metric> <!-- current down time --> <metric name="current_down_time_metric" type="long" unit="minutes"> <source>serviceprovider</source> <function xsi:type="span" resulttype="double"> <metric>statustimeseries</metric> <value> <longscalar>0</longscalar> </value> </function> </metric> <!-- uptime ratio --> <metric name="up_time_ratio_metric" type="long"> <source>serviceprovider</source> <function xsi:type="minus" resulttype="double"> <operand> <longscalar>1</longscalar> </operand> <operand> <function xsi:type="divide" resulttype="long"> <operand> <function xsi:type="valueoccurs" resulttype="long"> <metric>statustimeseries</metric> <value> <longscalar>0</longscalar> </value> </function> </operand> <operand> <longscalar>1440</longscalar> </operand> </function> </operand> </function> </metric> <metric name="statustimeseries" type="ts"> <source>serviceprovider</source> <function xsi:type="tsconstructor" resulttype="ts"> <schedule>availabilityschedule</schedule> <metric>measuredstatus</metric> <window>1440</window> </function> </metric> <metric name="measuredstatus" type="long"> <source>serviceprovider</source> <measurementdirective xsi:type="statusrequest" resulttype="integer"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> <!-- error rate --> <metric name="error_rate_metric" type="float"> <source>serviceprovider</source> <function xsi:type="tsconstructor"> <schedule>5minuteschedule</schedule> <metric>geterrorrate</metric> </function> </metric> <metric name="geterrorrate" type="float"> <source>serviceprovider</source> <function xsi:type="divide" resulttype="long"> <operand> <metric>internalerrors</metric> </operand> <operand> <metric>sumtransactions</metric> </operand> </function> </metric> <metric name="internalerrors" type="long"> <source>serviceprovider</source> <measurementdirective xsi:type="statusrequest" resulttype="integer"> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> <!-- cpu cores --> <metric name="cpu_cores_metric" type="long"> <source>serviceprovider</source> <measurementdirective xsi:type='statusrequest' resulttype='long'> <requesturi> ***unused*** </requesturi> </measurementdirective> </metric> <wsdlfile>/sla/servicedefinition[@name='sampleservice']/wsdlsoapoperation[@name='sampleoperation']/wsdlfile</wsdlfile> <soapbindingname>/sla/servicedefinition[@name='sampleservice']/wsdlsoapoperation[@name='sampleoperation']/soapbindingname</soapbindingname> <soapoperationname>/sla/servicedefinition[@name='sampleservice']/wsdlsoapoperation[@name='sampleoperation']/soapoperationname</soapoperationname> </wsdlsoapoperation> </servicedefinition> <obligations> <!-- service level objectives --> <servicelevelobjective name="performanceslo"> <obliged>service_provider</obliged> <validity> <start>2008-11-03t14:00:00</start> <end>2009-11-18t14:00:00</end> </validity> <expression> <predicate xsi:type="greater"> <slaparameter>performance</slaparameter> <value>600</value> </predicate> </expression> <evaluationevent>newvalue</evaluationevent> </servicelevelobjective> <servicelevelobjective name="responsetimeslo"> <obliged>service_provider</obliged> <validity> <start>2008-11-03t14:00:00</start> <end>2009-11-18t14:00:00</end> </validity> <expression> <predicate xsi:type="less"> <slaparameter>responsetime</slaparameter> <value>600</value> </predicate> </expression> <evaluationevent>newvalue</evaluationevent> </servicelevelobjective> <servicelevelobjective name="availabilityslo"> <obliged>service_provider</obliged> <validity> <start>2008-11-03t14:00:00</start> <end>2009-11-18t14:00:00</end> </validity> <expression> <predicate xsi:type="less"> <slaparameter>availability</slaparameter> <value>99</value> </predicate> </expression> <evaluationevent>newvalue</evaluationevent> </servicelevelobjective> <!-- action guarantees --> <actionguarantee name="performanceguarantee"> <obliged>service_provider</obliged> <expression> <predicate xsi:type='violation'> <servicelevelobjective>performanceslo</servicelevelobjective> </predicate> </expression> <evaluationevent>newvalue</evaluationevent> <qualifiedaction> <party>/sla/obligations/actionguarantee[@name='performanceguarantee']/qualifiedaction/party</party> <action xsi:type='notification' actionname='notification'> <notificationtype>violation</notificationtype> <causingguarantee>performanceslo</causingguarantee> <slaparameter>performance</slaparameter> </action> </qualifiedaction> <executionmodality>always</executionmodality> </actionguarantee> <actionguarantee name="responsetimeguarantee"> <obliged>service_provider</obliged> <expression> <predicate xsi:type='violation'> <servicelevelobjective>responsetimeslo</servicelevelobjective> </predicate> </expression> <evaluationevent>newvalue</evaluationevent> <qualifiedaction> <party>/sla/obligations/actionguarantee[@name='responsetimeguarantee']/qualifiedaction/party</party> <action xsi:type='notification' actionname='notification'> <notificationtype>violation</notificationtype> <causingguarantee>responsetimeslo</causingguarantee> <slaparameter>responsetime</slaparameter> </action> </qualifiedaction> <executionmodality>always</executionmodality> </actionguarantee> <actionguarantee name="availabilityguarantee"> <obliged>service_provider</obliged> <expression> <predicate xsi:type='violation'> <servicelevelobjective>availabilityslo</servicelevelobjective> </predicate> </expression> <evaluationevent>newvalue</evaluationevent> <qualifiedaction> <party>/sla/obligations/actionguarantee[@name='availabilityguarantee']/qualifiedaction/party</party> <action xsi:type='notification' actionname='notification'> <notificationtype>violation</notificationtype> <causingguarantee>availabilityslo</causingguarantee> <slaparameter>availability</slaparameter> </action> </qualifiedaction> <executionmodality>always</executionmodality> </actionguarantee> </obligations> </sla>
Comments
Post a Comment