❶ spring-tx-2.5-xsd報錯怎麼辦
這個文件是spring事務標簽的校驗文件,從新用eclipse或者myeclipse導入spring的jar包。
❷ 在vs2010中,寫了一個xml文件,xsd文件,如果寫的xml文件不符合xsd,怎麼驗證它的錯誤,vs會自動報錯嗎
這有個.java的驗證方法
修改相應路徑後可直接運行驗證
package test;
import java.io.File;
import javax.xml.XMLConstants;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.w3c.dom.Document;
public class TestDOMValidation
{
public static void main(String[] args)
{
try
{
// Get Document Builder Factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// Leave off validation, and turn off namespaces
factory.setValidating(false);
factory.setNamespaceAware(false);
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new File("data/test/shiporder.xml"));
//Document doc = builder.parse(new File("data/test/simple.xml"));
// SchemaFactory is a schema compiler. It reads external representations of schemas and
// prepares them for validation.
SchemaFactory constraintFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// Source: an object that implements this interface contains the information needed to act
// as source input (XML source or transformation instructions).
Source constraints = new StreamSource(new File("data/test/shiporder.xsd"));
//Source constraints = new StreamSource(new File("data/test/simple.xsd"));
// Schema object represents a set of constraints that can be checked/ enforced against an
// XML document.
Schema schema = constraintFactory.newSchema(constraints);
// Validator is a processor that checks an XML document against Schema.
Validator validator = schema.newValidator();
// Validate the DOM tree
try
{
validator.validate(new DOMSource(doc));
System.out.println("Document validates fine.");
}
catch (org.xml.sax.SAXException e)
{
System.out.println("Validation error: " + e.getMessage());
}
}
catch (ParserConfigurationException e)
{
System.out.println("The underlying parser does not support the requested features.");
}
catch (FactoryConfigurationError e)
{
System.out.println("Error occurred obtaining Document Builder Factory.");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
❸ xsd怎樣驗證是否編寫正確
你可以用excel驗證
打開excel2003 -> Data -> XML - >XML Source -> 在彈出的窗口中點 xml maps - >選擇XSD文件
如果你的xsd不正確,它就會報錯,然後點details,它會告訴你錯誤的!
❹ 關於xsd xs:complexType 問題
轉:
C/C++頭文件一覽
(
C、傳統 C++
#include //設定插入點
#include //字元處理
#include //定義錯誤碼
#include //浮點數處理
#include //文件輸入/輸出
#include //參數化輸入/輸出
#include //數據流輸入/輸出
#include //定義各種數據類型最值常量
#include //定義本地化函數
#include //定義數學函數
#include //定義輸入/輸出函數
#include //定義雜項函數及內存分配函數
#include //字元串處理
#include //基於數組的輸入/輸出
#include //定義關於時間的函數
#include //寬字元處理及輸入/輸出
#include //寬字元分類
//////////////////////////////////////////////////////////////////////////
標准 C++(同上的不再注釋)
#include //STL 通用演算法
#include //STL 位集容器
#include
#include
#include
#include
#include //復數類
#include
#include
#include
#include
#include //STL 雙端隊列容器
#include //異常處理類
#include
#include //STL 定義運算函數(代替運算符)
#include
#include //STL 線性列表容器
#include //STL 映射容器
#include
#include //基本輸入/輸出支持
#include //輸入/輸出系統使用的前置聲明
#include
#include //基本輸入流
#include //基本輸出流
#include //STL 隊列容器
#include //STL 集合容器
#include //基於字元串的流
#include //STL 堆棧容器
#include //標准異常類
#include //底層輸入/輸出支持
#include //字元串類
#include //STL 通用模板類
#include //STL 動態數組容器
#include
#include
using namespace std;
//////////////////////////////////////////////////////////////////////////
C99 增加
#include //復數處理
#include //浮點環境
#include //整數格式轉換
#include //布爾環境
#include //整型環境
#include //通用類型數學宏
---------------------------------------------------------------------------------------------------------
補充:
經常在CSDN以及其他之類的技術論壇上問關於C++ 頭文件的問題。提出這些問題的往往就是那些剛學C++的新手。當初我是菜鳥的時候也問過類似的問題。
現在來看看下面兩個include:
#include // 這個就是1998年標准化以後的標准頭文件
#include // 這個就是標准化以前的頭文件
更本質上的區別就是iostream把標准C++庫的組件放在一個名位std的namespace裡面。而相對的iostream.h則將這些標准組件放在全局空間里,同時在標准化以後舊有的C標准庫也已經經過改造了。
看看下面這兩個頭文件
// 標准化後經過改造的C的標准庫,所有的組件都放在了std中
#include
// 標准化以前C++中的C標准庫
#include
// 在看看這個頭文件C標准庫下 基於char* 的字元處理函數庫
#include
// 在標准化以後他變成了這樣
#include
// 但是很多朋友還看見過這個字元串處理函數庫,他包含了新的string class
#include
經過了標准委員會如此大規模手術後,在98年以前出品的C++編譯器(BC3.0,BC5.0)上能順利通過編譯的源文件,在支持新標準的編譯器上可能無法順利通過編譯也就是很正常的事了。
[起因]
在回過頭來看看標准程序庫,這個程序庫涵蓋范圍相當廣大,提過了許許多多好用的功能。正是因為這樣標准程序庫中class的名稱和函數名與第三方提供的程序庫中的class名或是函數名發生名字沖突的可能性大大增大。為了避免這個問題的發生,標准委員會決定將標准程序庫中每一樣東西都放在namespace std中。但是這么做同時有引來了一個新的問題。很多C++程序代碼依賴那些已經存在很多年的C++ 「准」標准程序庫(C++遲遲未標准化才導致這些情況的發生),例如iosteam.h,complex.h等等。
為了解決這個新出現的問題,標准化委員會決定設計一些新的頭文件名,給那些穿上std外衣的組件所使用。把C++頭文件的.h去掉,於是就有前面出現的iostream,同樣C的頭文件也做了相同的處理,同時在前面加上了一個字母c,以表示是C的頭文件(感覺上有中種族歧視的感覺)。同時標准化委員會聲明就有的C++頭文件將不再列於被支持的名單之中了,而舊有的C頭文件為了滿足「對C的兼容性」這個古老契約,仍然將繼續存活下去。
但是,那些編譯器廠商不可能去推翻他們客戶的舊有編譯器(也跟本不會去這么做),所以那些舊有的C++頭文件仍然苟延殘喘的活了下來,並不斷的擾亂那些C++新兵的心智。
下面就是現在大多數C++開發工具表示頭文件的組織狀態:
1. 舊的C++頭文件 比如iostream.h,他們雖然被標准化委員會所拋棄,但由於各大廠商為了各自的商業利益仍然將繼續存活下去,這些頭文件的內容將不處於namespace std中。
2. 新的C++頭文件如iostream雖然提供了和舊有頭文件相同的功能,但他的內容都並入了namespace std中,從而有效避免了名字污染的問題。
3. 標准C的頭文件如stdio.h繼續獲得支持,這類文件的內容並未放在std中。
4. C函數庫的技能也有對應的新式C++版本,起名稱類似cstdio,這類頭文件的內容也有幸穿上了std的外衣。
其實標准化以後的標准程序庫的改動並不只有這些而已,很多的標准化組件都被「tamplate化」。其中就有元老級人物iostream。標准程序庫的問題並不是用一篇,兩篇文章就可以說清楚的。如果你像進一步的了解C++的標准程序庫的話,你可以看看侯先生的《C++標准程序庫》。
❺ <xml version="1.0" encoding="UTF-8">報錯,是啥原因
是第一行開頭有個小紅叉嗎?
第一種方法:
將Window -> Preferences -> General -> Network Connections -> Cache 下的 Cache entries 框內文件Remove All,保存,然後右擊當前的項目選擇 Validate,Eclipse 會重新載入 xsd 文件。
第二種方法:
點擊eclipse左上角菜單欄 Project->clean 清理一下你所出現問題的項目。不僅這個問題,還有很多奇怪的問題都可以通過這種方式解決。
第三種方法:
如果錯誤依舊,那就需要刪掉 xsd 文件的版本號,例如:
http://www.springframework.org/schema/context/spring-context-3.0.xsd
改成: http://www.springframework.org/schema/context/spring-context.xsd
或者是沒有版本號的,可以加上版本號試試。
❻ spring報錯怎麼處理
處理方法:
報這類錯誤經常的原因是沒有導入對應的jar包。如果你不確定,可以找下相關的jar包中是否有對應的xsd文件。
如果上面確認有xsd文件,確定你spring xmlns引入的版本在jar包中有。否則更正版本。