1
如何創建XML元素,如下面的C#加入名稱空間信息如何添加命名空間XML元素
<Booking bookingRefCode="ABC2123331" bookingAction="addOrUpdate" bookingComplete="true" xmlns="http://schemas.test.com/booking" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:schemaLocation="http://schemas.test.com/booking http://schemas.test.com/Current/xsd/booking.xsd">
,這是我當前的代碼
xw.WriteAttributeString("bookingRefCode", book.jobRefNo);
xw.WriteAttributeString("bookingAction", "addOrUpdate");
xw.WriteAttributeString("bookingComplete", "true");
,所以我加入如新的屬性這
xw.WriteAttributeString("xmlns", "http://schemas.test.com/booking");
,但它給出錯誤這方面有任何想法?
剛剛編輯標記C#... –
我認爲它應該是'xsi:schemaLocation',而不是'xmlns:schemaLocation' – MiMo