Paste
Pasted as Java by jjjlld ( 13 years ago )
} else if (layout.compareTo("text") == 0) {
Node txtNode = panelElement.getFirstChild();
String strText = txtNode.getTextContent();
System.out.println("Output:" + strText);
DocumentBuilderFactory factory;
DocumentBuilder builder;
Document txtDom = null;
try {
factory = DocumentBuilderFactory.newInstance();
StringReader sr = new StringReader(strText);
InputSource is = new InputSource(sr);
builder = factory.newDocumentBuilder();
txtDom = builder.parse(is);
txtDom.normalize();
}
catch(Exception e){
Log.v("Exception on Text XML Parse:", "" + e);
}
NodeList txtPanelNodes = txtDom.getElementsByTagName("*");
if(txtPanelNodes.getLength()>0){
Node node = txtPanelNodes.item(0);
xxxxx =node.getTextContent();
//xxxxx =node.getNodeValue();
Log.v("hhhhh",""+xxxxx);
}
int txtTagCnt = txtPanelNodes.getLength();
for (int l=0; l < txtTagCnt; l++) {
Element txtPanelElement = (Element) txtPanelNodes.item(l);
NodeList txtList=txtPanelElement.getChildNodes();
for(int i1=0;i1<txtList.getLength();i1++){
String sss=txtList.item(i1).getNodeValue().trim().toString();
System.out.println("The Node value Getting"+sss);
// txtValue=sss.toString();
}
String txtLayout=txtPanelNodes.item(l).getNodeName();
NamedNodeMap txtTagNode=txtPanelElement.getAttributes();
if (txtLayout.compareTo("span") == 0) {
for(int x=0; x < txtTagNode.getLength(); x++){
NodeList textIDList = txtPanelElement.getChildNodes();
Node nd = txtTagNode.item(x);
Node node2;
String nodeName = nd.getNodeName();
String nodevalue = nd.getNodeValue();
System.out.println("span" + nodevalue);
if(nodeName.compareTo("style") == 0) {
String nodeValue1 = nd.getNodeValue();
String nodeC
node2 = nd.getFirstChild();
if(node2 != null) {
nodeC
nodeC
}
String str1=nodeCont.toString();
str1=str1.replaceAll(",", " ").replace(";", " ");
ArrayList<String> strr1=new ArrayList<String>();
String strArr1[]=str1.split(":").clone();
String dd=null;
for(int ww=0; ww<strArr1.length; ww++){
if(ww==1){
dd=strArr1[ww].toString();
String temp=dd.replace("px", " ");
ss=temp.substring(0, 2);
}
}} else {
System.out.println("Invalid tag in text:" + nodeName);
}
}
System.out.println("Good *** "+ss);
//f
}else if(txtLayout.compareTo("strong") == 0) {
for(int x=0; x < txtTagNode.getLength(); x++){
Node nd = txtTagNode.item(x);
String nodeName = nd.getNodeName();
System.out.println("strong" + nodeName);
}
}else if(txtLayout.compareTo("p") == 0) {
ArrayList<String> txt=new ArrayList<String>();
for(int x=0; x < txtTagNode.getLength(); x++){
Node nd = txtTagNode.item(x);
String nodeName = nd.getNodeName();
System.out.println("p" + nodeName);
if(nodeName.compareTo("style") == 0) {
nodeValue = nd.getNodeValue();
String str=nodeValue.toString();
str=str.replaceAll(",", " ").replace(";", " ");
String strArr[]=str.split(":").clone();
for(int ww=0; ww<strArr.length; ww++){
gra=strArr[1].toUpperCase();
System.out.println("Str["+ww+"] :"+strArr[ww]);
}
// System.out.println("p" + "style" + "nodevalue: "+ nodeValue + "nodeCont:" + nodeCont);
}else
System.out.println("Invalid tag in text:" +nodeName);
}
}
}
} else {
System.out.println("Unknow Tag Info:" + layout);
}
}
}
Revise this Paste