- Processing XML documents with Oracle JDeveloper 11g
- Deepak Vohra
- 406字
- 2021-08-06 17:22:08
JDeveloper built-in schema validation
Oracle JDeveloper 11g has built-in support for XML schema validation. If an XML document includes a reference to an XML schema, the XML document may be validated with the XML schema using the built-in feature. An XML schema may be specified in an XML document using the xsi:noNamespaceSchemaLocation
attribute or the xsi:namespaceSchemaLocation
attribute. Before we discuss when to use which attribute, we need to define the target namespace. A schema is a collection of type definitions and element declarations whose names belong to a particular namespace called a target namespace. Thus, a target namespace distinguishes between type definitions and element declarations from different collections. An XML schema doesn't need to have a target namespace. If the XML schema has a target namespace, specify the schema's location in an XML document using the xsi:namespaceSchemaLocation
attribute. If the XML schema does not have a target namespace, specify the schema location using the xsi:noNamespaceSchemaLocation
attribute. The xsi:noNamespaceSchemaLocation
and xsi:namespaceSchemaLocation
attributes are a hint to the processor about the location of an XML schema document. Taking the example XML schema catalog.xsd
and the example XML document, catalog.xml
from the previous chapter, specify the XML schema location in the XML document using the following attribute declaration:
xsi:noNamespaceSchemaLocation="catalog.xsd"
The XML schema may be in any directory. The example XML document does not include any namespace elements. Therefore, the schema is specified with the xsi:noNamespaceSchemaLocation
attribute in the root element catalog. The XML schema may be specified with a relative URL, or a file, or an HTTP URL. The xsi:noNamespaceSchemaLocation
attribute we added specifies the relative path to the XML schema document catalog.xsd
. To validate the XML document with the XML schema, right-click on the XML document and select Validate XML.

The XML document gets validated with the XML schema and the output indicates that the XML document does not have any validation errors.

To demonstrate validation errors, add a non-valid element to the XML document. As an example, add the following element to the catalog
element after the first journal
element:
<article></article>
To validate the modified XML document, right-click on the XML document and select Validate XML. The output indicates validation errors. All the elements after the non-valid element become non-valid. For example, the journal
element is valid as a subelement of the catalog
element, but because the second journal
element is after the non-valid article
element, the journal
element also becomes non-valid as indicated in the validation output.

- CorelDRAW X6圖形設(shè)計(jì)立體化教程
- 3ds Max 2016中文版完全自學(xué)手冊
- 邊做邊學(xué):Photoshop圖像制作案例教程(Photoshop CC 2019·微課版)
- Photoshop 平面廣告設(shè)計(jì)從入門到精通
- Maya建模技術(shù)解析
- Photoshop CS6中文版基礎(chǔ)培訓(xùn)教程
- Mastering phpMyAdmin 3.3.x for Effective MySQL Management
- 無師自通AutoCAD:中文版室內(nèi)設(shè)計(jì)
- SolidWorks 2018有限元:運(yùn)動(dòng)仿真與流場分析自學(xué)手冊
- Oracle Enterprise Manager Grid Control 11g R1: Business Service Management
- PostgreSQL 9.0 High Performance
- Photoshop手繪從新手到高手
- Origin 2022科學(xué)繪圖與數(shù)據(jù)分析(高級應(yīng)用篇)
- MODx Web Development
- Microsoft Dynamics Sure Step 2010