<v:line       style= "position:relative "       from= "0,0 "       to= "100,0 "       >       
                    <v:stroke       Startarrow= "classic "       EndArrow= "Classic "/>       
    </v:line>    
我想把这个保存到我XML里,不 知道怎么保存。
谢谢大家

解决方案 »

  1.   

    你可以取document.body,然后直接保存。
    用ajax发到后台,然后接收
    用post就好咯。
      

  2.   

    <v:line       style= "position:relative "       from= "0,0 "       to= "100,0 "       >        
                         <v:stroke       Startarrow= "classic "       EndArrow= "Classic "/>        
         </v:line>     
    上面我取到聊,存放到一个变量里,就不知道有怎么搞,不会要我操作字符串,用字符串来代替吧!
      

  3.   

    架构师交流群:59048426,已经上传google 、 eBay、Youtube等顶级软件产品的架构分析!资料陆续上传中。 
    达到人数后开始培训!欢迎加入探讨,提问题! 
    ============================================= 
    《企业应用架构模式》pdf 系列书籍已经上传至群共享,欢迎下载!
    能够经常提问及回答问题的朋友,可以得到群主的精美小礼品,赶紧加入吧!
      

  4.   

    可以仿照如下:XML文件:myXml.xml
    <?xml version="1.0" encoding="shift_jis" ?>
    <studentInfo>
    <student sex="male">
       <name>John</name>
       <age>14</age>
       <phone>6287555</phone>
    </student>
    <student sex="male">
       <name>Tom</name>
       <age>16</age>
       <phone>8273425</phone>
    </student>
    </studentInfo>与XML相关的JAVABEAN:myXmlBeanpackage myXmlep1;
    public class   myXmlBean
    {
    private String sex;
    private String name;
    private String age;
    private String phone;
    public void setSex(String sex){
       this.sex = sex;
    }
    public void setName(String name){
       this.name = name;
    }
    public void setAge(String age){
       this.age = age;
    }
    public void setPhone(String phone){
       this.phone = phone;
    }
    public String getSex(){
       return this.sex;
    }
    public String getName(){
       return this.name;
    }
    public String getAge(){
       return this.age;
    }
    public String getPhone(){
       return this.phone;
    }
    }
    XML读写程序:xmlTest.javapackage myXmlep1;
    import java.io.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.apache.crimson.tree.XmlDocument;
    import java.lang.Exception;
    public class   xmlTest
    {
    Vector student_Vector = new Vector();
    public static void main(String[] args)
    {
       xmlTest xmlTest = new xmlTest();
       xmlTest.student_Vector = new Vector();
       System.out.println("start reading");
       try
       {
        xmlTest.readXMLFile("myXml.xml");
        System.out.println("read over,start writing");
        xmlTest.writeXMLFile("Output.xml");
        System.out.println("write over");
       }
       catch (Exception e)
       {
        System.out.println("error");
       }
      
    }
    private void readXMLFile(String inFile) throws Exception{
       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
       DocumentBuilder db = null;
       try
       {
        db = dbf.newDocumentBuilder();
       }
       catch (ParserConfigurationException pce)
       {
        System.err.println(pce);
        System.exit(1);
       }
       Document doc = null;
       try
       {
        doc=db.parse(inFile);
       }
       catch (DOMException dom)
       {
        System.err.println(dom.getMessage());
        System.exit(1);
       }
       catch(IOException ioe){
        System.err.println(ioe);
        System.exit(1);
       }   Element root = doc.getDocumentElement();
       NodeList students = root.getElementsByTagName("student");
       for(int i=0;i<students.getLength();i++){
        Element student = (Element)students.item(i);
        myXmlBean stuBean = new myXmlBean();
        stuBean.setSex(student.getAttribute("sex"));    NodeList names = student.getElementsByTagName("name");
        if(names.getLength()==1){
         Element e = (Element)names.item(0);
         Text t = (Text)e.getFirstChild();
         stuBean.setName(t.getNodeValue());
        }    NodeList ages = student.getElementsByTagName("age");
        if(ages.getLength()==1){
         Element e = (Element)ages.item(0);
         Text t = (Text)e.getFirstChild();
         stuBean.setAge(t.getNodeValue());
        }    NodeList phones=student.getElementsByTagName("phone");
        if(phones.getLength()==1){
         Element e = (Element)phones.item(0);
         Text t = (Text)e.getFirstChild();
         stuBean.setPhone(t.getNodeValue());
        }    student_Vector.add(stuBean);
       }}
    private void writeXMLFile(String outFile) throws Exception{
       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
       DocumentBuilder db = null;
       try
       {
        db = dbf.newDocumentBuilder();
       }
       catch (ParserConfigurationException pce)
       {
        System.err.println(pce);
        System.exit(1);
       }
       Document doc = db.newDocument();   Element root = doc.createElement("write_studentInfo");
       doc.appendChild(root);
       for (int i = 0; i < student_Vector.size(); i++) {
        myXmlBean myXmlBean = (myXmlBean) student_Vector.get(i);
        Element student = doc.createElement("write_student");
        student.setAttribute("write_sex", myXmlBean.getSex());
        root.appendChild(student);
        Element name = doc.createElement("write_name");
        student.appendChild(name);
        Text tName = doc.createTextNode(myXmlBean.getName());
        name.appendChild(tName);    Element age = doc.createElement("write_age");
        student.appendChild(age);
        Text tAge = doc.createTextNode(String.valueOf(myXmlBean.getAge()));
        age.appendChild(tAge);    Element phone = doc.createElement("write_phone");
        student.appendChild(phone);
        Text tPhone = doc.createTextNode(myXmlBean.getPhone());
        phone.appendChild(tPhone);
        FileOutputStream outStream = new FileOutputStream(outFile);
        OutputStreamWriter outWriter = new OutputStreamWriter(outStream);
        ((XmlDocument) doc).write(outWriter, "shift_jis");
        outWriter.close();
        outStream.close();
       }
    }
    }