private XhtmlDocument parse(String entryName) throws FHIRFormatError, IOException { XhtmlDocument result = new XhtmlDocument(); skipWhiteSpaceAndComments(result); if (peekChar() != '<') throw new FHIRFormatError("Unable to Parse HTML - does not start with tag. Found "+peekChar()+descLoc()); readChar(); markLocation(); QName n = new QName(readName().toLowerCase()); if ((entryName != null) && !n.getName().equals(entryName)) throw new FHIRFormatError("Unable to Parse HTML - starts with '"+n+"' not '"+entryName+"'"+descLoc()); XhtmlNode root = result.addTag(n.getName()); root.setLocation(markLocation()); parseAttributes(root); markLocation(); NSMap nsm = checkNamespaces(n, root, null, true); if (readChar() == '/') { if (peekChar() != '>') throw new FHIRFormatError("unexpected non-end of element "+n+" "+descLoc()); readChar(); } else { unwindPoint = null; List<XhtmlNode> p = new ArrayList<XhtmlNode>(); parseElementInner(root, p, nsm, true); } return result; }
private void parseElement(XhtmlNode parent, List<XhtmlNode> parents, NSMap nsm) throws IOException, FHIRFormatError { markLocation(); QName name = new QName(readName()); XhtmlNode node = parent.addTag(name.getName()); node.setLocation(markLocation()); List<XhtmlNode> newParents = new ArrayList<XhtmlNode>(); newParents.addAll(parents); newParents.add(parent); parseAttributes(node); markLocation(); nsm = checkNamespaces(name, node, nsm, false); if (readChar() == '/') { if (peekChar() != '>') throw new FHIRFormatError("unexpected non-end of element "+name+" "+descLoc()); readChar(); } else { parseElementInner(node, newParents, nsm, "script".equals(name.getName())); } }
private XhtmlDocument parse(String entryName) throws FHIRFormatError, IOException { XhtmlDocument result = new XhtmlDocument(); skipWhiteSpaceAndComments(result); if (peekChar() != '<') throw new FHIRFormatError("Unable to Parse HTML - does not start with tag. Found "+peekChar()+descLoc()); readChar(); markLocation(); QName n = new QName(readName().toLowerCase()); if ((entryName != null) && !n.getName().equals(entryName)) throw new FHIRFormatError("Unable to Parse HTML - starts with '"+n+"' not '"+entryName+"'"+descLoc()); XhtmlNode root = result.addTag(n.getName()); root.setLocation(markLocation()); parseAttributes(root); markLocation(); NSMap nsm = checkNamespaces(n, root, null, true); if (readChar() == '/') { if (peekChar() != '>') throw new FHIRFormatError("unexpected non-end of element "+n+" "+descLoc()); readChar(); } else { unwindPoint = null; List<XhtmlNode> p = new ArrayList<XhtmlNode>(); parseElementInner(root, p, nsm, true); } return result; }
private void parseElement(XhtmlNode parent, List<XhtmlNode> parents, NSMap nsm) throws IOException, FHIRFormatError { markLocation(); QName name = new QName(readName()); XhtmlNode node = parent.addTag(name.getName()); node.setLocation(markLocation()); List<XhtmlNode> newParents = new ArrayList<XhtmlNode>(); newParents.addAll(parents); newParents.add(parent); parseAttributes(node); markLocation(); nsm = checkNamespaces(name, node, nsm, false); if (readChar() == '/') { if (peekChar() != '>') throw new FHIRFormatError("unexpected non-end of element "+name+" "+descLoc()); readChar(); } else { parseElementInner(node, newParents, nsm, "script".equals(name.getName())); } }