public String allText() { if (childNodes == null || childNodes.isEmpty()) return getContent(); StringBuilder b = new StringBuilder(); for (XhtmlNode n : childNodes) if (n.getNodeType() == NodeType.Text) b.append(n.getContent()); else if (n.getNodeType() == NodeType.Element) b.append(n.allText()); return b.toString(); }
/** * Generate EFhirClientException indicating the cause of the exception * along with any OperationOutcome server error the server may have generated. * * A default message of "One or more server side errors have occurred during this operation. Refer to e.getServerErrors() for additional details." * will be returned to users. * * @param message * @param serverError */ public EFhirClientException(OperationOutcome serverError) { super("Error on the server: "+serverError.getText().getDiv().allText()+". Refer to e.getServerErrors() for additional details."); if(serverError != null) { errors.add(serverError); } }
else if (c.getNodeType() == NodeType.Element) { if (c.getName().equals("a")) { list.add(new Piece(c.getAttribute("href"), c.allText(), c.getAttribute("title"))); } else if (c.getName().equals("b") || c.getName().equals("em") || c.getName().equals("strong")) { list.add(new Piece(null, c.allText(), null).setStyle("font-face: bold")); } else if (c.getName().equals("code")) { list.add(new Piece(null, c.allText(), null).setStyle("padding: 2px 4px; color: #005c00; background-color: #f9f2f4; white-space: nowrap; border-radius: 4px")); } else if (c.getName().equals("i")) { list.add(new Piece(null, c.allText(), null).setStyle("font-style: italic")); } else if (c.getName().equals("pre")) { Piece p = new Piece(c.getName()).setStyle("white-space: pre; font-family: courier"); p.getChildren().addAll(c.getChildNodes()); } else if (c.getName().equals("i")) { list.add(new Piece(null, c.allText(), null).setStyle("font-style: italic")); } else if (c.getName().equals("h1")||c.getName().equals("h2")||c.getName().equals("h3")||c.getName().equals("h4")) { Piece p = new Piece(c.getName());
public String allText() { if (childNodes == null || childNodes.isEmpty()) return getContent(); StringBuilder b = new StringBuilder(); for (XhtmlNode n : childNodes) if (n.getNodeType() == NodeType.Text) b.append(n.getContent()); else if (n.getNodeType() == NodeType.Element) b.append(n.allText()); return b.toString(); }
/** * Generate EFhirClientException indicating the cause of the exception * along with any OperationOutcome server error the server may have generated. * * A default message of "One or more server side errors have occurred during this operation. Refer to e.getServerErrors() for additional details." * will be returned to users. * * @param message * @param serverError */ public EFhirClientException(OperationOutcome serverError) { super("Error on the server: "+serverError.getText().getDiv().allText()+". Refer to e.getServerErrors() for additional details."); if(serverError != null) { errors.add(serverError); } }
public void parseResource( final JCas jCas, final Basic resource ) { // composition.addAuthor( practitioner.getPractitionerReference() ); // composition.setId( FhirElementFactory.createId( jCas, ID_NAME_COMPOSITION, noteSpecs.getNoteTime() ) ); // composition.setStatus( Composition.CompositionStatus.FINAL ); // composition.setType( getCompositionType() ); // composition.setLanguage( "English" ); // composition.setSubject( noteSpecs.getSubjectReference( FhirNoteSpecs.SUBJECT_PATIENT ) ); // The following claim to have a 0 .. 1 cardinality, but the doc also states that they SHALL be listed. // composition.setEncounter( noteSpecs.getEncounterReference() ); // composition.setCustodian( practitioner.getOrganizationReference() ); // composition.addEvent( noteSpecs.getEvent() ); // composition.addAttester( practitioner.createAttester( noteSpecs ) ); // composition.setText( FhirElementFactory.createNarrative( jCas.getDocumentText() ) ); final Narrative narrative = resource.getText(); final XhtmlNode htmlNode = narrative.getDiv(); final String docText = htmlNode.allText(); jCas.setDocumentText( docText ); }
else if (c.getNodeType() == NodeType.Element) { if (c.getName().equals("a")) { list.add(new Piece(c.getAttribute("href"), c.allText(), c.getAttribute("title"))); } else if (c.getName().equals("b") || c.getName().equals("em") || c.getName().equals("strong")) { list.add(new Piece(null, c.allText(), null).setStyle("font-face: bold")); } else if (c.getName().equals("code")) { list.add(new Piece(null, c.allText(), null).setStyle("padding: 2px 4px; color: #005c00; background-color: #f9f2f4; white-space: nowrap; border-radius: 4px")); } else if (c.getName().equals("i")) { list.add(new Piece(null, c.allText(), null).setStyle("font-style: italic")); } else if (c.getName().equals("pre")) { Piece p = new Piece(c.getName()).setStyle("white-space: pre; font-family: courier"); p.getChildren().addAll(c.getChildNodes()); } else if (c.getName().equals("i")) { list.add(new Piece(null, c.allText(), null).setStyle("font-style: italic")); } else if (c.getName().equals("h1")||c.getName().equals("h2")||c.getName().equals("h3")||c.getName().equals("h4")) { Piece p = new Piece(c.getName());
final Narrative narrative = ((Composition) resource).getText(); final XhtmlNode html = narrative.getDiv(); final String docText = html.allText(); jCas.setDocumentText( docText ); return null;
final Narrative narrative = ((Composition)resource).getText(); final XhtmlNode html = narrative.getDiv(); final String docText = html.allText(); jCas.setDocumentText( docText ); return null;