Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

StringºÍXmlÖ®¼äµÄת»»¡¢StringתInputStream

ͨ³£ÔÚ²Ù×÷xmlµÄʱºò£¬¶¼ÊÇͨ¹ýinputstream£¨ºÜ¶àÇé¿öÏÂÊÇFileInputStream£©À´¶ÁÈëxml²¢×ªÎªdomµÄ£¬ºÜ¶àÈË»áÓöµ½ÕâÖÖÇé¿öÊý¾Ý²»ÊÇ´ÓÎļþ¶ÁÈëµÄ¶øÊÇ´ÓStringÖÐÈ¡µÃµÄ
ÓÚÊÇ»áʹÓÃ
InputStream in = new ByteArrayInputStream (str.getBytes());À´È¡µÃinputstream £¬µ«ÊÇÕâÖÖInputStreamÖÐÊý¾Ý±»×ª³ÉÁËbyteÊý×飬ËùÒÔתdomµÄʱºò¾Í»á±¨´í
¿ÉÒÔͨ¹ýÒ»ÏÂ˼·À´½â¾ö
// ×Ö·û´®×ªXML
String xmlStr = \"......\";
StringReader sr = new StringReader(xmlStr);
InputSource is = new InputSource(sr);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder=factory.newDocumentBuilder();
Document doc = builder.parse(is);
//XMLת×Ö·û´®
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
t.setOutputProperty(\"encoding\",\"GB23121\");//½â¾öÖÐÎÄÎÊÌ⣬ÊÔ¹ýÓÃGBK²»ÐÐ
ByteArrayOutputStream bos = new ByteArrayOutputStream();
t.transform(new DOMSource(doc), new StreamResult(bos));
String xmlStr = bos.toString();


Ïà¹ØÎĵµ£º

¼ì²éxml´íÎó

°ÑxmlÍϵ½IEÀï¾ÍÕÒµ½´íÔÚÄÄÀïÁË
ÈçÏ£º
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
ÎĵµµÄ¶¥²ãÎÞЧ¡£´¦Àí×ÊÔ´ 'file:///D:/Tomcat 5.5/webapps/myapp/WEB-INF/web.xml' ʱ³ö´í¡£µÚ 1 ÐУ¬Î»ÖÃ: 44 ......

ÒÔXMLÎļþ´æ´¢ÅäÖÃÊý¾ÝµÄ¼¼ÊõʵÏÖ£¬c++

Ò»°ãÐÂÊÖͨ³£Ö»ÊÇʹÓÃÀàËÆµÄXerces,
TinyXMLÖ®ÀàµÄXML½âÎöxml£¬ÕâÖÖ·½Ê½Êµ¼ÊÉϺÜÀË·Ñʱ¼ä£¬×Ô¼º±àдºÜ¶à´úÂëÒ²ÈÝÒ׳ö´í¡£ÒòΪ£¬ËûÃǾ­³£ÒªÐ´Ò»¸öXML¶ÔÏóEntityµÄÀ࣬²¢¸½×ÅÒ»¶Ñ¶ÔÏó½âÎöµÄcode¡£¹¤×÷Á¿±È½Ï´ó¡£Ê¹ÓÃXML
Schema¹¤¾ß£¬XSDÉè¼Æ¹¤¾ß£¬È»ºóͨ¹ý¹¤¾ßÉú³ÉEntityClassºÍPaser
class¡£ÎÒ²»ÖªµÀÕâÖÖ¼¼ÊõÈ·ÇÐµÄÆðÔ ......

FLASH+XML²»ÏÔʾÖÐÎÄ»òÎÞ·¨ÏÔʾÖÐÎĵĽâ¾ö·½·¨

³£³£ÔÚÍøÉÏ¿´µ½Ò»Ð©ºÜµÄFLASHЧ¹û¿ÉÊÇÏÂÏÂÀ´ºó²Å·¢ÏÖÖÐÎIJ»Ö§³Ö»ò¶¼ÖÐÎÄÎÞ·¨ÏÔʾµÄÎÊÌ⣬ËùÒÔÔÚÍøÉÏÕÒÁ˺ܶà×ÊÁÏÖÕÓÚÕÒµ½ÁËÒ»¸ö¼òµ¥µÄ·½·¨À´½â¾öÕâ¸öÎÊÌ⣬ÔÚÕâÀïÓë´ó¼Ò·ÖÏíһϡ£
µãÄÏǶÈë°´Å¥£¬°´ÏÂctrlÑ¡Öдóд,Сд,Êý×Ö,±êµã·ûºÅ,ÖÐÎÄ(È«²¿)ºó,È·¶¨!!
 ÕâÑù¾ÍOKÁË¡£ ......

php½âÎöxmlʾÀý

<!-- xml ¸ñʽ
<books>
<book id='1001'>
<author>andylin</author>
<title>c language</title>
<publisher id="aaa">O'Reilly</publisher>
</book>

<book id='1002'>
<author>congfeng</author>
<t ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ