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

View File

@ -76,7 +76,11 @@ class SchemaBaseValidator implements IValidator {
Validator validator = schema.newValidator();
MyErrorHandler handler = new MyErrorHandler(theContext);
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) {
throw new ConfigurationException("Could not apply schema file", e);
} catch (IOException e) {