MCPcopy Create free account
hub / github.com/dumbledore/AlbiteREADER / pushEntity

Method pushEntity

src/org/kxml2/io/KXmlParser.java:723–781  ·  view source on GitHub ↗

result: isWhitespace; if the setName parameter is set, the name of the entity is stored in "name"

()

Source from the content-addressed store, hash-verified

721 * the name of the entity is stored in "name" */
722
723 private final void pushEntity()
724 throws IOException, XmlPullParserException {
725
726 push(read()); // &
727
728
729 int pos = txtPos;
730
731 while (true) {
732 int c = read();
733 if (c == ';')
734 break;
735 if (c < 128
736 && (c < '0' || c > '9')
737 && (c < 'a' || c > 'z')
738 && (c < 'A' || c > 'Z')
739 && c != '_'
740 && c != '-'
741 && c != '#') {
742 if(!relaxed){
743 error("unterminated entity ref");
744 }
745 //; ends with:"+(char)c);
746 if (c != -1)
747 push(c);
748 return;
749 }
750
751 push(c);
752 }
753
754 String code = get(pos);
755 txtPos = pos - 1;
756 if (token && type == ENTITY_REF){
757 name = code;
758 }
759
760 if (code.charAt(0) == '#') {
761 int c =
762 (code.charAt(1) == 'x'
763 ? Integer.parseInt(code.substring(2), 16)
764 : Integer.parseInt(code.substring(1)));
765 push(c);
766 return;
767 }
768
769 String result = (String) entityMap.get(code);
770
771 unresolved = result == null;
772
773 if (unresolved) {
774 if (!token)
775 error("unresolved: &" + code + ";");
776 }
777 else {
778 for (int i = 0; i < result.length(); i++)
779 push(result.charAt(i));
780 }

Callers 2

nextImplMethod · 0.95
pushTextMethod · 0.95

Calls 5

pushMethod · 0.95
readMethod · 0.95
errorMethod · 0.95
getMethod · 0.95
lengthMethod · 0.80

Tested by

no test coverage detected