Perl Cd Bookshelf [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Perl Cd Bookshelf [Electronic resources] - نسخه متنی

Mark V. Scardina, Ben ChangandJinyu Wang

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








Document Object Model (DOM) APIs to query and manipulate a parsed document or create a new document from scratch. You can use the Simple API for XML (SAX) event-based APIs for the same purpose without building a full-blown DOM tree in memory. You can use the Sun Microsystems Java Extension standard Java Architecture for XML Binding (JAXB) APIs to generate Java code from an XML Schema, which enables you to create and access a conformant XML document. Finally, the Sun Microsystems Java Extension standard Streaming API for XML (StAX)APIs enable you to perform stream parsing on an XML document in a manner that is similar to, yet simpler than, using SAX. The following sections discuss parsing and various accessor APIs and provide examples of how to use them.



Parsing and Binding an XML Document



Application programs invoke the parse function to read an XML document and provide access to its content and structure by DOM or SAX APIs. Usually, initialization and termination functions must also be invoked in association with the parse function. Note that various flags, such as to discard white space and to turn on validation, can be set with some initialization functions before the parse function is invoked by the application program. For example, whereas some XML parsers are only nonvalidating, meaning they cannot check to see whether the XML document conforms to the DTD or XML Schema, other parsers, such as those from Oracle, have optional validation, meaning users can specify validation or nonvalidation before invoking the parse function. In addition, the parse routine must be able to accept different language encodings as specified in the XML document.


The Oracle XML Parser for Java makes it easy for Java programmers to extend their existing Java applications seamlessly to support XML. It processes XML documents and provides access to the information contained in them through a variety of user-friendly APIs. The parser fully supports both the tree-based DOM and event-based SAX standards. It also has a built-in XSLT processor that makes transforming XML documents from one format to another extremely simple. The parser can be used in any environment that supports JDK 1.2.x or higher, and it can also be run inside the Oracle9i and Oracle Database 10g OJVM. The parser is completely internationalized and supports every character set supported by Java, in addition to numerous others. This support means that the parser provides error messages in nearly every language supported by Oracle9i and Oracle Database 10g, making it an invaluable tool if you’re writing XML applications for non–English- speaking users.


The Oracle XML Parser for C with its integrated XSLT processor is provided in two forms: as a stand-alone, command-line executable, and as a library for linking with applications. Most users write their own applications and use the XML library. The executable is provided as a quick way to familiarize new users with XML by parsing and validating their own test documents, and it is also used to apply stylesheets to the XML document.


The C library contains APIs for initializing, parsing a file or buffer, resetting and shutting down the parser, plus full DOM, SAX, and XSLT implementations. Typically, you would use the following sequence: initialize(), parse(), terminate(). If multiple documents are to be parsed, the sequence would be initialize(), parse(), parse(), …, terminate(). All data presented by a parse remains valid until termination or cleanup. If you need only the results on each parse without retaining older data, the sequence would be initialize(), parse(), clean(), parse(), clean(),…, terminate(). To apply stylesheets to the XML documents, an additional call to xslprocess before terminate() or clean() would be necessary. See the C header, xml.h, in the XDK distribution for details on available functions.


The Oracle XML Parser for C++ calls the C parser with a wrapper to make it accessible from C++, with both interfaces provided in the same XML library, oraxml10.lib or libxml10.a. Everything about the C APIs holds true for the C++ APIs, except that the C++ APIs are able to provide APIs in an object-oriented manner corresponding to the class and method names in the DOM specification. See the C++ header, xml.hpp, for details on available functions.


Finally, functionality exists by way of class generators in both Java and C++ to automate the mapping between XML documents and code, so that generated code can create, access, update, and validate XML documents against XML Schema. Among the advantages are speed (the generated code is easily generated from input schema), ease of use (application programmers can easily call these generated routines rather than code their own), and data conversion (XML document data can be converted to that language’s data types). Using this type of functionality makes marshalling and unmarshalling XML content back and forth into the language representation very easy and facilitates the programming of XML applications.


/ 218