MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / parse

Method parse

src/main/java/xml/XMLParser.java:70–247  ·  view source on GitHub ↗
(byte indata[], int size)

Source from the content-addressed store, hash-verified

68 }
69
70 public void parse(byte indata[], int size) throws XMLException, UnsupportedEncodingException{
71 int dptr=0;
72 while (size>0) {
73 size--;
74 char c=(char)(indata[dptr++] &0xff);
75 switch (state) {
76 case PLAIN_TEXT: {
77 //parsing plain text
78 if (c=='<') {
79 state=TAGNAME;
80
81 if (sbuf.length()>0)
82 eventListener.plainTextEncountered( parsePlainText(sbuf) );
83
84 sbuf=new StringBuffer();
85 tagName=new StringBuffer();
86 attr=null;
87 attr=new Vector();
88
89 continue;
90 }
91 sbuf.append(c); continue;
92 }
93
94 case ATRNAME:
95 {
96 if (c=='?') continue;
97 if (c==' ') continue;
98 if (c=='=') continue;
99 if (c=='\'') { state=ATRVALQS; atrName=parsePlainText(sbuf); sbuf=new StringBuffer(); continue; }
100 if (c=='\"') { state=ATRVALQD; atrName=parsePlainText(sbuf); sbuf=new StringBuffer(); continue; }
101
102 if (c!='>' && c!='/') {
103 sbuf.append(c);
104 continue;
105 } else {
106 state=TAGNAME;
107 sbuf=new StringBuffer();
108 }
109 }
110
111 case TAGNAME:
112 {
113 if (c=='?') continue;
114 if (c=='/') {
115 state=ENDTAGNAME;
116 sbuf=new StringBuffer();
117 if (tagName.length()>0) {
118 String tn= parsePlainText(tagName);
119 eventListener.tagStart(localName(tn, TAGNAME), attr);
120 sbuf.append(tn);
121 }
122 continue;
123 }
124 if (c==' ') { state=ATRNAME; continue; }
125 if (c=='>') {
126 state=PLAIN_TEXT;
127 if (eventListener.tagStart(localName(parsePlainText(tagName), TAGNAME), attr))

Callers 2

runMethod · 0.95
platformRequestMethod · 0.45

Calls 13

parsePlainTextMethod · 0.95
localNameMethod · 0.95
appendMethod · 0.80
addElementMethod · 0.80
writeMethod · 0.80
plainTextEncounteredMethod · 0.65
tagStartMethod · 0.65
tagEndMethod · 0.65
binValueEncounteredMethod · 0.65
equalsMethod · 0.45
toStringMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected