Sap Bcs Chema Guide

109
SAP Business Connector Schema Reference Guide SAP System Release 4.7 SAP AG - Neurottstr. 16 - D69190 Walldorf

description

SAP

Transcript of Sap Bcs Chema Guide

  • SAP Business ConnectorSchema Reference Guide

    SAP System

    Release 4.7

    SAP AG - Neurottstr. 16 - D69190 Walldorf

  • 2 SAP BC Schema Reference Guide 4.7

    Copyright

    Copyright 2003 SAP AG.. All rights reserved.

    No part of this description of functions may be reproduced or transmitted in any form or for anypurpose without the express permission of SAP AG.. The information contained herein may bechanged without prior notice.

    Some software products marketed by SAP AG and its distributors contain proprietary softwarecomponents of other software vendors.

    Microsoft , WINDOWS and EXCEL, NT and SQL-Server are registered trademarksof Microsoft Corporation.

    IBM, OS/2, DB2/6000, AIX, OS/400 and AS/400 are registered trademarks of IBMCorporation.

    OSF/Motif is a registered trademark of Open Software Foundation.

    ORACLE, is a registered trademark of ORACLE Corporation, California, USA.

    webMethods is a registered trademark of webMethods Incorporated, Virginia, USA.

    INFORMIX-OnLine for SAP is a registered trademark of Informix Software Incorporated.

    UNIX and X/Open are registered trademarks of SCO Santa Cruz Operation.

    SAP, R/2, R/3, RIVA, ABAP/4, SAPaccess, SAPmail, SAPoffice, SAP-EDI,SAP Business Workflow, SAP Early Watch, SAP Archive Link, R/3 Retail,ALE/WEB, SAPTRONIC are registered trademarks of SAP AG.

    All rights reserved.

  • Contents

    S

    ContentsAP BC Schema Reference Guide 4.7 3

    Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Welcome! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Program Code Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Viewing this Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Printing this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Other References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Chapter 2. SAP BC Schema Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11What Is an SAP BC Schema? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12What Does an SAP BC Schema Look Like? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    Schema Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Schema Details Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    Chapter 3. SAP BC Schemas Generated from XML Schemas . . . . . . . . . . . . . . . . . . . . . . 19What Does an XML Schema Look Like? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20What Does an SAP BC Schema Generated from an XML Schema Look Like? . . . . . . . . . . . . . . . . . 22

    What Does an SAP BC Schema Retain from an XML Schema? . . . . . . . . . . . . . . . . . . . . . . . . 23Element Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    Local Element Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Element References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    Attribute Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Local Attribute Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34Attribute References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    Changing the Default and Fixed Attribute Values in Attribute References . . . . . . . . . . . . . 37Any Element and Any Attribute Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Simple Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    List Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46Union Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48Fixed Facets in Simple Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Viewing Base Constraints for a Simple Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    Complex Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Complex Types Derived from Simple Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Anonymous Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58Content Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    Sequence Content Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

  • C o n t e n t s

    4

    Choice Content Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63All Content Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Mixed Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 SAP BC Schema Reference Guide 4.7

    Empty Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67Model Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69Attribute Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71Substitution Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73What if an XML Schema References Another XML Schema? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

    Include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Redefine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    Validation of XML Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    Chapter 4. SAP BC Schemas Generated from DTDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81What Does a DTD Look Like? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82What Does an SAP BC Schema Generated from a DTD Look Like? . . . . . . . . . . . . . . . . . . . . . . . . . 83

    What Does an SAP BC Schema Retain from a DTD? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84Element Type (ELEMENT) Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    PCDATA Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85Element Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    Occurrence Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Mixed Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91ANY Element Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92EMPTY Element Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    Attribute Type (ATTLIST) Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Enumerated Attribute Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    What if a DTD References Another DTD? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

  • SC H A P T E R1Introduction

    Welcome! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    Viewing this Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9AP BC Schema Reference Guide 4.7 5

  • C H A P T E R 1 I n t r o d u c t i o n

    6

    Welcome!This guide provides in-depth reference information about SAP BC schemas in SAP BC

    T SAP BC Schema Reference Guide 4.7

    Developer. It is aimed at solution developers who need to understand:

    The basic components of an SAP BC schema.

    How an SAP BC schema corresponds to the XML Schema definition from which it is generated.

    How an SAP BC schema corresponds to the Document Type Definition (DTD) from which it is generated.

    How the validation engine in the SAP BC Server augments elements and attributes in an XML document with default and fixed values from the SAP BC schema.

    To use this guide effectively, you should have a basic understanding of the XML Schema Language and DTDs. This guide does not provide any instruction about the XML Schema Language or DTDs. For a list of resources for the XML Schema Language, see Other References on page 9.

    ypographical ConventionsThis document uses the following typographical conventions:

    Convention Example

    Procedures are designated by a blue box in the left column. Procedures are presented as a series of numbered steps.

    1 On the Activity menu, click File.

    Terms that identify elements, options, selections, and commands on the screen are shown in bold.

    The Service field on the Properties tab specifies the name of the requested service.

    Characters that you must type exactly are shown in a typewriter font.

    Type: setup and then press ENTER.

    Variable information that you must type based on your specific situation or environment is shown in italics.

    Type: \setupand then press ENTER.

    Keyboard keys are shown in uppercase.

    Press ENTER; then press TAB.

  • Typographical Conventions

    S

    Keys that you must press simultaneously are joined with

    Press CTRL+ALT+M.

    Convention ExampleAP BC Schema Reference Guide 4.7 7

    Program Code ConventionsFor programming code and command syntax, this document uses the following typographical conventions:

    the + symbol.

    Directory paths are shown with the \ directory delimiter unless the subject is UNIX-specific. In these cases, the / is used. If you are working in a UNIX environment, substitute a / for the \ shown in the procedures in this book.

    \server\packages\Default

    Information that you must read before beginning a procedure or that alerts you to negative consequences of certain actions is denoted using this notation.

    Important! If the folder is not already open in the Service Browser, open it before you start the following procedure.

    Notes that provide related, but non-critical, information are denoted using this notation.

    Note: When you start SAP BC Developer, you are prompted to log on to a SAP BC Server.

    Helpful information such as shortcuts and alternatives. Tip! You can also use CTRL+C to copy an

    object.

    Convention Example

    Keywords and values that you must type exactly as printed are shown in typewriter font.

    %CoSymbol%

    Variable values or parameters that you must supply are shown in italics.

    %VarName%

    Keywords or values that are optional are enclosed in [ ]. Do not type the [ ] symbols in your own code.

    %loop LoopVar [null=NullValue]%

  • C H A P T E R 1 I n t r o d u c t i o n

    8

    Related DocumentationThe following documents are companions to this guide. Some documents are in PDF SAP BC Schema Reference Guide 4.7

    format and others are in HTML.

    Refer to this book... For...

    SAP BC Developer Guide

    Information about creating and testing services and client applications. This book for is for solution developers.

    You will find this book at:

    \developer\doc\SAPBCDeveloperGuide.pdf

    SAP BC Developer Tutorial

    Information that orients you to the SAP BC Developer and shows you how to create a simple application. It includes basic conceptual information about the SAP BC Developer. This book is for users of the SAP BC Developer.

    You will find this book at:

    \developer\doc\SAPBCDevTutorial.pdf

    SAP BC Administration Guide

    Information about using the Server Administrator to configure, monitor, and control the SAP BC Server. This book is for server administrators.

    You will find this book at:

    \server\doc\SAPBCAdministrationGuide.pdf

    SAP BC Built-In Services Guide

    Descriptions of services that are installed on your SAP BC Server. This book for is for solution developers.

    You will find this book at:

    \developer\doc\SAPBCBuiltInServicesGuide.pdf

    Building Output Templates and DSPs

    Information about creating output templates and Dynamic Server Pages (DSPs). This reference is for solution developers.

    You will find this book at:

    \developer\doc\SAPBCTemplatesAndDSPs.pdf

  • Viewing this Document

    S

    V

    P

    O

    SAP BC SOAP Programming Guide

    Information about using the SAP BC Server to exchange SOAP messages. This book is for developers.

    Refer to this book... For...AP BC Schema Reference Guide 4.7 9

    iewing this DocumentTo view this document, which is in PDF format, you must have Acrobat Reader 4.0 or later installed on your system. If you have an earlier version of Acrobat Reader, you will receive the following error message when you open this document and Acrobat Reader will not display the images in this document:

    Could not find the ColorSpace named Cs8.

    If you do not have this software or you do not have the correct version, you can download a free copy from:

    http://www.adobe.com/supportservice/custsupport/download.html.

    rinting this Guide To produce a hard copy of this guide, print this document from Acrobat Reader.

    ther ReferencesSAP BC schemas are closely related to their source filesXML Schemas and DTDs. The following is a list of additional resources that provide information about the XML Schema Language and DTDs.

    XML Schema Part 0: Primer at http://www.w3.org/TR/xmlschema-0/

    XML Schema Part 1: Structures at http://www.w3.org/TR/xmlschema-1/

    XML Schema Part 2: Datatypes at http://www.w3.org/TR/xmlschema-2/

    You will find this book at:

    \developer\doc\SAPBCSoapProgrammingGuide.pdf

    SAP BC Cooperative Development Guide

    Information about locking and unlocking elements, as well as integration with third-party source control applications. This book is for solution developers.

    You will find this book at:

    \developer\doc\SAPBCcoopdevguide.pdf\Integrationserver\doc\SAPBCcoopdevguide.pdf

  • SC H A P T E R2SAP BC Schema Overview

    What Is an IS Schema? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    What Does an IS Schema Look Like? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12AP BC Schema Reference Guide 4.7 11

  • C H A P T E R 2 S A P B C S c h e m a O v e r v i e w

    1

    What Is an SAP BC Schema?

    An SAP BC schema is a free-standing element in the Service Browser that acts as the

    W2 SAP BC Schema Reference Guide 4.7

    blueprint or model against which you validate an XML document. The SAP BC schema provides a formal description of the structure and content for a valid instance document (the XML document). The formal description is created through the specification of constraints. An SAP BC schema can contain the following types of constraints:

    Structural constraints in an SAP BC schema describe the elements, attributes, and types that appear in a valid instance document. For example, an SAP BC schema for a purchase order might specify that a valid element must consist of the , , , , and elements in that order.

    Content constraints in an SAP BC schema describe the type of information that elements and attributes can contain in a valid instance document. For example, the element might be required to contain a value that is a positive integer.

    During data validation, the validation engine in SAP BC Server compares the elements and attributes in the instance document with the structural and content constraints described for those elements and attributes in the SAP BC schema.The validation engine considers the instance document to be valid when it complies with the structural and content constraints described in the SAP BC schema. (The validation engine is the subsystem of the SAP BC Server that performs data validation.) For more information about data validation, see the SAP BC Developer Guide.

    You can create SAP BC schemas from an XML Schema, a DTD (Document Type Definition), or an XML document that references an existing DTD. For information about creating SAP BC schemas, see the SAP BC Developer Guide.

    hat Does an SAP BC Schema Look Like?The appearance and content of an SAP BC schema depends on whether you generate an SAP BC schema from an XML Schema or a DTD. For example, if you create an SAP BC schema from an XML Schema, the resulting SAP BC schema displays type definitions, element declarations, and attribute declarations. If you create an SAP BC schema from a DTD, the resulting SAP BC schema displays element type declarations.

    When you select an SAP BC schema in the Service Browser, Developer displays the contents of the SAP BC schema on the Schema tab. The Schema tab is divided into two areas: the Schema Browser on the left and the Schema Details area on the right. The Schema tab also identifies the target namespace for the SAP BC schema at the top of the tab.

  • What Does an SAP BC Schema Look Like?

    S

    Schema tab

    Specifies the targetnamespace to whichAP BC Schema Reference Guide 4.7 13

    Schema BrowserThe Schema Browser displays the components of an SAP BC schema in a format that mirrors the structure and content of the source file. The Schema Browser groups the global element declarations, attribute declarations, simple type definitions and complex type definitions from the source file under the top-level headings ELEMENTS, ATTRIBUTES, SIMPLE TYPES, and COMPLEX TYPES. For example, the ELEMENTS heading contains all of the global element declarations from the XML Schema or the DTD.

    If the source file does not contain one of these global components, the corresponding heading is absent. For example, if you create an SAP BC schema from an XML Schema that does contain any global attribute declarations, the Schema Browser does not display the ATTRIBUTES heading. An SAP BC schema created from a DTD never displays the SIMPLE TYPES or COMPLEX TYPES headings because DTDs do not contain type definitions.

    the schema belongs.

    Select a component inthe Schema Browser...

    ...to view and/or edit thecomponent in the

    Schema Details area.

  • C H A P T E R 2 S A P B C S c h e m a O v e r v i e w

    1

    Note: A DTD does contain attribute declarations. However, the Schema Browser does not display the ATTRIBUTES heading for SAP BC schemas generated from DTDs. This is because an attribute declaration in a DTD associates the attribute with an element type. 4 SAP BC Schema Reference Guide 4.7

    The Schema Browser uses unique symbols to represent the components of the SAP BC schema. Each of these symbols relates to a component of an XML Schema or a DTD. The following table identifies the symbol for each component that can appear in an SAP BC schema.

    Accordingly, the Schema Browser displays attributes as children of the element type declaration to which they are assigned. For more information, see Element Type (ELEMENT) Declarations on page 84.

    Note: In the following table (and throughout this book), global refers to elements, attributes, and types declared or defined as immediate children of the element in an XML Schema. All element type declarations in a DTD are considered global declarations.

    Symbol Description

    Element declaration. An element declaration associates an element name with a type definition. This symbol corresponds to the declaration in an XML Schema and the ELEMENT declaration in a DTD.

    Element reference. An element reference is a reference from an element declaration in a content specification to a globally declared element.

    In an SAP BC schema generated from an XML Schema, this symbol corresponds to the ref="globalElementName" attribute in an declaration.

    In an SAP BC schema generated from DTD, this symbol appears next to an element that is a child of another elementthe parent element has only element content.

    Any element declaration. In XML Schema, an element declaration is a wildcard declaration used as a placeholder for one or more undeclared elements in an instance document.

    In a DTD, an element declared to be of type ANY can contain any well-formed XML. This symbol corresponds to an element declared to be of type ANY.

    Because an element declaration does not have a name, the Schema Browser uses 'Any' as the name of the element.

    Attribute declaration. An attribute declaration associates an attribute name with a simple type definition. This symbol corresponds to the XML Schema declaration or the attribute in a DTD ATTLIST declaration.

  • What Does an SAP BC Schema Look Like?

    S

    Attribute reference. An attribute reference is a reference from a complex type definition to a globally declared attribute. This symbol corresponds to the

    Symbol DescriptionAP BC Schema Reference Guide 4.7 15

    ref="globalAttributeName" attribute in an attribute declaration.

    DTDs do not have attribute references. Consequently, attribute references do not appear in SAP BC schemas generated from DTDs.

    Any attribute declaration. An any attribute declaration is a wildcard declaration used as a placeholder for undeclared attributes in an instance document. This symbol corresponds to the declaration in an XML Schema.

    Because an declaration does not specify an attribute name, the Schema Browser uses 'Any Attribute' as the name of the attribute.

    Simple type definition. A simple type definition specifies the data type for a text-only element or an attribute. Unlike complex type definitions, simple type definitions cannot carry attributes. This symbol corresponds to the element in an XML Schema.

    If the simple type definition is unnamed (an anonymous type), the Schema Browser displays 'Anonymous' as the name of the complex type definition.

    Complex type definition. A complex type definition defines the structure and content for elements of complex type. (Elements of complex type can contain child elements and carry attributes.) This symbol corresponds to the element in an XML Schema.

    If the complex type definition is unnamed (an anonymous type), the Schema Browser displays 'Anonymous' as the name of the complex type definition.

    Sequence content model. A sequence content model specifies that the child elements in the instance document must appear in the same order in which they are declared in the content model. This symbol corresponds to the compositor in an XML Schema or a sequence list in an element type declaration in a DTD.

    Choice content model. A choice content model specifies that only one of the child elements in the content model can appear in the instance document. This symbol corresponds to the compositor in an XML Schema or a choice list in a DTD element type declaration.

    All content model. An all content model specifies that child elements can appear once, or not at all, and in any order in the instance document. This symbol corresponds to the compositor in an XML Schema.

    Mixed content. Elements that contain mixed content allow character data to be interspersed with child elements. This symbol corresponds to the mixed="true" attribute in an XML Schema complex type definition or a DTD element list in which the first item is #PCDATA.

  • C H A P T E R 2 S A P B C S c h e m a O v e r v i e w

    1

    Empty content. In an XML Schema, an element has empty content when its associated complex type definition does not contain any element

    Symbol Description6 SAP BC Schema Reference Guide 4.7

    Schema Details AreaThe Schema Details area displays information that you use to examine and edit the selected component in the Schema Browser. The contents of the Schema Details area vary depending on what component you select. For example, when you select a globally declared element of complex type, the Schema Details area looks like the following.

    Schema Details area for a global element declaration of complex type

    declarations. An element with empty content may still carry attributes.

    In a DTD, an element has empty content when it is declared to be of type EMPTY.

    ... the Schema Detailsarea displays information

    about that element.

    If you select anelement declaration...

  • What Does an SAP BC Schema Look Like?

    S

    When you select a simple type definition, the Schema Details area looks like the following:

    Schema Details area for a simple type definitionAP BC Schema Reference Guide 4.7 17

    If you select a simpletype definition...

    ... the Schema Detailsarea displays fields for

    viewing/editing thesimple type.

  • C H A P T E R 2 S A P B C S c h e m a O v e r v i e w

    18 SAP BC Schema Reference Guide 4.7

  • SC H A P T E R3SAP BC Schemas Generated from XML Schemas

    What Does an XML Schema Look Like? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    What Does an IS Schema Generated from an XML Schema Look Like? . . . . . . . . . . . . . . . 22

    Element Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    Attribute Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    Any Element and Any Attribute Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

    Simple Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Complex Type Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    Anonymous Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    Content Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    Mixed Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    Empty Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

    Model Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    Attribute Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

    Substitution Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

    What if an XML Schema References Another XML Schema? . . . . . . . . . . . . . . . . . . . . . . . . 74

    Validation of XML Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81AP BC Schema Reference Guide 4.7 19

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    2

    XML Schema definition language is used to formally describe the structure and content of a valid XML document (instance document). In Developer, you can create SAP BC schemas from XML Schema definitions. The resulting SAP BC schemas can be used with the pub.schema:validate service to validate XML documents.

    W0 SAP BC Schema Reference Guide 4.7

    hat Does an XML Schema Look Like?An XML Schema definition contains element declarations, attribute declarations, and type definitions to describe and identify the elements and attributes of a valid XML document. Simple type definitions and complex type definitions describe the content these elements and attributes can contain. In an XML Schema, element declarations, attribute declarations, and type definitions are children of the top-level element.

    XML Schema for po.xsd

    Note: All of the XML Schema definitions provided in this guide conform to the syntax, structures, and data types specified in the XML Schema Recommendation adopted by the W3C in May of 2001.

  • What Does an XML Schema Look Like?

    S

    Complex typedefinitionAP BC Schema Reference Guide 4.7 21

    Complex typedefinition

    Simple typedefinition

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    2

    What Does an SAP BC Schema Generated from an XML Schema Look Like?2 SAP BC Schema Reference Guide 4.7

    When you generate an SAP BC schema from an XML Schema, the schema processor creates an SAP BC schema that contains all of the defined types, declared elements, and declared attributes from the schema definition. (The schema processor is the subsystem of the SAP BC Server that compiles an SAP BC schema from a source file.) The SAP BC schema groups the global elements, attributes, complex types, and simple types under the headings ELEMENTS, ATTRIBUTES, SIMPLE TYPES, and COMPLEX TYPES respectively. You can expand the headings to view the global elements, attributes, or type definitions.

    To illustrate the relationship between an SAP BC schema and the source XML Schema, below is the SAP BC schema generated from XML schema po.xsd. (The schema po.xsd is presented on page 20.) The resulting SAP BC schema is named poSchema.

    SAP BC schema for po.xsd

    Note: Top-level declarations and global declarations are types, elements, and attributes that are defined or declared immediately under the element in an XML Schema. Local declarations are elements and attributes declared as part of a complex type definition, a model group, or an attribute group.

    Global elementdeclarations appear as

    immediate children ofthis heading.

    Global simple typedefinitions appear asimmediate children of

    this heading.

    Global complex typedefinitions appear asimmediate children of

    this heading.

  • What Does an SAP BC Schema Generated from an XML Schema Look Like?

    S

    Notice that poSchema contains the top-level headings ELEMENTS, SIMPLE TYPES, and COMPLEX TYPES. The SAP BC schema does not display a top-level ATTRIBUTES heading because the po.xsd file does not contain any global attribute declarations. AP BC Schema Reference Guide 4.7 23

    What Does an SAP BC Schema Retain from an XML Schema?When you generate an SAP BC schema from an XML Schema, the schema processor retains any information that can be used to validate or augment the structure and content of an instance document. For example, an SAP BC schema created from an XML Schema contains simple type definitions, complex type definitions, element declarations, and attribute declarations because they validate the structure or content of elements in an instance document. The SAP BC schema also retains the values of the default and fixed attributes from element and attribute declarations because these values can be used to augment the content of an element or attribute in an instance document.

    For some components of an XML Schema that provide information for validation or augmentation, there is not a direct relationship between the XML Schema and the SAP BC schema. For example, model groups and attribute groups do not appear as unique components in the Schema Browser. The schema processor consumes model groups and attribute groups and inserts the contents of the groups in the complex types in which the groups are referenced.

    The schema processor discards any information that does not contribute to validating or augmenting the content and structure of an instance document. For example, the schema processor does not retain annotations, comments, or derivation restriction information from the XML Schema. Consequently, these components do not appear in SAP BC schemas.

    The following sections provide more detailed information and examples of how Developer renders the components of an XML Schema in an SAP BC schema.

    Tip! The XML Schema po.xsd is located in the directory \developer\samples\xml\xsd\po. To further examine the SAP BC schema generated from this file, use Developer to create your own copy of the SAP BC schema. For more information about creating an SAP BC schema, see the SAP BC Developer Guide.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    2

    Element DeclarationsAn element declaration associates an element name with a simple or complex type 4 SAP BC Schema Reference Guide 4.7

    definition. The element declaration can contain attributes to specify a default value, a fixed value, and whether the element is abstract or nillable. If an element declaration is part of a content specification, the element declaration can contain attributes to specify occurrence constraints.

    Global (or top-level) attribute declarations appear as immediate children of the element in the XML Schema. Following are the global element declarations for and from po.xsd.

    Global element declarations in an XML Schema

    In the SAP BC schema generated from po.xsd, the comment and purchaseOrder element declarations appear immediately under the ELEMENTS heading. (comment and purchaseOrder are global element declarations.) You can expand an element declaration to view the assigned type definition. When you select an element declaration, the Schema Details area displays information such as the namespace to which the element belongs, default and fixed values, if the element is abstract, if the element can be nil, and the type assigned to the element.

    In the Schema Browser, the comment and purchaseOrder element declarations look like the following.

    Note: An XML schema can also contain the wildcard element declaration to allow an instance document to contain one or more undeclared elements that belong to a specific namespace. For more information about , see Any Element and Any Attribute Declarations on page 39.

  • Element Declarations

    S

    Global element declarations in the Schema BrowserAP BC Schema Reference Guide 4.7 25

    When you select an element declaration in the Schema Browser, the Schema Details area displays the following fields:

    This element is definedto be of simple type.

    This element is definedto be of complex type.

    This field... Specifies...

    Name The local name of the element followed by the namespace to which the element belongs. The Name value is equal to the expanded value (prefix plus local name) of the name attribute in the element declaration.

    Default The default value for the element. The Default value is equal to the value of the default attribute in the element declaration.

    During data validation, if the element appears in an instance document but contains no content, the validation engine supplies the element with the Default value. If the element does not appear in the instance document, the validation engine does not augment the instance document.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    2

    Fixed Value The fixed value for the element. The Fixed Value is equal to the value of the fixed attribute in the element declaration.

    This field... Specifies...6 SAP BC Schema Reference Guide 4.7

    When the validation engine validates an instance document against the SAP BC schema, if the element appears, its value must be equal to the Fixed Value.

    During data validation, if the element appears in an instance document but contains no content, the validation engine supplies the element with the Fixed Value. If the element does not appear in the instance document, the validation engine does not augment the instance document.

    Is Nillable Whether the element can have no content in the instance document. The Is Nillable value is equal to the value of the nillable attribute in the element declaration. The Is Nillable field can have the following values:

    True indicates that the nil attribute for this element in the instance document can be set to true. (When nil="true", the element has a null value.) When the value of Is Nillable is True, the element declaration in the XML Schema contains nillable="true".

    False indicates that the nil attribute for the element in an instance document cannot be set to true; that is, the element must contain content. When the value of Is Nillable is False, the element declaration contains nillable="false" or the nillable attribute is absent. This is the default value.

    Is Abstract Whether the element is abstract. The Is Abstract value is equal to the value of the abstract attribute in the element declaration. The Is Abstract field can have the following values:

    True indicates the element is abstract. Abstract element declarations cannot appear in instance documents. Instead, an element in the abstract elements substitution group must appear in the instance document. When Is Abstract is True, the element declaration contains abstract="true".

    False indicates the element is not abstract. When the value of Is Abstract is False, the element declaration contains abstract="false" or the abstract attribute is absent. This is the default value.

  • Element Declarations

    S

    Complex Type The name and namespace of the complex type assigned to the element. This field appears only if the element is defined to be of complex type.

    This field... Specifies...AP BC Schema Reference Guide 4.7 27

    If the element is defined to be of anonymous complex type, this field displays 'Anonymous' as the name of the complex type.

    In the Schema Browser, the complex type definition assigned to an element appears as an immediate child of the element. For more information about complex type definitions, see Complex Type Definitions on page 53.

    Simple Type The name and namespace of the simple type assigned to the element. This field appears only if the element is defined to be of simple type. If the element is defined to be of anonymous simple type, this field displays 'Anonymous' as the name of the simple type.

    In the Schema Browser, the simple type definition assigned to an element appears as an immediate child of the element. For more information about simple types, see Simple Type Definitions on page 44.

    Min Occurs The minimum number of times this element must appear. The Min Occurs value is equal to the value of the minOccurs attribute in the local element declaration. If the local element declaration does not specify minOccurs, the schema processor uses a default value of 1.

    This field appears only when you select a local element declarationan element declaration in a complex type definition.

    Max Occurs The maximum number of times this element may appear. The Max Occurs value is equal to the value of the maxOccurs attribute in the local element declaration. If the local element declaration does not specify maxOccurs, the schema processor uses a default value of 1.

    This field appears only when you select a local element declarationan element declaration in a complex type definition.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    2

    Local Element DeclarationsLocal element declarations are those elements declared as part of a complex type definition. More specifically, the local element declarations are part of the content

    L8 SAP BC Schema Reference Guide 4.7

    specification for the complex type definition. A content specification specifies the child elements for a complex type definition and the order in which these child elements must appear. For example, in po.xsd, the shipTo, billTo, and items elements are declared as part of the content model in the PurchaseOrderType definition.

    Local element declarations in an XML Schema

    In the Schema Browser, local element declarations appears as children of the complex type in which they are declared. To view the shipTo, billTo, and items element declarations in the Schema Browser, expand the PurchaseOrderType complex type definition and then expand the Sequence content model.

    .

    .

    .

    ocal element declarations

  • Element Declarations

    S

    Local element declarations in the PurchaseOrderType complex type definitionAP BC Schema Reference Guide 4.7 29

    For information about the fields the Schema Details area displays when you select a local element declaration in the Schema Browser, see the table on page 25.

    shipTo, billTo, anditems are locally

    declared elements.

    comment is areference to a globally

    declared element.

    Note: In XML Schemas, local element declarations can also be element declarations in a model group. SAP BC schemas do not display model groups. If a complex type definition in the XML Schema references a model group, the schema processor inserts the contents of the model group at the location of the model group reference. For more information about model groups, see Model Groups on page 69.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    3

    Element ReferencesAn element reference is a local element declaration that references a global element. The value of the ref attribute in the element declaration specifies which element is being 0 SAP BC Schema Reference Guide 4.7

    referenced. For example, the complex type definition contains a reference to the global element declaration .

    Element reference

    The Schema Browser uses the symbol to identify a reference to a global element declaration. The Schema Browser displays element references as children of the complex type definition in which they are declared. The example on page 29 shows the element reference to the global element declaration comment in the PurchaseOrderType complex type definition. For information about the fields the Schema Details area displays when you select an element reference in the Schema Browser, see the table on page 25.

    .

    .

    .

    This is a reference tothe globally declared

    element comment.

  • Attribute Declarations

    S

    Attribute DeclarationsAn attribute declaration associates an attribute name with a data type. The data type for AP BC Schema Reference Guide 4.7 31

    an attribute is always a simple type. An attribute declaration can specify a default value, a fixed value, and whether the appearance of the attribute in the instance document is required. Like element declarations, attribute declarations can be global or local.

    Global (or top-level) attribute declarations appear as immediate children of the element in the XML Schema. For example, the following schema segment contains a global attribute declaration for the attribute.

    Global attribute declaration in an XML Schema

    In an SAP BC schema, global attribute declarations appear immediately under the ATTRIBUTES heading in the Schema Browser. For example, the color attribute declared in the preceding schema segment appears under ATTRIBUTES in the Schema Browser. The simple type definition associated with the attribute name appears as a child of the attribute declaration In the SAP BC schema generated from the above schema segment, the simple type string appears as a child of the color attribute declaration.

    Note: An XML schema can also contain the wildcard attribute declaration to allow an instance document to contain one or more undeclared attributes. For more information about , see Any Element and Any Attribute Declarations on page 39.

    .

    .

    .

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    3

    Global attribute declaration in the Schema Browser2 SAP BC Schema Reference Guide 4.7

    When you select an attribute declaration in the Schema Browser, the Schema Details area displays the following fields:

    The global attributedeclaration color is of

    type string.

  • Attribute Declarations

    S

    This field... Specifies...

    Name The local name and target namespace of the attribute declaration. The AP BC Schema Reference Guide 4.7 33

    Name value is equal to the expanded value (prefix plus local name) of the name attribute in the attribute declaration.

    Default The default value for the attribute in an instance document. The Default value is equal to the value of the default attribute in the attribute declaration.

    During data validation, the validation engine supplies the instance document with an attribute whose value equals that of Default if:

    The element to which the attribute is assigned appears in the instance document, and

    The attribute itself does not appear.

    If the element to which the attribute declaration is assigned does not appear in the instance document, the validation engine does not augment the instance document.

    Note: During data validation, the validation engine applies the Default value for an attribute declaration differently than the Default value for an element declaration. For attributes, the validation engine supplies the instance document with an attribute with the Default value when the attribute does not appear in the instance document. For elements, the validation engine supplies the instance document with an element equal to the Default value only if the element appears in the instance document, but has no content.

    Fixed Value The fixed value for the attribute. The Fixed Value is equal to the value of the fixed attribute in the attribute declaration.

    If this attribute appears in an instance document, the attribute value must equal the Fixed Value.

    During data validation, the validation engine supplies the instance document with an attribute whose value equals Fixed Value if:

    The element to which the attribute is assigned appears in the instance document, and

    The attribute itself does not appear in the instance document.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    3

    Is Required Whether or not the attribute must appear in an instance document. The Is Required value is determined by the value of the use attribute in the

    This field... Specifies...4 SAP BC Schema Reference Guide 4.7

    Local Attribute DeclarationsLocal attribute declarations are attribute declarations that appear in a complex type definition. For example, in the following schema segment, the PurchaseOrderType definition contains a local attribute declaration for orderDate.

    attribute declaration. This field only appears when you select a local attribute declaration or an attribute reference.

    The Is Required field can have one of the following values:

    True specifies that the attribute is required and must appear in the instance document. When the value of Is Required is True, the attribute declaration contains use="required".

    False specifies that the appearance of the attribute in the instance document is optional; that is, the attribute is not required. When the value of Is Required is False, the attribute declaration or use="optional"or the use attribute is absent from the declaration.

    Note: If an attribute declaration in an XML Schema contains use="prohibited", the attribute declaration does not appear in the Schema Browser. The schema processor does not retain attribute declarations whose use is prohibited.

    Simple Type The name and namespace of the simple type definition associated with the attribute. For more information about simple types, see Simple Type Definitions on page 44.

  • Attribute Declarations

    S

    Local attribute declaration in an XML Schema

    AP BC Schema Reference Guide 4.7 35

    In an SAP BC schema, attributes declared in a complex type definition are grouped into an ATTRIBUTES heading located under the complex type definition. For example, to view the orderDate attribute declaration in an SAP BC schema, expand the PurchaseOrderType definition and then expand the ATTRIBUTES heading.

    Local attribute declaration in the Schema Browser

    .

    .

    .

    Local attributedeclaration

    Local attributedeclarations appear aschildren of the complex

    type in which they aredeclared.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    3

    For more information about the fields the Schema Details area displays when you select a local attribute declaration, see the table on page 33.6 SAP BC Schema Reference Guide 4.7

    Attribute ReferencesAn attribute reference is a reference from a local attribute declaration to a global attribute. The value of the ref attribute in the local attribute declaration specifies which attribute is being referenced. For example, in the schema segment below, the Item complex type definition references the global attribute declaration for color.

    Attribute reference in an XML Schema

    The Schema Browser uses to indicate that a local attribute declaration is a reference to a global attribute declaration. Like local attribute declarations, the Schema Browser display attribute references under the ATTRIBUTES heading for the complex type definition in which the reference appears. For example, in the SAP BC schema generated from the above schema segment, the Schema Browser displays the color attribute reference under the ATTRIBUTES heading for the Items complex type definition.

    .

    .

    .

    .

    .

    .

    This is a reference to theglobal attribute

    declaration color.

    Global attributedeclaration for color.

  • Attribute Declarations

    S

    Attribute reference in the Schema BrowserAP BC Schema Reference Guide 4.7 37

    For information about the fields that appear in the Schema Details area when you select an attribute reference, see the table on page 33.

    Changing the Default and Fixed Attribute Values in Attribute ReferencesAn attribute declaration can specify a default or fixed value using the default or fixed attributes respectively. An attribute reference to a global attribute declaration inherits the default or fixed values set in the global attribute declaration. In some circumstances, an attribute reference can set a default or fixed value that overrides the values set in the global attribute declaration.

    An attribute reference can specify a default or fixed attribute value in the following situations:

    The global attribute declaration does not specify a default or fixed attribute value. The attribute reference can specify either a default attribute value or a fixed attribute value.

    The global attribute declaration specifies a default attribute value. The attribute reference can specify either a default attribute value or a fixed attribute value.

    The global attribute declaration specifies a fixed attribute value. The attribute reference can specify a fixed attribute value, but the value must be identical to the value specified in the global attribute declaration.

    This global attributedeclaration...

    ... is referenced in theItems complex type

    definition.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    3

    For example, in the following schema segment, the anonymous complex type definition for the lineItem element references the global attribute declaration for color. In the global attribute declaration, the value of the default attribute is red. However, in the attribute reference to color, the value of the default attribute is set to blue. 8 SAP BC Schema Reference Guide 4.7

    Global attribute declaration and attribute reference with different default values

    The SAP BC schema generated from the above schema segment reflects the different default values for the global attribute declaration and the attribute reference. When you select the global attribute declaration, the Schema Details area displays red as the Default value. When you select the attribute reference color, the Schema Details area displays blue as the Default value.

    .

    .

    .

    In the global attributedeclaration, the default

    value is red.

    In the attributereference, the defaultvalue is red. The local

    value overrides theglobal value.

    Note: When viewing attribute references in the Schema Browser, keep in mind that the Fixed Value and Default values of an attribute reference might be different from those of the referenced global attribute declaration.

  • Any Element and Any Attribute Declarations

    S

    Any Element and Any Attribute DeclarationsXML Schema language provides two wildcard declarations that a schema author can use AP BC Schema Reference Guide 4.7 39

    to allow for unexpected or unknown elements or attributes in instance documents. The declaration in a content specification works as a placeholder for one or more undeclared elements. The declaration acts as a placeholder for one or more undeclared attributes. The element or attribute that corresponds to the wildcard declaration in the instance document is called the matching element or matching attribute.

    In the and wildcard declarations, the namespace attribute value determines the namespaces to which the matching element or attribute can or cannot belong. The namespace attribute in an or declaration can have the following values:

    For example, the declaration in the following schema fragment specifies that instances of the element can contain one element that belongs to any namespace. The declaration specifies that instances of the element can carry any attributes that belong to the http://www.myexample.com namespace.

    This namespace attribute value... Indicates the matching element or attribute can be...

    ##any Any element or attribute from any namespace or that belongs to no namespace. This is the default value.

    ##local Any element or attribute that does not belong to a namespace.

    ##other Any element or attribute that belongs to a namespace other than the target namespace of the XML Schema.

    ##targetNamespace Any element or attribute from the target namespace of the XML Schema.

    "URI1 URI2" Any element or attribute from a namespace in a whitespace-separated list of URIs.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    4

    Any Element and Any Attribute declarations in an XML Schema

    .

    The matching elementcan be from any

    namespace.

    The matching attributemust be from the

    namespacewww.myexample.com.

  • Any Element and Any Attribute Declarations

    S

    Any Element and Any Attribute in the Schema BrowserAP BC Schema Reference Guide 4.7 41

    When you select an 'Any' declaration or an 'Any Attribute' declaration in the Schema Browser, the Schema Details area displays the following fields:

    An any attributedeclaration.

    An any elementdeclaration.

    Note: The Schema Browser displays an 'Any' element declaration as being of complex type. In an instance document, the matching element can be of any typesimple or complex.

    This field... Specifies...

    Min Occurs The minimum number of occurrences for the matching element in the instance document. This field appears only when an 'Any' element declaration is selected in the Schema Browser.

    Max Occurs The maximum number of occurrences for the matching element in the instance document. This field appears only when an 'Any' element declaration is selected in the Schema Browser.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    4

    Process Contents

    The validation constraints placed on the matching element or attribute in the instance document. The value of the Process Contents field equals

    This field... Specifies...2 SAP BC Schema Reference Guide 4.7

    the value of the processContents attribute in the any or anyAttribute declaration. This Process Contents field can have one of the following values:

    strict specifies that the validation engine must validate the matching element or attribute against a global declaration in a schema belonging to one of the allowed namespaces. If the validation engine cannot find one of the XML components, it generates the validation error NV-003, Unable to locate a matching element declaration or NV-006 Unable to locate a matching attribute declaration. The ProcessContents value is strict when the processContents attribute is absent or is set to "strict" in the element or attribute declaration. This is the default value.

    skip specifies that the matching element or attribute must be well-formed XML. The validation engine does not need to make sure the matching element or attribute is schema-valid. The ProcessContents value equals skip when processContents="skip" in the element or attribute declaration.

    lax specifies that when the validation engine encounters the matching element or attribute in the instance document, it should (if possible) validate the matching element or attribute against the corresponding global declaration in a schema from an allowed namespace. However, if the validation engine cannot find the schema in the namespace, no error occurs. The ProcessContents value equals lax when processContents="lax" in the element or attribute declaration.

    Qualifier Whether the matching element or attribute can or cannot be from one of the namespaces listed in the URIs field.

    The namespace attribute value in the any or anyAttribute declaration determines the value of the Qualifier field. The following table describes how the schema processor populates the Qualifier field based on the namespace attribute value.

    Namespace Qualifier Description

    ##any any Specifies that the matching element or attribute can be from any namespace.

    ##local specific Specifies that the matching element or attribute must belong to a namespace.

  • Any Element and Any Attribute Declarations

    S

    Namespace Qualifier Description

    This field... Specifies...AP BC Schema Reference Guide 4.7 43

    ##other not Specifies that the matching element or attribute must be from a namespace other than the namespaces listed in the URIs field.

    ##targetNamespace specific Specifies that the matching element or attribute must be from the namespace listed in the URIs field.

    "URI1 URI2" specific Specifies that the matching element or attribute must be from one of the namespaces listed in the URIs field.

    URIs The namespaces to which the matching element or attribute can or cannot belong.

    The namespace attribute value in the any or anyAttribute declaration determines the value of the URIs field. The following table describes how the schema processor populates the URIs field based on the namespace attribute value.

    Namespace attribute URIs value

    ##any blank

    If the namespace attribute does not appear in the attribute declaration, ##any is used.

    ##local ''unqualified'

    ##other Target namespace and 'unqualified'

    ##targetNamespace Target namespace

    "URI1 URI2" URIs specified by the namespace attribute in the or declaration.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    4

    Simple Type DefinitionsSimple type definitions specify the content for attributes or text-only elements. A simple 4 SAP BC Schema Reference Guide 4.7

    type definition is enclosed in the tag. A simple type definition creates a new data type by restricting or extending an existing data type. The definition identifies the existing data type used to derive the new simple type. The definition also identifies the constraining facet values applied to the new type.

    Following is the global simple type definition SKU from po.xsd. The SKU simple type is derived from the built-in data type string and specifies a pattern constraint.

    Global simple type definition

    In the Schema Browser, global defined simple type definitions appear under the SIMPLE TYPES heading. When you select the SKU simple type definition, the Schema Browser displays the following:

    Note: Unlike a complex type definition, a simple type definition cannot contain element declarations or carry attribute declarations.

    .

    .

    .

  • Simple Type Definitions

    S

    Simple type definition in the Schema BrowserAP BC Schema Reference Guide 4.7 45

    When you select a simple type definition in the Schema Browser, the Schema Details area displays the simple type name and namespace, the primitive type, and all the constraining facets that can be set for the simple type. Primitive types are the basic data types from which all other data types are derived. The constraining facets displayed in the Schema Details area depend on the primitive type from which the simple type is derived. For example, if the primitive type is string, the Schema Details area displays the constraining facets enumeration, length, minLength, maxLength, whiteSpace, and pattern.

    Global simple typedefinition

    Note: In the Schema Browser, a simple type definition also appears as a child of each element or attribute for which it is the defined type. For example in po.xsd, the element is defined to be of type string. In the Schema Browser, the string simple type appears as a child of the comment element.

    Note: For more information about primitive types, refer to XML Schema Part 2: Datatypes at http://www.w3.org/TR/xmlschema-2/.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    4

    This field... Specifies...

    Simple Type: Name The local name and target namespace of the simple type. The Name 6 SAP BC Schema Reference Guide 4.7

    For information about Base Constraints, see Viewing Base Constraints for a Simple Type on page 51.

    List TypesA list type is a simple type that is defined to be a whitespace-separated sequence of another simple type. For example, the following schema segment defines the list type listOfDecimals. Elements or attributes of this type contain a whitespace-separated sequence of decimals.

    value is equal to the expanded value (prefix plus local name) of the name attribute in the type definition.

    If the Schema Details area displays 'Anonymous' as the name of the simple type, the simple type is an anonymous (unnamed) type defined in an element or attribute declaration. For more information about anonymous types, see Anonymous Types on page 58.

    Primitive Type The primitive datatype from which the simple type is derived.

    Constraining Facets

    The constraining facets applied to a simple type definition. The constraining facets displayed depend on the primitive type of the simple type definition. A constraining facet field contains a value only if the simple type definition specified a value for the facet. The constraining facets fields do not display facet values set in the type definition from which the simple type was derived.

    For a description of each constraining facet, see the SAP BC Developer Guide.

    Tip! You can edit a simple type definition by changing the values of its constraining facets. You can only edit global simple type definitions or anonymous simple type definitions. For more information about editing simple types, see the SAP BC Developer Guide.

  • Simple Type Definitions

    S

    List type in an XML Schema

    This simple type is a listtype derived from thedecimal simple type.

    This simple type...

    .... is a list type...

    ... and is derived fromthis primitive type.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    4

    Union TypesA union type is a simple type that is the union or group of one or more simple types. For example, in the following schema segment, the simple type definition named 8 SAP BC Schema Reference Guide 4.7

    "integerUnion" is a union of the myInteger and yourInteger type definitions. (The myInteger and yourInteger type definitions are members of the union type integerUnion.)

    Union types in an XML Schema X

    In a conforming XML document, the element or attribute defined to be a union type can be an instance of one or more of the types belonging to the union. For example, in an XML document that conforms to the above schema, instances of the element can conform to myInteger or yourInteger. The order in which the simple types are listed in the union type definition determines the validation engines processing order. The validation engine first compares an instance of the element to the simple type myInteger. If the instance element does not conform to myInteger, the validation engine compares the instance element to yourInteger. In practice, the member types of a union type are usually listed from most restrictive to least restrictive.

    .

    .

    .

    This simple type is aunion of the myIntegerand yourInteger simple

    types.

  • Simple Type Definitions

    S

    In an SAP BC schema, the Schema Details area indicates that a simple type definition is a union type by displaying the word [UNION] before the name and namespace of the simple type. In the Primitive Type field, the Schema Details area lists the primitive types of the simple types that constitute the union type. AP BC Schema Reference Guide 4.7 49

    Union types in the Schema Browser

    Fixed Facets in Simple Type DefinitionsIn a simple type definition, a schema author can fix the value of a constraining facet so that types derived from the simple type cannot specify a new value for the facetthe facets value is fixed. For example, in the productCode simple type definition, the value of the constraining facet is fixed to 8. Any simple types derived from the productCode type will have a length facet value fixed to 8.

    ... and is a union ofsimple types derivedfrom these primitive

    types.

    This simple type ...

    ... is a union type ...

    Note: Each member simple type in a union type has a set of base constraints. However, the union type itself does not have base constraints. Consequently, the Base Constraints button is unavailable when you select a union type in the Schema Browser. For more information about base constraints, see Viewing Base Constraints for a Simple Type on page 51.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    5

    Fixed facets in a simple type definition

    .

    When the value of theixed attribute is true, thevalue of the constraining

    facet is fixed.

    ... the length facetvalue is fixed to 8.

    In this simple type ...

  • Simple Type Definitions

    S

    Note: A constraining facet with a fixed value cannot be edited. For more information about editing constraining facets for simple types, see the SAP BC Developer Guide.AP BC Schema Reference Guide 4.7 51

    Viewing Base Constraints for a Simple TypeWhen you select a simple type definition in the Schema Browser, the Schema Details area displays the constraining facets that can be set for the simple type. The constraining facets displayed in the Schema Details area depend on the primitive type from which the simple type was derived. For example, if the simple type definition is derived from string, the Schema Details area displays the enumeration, length, minLength, maxLength, whiteSpace, and pattern facets.

    A constraining facet field contains a value only if the simple type definition specified a value for the facet. For example, when you select the SKU simple type definition in the SAP BC schema created from po.xsd, only the pattern field contains a value. This is because the SKU simple type definition specified a value only for the pattern constraining facet. The constraining facet fields do not display facet values set in the type definition (or definitions) from which the simple type was derived. However, elements associated with the SKU simple type must have a value that conforms to the facets specified by the SKU type definition and the facets specified in the types from which SKU was derived.

    You can view the constraining facet values set in the type definitions from which a simple type was derived by clicking the Base Constraints button. Base constraints are the constraining facet values from the primitive type to the immediate parent type. These constraint values represent the cumulative facet values for the simple type.

    In the Schema Details area, click Base Constraints.

    Developer opens the Base Constraints dialog box.

    To view the base constraints for a simple type

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    5

    Base Constraints dialog box2 SAP BC Schema Reference Guide 4.7

    ... maxInclusive was fixedto 100 ....

    ... and fractionDigits wasfixed to 0.

    This simple type is derivedfrom a type or types where

    minInclusive was set to 50 ....

    Tip! Knowing the constraining facet values a simple type definition inherits from its parent types can be useful when you compare an XML document to an SAP BC schema or when you edit simple types.

  • Complex Type Definitions

    S

    Complex Type DefinitionsComplex type definitions constrain the structure and contents of an element of complex AP BC Schema Reference Guide 4.7 53

    type. Elements defined to be of complex type may contain child elements and carry attributes. A complex type definition specifies the child elements, content model, and attributes for an element of complex type. A complex type definition is enclosed in the tag.

    The following global complex type definition for USAddress specifies a sequence content model that contains five local element declarations. (A content model specifies the names and order of the child elements that can appear in elements defined to be of this type.) The USAddress complex type also specifies one attribute declaration.

    Global complex type definition

    In the Schema Browser, the USAddress type definition appears as a child of COMPLEX TYPES because it is a global complex type definition. Expand USAddress to view the sequence content model for the type definition. Expand the content model to view the local element declarations in the complex type definition.

    Because this complex type definition carries an attribute, the Schema Browser displays an ATTRIBUTES heading immediately below the complex type name. Expand ATTRIBUTES to view the local attribute declarations. If a complex type definition does not contain attribute declarations, the ATTRIBUTES heading does not appear below the complex type name.

    .

    .

    .

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    5

    USAddress complex type definition in the Schema Browser4 SAP BC Schema Reference Guide 4.7

    When you select a complex type in the Schema Browser, the Schema Details area displays the following fields:

    ... this local attributedeclaration...

    ... a sequence contentmodel...

    ... and these localelement declarations.

    This complex typedefinition contains...

    Note: The Schema Browser also displays a global complex type definition as a child of the elements for which it is the declared type. For example, in the PurchaseOrderType definition, the shipTo and billTo elements are defined to be of the type USAddress. In the Schema Browser, the USAddress complex type definition appears under COMPLEX TYPES and as an immediate child of the shipTo and billTo element declarations.

  • Complex Type Definitions

    S

    This field... Specifies...

    Name The local name and target namespace of the complex type. The AP BC Schema Reference Guide 4.7 55

    Name value is equal to the expanded value (prefix plus local name) of the name attribute in the type definition.

    If the Schema Details area displays 'Anonymous' as the name of the simple type, the complex type is an anonymous (unnamed) type defined in an element declaration. For more information about anonymous types, see Anonymous Types on page 58.

    Is Abstract Whether the complex type definition is abstract. The value of Is Abstract corresponds to the abstract attribute in the complex type definition., The Is Abstract field can have one of the following values:

    True indicates the complex type is abstract. When an element corresponds to an abstract complex type definition, the element in the instance document must contain xsi:type to refer to a complex type derived from the abstract type. When the value of Is Abstract is True, the complex type definition contains abstract="true".

    False indicates the complex type definition is not abstract. When the value of Is Abstract is False, the abstract attribute is absent from the complex type definition or abstract="false".

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    5

    Complex Types Derived from Simple TypesWhen a complex type definition is derived from a simple type definition, the complex type is used to describe an element that contains simple content (text-only) and carries 6 SAP BC Schema Reference Guide 4.7

    attributes. In the following example, the unitPrice complex type is derived by extension from the decimal simple type and carries a unitOfMeasure attribute.

    Complex type derived from a simple type

    When you select a complex type derived from a simple type in the Schema Browser, the Schema Details area displays the Name and Is Abstract fieldsthe same fields it displays for all complex types. However, the Schema Details area also displays the name, namespace, and constraining facets for the simple type from which the complex type is derived.

    .

    .

    .

  • Complex Type Definitions

    S

    Complex type derived from a simple type in the Schema BrowserAP BC Schema Reference Guide 4.7 57

    This complex type ....

    .... is derived from an'Anonymous' simple

    type.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    5

    Anonymous TypesAnonymous types are unnamed simple types or unnamed complex types defined as part 8 SAP BC Schema Reference Guide 4.7

    of an element declaration. Instead of referencing a globally defined type, the element declaration contains a new type definition in-line. Anonymous type definitions can contain the same information and attributes as named type definitionswith the exception of the name attribute which does not appear in an anonymous type definition. A schema author might use anonymous types when a type definition is only going to be used by one element. Anonymous type definitions cannot be referenced by element or attribute declarations. Additionally, new type definitions cannot be derived from anonymous type definitions.

    The Items complex type definition contains an anonymous complex type definition and an anonymous simple type definition. Notice that there is no type attribute in the item element declaration or the quantity element declaration. Additionally, there is no name attribute for the types defined as children of item and quantity.

    Anonymous type definitions

    .

    .

    .

    The item element isdefined to be of

    anonymous complextype.

    The quantity element isdefined to be of

    anonymous simple type.

  • Anonymous Types

    S

    In the Schema Browser, an anonymous complex type or anonymous simple type appears as a child of the element in which it is defined. To indicate the type is anonymous, the Schema Browser displays 'Anonymous' next to the complex type or simple type symbol. AP BC Schema Reference Guide 4.7 59

    To illustrate how the Schema Browser displays anonymous types, the Items element in an SAP BC schema is shown below.

    Anonymous complex and simple types in the Schema Browser

    For information about the fields the Schema Details area displays for a complex type definition, see the table on page 55. For information about the fields the Schema Details area displays for a simple type, see the table on page 46. You can edit anonymous simple types. For more information about editing simple types, see the SAP BC Developer Guide.

    Anonymous complextype definition

    Anonymous simple typedefinition

    Note: Anonymous simple and anonymous complex types do not appear as immediate children of the SIMPLE TYPES or COMPLEX TYPES headings in the Schema Browser. Only globally defined, named types appear as children of these headings.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    6

    Content ModelsElements of complex type can contain child elements. In a complex type definition, the 0 SAP BC Schema Reference Guide 4.7

    content model specifies which child elements can appear and the order in which those child elements can appear. The schema processor retains information about content models when it creates an SAP BC schema from an XML Schema. A content model can specify that:

    The child elements in the instance document must appear in the same order as the child elements in the content model (sequence).

    Only one of the child elements in the content model can appear in the instance document (choice).

    The child elements can appear once or not at all, and in any order (all).

    The following sections provide more information about how the Schema Browser displays content models.

    Sequence Content ModelThe content model specifies that the child elements in the instance document must appear in the same order in which they are declared in the content model. If the child elements in the instance document do not appear in the specified order, the instance document is not valid.

    The USAddress complex type definition in po.xsd uses a to specify that elements declared to be of the type USAddress must include the name, street, city, state, and zip elementsin that order.

    Note: Sequence, choice, and all are also called compositors in the XML Schema language.

  • Content Models

    S

    Sequence content model

    aAP BC Schema Reference Guide 4.7 61

    A element can contain the minOccurs and maxOccurs attributes. These attributes specify how often the sequence of elements can appear as children of the associated element. If minOccurs and maxOccurs are not specified, the default values are used (0 and 1, respectively).

    The Schema Browser uses to indicate a sequence content model. Content models appear as children of the complex type definition. Following is the USAddress complex type in the Schema Browser. The sequence content model is a child of the USAddress type definition.

    .

    .

    .

    The sequence specifiesthat child elements mustppear in the same order

    in the instancedocument.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    6

    Sequence content model in the Schema Browser2 SAP BC Schema Reference Guide 4.7

    When you select a Sequence content model in the Schema Browser, the Schema Details area displays the following fields.

    The Sequence contentmodel specifies...

    ... that the instancedocument must contain

    these elements in thisorder.

    This field... Specifies...

    Min Occurs The minimum number of occurrences of the content model for an element in the instance document. The value of the Min Occurs field is equal to the value of the minOccurs attribute in the content model.

    Max Occurs The maximum number of occurrences of the content model for an element in the instance document. The value of the Max Occurs field is equal to the value of the maxOccurs attribute in the content model.

    Summary of Children

    The name and occurrence constraints for the child elements in the content model.

    This column... Specifies...

    Name The name of the child element.

    Min, Max The minimum and maximum occurrence constraints for the child element. The Min and Max value correspond to the minOccurs and maxOccurs attributes (respectively) in the local element declaration.

  • Content Models

    S

    Choice Content ModelThe content model specifies that only one of the child elements listed in the content model can appear in the instance document. If one of the child elements does not AP BC Schema Reference Guide 4.7 63

    appear or more than one child element appears, the instance document is not schema-valid. (An exception to this is when the minOccurs attribute for the element is set to 0. If minOccurs=0, the SAP BC Server validation engine does not generate a validation error if no child element appears.)

    In the following schema segment, the choice content model specifies that instances of the element must contain the ,< Ms.>, or child element. The content model specifies that the first child element of must be , , or followed by the , , and child elementsin that order.

    Choice content model

    Similar to the content model, a schema author can use the minOccurs and maxOccurs attributes to set occurrence constraints for a content model. If in the above schema segment, the content model contained maxOccurs=3, then the elements , < Ms.>, or could appear one, two, or three times in instances of .

    The Schema Browser uses to indicate a choice content model in a complex type definition. Following is an example of the buyerName element in the Schema Browser.

    .

    .

    .

    Only one of these childelements can appear in

    instances of thebuyerName element.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    6

    Notice that the Choice content model is a child of the Sequence content model. If the Choice content model were the only content model for the anonymous complex type assigned to buyerName, Choice would appear as a child of the 'Anonymous' complex 4 SAP BC Schema Reference Guide 4.7

    type definition. Expand to view the child elements in the Choice content model.

    Choice content model in the Schema Browser

    For information about the fields displayed in the Schema Details area when you select a Choice content model, see the table on page 62.

    All Content ModelThe content model specifies that the elements in the content model can appear either once or not at all, and in any order. An element cannot appear more than once. For example, the content model in the shirt element declaration specifies that the , , and elements can appear in any order as child elements in instances of the element.

    The choice contentmodel specifies...

    ... that only one of theseelements can appear inthe instance document.

  • Content Models

    S

    All content model

    These child elements canappear either once or notat all and in any order in

    instances of the shirtelement.

    The all content modelspecifies...

    ... that these elementscan appear once or not

    at all and in any order inthe instance document.

  • C H A P T E R 3 S A P B C S c h e m a s G e n e r a t e d f r o m X M L S c h e m a s

    6

    For information about the fields the Schema Details area displays when you select an all content model in the Schema Browser, see the table on page 62.

    M6 SAP BC Schema Reference Guide 4.7

    ixed ContentA schema author can specify that an element of complex type can contain character data mixed in with child elements. To allow an element to have mixed content, the mixed attribute in the complex type definition is set to true.

    For example, instances of the element can contain character data mixed in with the child elements , , , and .

    Complex type definition with mixed content

    The Schema Browser uses the symbol to indicate that the elements corresponding to

    the complex type can contain mixed content. In the Schema Browser, the mixed content symbol appears as a child of the complex type definition and as a parent of the content model.

    Important! Because of the flexibility of content models, the validation engine in SAP BC Server does not enforce validation restrictions for content models.

    .

    .

    .

    The mixed attributeindicates elements ofthis type can contain

    mixed content.

  • Empty Content

    S

    Complex type definition that specifies mixed content

    EAP BC Schema Reference Guide 4.7 67

    The Schema Details area does not display any fields when you select a Mixed content

    symbol in the Schema Browser.