Fix build

This commit is contained in:
James Agnew 2014-09-17 11:43:18 -04:00
parent 62bf2620f1
commit 06e2b6632d
2 changed files with 8 additions and 4 deletions

View File

@ -637,7 +637,7 @@ public class XmlParser extends BaseParser implements IParser {
return; return;
} }
boolean firstEvent = true; boolean firstElement = true;
for (XMLEvent event : theDt.getValue()) { for (XMLEvent event : theDt.getValue()) {
switch (event.getEventType()) { switch (event.getEventType()) {
case XMLStreamConstants.ATTRIBUTE: case XMLStreamConstants.ATTRIBUTE:
@ -677,7 +677,7 @@ public class XmlParser extends BaseParser implements IParser {
break; break;
case XMLStreamConstants.START_ELEMENT: case XMLStreamConstants.START_ELEMENT:
StartElement se = event.asStartElement(); StartElement se = event.asStartElement();
if (firstEvent) { if (firstElement) {
if (StringUtils.isBlank(se.getName().getPrefix())) { if (StringUtils.isBlank(se.getName().getPrefix())) {
String namespaceURI = se.getName().getNamespaceURI(); String namespaceURI = se.getName().getNamespaceURI();
if (StringUtils.isBlank(namespaceURI)) { if (StringUtils.isBlank(namespaceURI)) {
@ -691,6 +691,7 @@ public class XmlParser extends BaseParser implements IParser {
theEventWriter.writeStartElement(prefix, se.getName().getLocalPart(), namespaceURI); theEventWriter.writeStartElement(prefix, se.getName().getLocalPart(), namespaceURI);
theEventWriter.writeNamespace(prefix, namespaceURI); theEventWriter.writeNamespace(prefix, namespaceURI);
} }
firstElement = false;
} else { } else {
if (isBlank(se.getName().getPrefix())) { if (isBlank(se.getName().getPrefix())) {
if (isBlank(se.getName().getNamespaceURI())) { if (isBlank(se.getName().getNamespaceURI())) {
@ -721,7 +722,6 @@ public class XmlParser extends BaseParser implements IParser {
break; break;
} }
firstEvent = false;
} }
} }

View File

@ -76,7 +76,11 @@ class SchemaBaseValidator implements IValidator {
Validator validator = schema.newValidator(); Validator validator = schema.newValidator();
MyErrorHandler handler = new MyErrorHandler(theContext); MyErrorHandler handler = new MyErrorHandler(theContext);
validator.setErrorHandler(handler); validator.setErrorHandler(handler);
validator.validate(new StreamSource(new StringReader(theContext.getXmlEncodedResource()))); String encodedResource = theContext.getXmlEncodedResource();
// ourLog.info(new FhirContext().newXmlParser().setPrettyPrint(true).encodeBundleToString((Bundle) theContext.getResource()));
validator.validate(new StreamSource(new StringReader(encodedResource)));
} catch (SAXException e) { } catch (SAXException e) {
throw new ConfigurationException("Could not apply schema file", e); throw new ConfigurationException("Could not apply schema file", e);
} catch (IOException e) { } catch (IOException e) {