1 16 17 package org.jboss.axis; 18 19 import org.jboss.axis.encoding.DeserializationContext; 20 import org.jboss.axis.encoding.DeserializationContextImpl; 21 import org.jboss.axis.encoding.SerializationContextImpl; 22 import org.jboss.axis.message.InputStreamBody; 23 import org.jboss.axis.message.MimeHeadersImpl; 24 import org.jboss.axis.message.SOAPBodyAxisImpl; 25 import org.jboss.axis.message.SOAPDocumentImpl; 26 import org.jboss.axis.message.SOAPEnvelopeAxisImpl; 27 import org.jboss.axis.message.SOAPHeaderElementAxisImpl; 28 import org.jboss.axis.message.SOAPPartAxisImpl; 29 import org.jboss.axis.soap.SOAPConstants; 30 import org.jboss.axis.transport.http.HTTPConstants; 31 import org.jboss.axis.utils.Messages; 32 import org.jboss.axis.utils.SessionUtils; 33 import org.jboss.logging.Logger; 34 import org.w3c.dom.Attr ; 35 import org.w3c.dom.CDATASection ; 36 import org.w3c.dom.Comment ; 37 import org.w3c.dom.DOMException ; 38 import org.w3c.dom.DOMImplementation ; 39 import org.w3c.dom.Document ; 40 import org.w3c.dom.DocumentFragment ; 41 import org.w3c.dom.DocumentType ; 42 import org.w3c.dom.Element ; 43 import org.w3c.dom.EntityReference ; 44 import org.w3c.dom.NamedNodeMap ; 45 import org.w3c.dom.Node ; 46 import org.w3c.dom.NodeList ; 47 import org.w3c.dom.ProcessingInstruction ; 48 import org.w3c.dom.Text ; 49 import org.xml.sax.InputSource ; 50 import org.xml.sax.SAXException ; 51 52 import javax.xml.namespace.QName ; 53 import javax.xml.soap.SOAPException ; 54 import javax.xml.soap.SOAPMessage ; 55 import javax.xml.transform.Source ; 56 import javax.xml.transform.dom.DOMSource ; 57 import javax.xml.transform.stream.StreamSource ; 58 import java.io.BufferedReader ; 59 import java.io.ByteArrayInputStream ; 60 import java.io.ByteArrayOutputStream ; 61 import java.io.IOException ; 62 import java.io.InputStream ; 63 import java.io.Reader ; 64 import java.io.StringReader ; 65 import java.io.StringWriter ; 66 import java.io.UnsupportedEncodingException ; 67 import java.io.Writer ; 68 import java.util.Enumeration ; 69 import java.util.Iterator ; 70 import java.util.Vector ; 71 72 88 public class MessagePart extends SOAPPartAxisImpl implements Part 89 { 90 91 private static Logger log = Logger.getLogger(MessagePart.class.getName()); 92 93 public static final int FORM_STRING = 1; 94 public static final int FORM_INPUTSTREAM = 2; 95 public static final int FORM_SOAPENVELOPE = 3; 96 public static final int FORM_BYTES = 4; 97 public static final int FORM_BODYINSTREAM = 5; 98 public static final int FORM_FAULT = 6; 99 private int currentForm; 100 101 private MimeHeadersImpl mimeHeaders = new MimeHeadersImpl(); 103 104 private static final String [] formNames = 105 {"", "FORM_STRING", "FORM_INPUTSTREAM", "FORM_SOAPENVELOPE", 106 "FORM_BYTES", "FORM_BODYINSTREAM", "FORM_FAULT"}; 107 108 118 private Object currentMessage; 119 120 private String currentMessageAsString = null; 122 private byte[] currentMessageAsBytes = null; 123 private SOAPEnvelopeAxisImpl currentMessageAsEnvelope = null; 124 125 128 private Message msgObject; 129 130 133 private Source contentSource = null; 134 135 139 141 150 public MessagePart(Message parent, Object initialContents, boolean isBodyStream) 151 { 152 153 setMimeHeader(HTTPConstants.HEADER_CONTENT_ID, SessionUtils.generateSessionId()); 154 setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, "text/xml"); 155 156 msgObject = parent; 157 int form = FORM_STRING; 159 if (initialContents instanceof SOAPEnvelopeAxisImpl) 160 { 161 form = FORM_SOAPENVELOPE; 162 } 163 else if (initialContents instanceof InputStream ) 164 { 165 form = isBodyStream ? FORM_BODYINSTREAM : FORM_INPUTSTREAM; 166 } 167 else if (initialContents instanceof byte[]) 168 { 169 form = FORM_BYTES; 170 } 171 else if (initialContents instanceof AxisFault) 172 { 173 form = FORM_FAULT; 174 } 175 176 if (log.isDebugEnabled()) 177 { 178 log.debug("Enter: SOAPPart ctor(" + formNames[form] + ")"); 179 } 180 181 setCurrentMessage(initialContents, form); 182 183 if (log.isDebugEnabled()) 184 { 185 log.debug("Exit: SOAPPart ctor()"); 186 } 187 } 188 189 190 195 public Message getMessage() 196 { 197 return msgObject; 198 } 199 200 206 public void setMessage(Message msg) 207 { 208 this.msgObject = msg; 209 } 210 211 216 public String getContentType() 217 { 218 return "text/xml"; 219 } 220 221 228 public int getContentLength() 229 { 230 try 231 { 232 byte[] bytes = this.getAsBytes(); 233 return bytes.length; 234 } 235 catch (AxisFault fault) 236 { 237 return 0; } 239 } 240 241 253 254 public void setSOAPEnvelope(SOAPEnvelopeAxisImpl env) 255 { 256 setCurrentMessage(env, FORM_SOAPENVELOPE); 257 } 258 259 267 public int getSize() 268 { 269 return this.getContentLength(); 271 } 272 273 278 public void writeTo(Writer writer) throws IOException 279 { 280 if (currentForm == FORM_FAULT) 281 { 282 AxisFault env = (AxisFault)currentMessage; 283 try 284 { 285 env.output(new SerializationContextImpl(writer, getMessage().getMessageContext())); 286 } 287 catch (Exception e) 288 { 289 log.error(Messages.getMessage("exception00"), e); 290 throw env; 291 } 292 } 293 294 else if (currentForm == FORM_SOAPENVELOPE) 295 { 296 SOAPEnvelopeAxisImpl env = (SOAPEnvelopeAxisImpl)currentMessage; 297 try 298 { 299 env.output(new SerializationContextImpl(writer, getMessage().getMessageContext())); 300 } 301 catch (Exception e) 302 { 303 throw AxisFault.makeFault(e); 304 } 305 } 306 307 else 308 { 309 String xmlMessage = getAsString(); 310 writer.write(xmlMessage); 311 } 312 } 313 314 324 public Object getCurrentMessage() 325 { 326 return currentMessage; 327 } 328 329 335 public void setCurrentMessage(Object currMsg, int form) 336 { 337 setCurrentForm(currMsg, form); 338 } 339 340 348 private void setCurrentForm(Object currMsg, int form) 349 { 350 351 if (currentForm == FORM_SOAPENVELOPE && currentMessageAsEnvelope.isProcessingRPCInvocation() && form == FORM_STRING) 352 { 353 log.debug("Preventing FORM_STRING while processing RPCInvocation"); 354 return; 355 } 356 357 log.debug("Changing message form: " + formNames[currentForm] + " -> " + formNames[form]); 358 359 currentMessageAsString = null; 360 currentMessageAsBytes = null; 361 currentMessageAsEnvelope = null; 362 363 currentMessage = currMsg; 364 currentForm = form; 365 366 if (currentForm == FORM_STRING && log.isTraceEnabled()) 367 { 368 log.trace(currMsg); 369 } 370 371 if (currentForm == FORM_SOAPENVELOPE) 372 { 373 currentMessageAsEnvelope = (SOAPEnvelopeAxisImpl)currMsg; 374 } 375 } 376 377 384 public byte[] getAsBytes() throws AxisFault 385 { 386 log.debug("Enter: SOAPPart::getAsBytes"); 387 if (currentForm == FORM_BYTES) 388 { 389 log.debug("Exit: SOAPPart::getAsBytes"); 390 return (byte[])currentMessage; 391 } 392 393 if (currentForm == FORM_BODYINSTREAM) 394 { 395 try 396 { 397 getAsSOAPEnvelope(); 398 } 399 catch (Exception e) 400 { 401 log.fatal(Messages.getMessage("makeEnvFail00"), e); 402 log.debug("Exit: SOAPPart::getAsBytes"); 403 return null; 404 } 405 } 406 407 if (currentForm == FORM_INPUTSTREAM) 408 { 409 try 411 { 412 InputStream inp = null; 413 byte[] buf = null; 414 try 415 { 416 inp = (InputStream )currentMessage; 417 ByteArrayOutputStream baos = new ByteArrayOutputStream (); 418 buf = new byte[4096]; 419 int len; 420 while ((len = inp.read(buf, 0, 4096)) != -1) 421 baos.write(buf, 0, len); 422 buf = baos.toByteArray(); 423 } 424 finally 425 { 426 if (inp != null && 427 currentMessage instanceof org.jboss.axis.transport.http.SocketInputStream) 428 inp.close(); 429 } 430 setCurrentForm(buf, FORM_BYTES); 431 log.debug("Exit: SOAPPart::getAsBytes"); 432 return (byte[])currentMessage; 433 } 434 catch (Exception e) 435 { 436 log.error(Messages.getMessage("exception00"), e); 437 } 438 log.debug("Exit: SOAPPart::getAsBytes"); 439 return null; 440 } 441 442 if (currentForm == FORM_SOAPENVELOPE || 443 currentForm == FORM_FAULT) 444 { 445 getAsString(); 448 } 449 450 if (currentForm == FORM_STRING) 451 { 452 if (currentMessage == currentMessageAsString && 456 currentMessageAsBytes != null) 457 { 458 if (log.isDebugEnabled()) 459 { 460 log.debug("Exit: SOAPPart::getAsBytes()"); 461 } 462 return currentMessageAsBytes; 463 } 464 currentMessageAsString = (String )currentMessage; 466 try 467 { 468 String encoding = null; 470 if (msgObject != null) 471 { 472 try 473 { 474 encoding = (String )msgObject.getProperty(SOAPMessage.CHARACTER_SET_ENCODING); 475 } 476 catch (SOAPException e) 477 { 478 } 479 } 480 if (encoding == null) 481 { 482 encoding = "UTF-8"; 483 } 484 setCurrentForm(((String )currentMessage).getBytes(encoding), 485 FORM_BYTES); 486 } 487 catch (UnsupportedEncodingException ue) 488 { 489 setCurrentForm(((String )currentMessage).getBytes(), 490 FORM_BYTES); 491 } 492 currentMessageAsBytes = (byte[])currentMessage; 493 494 log.debug("Exit: SOAPPart::getAsBytes"); 495 return (byte[])currentMessage; 496 } 497 498 log.error(Messages.getMessage("cantConvert00", "" + currentForm)); 499 500 log.debug("Exit: SOAPPart::getAsBytes"); 501 return null; 502 } 503 504 511 public String getAsString() throws AxisFault 512 { 513 514 log.debug("Enter: SOAPPart::getAsString"); 515 516 if (currentForm == FORM_STRING) 517 { 518 if (log.isDebugEnabled()) 519 { 520 log.debug("Exit: SOAPPart::getAsString()"); 521 } 522 return (String )currentMessage; 523 } 524 525 if (currentForm == FORM_INPUTSTREAM || currentForm == FORM_BODYINSTREAM) 526 { 527 getAsBytes(); 529 } 530 531 if (currentForm == FORM_BYTES) 532 { 533 534 if (currentMessage == currentMessageAsBytes && currentMessageAsString != null) 538 { 539 if (log.isDebugEnabled()) 540 { 541 log.debug("Exit: SOAPPart::getAsString()"); 542 } 543 return currentMessageAsString; 544 } 545 546 currentMessageAsBytes = (byte[])currentMessage; 548 try 549 { 550 setCurrentForm(new String ((byte[])currentMessage, "UTF-8"), FORM_STRING); 551 } 552 catch (UnsupportedEncodingException ue) 553 { 554 setCurrentForm(new String ((byte[])currentMessage), FORM_STRING); 555 } 556 557 currentMessageAsString = (String )currentMessage; 558 if (log.isDebugEnabled()) 559 { 560 log.debug("Exit: SOAPPart::getAsString()"); 561 } 562 563 return (String )currentMessage; 564 } 565 566 if (currentForm == FORM_FAULT) 567 { 568 StringWriter writer = new StringWriter (); 569 try 570 { 571 this.writeTo(writer); 572 } 573 catch (Exception e) 574 { 575 log.error(Messages.getMessage("exception00"), e); 576 return null; 577 } 578 setCurrentForm(writer.getBuffer().toString(), FORM_STRING); 579 if (log.isDebugEnabled()) 580 { 581 log.debug("Exit: SOAPPart::getAsString(): " + currentMessage); 582 } 583 return (String )currentMessage; 584 } 585 586 if (currentForm == FORM_SOAPENVELOPE) 587 { 588 StringWriter writer = new StringWriter (); 589 try 590 { 591 writeTo(writer); 592 } 593 catch (Exception e) 594 { 595 throw AxisFault.makeFault(e); 596 } 597 598 String msgAsString = writer.getBuffer().toString(); 599 setCurrentForm(msgAsString, FORM_STRING); 600 if (log.isDebugEnabled()) 601 { 602 log.debug("Exit: SOAPPart::getAsString()"); 603 } 604 605 return msgAsString; 606 } 607 608 log.error(Messages.getMessage("cantConvert01", "" + currentForm)); 609 610 log.debug("Exit: SOAPPart::getAsString()"); 611 return null; 612 } 613 614 622 public SOAPEnvelopeAxisImpl getAsSOAPEnvelope() throws AxisFault 623 { 624 625 if (log.isDebugEnabled()) 626 { 627 log.debug("Enter: SOAPPart::getAsSOAPEnvelope()"); 628 log.debug(Messages.getMessage("currForm", formNames[currentForm])); 629 } 630 631 if (currentForm == FORM_SOAPENVELOPE) 632 { 633 SOAPEnvelopeAxisImpl env = (SOAPEnvelopeAxisImpl)currentMessage; 634 return env; 635 } 636 637 if (currentForm == FORM_BODYINSTREAM) 638 { 639 InputStreamBody bodyEl = new InputStreamBody((InputStream )currentMessage); 640 SOAPEnvelopeAxisImpl env = new SOAPEnvelopeAxisImpl(); 641 env.addBodyElement(bodyEl); 642 setCurrentForm(env, FORM_SOAPENVELOPE); 643 return env; 644 } 645 646 InputSource is; 647 648 if (currentForm == FORM_INPUTSTREAM) 649 { 650 is = new InputSource ((InputStream )currentMessage); 651 String encoding = null; 653 if (msgObject != null) 654 { 655 try 656 { 657 encoding = (String )msgObject.getProperty(SOAPMessage.CHARACTER_SET_ENCODING); 658 } 659 catch (SOAPException e) 660 { 661 } 662 } 663 if (encoding != null) 664 { 665 is.setEncoding(encoding); 666 } 667 } 668 else if (currentForm == FORM_BYTES) 669 { 670 is = new InputSource (new ByteArrayInputStream ((byte[])currentMessage)); 671 } 672 else 673 { 674 is = new InputSource (new StringReader (getAsString())); 675 } 676 677 DeserializationContext dser = new DeserializationContextImpl(is, 678 getMessage().getMessageContext(), 679 getMessage().getMessageType()); 680 681 try 683 { 684 dser.parse(); 685 } 686 catch (SAXException e) 687 { 688 Exception real = e.getException(); 689 if (real == null) 690 real = e; 691 throw AxisFault.makeFault(real); 692 } 693 694 SOAPEnvelopeAxisImpl env = dser.getEnvelope(); 695 if (currentMessageAsEnvelope != null) 696 { 697 checkMustUnderstand(getMessage().getMessageContext(), env); 699 700 Vector newHeaders = env.getHeaders(); 702 Vector oldHeaders = currentMessageAsEnvelope.getHeaders(); 703 if (null != newHeaders && null != oldHeaders) 704 { 705 Iterator ohi = oldHeaders.iterator(); 706 Iterator nhi = newHeaders.iterator(); 707 while (ohi.hasNext() && nhi.hasNext()) 708 { 709 SOAPHeaderElementAxisImpl nhe = (SOAPHeaderElementAxisImpl)nhi.next(); 710 SOAPHeaderElementAxisImpl ohe = (SOAPHeaderElementAxisImpl)ohi.next(); 711 712 if (ohe.isProcessed()) nhe.setProcessed(true); 713 } 714 } 715 } 716 717 ((SOAPBodyAxisImpl)env.getBody()).setAllImmutable(true); 718 719 setCurrentForm(env, FORM_SOAPENVELOPE); 720 721 log.debug("Exit: SOAPPart::getAsSOAPEnvelope"); 722 return (SOAPEnvelopeAxisImpl)currentMessage; 723 } 724 725 733 private void checkMustUnderstand(MessageContext msgContext, SOAPEnvelopeAxisImpl envelope) throws AxisFault 734 { 735 String svcActor = ""; 737 Vector headers = null; try 739 { 740 headers = envelope.getHeaders(); 741 } 742 catch (AxisFault axisFault) 743 { 744 axisFault.printStackTrace(); } 746 747 Vector misunderstoodHeaders = null; 748 Enumeration en = headers.elements(); 749 while (en.hasMoreElements()) 750 { 751 SOAPHeaderElementAxisImpl header = (SOAPHeaderElementAxisImpl)en. 752 nextElement(); 753 754 if (header.getActor() != null && header.getMustUnderstand() && 755 header.getActor() != svcActor) 756 { 757 if (misunderstoodHeaders == null) 758 misunderstoodHeaders = new Vector (); 759 misunderstoodHeaders.addElement(header); 760 } 761 } 762 763 SOAPConstants soapConstants = msgContext.getSOAPConstants(); 764 767 if (misunderstoodHeaders != null) 768 { 769 AxisFault fault = 770 new AxisFault(soapConstants.getMustunderstandFaultQName(), 771 null, null, 772 null, null, 773 null); 774 775 StringBuffer whatWasMissUnderstood = new StringBuffer (256); 776 777 if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) 779 { 780 en = misunderstoodHeaders.elements(); 781 while (en.hasMoreElements()) 782 { 783 SOAPHeaderElementAxisImpl badHeader = (SOAPHeaderElementAxisImpl)en. 784 nextElement(); 785 QName badQName = new QName (badHeader.getNamespaceURI(), 786 badHeader.getName()); 787 788 if (whatWasMissUnderstood.length() != 0) whatWasMissUnderstood.append(", "); 789 whatWasMissUnderstood.append(badQName.toString()); 790 791 SOAPHeaderElementAxisImpl newHeader = new 792 SOAPHeaderElementAxisImpl(Constants.URI_SOAP12_ENV, 793 Constants.ELEM_NOTUNDERSTOOD); 794 newHeader.addAttribute(null, 795 Constants.ATTR_QNAME, 796 badQName); 797 798 fault.addHeader(newHeader); 799 } 800 } 801 802 fault.setFaultString(Messages.getMessage("noUnderstand00", 803 whatWasMissUnderstood.toString())); 804 805 throw fault; 806 } 807 } 808 809 815 public void addMimeHeader(String header, String value) 816 { 817 mimeHeaders.addHeader(header, value); 818 } 819 820 826 private String getFirstMimeHeader(String header) 827 { 828 String [] values = mimeHeaders.getHeader(header); 829 if (values != null && values.length > 0) 830 return values[0]; 831 return null; 832 } 833 834 838 839 844 public String getContentLocation() 845 { 846 return getFirstMimeHeader(HTTPConstants.HEADER_CONTENT_LOCATION); 847 } 848 849 854 public void setContentLocation(String loc) 855 { 856 setMimeHeader(HTTPConstants.HEADER_CONTENT_LOCATION, loc); 857 } 858 859 865 public void setContentId(String newCid) 866 { 867 setMimeHeader(HTTPConstants.HEADER_CONTENT_ID, newCid); 868 } 869 870 875 public String getContentId() 876 { 877 return getFirstMimeHeader(HTTPConstants.HEADER_CONTENT_ID); 878 } 879 880 887 public String getContentIdRef() 888 { 889 return org.jboss.axis.attachments.Attachments.CIDprefix + 890 getContentId(); 891 } 892 893 894 900 public java.util.Iterator getMatchingMimeHeaders(final String [] match) 901 { 902 return mimeHeaders.getMatchingHeaders(match); 903 } 904 905 912 public java.util.Iterator getNonMatchingMimeHeaders(final String [] match) 913 { 914 return mimeHeaders.getNonMatchingHeaders(match); 915 } 916 917 927 public void setContent(Source source) throws SOAPException 928 { 929 930 if (source == null) 931 throw new SOAPException (Messages.getMessage("illegalArgumentException00")); 932 933 contentSource = source; 934 InputSource in = org.jboss.axis.utils.XMLUtils.sourceToInputSource(contentSource); 935 InputStream is = in.getByteStream(); 936 if (is != null) 937 { 938 setCurrentMessage(is, FORM_INPUTSTREAM); 939 } 940 else 941 { 942 Reader r = in.getCharacterStream(); 943 if (r == null) 944 { 945 throw new SOAPException (Messages.getMessage("noCharacterOrByteStream")); 946 } 947 BufferedReader br = new BufferedReader (r); 948 String line = null; 949 StringBuffer sb = new StringBuffer (); 950 try 951 { 952 while ((line = br.readLine()) != null) 953 { 954 sb.append(line); 955 } 956 } 957 catch (IOException e) 958 { 959 throw new SOAPException (Messages.getMessage("couldNotReadFromCharStream"), e); 960 } 961 setCurrentMessage(sb.toString(), FORM_STRING); 962 } 963 } 964 965 975 public Source getContent() throws SOAPException 976 { 977 if (contentSource == null) 978 { 979 switch (currentForm) 980 { 981 case FORM_STRING: 982 String s = (String )currentMessage; 983 contentSource = new StreamSource (new StringReader (s)); 984 break; 985 case FORM_INPUTSTREAM: 986 contentSource = new StreamSource ((InputStream )currentMessage); 987 break; 988 case FORM_SOAPENVELOPE: 989 SOAPEnvelopeAxisImpl se = (SOAPEnvelopeAxisImpl)currentMessage; 990 try 991 { 992 contentSource = new DOMSource (se.getAsDocument()); 993 } 994 catch (Exception e) 995 { 996 throw new SOAPException (Messages.getMessage("errorGetDocFromSOAPEnvelope"), e); 997 } 998 break; 999 case FORM_BYTES: 1000 byte[] bytes = (byte[])currentMessage; 1001 contentSource = new StreamSource (new ByteArrayInputStream (bytes)); 1002 break; 1003 case FORM_BODYINSTREAM: 1004 contentSource = new StreamSource ((InputStream )currentMessage); 1005 break; 1006 } 1007 } 1008 return contentSource; 1009 } 1010 1011 1019 public Iterator getAllMimeHeaders() 1020 { 1021 return mimeHeaders.getAllHeaders(); 1022 } 1023 1024 1049 public void setMimeHeader(String name, String value) 1050 { 1051 mimeHeaders.setHeader(name, value); 1052 } 1053 1054 1065 public String [] getMimeHeader(String name) 1066 { 1067 return mimeHeaders.getHeader(name); 1068 } 1069 1070 1074 public void removeAllMimeHeaders() 1075 { 1076 mimeHeaders.removeAllHeaders(); 1077 } 1078 1079 1085 public void removeMimeHeader(String header) 1086 { 1087 mimeHeaders.removeHeader(header); 1088 } 1089 1090 1099 public javax.xml.soap.SOAPEnvelope getEnvelope() throws SOAPException 1100 { 1101 try 1102 { 1103 return getAsSOAPEnvelope(); 1104 } 1105 catch (AxisFault af) 1106 { 1107 throw new SOAPException (af); 1108 } 1109 } 1110 1111 1121 1122 private Document document = new SOAPDocumentImpl(this); 1123 1124 1127 public Document getSOAPDocument() 1128 { 1129 if (document == null) 1130 { 1131 document = new SOAPDocumentImpl(this); 1132 } 1133 return document; 1134 } 1135 1136 1139 public DocumentType getDoctype() 1140 { 1141 return document.getDoctype(); 1142 } 1143 1144 1147 public DOMImplementation getImplementation() 1148 { 1149 return document.getImplementation(); 1150 } 1151 1152 1155 protected Document mDocument; 1156 1157 public Element getDocumentElement() 1158 { 1159 try 1160 { 1161 return getEnvelope(); 1162 } 1163 catch (SOAPException se) 1164 { 1165 return null; 1166 } 1167 } 1168 1169 1174 public Element createElement(String tagName) throws DOMException 1175 { 1176 return document.createElement(tagName); 1177 } 1178 1179 public DocumentFragment createDocumentFragment() 1180 { 1181 return document.createDocumentFragment(); 1182 } 1183 1184 public Text createTextNode(String data) 1185 { 1186 return document.createTextNode(data); 1187 } 1188 1189 public Comment createComment(String data) 1190 { 1191 return document.createComment(data); 1192 } 1193 1194 public CDATASection createCDATASection(String data) throws DOMException 1195 { 1196 return document.createCDATASection(data); 1197 } 1198 1199 public ProcessingInstruction createProcessingInstruction(String target, String data) 1200 throws DOMException 1201 { 1202 return document.createProcessingInstruction(target, data); 1203 } 1204 1205 public Attr createAttribute(String name) throws DOMException 1206 { 1207 return document.createAttribute(name); 1208 } 1209 1210 public EntityReference createEntityReference(String name) throws DOMException 1211 { 1212 return document.createEntityReference(name); 1213 } 1214 1215 public NodeList getElementsByTagName(String tagname) 1216 { 1217 return document.getElementsByTagName(tagname); 1218 } 1219 1220 public Node importNode(Node importedNode, boolean deep) 1221 throws DOMException 1222 { 1223 return document.importNode(importedNode, deep); 1224 } 1225 1226 public Element createElementNS(String namespaceURI, String qualifiedName) 1227 throws DOMException 1228 { 1229 return document.createElementNS(namespaceURI, qualifiedName); 1230 } 1231 1232 public Attr createAttributeNS(String namespaceURI, String qualifiedName) 1233 throws DOMException 1234 { 1235 return document.createAttributeNS(namespaceURI, qualifiedName); 1236 } 1237 1238 public NodeList getElementsByTagNameNS(String namespaceURI, String localName) 1239 { 1240 return document.getElementsByTagNameNS(namespaceURI, localName); 1241 } 1242 1243 public Element getElementById(String elementId) 1244 { 1245 return document.getElementById(elementId); 1246 } 1247 1248 1250 public String getEncoding() 1251 { 1252 throw new UnsupportedOperationException ("Not yet implemented.69"); 1253 } 1254 1255 public void setEncoding(String s) 1256 { 1257 throw new UnsupportedOperationException ("Not yet implemented.70"); 1258 } 1259 1260 public boolean getStandalone() 1261 { 1262 throw new UnsupportedOperationException ("Not yet implemented.71"); 1263 } 1264 1265 1266 public void setStandalone(boolean flag) 1267 { 1268 throw new UnsupportedOperationException ("Not yet implemented.72"); 1269 } 1270 1271 public boolean getStrictErrorChecking() 1272 { 1273 throw new UnsupportedOperationException ("Not yet implemented.73"); 1274 } 1275 1276 1277 public void setStrictErrorChecking(boolean flag) 1278 { 1279 throw new UnsupportedOperationException ("Not yet implemented. 74"); 1280 } 1281 1282 1283 public String getVersion() 1284 { 1285 throw new UnsupportedOperationException ("Not yet implemented. 75"); 1286 } 1287 1288 1289 public void setVersion(String s) 1290 { 1291 throw new UnsupportedOperationException ("Not yet implemented.76"); 1292 } 1293 1294 1295 public Node adoptNode(Node node) 1296 throws DOMException 1297 { 1298 throw new UnsupportedOperationException ("Not yet implemented.77"); 1299 } 1300 1301 1304 1305 public String getNodeName() 1306 { 1307 return document.getNodeName(); 1308 } 1309 1310 public String getNodeValue() throws DOMException 1311 { 1312 return document.getNodeValue(); 1313 } 1314 1315 public void setNodeValue(String nodeValue) throws DOMException 1316 { 1317 document.setNodeValue(nodeValue); 1318 } 1319 1320 public short getNodeType() 1321 { 1322 return document.getNodeType(); 1323 } 1324 1325 public Node getParentNode() 1326 { 1327 return document.getParentNode(); 1328 } 1329 1330 public NodeList getChildNodes() 1331 { 1332 return document.getChildNodes(); 1333 } 1334 1335 public Node getFirstChild() 1336 { 1337 return document.getFirstChild(); 1338 } 1339 1340 public Node getLastChild() 1341 { 1342 return document.getLastChild(); 1343 } 1344 1345 public Node getPreviousSibling() 1346 { 1347 return document.getPreviousSibling(); 1348 } 1349 1350 public Node getNextSibling() 1351 { 1352 return document.getNextSibling(); 1353 } 1354 1355 public NamedNodeMap getAttributes() 1356 { 1357 return document.getAttributes(); 1358 } 1359 1360 public Document getOwnerDocument() 1361 { 1362 return document.getOwnerDocument(); 1363 } 1364 1365 public Node insertBefore(Node newChild, Node refChild) throws DOMException 1366 { 1367 return document.insertBefore(newChild, refChild); 1368 } 1369 1370 public Node replaceChild(Node newChild, Node oldChild) throws DOMException 1371 { 1372 return document.replaceChild(newChild, oldChild); 1373 } 1374 1375 public Node removeChild(Node oldChild) throws DOMException 1376 { 1377 return document.removeChild(oldChild); 1378 } 1379 1380 public Node appendChild(Node newChild) throws DOMException 1381 { 1382 return document.appendChild(newChild); 1383 } 1384 1385 public boolean hasChildNodes() 1386 { 1387 return document.hasChildNodes(); 1388 } 1389 1390 public Node cloneNode(boolean deep) 1391 { 1392 return document.cloneNode(deep); 1393 } 1394 1395 public void normalize() 1396 { 1397 document.normalize(); 1398 } 1399 1400 public boolean isSupported(String feature, String version) 1401 { 1402 return document.isSupported(feature, version); 1403 } 1404 1405 public String getNamespaceURI() 1406 { 1407 return document.getNamespaceURI(); 1408 } 1409 1410 public String getPrefix() 1411 { 1412 return document.getPrefix(); 1413 } 1414 1415 public void setPrefix(String prefix) throws DOMException 1416 { 1417 document.setPrefix(prefix); 1418 } 1419 1420 public String getLocalName() 1421 { 1422 return document.getLocalName(); 1423 } 1424 1425 public boolean hasAttributes() 1426 { 1427 return document.hasAttributes(); 1428 } 1429} 1430 1431 | Popular Tags |