Ticket sales

xiaoxiao2021-03-06  102

SP_XML_PREPAREDOCUMENT

Read the Scalable Markup Language (XML) text provided as an input, then analyze it using the MSXML Syntax Analyzer (MSXML2.DLL) and provides you with the analysis. The analytical document is a tree type representation of each node (element, characteristics, text, annotation, etc.) in the XML document.

SP_XML_PREPAREDocument returns a handle that can be used to access the newly created internal representation of the XML document. The handle is kept valid during the connection to Microsoft® SQL ServerTM 2000 until the connection is reset or executes sp_xml_removedocument so that the handle is invalid.

Description The analyzed document is stored in the internal cache of SQL Server 2000. MSXML Syntax Analyzer uses SQL Server to use one-third of total memory. To avoid insufficient memory, run sp_xml_removedocument to release memory.

grammar

SP_XML_PREPAREDocument hdoc output [, xmltext] [, xpath_namespaces]

parameter

HDOC

It is a handle of the newly created document. HDOC's data type is Integer.

[xmltext]

It is the original XML document. MSXML Syntax Analyzer Analyzes the XML document. XMLText is the parameter of the Text Type (Char, Nchar, Varchar, NVarchar, Text, or Ntext). The default is NULL, in which case the internal representation of the empty XML document will be created.

[XPATH_NAMESPACES]]

Specifies the namespace declarations used in the row of OpenXML and column XPath expressions. The default is . XPath_NameSpaces provides namespace URI to the prefix used in the XPath expression of OpenXML by conforming to the XML documentation of symbolization. Xpath_NameSpaces declares prefix must be used to reference namespace URN: Schemas-Microsoft-COM: XML-MetAprop, which provides metadata for XML elements after analysis. Although this method can be used to redefine the namespace prefix for the meta-attribute namespace, but this namespace will not be lost. This prefix MP is still valid for URN: Schemas-Microsoft-COM: XML-MetAProp, even if xpath_namespaces do not include such declarations. XPath_NameSpaces is the parameter of the Text Type (Char, Nchar, Varchar, NVarchar, Text, or Ntext).

Returns the code value

0 (success) or> 0 (failure)

Authority

Perform permissions The default is granted public roles.

Example

A. Prepare internal representation for XML documents that meet grammar rules

The following example returns the handle of the newly created XML document inside the input provided. In the call to sp_xml_preparedocument, the default namespace prefix mapping is used.

Declare @HDoc Int

Declare @doc varchar (1000)

Set @doc = '

'

--Create an internal representation of the xml document.

EXEC SP_XML_PREPAREDocument @HDoc output, @doc

- Remove the internal representation.

Exec sp_xml_removedocument @HDOC

B. Prepare the internal representation for XML documents with DTD compliant grammar rules

The following example returns the handle of the newly created XML document inside the input provided. The stored procedure verifies the loaded document according to the DTD included in the document. In the call to sp_xml_preparedocument, the default namespace prefix mapping is used.

Declare @HDoc Int

Declare @doc varchar (2000)

Set @doc = '

DOCTYPE ROOT

[

]>

'

EXEC SP_XML_PREPAREDocument @HDoc output, @doc

C. Specify a namespace URI

The following example returns the handle of the newly created XML document inside the input provided. In the call to sp_xml_preparedocument, the MP prefix mapping the meta-attribute namespace is retained, and the XYZ mapping prefix is ​​added to the namespace URN: MyNameSpace.

Declare @HDoc Int

Declare @doc varchar (1000) set @doc = '

ORDERDATE = "1996-07-04T00: 00: 00">

ORDERDATE = "1996-08-16t00: 00: 00">

'

--Create an internal representation of the xml document.

EXEC SP_XML_PREPAREDocument @HDoc output, @doc, ' "

See

SP_XML_REMOVEDOCUMENT

转载请注明原文地址:https://www.9cbs.com/read-124268.html

New Post(0)